
  jQuery(document).ready(function(){

    //preloadImg('../images/');
    // textReplacement(jQuery('.searchBox input'));

    jQuery(".left-menu-item:not(.promo) h1").click(function () {
     jQuery(this).parent().children(".menu-item").children(".menu-item-bg").slideToggle();

					if( jQuery(this).parent().hasClass("off") ){
						jQuery(this).parent().removeClass("off");
					}
					else{
						jQuery(this).parent().addClass("off");
					}
    });


jQuery("#scrollLeft").click(function()
		{
			scrollPaneHorz("left");
			return false;
		}
	);
	jQuery("#scrollRight").click(function()
		{

			scrollPaneHorz("right");
			return false;
		}
	);


var scrollDistanceHorz = 340;
var scrollPosHorz = 0;
function scrollPaneHorz(direction){
	var scrollDistance = jQuery("#promoScroller").width();
	var scrollPaneWidth = ((jQuery("#scrollPaneHorz .horzItem").siblings().length)) * ( (jQuery("#scrollPaneHorz .horzItem").width() ) );// + jQuery("ul#scrollPaneHorz li").css("margin-left") + jQuery("ul#scrollPaneHorz li").css("margin-right"));

	if(direction=="right"){
		nextScrollPosHorz = scrollPosHorz - scrollDistanceHorz;
		if(nextScrollPosHorz  > (0 - scrollPaneWidth)){
			scrollPosHorz=nextScrollPosHorz;

            //alert(nextScrollPosHorz)
			jQuery("#scrollPaneHorz").animate( { marginLeft: nextScrollPosHorz+'px'}, 1000 );
		}
	}

	if(direction=="left"){
		nextScrollPosHorz = scrollPosHorz + scrollDistanceHorz;
		if(nextScrollPosHorz <= 0){
			scrollPosHorz=nextScrollPosHorz;

			jQuery("#scrollPaneHorz").animate( { marginLeft : nextScrollPosHorz+'px'}, 1000 );
		}
	}
}



  });

function textReplacement(input){
	var originalvalue = input.val();

	input.focus( function(){
		if( jQuery.trim(input.val()) == originalvalue ){ input.val(''); }
	});

	input.blur( function(){
		if( jQuery.trim(input.val()) == '' ){ input.val(originalvalue); }
	});
}

function preloadImg(imgSrc){
  var blank = new Image();
  blank.src = imgSrc;
}