/* ------------ Functions used to navigate green boxes to right of homepage -------------*/

chHMoving = false;

function chHLeft() {	
	if (chHMoving == false) {	
	
		chHMoving = true;
	
		jQuery("a.chHSelected").removeClass('chHSelected').addClass('chHNotSelected');
	
		jQuery(".chHThumb").each(function (i) {
															
			left = jQuery(this).css("left");			
			left = left.replace("px","");			
			left = parseInt(left);
			
			jQuery("a.chHSelected").removeClass('chHSelected').addClass('chHNotSelected');
			
			if (left == 94) {
				left = 258;
				jQuery(this).find('img:first').css({"marginBottom": 0});
				jQuery(this).animate({"left": left, "height": 73, "width": 82, "top": 23, "z-index": 0, "fontSize": 80 + "%"}, 500, "easeOutQuad", function(){
					jQuery(this).css({"z-index": 0});
				});																													   
			} else if (left == 2) {
				left = 94;
				jQuery(this).find('img:first').css({"marginBottom": -1});
				jQuery(this).animate({"left": left, "height": 118, "width": 154, "top": 0, "z-index": 1, "fontSize": 110 + "%"}, 500, "easeOutQuad", function(){
					jQuery(this).css({"z-index": 1});				
					jQuery(this).find("a:last").removeClass('chHNotSelected').addClass('chHSelected');
					//jQuery(this).find("a:last").trigger('click');
					chHMoving = false;
				});	
			} else if (left == 534) {
				left = 626;
				jQuery(this).animate({"left": left}, 500, "easeOutQuad", function(){			
					jQuery(this).css({"left": -90});	
				});
			}  else {
				left = left + 92;
				jQuery(this).animate({"left": left}, 500, "easeOutQuad");
			}
			
			
		});
	
	}
}

function chHRight() {	
	if (chHMoving == false) {	
	
		chHMoving = true;
	
		jQuery("a.chHSelected").removeClass('chHSelected').addClass('chHNotSelected');
		jQuery(".chHThumb").each(function (i) {
															
			left = jQuery(this).css("left");			
			left = left.replace("px","");			
			left = parseInt(left);
			jQuery("a.chHSelected").removeClass('chHSelected').addClass('chHNotSelected');
			
			if (left == 94) {
				left = 2;
				jQuery(this).find('img:first').css({"marginBottom": 0});
				jQuery(this).animate({"left": left, "height": 73, "width": 82, "top": 23, "z-index": 0, "fontSize": 80 + "%"}, 500, "easeOutQuad", function(){
					jQuery(this).css({"z-index": 0});
				});																													   
			} else if (left == 258) {
				left = 94;
				jQuery(this).find('img:first').css({"marginBottom": -1});
				jQuery(this).animate({"left": left, "height": 118, "width": 154, "top": 0, "z-index": 1, "fontSize": 110 + "%"}, 500, "easeOutQuad", function(){
					jQuery(this).css({"z-index": 1});					
					jQuery(this).find("a:last").removeClass('chHNotSelected').addClass('chHSelected');
					//jQuery(this).find("a:last").trigger('click');
					chHMoving = false;
				});	
			} else if (left == -90) {
				left = -182;
				jQuery(this).animate({"left": left}, 500, "easeOutQuad", function(){			
					jQuery(this).css({"left": 350});	
				});
			} else {
				left = left - 92;
				jQuery(this).animate({"left": left}, 500, "easeOutQuad");
			}
		});
	
	}
	
}
