﻿// FOR HEADER PULLDOWN MENU
function showHide(){
	var a = showHide.arguments;
	if(a.length>0 && a[0] != '') 
		a = new Array('sub'+a[0], 'close_upper','close_lower',a[0]);
	else a = new Array();

	if(!document.layerSet){
		if(a.length > 0){
			aLayers = new Array();
			for(i=0; i<a.length-1;i++)
				aLayers[i] = a[i];document.layerSet = true;
		}
	} else{
		theIndex = aLayers[0].charAt(3);
		if(document.layers){
			hideImage = document.layers['top'].document.images['Image'+theIndex];
		}else{
			hideImage = document.images['Image'+theIndex];
		}
		//hideImage.src = eval('out' + theIndex + '.src');
		for(i=0;i<aLayers.length;i++){
			if(document.layers)
				document.layers[aLayers[i]].visibility='hide';
			else if(document.getElementById)
				document.getElementById(aLayers[i]).style.visibility='hidden';
			else if(document.all)
				document.all(aLayers[i]).style.visibility='hidden';
		}
	}
	
	if(a.length > 0){
		for(i=0; i<a.length-1;i++){
			aLayers[i] = a[i];
			if(document.layers)
				document.layers[aLayers[i]].visibility='show';
			else if(document.getElementById)
					document.getElementById(aLayers[i]).style.visibility='visible';
			else if(document.all)
				document.all(aLayers[i]).style.visibility='visible';
		}
		
		//if(document.layers){
		//	document.layers['top'].document.images['Image'+a[2]].src=eval('over' + a[2] +'.src');
		//}else{
		//	document.images['Image'+a[2]].src = eval('over' + a[2] +'.src');
		//}
	}
}

/***********************************************
* Ultimate Fade-In Slideshow: © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

	var fadeimages2=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
	fadeimages2[0]=["http://www.kadee.com/advpics/10.gif", "http://www.kadee.com/htmbord/HO-Scale Couplers.htm", ""]
	fadeimages2[1]=["http://www.kadee.com/advpics/12.gif", "http://www.kadee.com/htmbord/HO-Scale Couplers.htm", ""]
	fadeimages2[2]=["http://www.kadee.com/advpics/14.gif", "http://www.kadee.com/htmbord/HO-Scale Couplers.htm", ""]
	fadeimages2[3]=["http://www.kadee.com/advpics/150.gif", "http://www.kadee.com/htmbord/HO-Scale Couplers.htm", ""]

	var fadeimages5=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
	fadeimages5[0]=["http://www.kadee.com/advpics/500r.jpg", "http://www.kadee.com/htmbord/HO-Scale Trucks.htm", ""]
	fadeimages5[1]=["http://www.kadee.com/advpics/510r.jpg", "http://www.kadee.com/htmbord/HO-Scale Trucks.htm", ""]
	fadeimages5[2]=["http://www.kadee.com/advpics/513r2.jpg", "http://www.kadee.com/htmbord/HO-Scale Trucks.htm", ""]
	fadeimages5[3]=["http://www.kadee.com/advpics/555r.jpg", "http://www.kadee.com/htmbord/HO-Scale Trucks.htm", ""]

		var fadeimages8=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
	fadeimages8[0]=["http://www.kadee.com/dealer/2.jpg", "http://www.kadee.com/htmbord/intadv.htm", ""]
	fadeimages8[1]=["http://www.kadee.com/dealer/4.jpg", "http://www.rollinstock.com", ""]
	fadeimages8[2]=["http://www.kadee.com/dealer/rvmrrc.jpg", "http://www.rvmrc.railfan.net", ""]
	fadeimages8[3]=["http://www.kadee.com/dealer/8.jpg", "http://www.us-trains.com", ""]
	fadeimages8[4]=["http://www.kadee.com/dealer/9.jpg", "http://www.modeltrainstuff.com", ""]
	fadeimages8[5]=["http://www.kadee.com/dealer/10.jpg", "http://www.KadeeCouplers.com", ""]
	fadeimages8[6]=["http://www.kadee.com/dealer/11.jpg", "http://www.mgsharp.com", ""]
	fadeimages8[7]=["http://www.kadee.com/dealer/12.jpg", "http://www.modeljunction.info", ""]
	fadeimages8[8]=["http://www.kadee.com/dealer/13.jpg", "http://www.yankeedabbler.com", ""]
	fadeimages8[9]=["http://www.kadee.com/dealer/14.jpg", "http://www.kadeetrains.com", ""]
	fadeimages8[10]=["http://www.kadee.com/dealer/KD.jpg", "", ""]
	fadeimages8[11]=["http://www.kadee.com/dealer/PWRS.jpg", "http://www.pwrs.ca/announcements/view.php?ID=914", ""]

	
	var fadeimages9=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
	fadeimages9[0]=["http://www.kadee.com/animation/1.jpg", "", ""]
	fadeimages9[1]=["http://www.kadee.com/animation/2.jpg", "", ""]
	fadeimages9[2]=["http://www.kadee.com/animation/3.jpg", "", ""]
	fadeimages9[3]=["http://www.kadee.com/animation/4.jpg", "", ""]
	fadeimages9[4]=["http://www.kadee.com/animation/5.jpg", "", ""]
	fadeimages9[5]=["http://www.kadee.com/animation/6.jpg", "", ""]
	fadeimages9[6]=["http://www.kadee.com/animation/7.jpg", "", ""]
	fadeimages9[7]=["http://www.kadee.com/animation/8.jpg", "", ""]
	fadeimages9[8]=["http://www.kadee.com/animation/9.jpg", "", ""]
	fadeimages9[9]=["http://www.kadee.com/animation/10.jpg", "", ""]
	fadeimages9[10]=["http://www.kadee.com/animation/11.jpg", "", ""]
	fadeimages9[11]=["http://www.kadee.com/animation/12.jpg", "", ""]
	fadeimages9[12]=["http://www.kadee.com/animation/13.jpg", "", ""]
	fadeimages9[13]=["http://www.kadee.com/animation/14.jpg", "", ""]
	fadeimages9[14]=["http://www.kadee.com/animation/15.jpg", "", ""]
	fadeimages9[15]=["http://www.kadee.com/animation/16.jpg", "", ""]
	fadeimages9[16]=["http://www.kadee.com/animation/17.jpg", "", ""]
	fadeimages9[17]=["http://www.kadee.com/animation/18.jpg", "", ""]
	fadeimages9[18]=["http://www.kadee.com/animation/19.jpg", "", ""]
	fadeimages9[19]=["http://www.kadee.com/animation/20.jpg", "", ""]
	fadeimages9[20]=["http://www.kadee.com/animation/21.jpg", "", ""]
	fadeimages9[21]=["http://www.kadee.com/animation/22.jpg", "", ""]
	fadeimages9[22]=["http://www.kadee.com/animation/23.jpg", "", ""]
	fadeimages9[23]=["http://www.kadee.com/animation/24.jpg", "", ""]
	fadeimages9[24]=["http://www.kadee.com/animation/25.jpg", "", ""]
	fadeimages9[25]=["http://www.kadee.com/animation/26.jpg", "", ""]
	fadeimages9[26]=["http://www.kadee.com/animation/27.jpg", "", ""]
	fadeimages9[27]=["http://www.kadee.com/animation/28.jpg", "", ""]
	fadeimages9[28]=["http://www.kadee.com/animation/29.jpg", "", ""]
	fadeimages9[29]=["http://www.kadee.com/animation/30.jpg", "", ""]
	fadeimages9[30]=["http://www.kadee.com/animation/31.jpg", "", ""]
	fadeimages9[31]=["http://www.kadee.com/animation/32.jpg", "", ""]
	fadeimages9[32]=["http://www.kadee.com/animation/33.jpg", "", ""]
	fadeimages9[33]=["http://www.kadee.com/animation/34.jpg", "", ""]
	fadeimages9[34]=["http://www.kadee.com/animation/35.jpg", "", ""]
	fadeimages9[35]=["http://www.kadee.com/animation/36.jpg", "", ""]
	fadeimages9[36]=["http://www.kadee.com/animation/37.jpg", "", ""]
	fadeimages9[37]=["http://www.kadee.com/animation/38.jpg", "", ""]
	fadeimages9[38]=["http://www.kadee.com/animation/39.jpg", "", ""]
	fadeimages9[39]=["http://www.kadee.com/animation/40.jpg", "", ""]
	fadeimages9[40]=["http://www.kadee.com/animation/41.jpg", "", ""]
	fadeimages9[41]=["http://www.kadee.com/animation/42.jpg", "", ""]
	fadeimages9[42]=["http://www.kadee.com/animation/43.jpg", "", ""]
	fadeimages9[43]=["http://www.kadee.com/animation/44.jpg", "", ""]
	fadeimages9[44]=["http://www.kadee.com/animation/45.jpg", "", ""]
	fadeimages9[45]=["http://www.kadee.com/animation/46.jpg", "", ""]
	fadeimages9[46]=["http://www.kadee.com/animation/47.jpg", "", ""]
	fadeimages9[47]=["http://www.kadee.com/animation/48.jpg", "", ""]
	fadeimages9[48]=["http://www.kadee.com/animation/49.jpg", "", ""]
	fadeimages9[49]=["http://www.kadee.com/animation/50.jpg", "", ""]
	fadeimages9[50]=["http://www.kadee.com/animation/51.jpg", "", ""]
	fadeimages9[51]=["http://www.kadee.com/animation/52.jpg", "", ""]
	fadeimages9[52]=["http://www.kadee.com/animation/53.jpg", "", ""]
	fadeimages9[53]=["http://www.kadee.com/animation/54.jpg", "", ""]
	fadeimages9[54]=["http://www.kadee.com/animation/55.jpg", "", ""]
	fadeimages9[55]=["http://www.kadee.com/animation/56.jpg", "", ""]
	fadeimages9[56]=["http://www.kadee.com/animation/57.jpg", "", ""]
	fadeimages9[57]=["http://www.kadee.com/animation/58.jpg", "", ""]
	fadeimages9[58]=["http://www.kadee.com/animation/59.jpg", "", ""]
	fadeimages9[59]=["http://www.kadee.com/animation/60.jpg", "", ""]
	fadeimages9[60]=["http://www.kadee.com/animation/61.jpg", "", ""]
	fadeimages9[61]=["http://www.kadee.com/animation/62.jpg", "", ""]
	fadeimages9[62]=["http://www.kadee.com/animation/63.jpg", "", ""]
	fadeimages9[63]=["http://www.kadee.com/animation/64.jpg", "", ""]
	fadeimages9[64]=["http://www.kadee.com/animation/65.jpg", "", ""]
	fadeimages9[65]=["http://www.kadee.com/animation/66.jpg", "", ""]
	fadeimages9[66]=["http://www.kadee.com/animation/67.jpg", "", ""]
	fadeimages9[67]=["http://www.kadee.com/animation/68.jpg", "", ""]
	fadeimages9[68]=["http://www.kadee.com/animation/69.jpg", "", ""]
	fadeimages9[69]=["http://www.kadee.com/animation/70.jpg", "", ""]
	fadeimages9[70]=["http://www.kadee.com/animation/71.jpg", "", ""]
	fadeimages9[71]=["http://www.kadee.com/animation/72.jpg", "", ""]
	fadeimages9[72]=["http://www.kadee.com/animation/73.jpg", "", ""]
	fadeimages9[73]=["http://www.kadee.com/animation/74.jpg", "", ""]
	fadeimages9[74]=["http://www.kadee.com/animation/75.jpg", "", ""]
	fadeimages9[75]=["http://www.kadee.com/animation/76.jpg", "", ""]
	fadeimages9[76]=["http://www.kadee.com/animation/77.jpg", "", ""]
	fadeimages9[77]=["http://www.kadee.com/animation/78.jpg", "", ""]
	fadeimages9[78]=["http://www.kadee.com/animation/79.jpg", "", ""]
	fadeimages9[79]=["http://www.kadee.com/animation/80.jpg", "", ""]
	fadeimages9[80]=["http://www.kadee.com/animation/81.jpg", "", ""]
	fadeimages9[81]=["http://www.kadee.com/animation/82.jpg", "", ""]
	fadeimages9[82]=["http://www.kadee.com/animation/83.jpg", "", ""]
	fadeimages9[83]=["http://www.kadee.com/animation/84.jpg", "", ""]
	fadeimages9[84]=["http://www.kadee.com/animation/85.jpg", "", ""]
	fadeimages9[85]=["http://www.kadee.com/animation/86.jpg", "", ""]
	fadeimages9[86]=["http://www.kadee.com/animation/87.jpg", "", ""]
	fadeimages9[87]=["http://www.kadee.com/animation/88.jpg", "", ""]
	fadeimages9[88]=["http://www.kadee.com/animation/89.jpg", "", ""]
	fadeimages9[89]=["http://www.kadee.com/animation/90.jpg", "", ""]
	fadeimages9[90]=["http://www.kadee.com/animation/91.jpg", "", ""]
	fadeimages9[91]=["http://www.kadee.com/animation/92.jpg", "", ""]
	fadeimages9[92]=["http://www.kadee.com/animation/93.jpg", "", ""]
	fadeimages9[93]=["http://www.kadee.com/animation/94.jpg", "", ""]
	fadeimages9[94]=["http://www.kadee.com/animation/95.jpg", "", ""]
	fadeimages9[95]=["http://www.kadee.com/animation/96.jpg", "", ""]
	fadeimages9[96]=["http://www.kadee.com/animation/97.jpg", "", ""]
	fadeimages9[97]=["http://www.kadee.com/animation/98.jpg", "", ""]
	fadeimages9[98]=["http://www.kadee.com/animation/99.jpg", "", ""]
	fadeimages9[99]=["http://www.kadee.com/animation/100.jpg", "", ""]
	fadeimages9[100]=["http://www.kadee.com/animation/101.jpg", "", ""]
	fadeimages9[101]=["http://www.kadee.com/animation/102.jpg", "", ""]
	fadeimages9[102]=["http://www.kadee.com/animation/103.jpg", "", ""]
	fadeimages9[103]=["http://www.kadee.com/animation/104.jpg", "", ""]
	fadeimages9[104]=["http://www.kadee.com/animation/105.jpg", "", ""]
	fadeimages9[105]=["http://www.kadee.com/animation/106.jpg", "", ""]
	fadeimages9[106]=["http://www.kadee.com/animation/107.jpg", "", ""]
	fadeimages9[107]=["http://www.kadee.com/animation/108.jpg", "", ""]
	fadeimages9[108]=["http://www.kadee.com/animation/109.jpg", "", ""]
	fadeimages9[109]=["http://www.kadee.com/animation/110.jpg", "", ""]
	fadeimages9[110]=["http://www.kadee.com/animation/111.jpg", "", ""]
	fadeimages9[111]=["http://www.kadee.com/animation/112.jpg", "", ""]
	fadeimages9[112]=["http://www.kadee.com/animation/113.jpg", "", ""]
	fadeimages9[113]=["http://www.kadee.com/animation/114.jpg", "", ""]
	fadeimages9[114]=["http://www.kadee.com/animation/115.jpg", "", ""]
	fadeimages9[115]=["http://www.kadee.com/animation/116.jpg", "", ""]
	fadeimages9[116]=["http://www.kadee.com/animation/117.jpg", "", ""]
	fadeimages9[117]=["http://www.kadee.com/animation/118.jpg", "", ""]
	fadeimages9[118]=["http://www.kadee.com/animation/119.jpg", "", ""]
	fadeimages9[119]=["http://www.kadee.com/animation/120.jpg", "", ""]
	fadeimages9[120]=["http://www.kadee.com/animation/121.jpg", "", ""]
	fadeimages9[121]=["http://www.kadee.com/animation/122.jpg", "", ""]
	fadeimages9[122]=["http://www.kadee.com/animation/123.jpg", "", ""]
	fadeimages9[123]=["http://www.kadee.com/animation/124.jpg", "", ""]
	fadeimages9[124]=["http://www.kadee.com/animation/125.jpg", "", ""]
	fadeimages9[125]=["http://www.kadee.com/animation/126.jpg", "", ""]
	fadeimages9[126]=["http://www.kadee.com/animation/127.jpg", "", ""]
	fadeimages9[127]=["http://www.kadee.com/animation/128.jpg", "", ""]
	fadeimages9[128]=["http://www.kadee.com/animation/129.jpg", "", ""]
	fadeimages9[129]=["http://www.kadee.com/animation/130.jpg", "", ""]
	fadeimages9[130]=["http://www.kadee.com/animation/131.jpg", "", ""]
	fadeimages9[131]=["http://www.kadee.com/animation/132.jpg", "", ""]
	fadeimages9[132]=["http://www.kadee.com/animation/133.jpg", "", ""]
	fadeimages9[133]=["http://www.kadee.com/animation/134.jpg", "", ""]
	fadeimages9[134]=["http://www.kadee.com/animation/135.jpg", "", ""]
	fadeimages9[135]=["http://www.kadee.com/animation/136.jpg", "", ""]
	fadeimages9[136]=["http://www.kadee.com/animation/137.jpg", "", ""]
	fadeimages9[137]=["http://www.kadee.com/animation/138.jpg", "", ""]
	fadeimages9[138]=["http://www.kadee.com/animation/139.jpg", "", ""]
	fadeimages9[139]=["http://www.kadee.com/animation/140.jpg", "", ""]
	fadeimages9[140]=["http://www.kadee.com/animation/141.jpg", "", ""]
	fadeimages9[141]=["http://www.kadee.com/animation/142.jpg", "", ""]
	fadeimages9[142]=["http://www.kadee.com/animation/143.jpg", "", ""]
	fadeimages9[143]=["http://www.kadee.com/animation/144.jpg", "", ""]
	fadeimages9[144]=["http://www.kadee.com/animation/145.jpg", "", ""]
	fadeimages9[145]=["http://www.kadee.com/animation/146.jpg", "", ""]
	fadeimages9[146]=["http://www.kadee.com/animation/147.jpg", "", ""]
	fadeimages9[147]=["http://www.kadee.com/animation/148.jpg", "", ""]
	fadeimages9[148]=["http://www.kadee.com/animation/149.jpg", "", ""]
	fadeimages9[149]=["http://www.kadee.com/animation/150.jpg", "", ""]

var fadebgcolor="#ffd700"

////NO need to edit beyond here/////////////

var fadearray=new Array() //array to cache fadeshow instances
var fadeclear=new Array()   //array to cache corresponding clearinterval pointers

var dom=(document.getElementById) //modern dom browsers
var ie4=document.all

function fadeshow(theimages, fadewidth, fadeheight, borderwidth, pause, displayorder){

	this.pause=pause
	this.degree=10 //initial opacity degree (10%)
	this.curimageindex=0
	this.nextimageindex=1
	fadearray[fadearray.length]=this
	this.slideshowid=eval(fadearray.length-1)
	this.canvasbase="canvas"+this.slideshowid
	this.curcanvas=this.canvasbase+"_0"
	if (typeof displayorder!="undefined")
		theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
	this.theimages=theimages
	this.imageborder=parseInt(borderwidth)
	this.postimages=new Array() //preload images
	for (p=0;p<theimages.length;p++){
		this.postimages[p]=new Image()
		this.postimages[p].src=theimages[p][0]
	}

	var fadewidth=fadewidth+this.imageborder*2
	var fadeheight=fadeheight+this.imageborder*2

	if (ie4||dom)
		document.write('<div style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:4px;left:0px;filter:alpha(opacity=10);-moz-opacity:10;-khtml-opacity:10;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:4px;left:0px;filter:alpha(opacity=10);-moz-opacity:10;background-color:'+fadebgcolor+'"></div></div>')
	else
		document.write('<img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'">')

	if (ie4||dom)
		this.startit()
	else{
		this.curimageindex++
		var temp='setInterval("fadearray['+this.slideshowid+'].rotateimage()", '+this.pause+')'
		eval(temp)
	}
}

function fadepic(obj){
	if (obj.degree<100){
		obj.degree+=10
		if (obj.tempobj.filters)
			obj.tempobj.filters.alpha.opacity=obj.degree
		else if (obj.tempobj.style.MozOpacity)
			obj.tempobj.style.MozOpacity=obj.degree/101
		else if (obj.tempobj.style.KhtmlOpacity)
			obj.tempobj.style.KhtmlOpacity=obj.degree/100
	}
	else{
		clearInterval(fadeclear[obj.slideshowid])
		obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
		obj.tempobj=ie4? eval("document.all."+obj.nextcanvas) : document.getElementById(obj.nextcanvas)
		obj.populateslide(obj.tempobj, obj.nextimageindex)
		obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
		var temp='setTimeout("fadearray['+obj.slideshowid+'].rotateimage()", '+obj.pause+')'
		eval(temp)
	}
}

fadeshow.prototype.populateslide=function(picobj, picindex){
	var slideHTML=""
	if (this.theimages[picindex][1]!="") //if associated link exists for image
		slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
	slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px" alt="Advertisement">'
	if (this.theimages[picindex][1]!="") //if associated link exists for image
		slideHTML+='</a>'
	picobj.innerHTML=slideHTML
}


fadeshow.prototype.rotateimage=function(){
	if (ie4||dom){
		this.resetit()
		var crossobj=this.tempobj=ie4? eval("document.all."+this.curcanvas) : document.getElementById(this.curcanvas)
		crossobj.style.zIndex++
		var temp='setInterval("fadepic(fadearray['+this.slideshowid+'])",50)'
		fadeclear[this.slideshowid]=eval(temp)
		this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
	}
	else{
		var ns4imgobj=eval("document.images.defaultslide"+this.slideshowid)
		ns4imgobj.src=this.postimages[this.curimageindex].src
	}
	this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}

fadeshow.prototype.resetit=function(){
	this.degree=10
	var crossobj=ie4? eval("document.all."+this.curcanvas) : document.getElementById(this.curcanvas)
	if (crossobj.filters)
		crossobj.filters.alpha.opacity=this.degree
	else if (crossobj.style.MozOpacity)
		crossobj.style.MozOpacity=this.degree/101
	else if (crossobj.style.KhtmlOpacity)
		crossobj.style.KhtmlOpacity=obj.degree/100
}

fadeshow.prototype.startit=function(){
	var crossobj=ie4? eval("document.all."+this.curcanvas) : document.getElementById(this.curcanvas)
	this.populateslide(crossobj, this.curimageindex)
	this.rotateimage()
}

