var fadeimages=new Array();


fadeimages[12]=["interface/banners/temp3.jpg", "/baby-nursery.html","nun",""]; 
fadeimages[4]=["interface/banners/bargains.jpg", "/specials.html","nun",""]; 
fadeimages[5]=["interface/banners/all_brands.jpg", "/all_brands.html","nun",""]; 
fadeimages[6]=["interface/banners/hot_products.jpg", "/hot_products.php","nun",""]; 
fadeimages[8]=["interface/banners/blogs.jpg", "/blogs.php","nun",""];

function hideslideshow(banner){
	document.getElementById(banner).style.display = "block";
	document.getElementById(banner).style.visibility = "visible";
	
	document.getElementById("master0").style.display = "none";
	document.getElementById("master0").style.visibility = "hidden";
}

var cur_slide_id = 0;// current slide id
var set_slide = "";// innerHTML container
var nInterval;// fadedown loop interval
var startInterval = false;// protection from repeat intervals
var autorun_on = true;// on/off for auto looping of banner
var autoloop_terminated = false;// kill process boolean
var slide_que = 0;// slide que for autoloop
var i = 100;//global for opacity 
function fadefix(op_value){// this function will set the opacity to specified value 
// thanks to Dynamic Drive (http://www.dynamicdrive.com) for the opacity code in this function
	topslide = document.getElementById("top_slide");
	if (topslide.filters&&topslide.filters[0]){
		if(typeof topslide.filters[0].opacity=="number") {//if IE6+
			topslide.filters(0).opacity=op_value;
		} else { //else if IE5.5-
		topslide.style.filter="alpha(opacity="+op_value+")";
		}
	} else if(topslide.style.MozOpacity){
		topslide.style.MozOpacity=op_value/101;
	} else if(topslide.style.KhtmlOpacity){
		topslide.style.KhtmlOpacity=op_value/100;
	} else if(topslide.style.opacity&&!topslide.filters){
		topslide.style.opacity=op_value/101;
	}
}
function fadedown(){
	if(i>0){// global "i" represent the opacity value
		i -= 10;
		fadefix(i);// set opacity of the div "top_slide"
	} else {
		nInterval = window.clearInterval(nInterval);
		startInterval = false;// we have sleared the interval, now reset the protection so a new interval can be created
		i = 100;// reset i
		document.getElementById("top_slide").innerHTML = document.getElementById("low_slide").innerHTML;// make the invisible top slide a clone of the newly displayed one
		fadefix(100);// reset opacity so it can be faded next time
	}
}
function new_slide(newid){// this function will fade out a slide, revealing a new one
	if(cur_slide_id != newid){
		cur_slide_id = newid;
		set_slide = "<a href='"+fadeimages[newid][1]+"' class='banner_layer' onmouseover='billbanner_over()' onmouseout='billbutton_out()'>";
		set_slide +=  "<img src='"+fadeimages[newid][0]+"' border='0' ";
		if(fadeimages[newid][3].length > 0)set_slide +=  " "+fadeimages[newid][3]+" ";
		set_slide +=  " /></a>";
		document.getElementById("low_slide").innerHTML = set_slide;// we created the new slide and put it in lower div
		if(!startInterval){// protection from creating multiple "nInterval" values
			nInterval = window.setInterval(fadedown,50);// start the "fadedown" loop process
			startInterval = true;
		}
	}
	icon = fadeimages[newid][2];// pull icon data from array
	if(icon!="nun"){
		document.getElementById("iconnav").style.display = "block";//make sure icons are visible
		document.getElementById(icon).src = "interface/mini_icons/"+icon+"_o.png";
		if(prev_icon != icon){// fixes problem with persistant highlight state
			document.getElementById(prev_icon).src = "interface/mini_icons/"+prev_icon+"_d.png";
		}
		prev_icon = icon;
	} else {
		document.getElementById("iconnav").style.display = "none";
	}
}
function billbanner_over(){
	autorun_on = false;// pause the autoloop
}
function billbutton_over(slide_id){
	autorun_on = false;// pause the autoloop
	new_slide(slide_id);// trigger a new slide
	slide_que = slide_id+1;//this helps keep slides in order should user hover over a button
}
function hotbutton_over(slide_id){
	autorun_on = false;// pause the autoloop
	new_slide(slide_id);// trigger a new slide
}
function billbutton_out(){
	autorun_on = true;
	if(autoloop_terminated){// if the auto loop has been terminated, restart it
		autoloop_terminated = false;
		autoloop();
	}
}
function autoloop(){
		if(autorun_on){// autorun is turned of for certain hoover states
			if(slide_que >= autoloopimages.length){slide_que = 0;}//if maxed,  backed to 1 
			new_slide(autoloopimages[slide_que]);// set new slide function in motion
			slide_que++;// advance the que
			setTimeout(autoloop,5000);// set function to repeat
		} else {
			autoloop_terminated = true;// if hoover lasts more that the "Timeout" we will kill the loop. it will need to be restarted by an "out" hover event
		}
}
function page_load(depth){// what scripts will run  when the page loads 
	if(depth=="top"){
		autoloop();// start the banner auto loop 
	}
}
























