// rounded corners
window.onload = function() {
	settings = {
  	tl: { radius: 7 },
    tr: { radius: 7 },
    bl: { radius: 7 },
    br: { radius: 7 },
    antiAlias: true,
    autoPad: true,
    validTags: ["div"]
	}
	var myBoxObject = new curvyCorners(settings, "promo");
	var myBoxObject2 = new curvyCorners(settings, "promo-solid");
	var myBoxObject2 = new curvyCorners(settings, "promo-bundle");
  myBoxObject.applyCornersToAll();
	myBoxObject2.applyCornersToAll();
}

$(document).ready(function() {
						   
	//homepage graphics fade					   
	
	var cont1 = 1;
	var cont2 = 2;
		
	function automat() {
		$('#v-fade-' + cont1).fadeOut("slow");
		$('#v-fade-' + cont2).fadeIn("slow");
		cont1++;
		cont2++;
		if(cont1==6) cont1 = 1;
		if(cont2==6) cont2 = 1;
	}
		

	var id = setInterval(automat, 10000000000);
	
	
	
	$('#home-comp').click(function() {
		if($(this).hasClass('selected') == false){
			id = window.clearInterval(id);
			$('#v-fade-2, #v-fade-3, #v-fade-4').fadeOut("slow");
			$('#v-fade-1').fadeIn("slow");
			$(this).toggleClass('selected');
			$('#home-bus, #home-ecomm, #home-enter').removeClass('selected');
		}
	});
	
	$('#home-bus').click(function() {
		if($(this).hasClass('selected') == false){
			id = window.clearInterval(id);
			$('#v-fade-1, #v-fade-3, #v-fade-4').fadeOut("slow");
			$('#v-fade-2').fadeIn("slow");
			$(this).toggleClass('selected');
			$('#home-comp, #home-ecomm, #home-enter').removeClass('selected');
		}
	});
		
	$('#home-ecomm').click(function() {
		if($(this).hasClass('selected') == false){
			id = window.clearInterval(id);
			$('#v-fade-3, #v-fade-2, #v-fade-4').fadeOut("slow");
			$('#v-fade-1').fadeIn("slow");
			$(this).toggleClass('selected');
			$('#home-comp, #home-bus, #home-enter').removeClass('selected');
		}
	});
		
	$('#home-enter').click(function() {
		if($(this).hasClass('selected') == false){
			id = window.clearInterval(id);
			$('#v-fade-1, #v-fade-2, #v-fade-3').fadeOut("slow");
			$('#v-fade-4').fadeIn("slow");
			$(this).toggleClass('selected');
			$('#home-comp, #home-bus, #home-ecomm').removeClass('selected');
		}
	});
		
});

function checksearchForm() {
	if($("#search input[name='sp_q']").val() == "" || $("#search input[name='sp_q']").val() == "Search our website")
	{
		alert("Please enter a search term!");
	  	return false;
	}
	return true;
}

