 $(document).ready(function() {	

	 
	 /************************************************************************************
	 *
	 *	Define what happens for IE6 users
	 *
	 ***********************************************************************************/
	 if ( $.browser.msie && $.browser.version=='6.0') {
		 document.location.replace('../ie6.html');
	 }	 
 
	 /************************************************************************************
	 *
	 *	Define what happens when the customer-login-handle is clicked
	 *
	 ***********************************************************************************/
	$('.customer-login-handle').click(function() {
		// Height is 4, so the panel is closed
		if ($('.customer-login-content-wrapper').height() == 4) {
			$('.customer-login-content-wrapper').animate({
				height: '280px'
			}, 250);
		// Height is not 4, so the panel is open
		} else {
			$('.customer-login-content-wrapper').animate({
				height: '4px'
			}, 250);		
		}
	});
 
 
 
 
 	 /************************************************************************************
	 *
	 *	Define what happens when an user hovers over a reference image
	 *
	 ***********************************************************************************/
	$('.homepage-reference-wrapper').mouseenter(function() {
		//Select the child of object we are holding our mouse over
		$(this).find('.reference-link-div').slideToggle('fast');
	});
 	$('.homepage-reference-wrapper').mouseleave(function() {
		// Fade out when the mouse leaves the object
		// we hide all links to make sure we don't have any
		// objects remaining.
		$(this).find('.reference-link-div').slideToggle('fast');
	});
	
	
	
	
	 /************************************************************************************
	 *
	 *	Define what happens when an user clicks the newsletter/more info bar
	 *
	 ***********************************************************************************/
	 $('.more-info-right, .more-info-left').live('click', function() {
		$('.more-info-left').addClass('open');
		$('.more-info-right').addClass('open');
		$('.more-info-closed h3,.more-info-closed h2').css('cursor','auto');
		$('.more-info-open').slideDown(500,function(){
			//window.scrollTo(0,9999);
		});
	 });	


	 
	 
	 /************************************************************************************
	 *
	 *	Define what happens when an user clicks one of our references
	 *
	 ***********************************************************************************/
	 $('.reference-row').click(function() {
		
		
		if ($(this).children().first().hasClass('open')) {
		
			// Clicked on an open reference, so close it.
			$('.reference-row .reference-row-content').slideUp();
			$('.reference-row .reference-row-arrow').removeClass('open');
			$('.reference-row .reference-row-title').removeClass('open');
			
		} else {

			// First close all the rows so there can only be one open at the time
			$('.reference-row .reference-row-content').slideUp();
			$('.reference-row .reference-row-arrow').removeClass('open');
			$('.reference-row .reference-row-title').removeClass('open');
						
			// Now open the row that has been clicked
			$(this).children().first().toggleClass('open');
			$(this).children().first().next().toggleClass('open');
			$(this).children().last().slideDown();
			
		}
	 });
	 
 });
 

