function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    //var $sibs  = $active.siblings();
    //var rndNum = Math.floor(Math.random() * $sibs.length );
    //var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}




/* End Dropdown menu functionaltiy */

$(document).ready(function(){
						   
$("#searchButton").click(function(event){
event.preventDefault();
$("#searchForm").submit();
});
$("#searchForm #q").focus(function(){
if ($(this).val() == "Search Products") {
$("#searchForm #q").val("");
}
}); 
						   
						   
	
	
	$.ajax({
   			type: "GET",
			cache: false,
   			url: "/ecom/ssi_rotating_header_text.php",
   			success: function(resulthtml){
				$("#order_online_txt").html(resulthtml);
				
				setTimeout('topScrollingBanner()', 5000);
   			}
 	});
	
	
	//Un comment this to add back homepage image rotation
	//setTimeout('imageCarousel()', 5000);

	/* Make Enter Keyword dissaper when a person focuses on the box */
	$(".search_input #q").focus(function(){
		if ($(this).val() == "Enter Keyword") {
			$(this).val("");
		}
	});
	
	/* Myspace / YouTube are not set up yet, so trigger a coming soon alert */
	/*
	$(".myspace").click(function(event){
		event.preventDefault();
		alert("Coming soon!");
	});
	*/
	$(".youtube").click(function(event){
		event.preventDefault();
		alert("Coming soon!");
	});
	
	/* Header search form */
	$("#product_header_submit").click(function(event){
		event.preventDefault();
		$("#product_header_search").submit();
	});
	
	
	/* Make Enter Keyword dissaper when a person focuses on the box */
	$("#newsletter_signup input").focus(function(){
		if ($(this).val() == "Enter Email") {
			$(this).val("");
		}
	});
	
	$("#newsletter_signup a").click(function(event){
		event.preventDefault();
		$("#newsletter_signup_form").submit();
	});
	
	
	
	/* Social media icons hover */
	/*
	$(".social_media_icons a").hover(function(){
		icon = $(this).css("background-image");
		newicon = icon.replace(/.gif/i,"-color.gif");
		$(this).css("background-image",newicon);
	},function(){
		icon = $(this).css("background-image");
		newicon = icon.replace(/-color.gif/i,".gif");
		$(this).css("background-image",newicon);
	});
	*/
});
