var imgs = new Array("url(images/home1.jpg)", "url(images/home2.jpg)", "url(images/home3.jpg)", "url(images/home4.jpg)", "url(images/home5.jpg)", "url(images/home6.jpg)")
var counter = 0;
var wait = 5000;

var jq = jQuery.noConflict();
jq(document).ready(function() {
	jq("#slider").hide();
	jq(".advertitems").hide();
	jq(".ddarrow").toggle(function(){
		jq(this).parent().find(".advertitems").slideDown("fast");
		var newSrc = jq(this).find("img").attr("src").replace("_up.png","_down.png");
		jq(this).find("img").attr("src",newSrc);
		return false;
		},function(){
		
		jq(this).parent().find(".advertitems").slideUp("slow");
		var newSrc = jq(this).find("img").attr("src").replace("_down.png","_up.png");
		jq(this).find("img").attr("src",newSrc);
		return false;
		});
		
	jq("a.blurb").toggle(function(){
		jq(this).next('div.story').slideDown("slow");
	},function() {
		jq(this).next('div.story').slideUp("slow");
	});
	
	jq("#contactslider").toggle(function(){
		jq("#slider").slideDown("slow");
		
	},function() {
		jq("#slider").slideUp("slow");
	});
	
	
});

if ("document.getElementByClassName(home)"){
	var intervals = self.setInterval("crossFade()", wait);
}
/*if ("document.getElementByClassName(siloader)"){
	var intervals = self.setInterval("crossFade2()", wait);
}*/
/*
Effect.ShowForm = function(element){
	document.getElementById("slider").style.visibility = 'visible';
	var element = document.getElementById(element);
	if (element.style.display == "none") {
		intervals = window.clearInterval(intervals);
		Effect.Fade("side_col");
		setTimeout('Effect.SlideDown(\"slider\")',1100);
		
	} else if (element.style.display != "none") {
		intervals = window.setInterval('crossFade()', wait);
		Effect.SlideUp("slider");
		setTimeout('Effect.Appear(\"side_col\")',1100)
	}
}*/


Effect.ShowSiSub = function(element){
	var element = document.getElementById(element);
	if (element.style.display == "none") {
		setTimeout('Effect.SlideDown(\"sisubbrand\")',1100);
		setTimeout("window.location='studioitalia.php'",3000);
	} else if (element.style.display != "none") {
		setTimeout('Effect.SlideUp(\"sisubbrand\")',1100)
	}
}

Effect.ShowAdvert = function(element){
	var element = document.getElementById(element);
	if (element.style.display == "none") {
		setTimeout('Effect.SlideDown(\"sisubbrand\")',1100);
		setTimeout("window.location='studioitalia.php'",3000);
	} else if (element.style.display != "none") {
		setTimeout('Effect.SlideUp(\"sisubbrand\")',1100)
	}
}

crossFade = function(){
	Effect.Fade("crossfader");
	setTimeout('changeBackground();',1100);
}

/*crossFade2 = function(){
	Effect.Fade("crossfader");
	setTimeout('changeSi();',1100);
}*/

changeBackground = function(){
	document.getElementById("crossfader").style.backgroundImage = imgs[counter];
	document.getElementById("crossfader").style.display = '';
	counter++;
	if (counter == 6) counter = 0;
	document.getElementById("content").style.backgroundImage = imgs[counter];
}

/*changeSi = function(){
	document.getElementById("si").style.backgroundImage = imgs[counter];
	document.getElementById("si").style.display = '';
	counter++;
	if (counter == 6) counter = 0;
	document.getElementById("si").style.backgroundImage = imgs[counter];
}*/