$('.anythingSlider').anythingSlider({
    easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
    autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
    delay: 5000,                    // How long between slide transitions in AutoPlay mode
    startStopped: false,            // If autoPlay is on, this can force it to start stopped
    animationTime: 600,             // How long the slide transition takes
    buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
	pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
	startText: "Go",             // Start text
    stopText: "Stop"               // Stop text
});

//preload images
jQuery.preloadImages = function()
{
	jQuery.each (arguments,function (e)
	{
		jQuery ('<img src="' + this + '" />');
	});
}

$.preloadImages("images/home_shop_button_over.png", "images/inner_buy_button_over.jpg", "images/nav_rugged_over.png", "images/nav_simple_over.png", "images/nav_portable_over.png", "images/footer_gtech_over.jpg", "images/specs_download_over.jpg", "images/share_share_over.png", "images/share_email_over.png", "images/compare_buy_button_over.jpg", "images/finder_bg.png");

$("#shop_button img, #footer_gtech, #nav .inactive, #xseriesmenusub .active, #inner_buy_button, #specs_download_button, #inner_share img, .compare_buy_button").hover(function(){
	
	var src = $(this).attr("src").replace(/\.([pjg])/,"_over.$1");
	$(this).attr("src",src);
	
}, function() {
	
	var src = $(this).attr("src").replace("_over.",".");
	$(this).attr("src",src);
	
});

var searchInitText = $("#footer_search_input").val();
$("#footer_search_input").focus(function(){
	if($("#footer_search_input").val() == searchInitText)
		$("#footer_search_input").val("");
});

$("#footer_search_input").blur(function(){
	if($("#footer_search_input").val() == "")
		$("#footer_search_input").val(searchInitText);
});

$("#product_finder_link").hover( function(){
	if (jQuery.browser.msie) {
		$("#product_finder").show();
	} else {
		$("#product_finder").fadeIn(150);
	}
}, function() {
	
});

$("#product_finder_container").hover( function(){
	}, function() {
	if (jQuery.browser.msie) {
		$("#product_finder").hide();
	} else {
		$("#product_finder").fadeOut(150);
	}
});

if($('#inner_pictures a').length > 0 )
	$('#inner_pictures a').lightBox();

/*Buy page*/
$('#buy_choose_product').change(function(e){
	var a = $(this).val();
	if( a == "all" ) {
		$('.buy_rugged').show();
		$('.buy_portable').show();
		$('.buy_simple').show();
	}
	else {
		if( a == "rugged" ) {
			$('.buy_rugged').show();
			$('.buy_portable').hide();
			$('.buy_simple').hide();
		}
		else if( a == "portable" ) {
			$('.buy_rugged').hide();
			$('.buy_portable').show();
			$('.buy_simple').hide();
		}
		else if( a == "simple" ) {
			$('.buy_rugged').hide();
			$('.buy_portable').hide();
			$('.buy_simple').show();
		}
	}
});

function change_country(country) {
	if(country=="all") {
		$('.buy_uk').show();
		$('.buy_fr').show();
		$('.buy_de').show();
		$('.buy_selectc_active').addClass("buy_selectc_inactive").removeClass("buy_selectc_active");
		$('.buy_selectc_all').addClass("buy_selectc_active");
	}
	else if(country=="uk") {
		$('.buy_uk').show();
		$('.buy_fr').hide();
		$('.buy_de').hide();
		$('.buy_selectc_active').addClass("buy_selectc_inactive").removeClass("buy_selectc_active");
		$('.buy_selectc_uk').addClass("buy_selectc_active").addClass("buy_selectc_active");
	}
	else if(country=="fr") {
		$('.buy_uk').hide();
		$('.buy_fr').show();
		$('.buy_de').hide();
		$('.buy_selectc_active').addClass("buy_selectc_inactive").removeClass("buy_selectc_active");
		$('.buy_selectc_fr').addClass("buy_selectc_active").addClass("buy_selectc_active");
	}
	else if(country=="de") {
		$('.buy_uk').hide();
		$('.buy_fr').hide();
		$('.buy_de').show();
		$('.buy_selectc_active').addClass("buy_selectc_inactive").removeClass("buy_selectc_active");
		$('.buy_selectc_de').addClass("buy_selectc_active").addClass("buy_selectc_active");
	}
}


$(".banner_xseries").hover(function() {
      $(this).children('#banner_xmore').css('display','block');
 },function(){
	 $(this).children('#banner_xmore').css('display','none');
 })


$("#xseriesmenulink").hover( function(){
	if (jQuery.browser.msie) {
		$("#xseriesmenusub").show();
	} else {
		$("#xseriesmenusub").fadeIn(150);
	}
}, function() {
	
});

$("#xseriesmenu").hover( function(){
	}, function() {
	if (jQuery.browser.msie) {
		$("#xseriesmenusub").hide();
	} else {
		$("#xseriesmenusub").fadeOut(150);
	}
});


