//for fade images

function fade(fadeimages,fadetime,numframes,pause,bgimage,fgimage,bg,fg,opacity) {
	if (fadeimages.length >= 2) {
		var imagestring = "Array(";
		for (i=0;i<fadeimages.length;i++) {
			imagestring += "'"+fadeimages[i]+"',";
		}
		imagestring = imagestring.substr(0,imagestring.length-1) + ")";
		if (opacity>=100) {
			//alert (opacity);
			bg = fg;
			if (fg == fadeimages.length-1)
				fg = 0;
			else
				fg++;
			document.getElementById(bgimage).src = fadeimages[bg];
			document.getElementById(fgimage).src = fadeimages[fg];
			opacity = 0;
			if (document.all)
				document.getElementById(fgimage).style.filter = "alpha(opacity="+opacity+")";
			else
				document.getElementById(fgimage).style.MozOpacity = opacity+"%";
			setTimeout("pausefade("+imagestring+","+fadetime+","+numframes+","+pause+",'"+bgimage+"','"+fgimage+"',"+bg+","+fg+","+opacity+");",fadetime/numframes);
		} else {
			//alert (opacity);
			if (document.all)
				document.getElementById(fgimage).style.filter = "alpha(opacity="+opacity+")";
			else
				document.getElementById(fgimage).style.MozOpacity = opacity+"%";
			opacity += 100/numframes;
			setTimeout("fade("+imagestring+","+fadetime+","+numframes+","+pause+",'"+bgimage+"','"+fgimage+"',"+bg+","+fg+","+opacity+");",fadetime/numframes);
		}
	}
}

function pausefade(fadeimages,fadetime,numframes,pause,bgimage,fgimage,bg,fg,opacity) {
	var imagestring = "Array(";
	for (i=0;i<fadeimages.length;i++) {
		imagestring += "'"+fadeimages[i]+"',";
	}
	imagestring = imagestring.substr(0,imagestring.length-1) + ")";
	setTimeout("fade("+imagestring+","+fadetime+","+numframes+","+pause+",'"+bgimage+"','"+fgimage+"',"+bg+","+fg+","+opacity+");", pause);
}
					//controllers

var fadeimages = Array("images/galleryphotos/gallery1.jpg","images/galleryphotos/gallery2.jpg","images/galleryphotos/gallery3.jpg","images/galleryphotos/gallery4.jpg","images/galleryphotos/gallery5.jpg","images/galleryphotos/gallery6.jpg","images/galleryphotos/gallery7.jpg","images/galleryphotos/gallery8.jpg","images/galleryphotos/gallery9.jpg","images/galleryphotos/gallery10.jpg","images/galleryphotos/gallery11.jpg","images/galleryphotos/gallery12.jpg","images/galleryphotos/gallery13.jpg","images/galleryphotos/gallery14.jpg","images/galleryphotos/gallery15.jpg","images/galleryphotos/gallery16.jpg","images/galleryphotos/gallery17.jpg","images/galleryphotos/gallery18.jpg","images/galleryphotos/gallery19.jpg","images/galleryphotos/gallery20.jpg","images/galleryphotos/gallery21.jpg","images/galleryphotos/gallery22.jpg","images/galleryphotos/gallery23.jpg","images/galleryphotos/gallery24.jpg","images/galleryphotos/gallery25.jpg","images/galleryphotos/gallery26.jpg","images/galleryphotos/gallery27.jpg","images/galleryphotos/gallery28.jpg","images/galleryphotos/gallery29.jpg","images/galleryphotos/gallery30.jpg","images/galleryphotos/gallery31.jpg","images/galleryphotos/gallery32.jpg","images/galleryphotos/gallery33.jpg","images/galleryphotos/gallery34.jpg","images/galleryphotos/gallery35.jpg","images/galleryphotos/gallery36.jpg","images/galleryphotos/gallery37.jpg","images/galleryphotos/gallery38.jpg","images/galleryphotos/gallery39.jpg","images/galleryphotos/gallery40.jpg","images/galleryphotos/gallery41.jpg","images/galleryphotos/gallery42.jpg","images/galleryphotos/gallery43.jpg"); //add new images here
var fadetime = 1000 * 1;
var numframes = 20; // how detailed the transition is ; not 0;higher number = smoother transition
var pause = 1000 * 2; //how long image stays static
var imagearray = Array(fadeimages.length);
for (i=0;i<fadeimages.length;i++) {
	imagearray[i] = new Image();
	imagearray[i].src = fadeimages[i];
}

/* to check div position based on screen resolution */

Size = new Object;
Size.Small = "<Style>.modDiv{position:absolute;visibility:visible;z-index:2;; left: 280px; top: 415px}</Style>"
Size.Medium = "<Style>.modDiv{position:absolute;visibility:visible;z-index:2;; left: 325px; top: 415px}</Style>"
Size.Large = "<Style>.modDiv{position:absolute;visibility:visible;z-index:2;; left: 390px; top: 415px}</Style>"

W = screen.width;

if (W <= 800){document.write(Size.Small)};
if ((W > 800)&&(W < 1100)){document.write(Size.Medium)};
if (W > 1100){document.write(Size.Large)};



