jQuery(document).ready(function() {
    /* Homepage Animations */
    var isIE6 = (navigator.userAgent.toLowerCase().substr(25, 6) == "msie 6") ? true : false;
    if (isIE6 == false) {
        var timer;
        jQuery('div.homepanel').hover(
		function() {
		    var me = jQuery(this);
		    if (timer) {
		        clearTimeout(timer);
		        timer = null
		    }
		    timer = setTimeout(
				function() {
				    /* shrink siblings first */
				    var x = me.siblings();
				    x.animate({ width: '275px' });
				    x.children('img').animate({ width: '275px', marginTop: '40px' }, 'fast');
				    x.children('div.hover').fadeOut();

				    /* expand this */
				    me.animate({ width: '403px' });
				    me.children('img').animate({ width: '403px', marginTop: '0px' }, 'slow');
				    me.children('div.hover').fadeIn();
				},
				100
			);
		}
	);
        jQuery('#toppanel').hover(
		function() {
		},
		function() {
		    if (timer) {
		        clearTimeout(timer);
		        timer = null
		    }
		    jQuery('div.homepanel').stop(true).animate({ width: '310px' });
		    jQuery('div.homepanel img').stop(true).animate({ width: '310px', marginTop: '20px' }, 'fast');
		    jQuery('div.hover').fadeOut();
		}
	);
    };
    /* /Homepage Animations */

    /* Quote Animations */
    setInterval(function() { changeQuote() }, 5000);

    /* About IBOSS Fade */
    jQuery('div.offering div div.cols2').hover(
		function() {
		    jQuery(this).fadeTo(500, 1);
		    jQuery(this).siblings().fadeTo(500, 0.2);
		},
		function() {
		    jQuery(this).siblings().fadeTo(500, 1);
		}
	);
    
});

var i;
var quotes = [
	{ quote: 'You and your colleagues recently provided me with and set up my computer that was provided by DSA via Leeds University. Everything is working really well and I am chuffed with how brilliant you all were! ', cite: '-- Alex from Castleford' },
	{ quote: 'She texted and I wont embarrass you by telling you all she said, but I will just say you are almost elevated to the level of sainthood! Brilliant, brilliant help all along and quite incredible.<br/>Huge thanks, as usual (!)', cite: '-- Barbara' }
	
];
function changeQuote() {
	if(!i) {i = 0;}
	jQuery('div.quotepanel').children().hide();
	jQuery('div.quotepanel blockquote p').html(quotes[i].quote);
	jQuery('div.quotepanel cite').html('-- ' + quotes[i].cite );
	jQuery('div.quotepanel').children().fadeIn();
	i = (i + 1) % quotes.length;
}
