// JavaScript Document

<!--

var img_array=new Array();
img_array[0]="../images/default.jpg";
img_array[1]="images/roomset2.jpg";
img_array[2]="images/roomset3.jpg";
img_array[3]="images/roomset4.jpg";
img_array[4]="images/roomset_pic03.jpg";
img_array[5]="images/default.jpg";
img_array[6]="images/roomset2.jpg";
img_array[7]="images/roomset3.jpg";
img_array[8]="images/roomset4.jpg";
img_array[9]="images/roomset5.jpg";
img_array[10]="images/default.jpg";
img_array[11]="images/roomset2.jpg";
img_array[12]="images/roomset3.jpg";
img_array[13]="images/roomset4.jpg";
img_array[14]="images/roomset5.jpg";

var steps=15;			// How many steps would you like for fading?. Max is 100, min is 1.
var gap=75;			// How long would you like the delay between each frame (in 1/1000 ths of a second)? Min is 1, max should be no more than 10000 (10 seconds).
var show_img_gap=2000;		// How long would you like to show the image for before it starts to fade out again.
var hide_img_gap=75;		// How long would you like to hide the image for before it starts to fade in again.

steps=(steps<1 || steps>100)?15:Math.round(steps);
gap=(gap<1)?75:Math.round(gap);
show_img_gap=(show_img_gap<1)?75:Math.round(show_img_gap);
hide_img_gap=(hide_img_gap<1)?75:Math.round(hide_img_gap);

function controler_of_fade(){

n=0;
m=0;
img_num=0;
fading="images/in";
fade();}

function fade(){

document.getElementById("fader").src=img_array[img_num];

m=Math.round(n/steps*100);

// m=Math.round(Math.pow((n/steps*Math.pow(100,(1/2))),2));		// Uncomment the beginning of this line for a different fade effect. It will spend more time faded in than faded out.

document.getElementById("fader").style.filter="images/alpha(opacity="images/+m+")";	// IE fade.
document.getElementById("fader").style.MozOpacity=m/100;		// Gecko fade.
document.getElementById("fader").style.Opacity=m/100;			// Standards fade.

n+=(fading=="images/in")?1:(-1);

if(n==steps+1){n-=2;fading="images/out";if(img_num!=img_array.length-1){setTimeout("fade()",show_img_gap);}}
else if(n==0){fading="images/in";img_num++;setTimeout("fade()",hide_img_gap);}
else{setTimeout("fade()",gap);}}

//-->
