// JavaScript Document
// 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==5) cont1 = 1;
		if(cont2==5) cont2 = 1;
	}
		

	var id = setInterval(automat, 10000);
	

	$('#home-down').mouseover(function() {
		if($(this).hasClass('this-seg') == false){
			id = window.clearInterval(id);
			$('#v-fade-2, #v-fade-3, #v-fade-4').fadeOut("slow");
			$('#v-fade-1').fadeIn("slow");
			$(this).toggleClass('this-seg');
			$('#home-bus, #home-ecomm, #home-comp').removeClass('this-seg');
		}
	});
	
	$('#home-comp').mouseover(function() {
		if($(this).hasClass('this-seg') == false){
			id = window.clearInterval(id);
			$('#v-fade-1, #v-fade-3, #v-fade-4').fadeOut("slow");
			$('#v-fade-2').fadeIn("slow");
			$(this).toggleClass('this-seg');
			$('#home-bus, #home-ecomm, #home-down').removeClass('this-seg');
		}
	});
		
	$('#home-bus').mouseover(function() {
		if($(this).hasClass('this-seg') == false){
			id = window.clearInterval(id);
			$('#v-fade-1, #v-fade-2, #v-fade-4').fadeOut("slow");
			$('#v-fade-3').fadeIn("slow");
			$(this).toggleClass('this-seg');
			$('#home-comp, #home-ecomm, #home-down').removeClass('this-seg');
		}
	});
		
	$('#home-ecomm').mouseover(function() {
		if($(this).hasClass('this-seg') == false){
			id = window.clearInterval(id);
			$('#v-fade-1, #v-fade-2, #v-fade-3').fadeOut("slow");
			$('#v-fade-4').fadeIn("slow");
			$(this).toggleClass('this-seg');
			$('#home-comp, #home-bus, #home-down').removeClass('this-seg');
		}
	});
		
});

$(document).ready(function() {
						   
	//Sponsor graphics fade					   
	
	var img1 = 1;
	var img2 = 2;
function spons() {
		$('#s-img-' + img1).fadeOut("slow");
		$('#s-img-' + img2).fadeIn("slow");
		img1++;
		img2++;
		if(img1==3) img1 = 1;
		if(img2==3) img2 = 1;
	}
		

	var id = setInterval(spons, 6000);

});