var browser=navigator.appName;
d = document;
var imgatt = new Array()//name,speed,counter,nextimage,intervalID()
imgatt[0] = ['underight1', 300, 00, "url(assets/lines.gif)", null];
imgatt[1] = ['underight2', 300, 00, "url(assets/walltile.gif)", null];
imgatt[2] = ['bolt', 30, 1.0, "url(assets/bolt.gif)", null];
if (browser=="Microsoft Internet Explorer")
{
imgatt[2][2]= 100;
}
var preInterval
function fadein(it)
{
 clearInterval(preInterval);
 ame=it
 imgatt[it][4] = setInterval("appear(ame)", imgatt[it][1]);
 preInterval = imgatt[it][4]
}
function appear(ame)
{
if (browser=="Microsoft Internet Explorer")
{
	opstr=d.getElementById(imgatt[ame][0]).style.filter
	if (opstr.match("opacity=100") == null)
	{
	imgatt[ame][2]+=1.5;
	d.getElementById(imgatt[ame][0]).style.filter = 'alpha(opacity='+imgatt[ame][2]+')';
	}else{
	d.getElementById(imgatt[ame][0]).style.filter = 'alpha(opacity=100)';
	clearInterval(imgatt[ame][4]);
	imgatt[ame][2] = 100;
	}
}else{
	if (d.getElementById(imgatt[ame][0]).style.opacity <= 0.95)
	{
	imgatt[ame][2]+=.05;
	d.getElementById(imgatt[ame][0]).style.opacity = imgatt[ame][2];
	}else{  
	if (d.getElementById(imgatt[ame][0]).style.opacity >= 0.95)
	{
	d.getElementById(imgatt[ame][0]).style.opacity = 1;
	clearInterval(imgatt[ame][4]);
	imgatt[ame][2] = 1.0;
	}
	}
}
}
function fadeout(fit)
{
theitem= fit
clearInterval(preInterval);
imgatt[fit][4]=setInterval("disappear(theitem)", imgatt[theitem][1])
preInterval = imgatt[fit][4]
}
function disappear(theitem)
{
if (browser=="Microsoft Internet Explorer")
{
	if (d.getElementById(imgatt[theitem][0]).style.filter.match("opacity=0") == null)
	{	
	imgatt[theitem][2]-=1.5;
	d.getElementById(imgatt[theitem][0]).style.filter = 'alpha(opacity='+ imgatt[theitem][2] +')';
	}else{
	clearInterval(imgatt[theitem][4]);
	d.getElementById(imgatt[theitem][0]).style.filter = 'alpha(opacity=0)';
	imgatt[theitem][2] = 0;
	}
}else{
	if (d.getElementById(imgatt[theitem][0]).style.opacity >= 0)
	{
	imgatt[theitem][2]-=.05;
	d.getElementById(imgatt[theitem][0]).style.opacity = imgatt[theitem][2];
 	}else{
	clearInterval(imgatt[theitem][4]);
	d.getElementById(imgatt[theitem][0]).style.opacity = 0;
	imgatt[theitem][2] = 0;
	}
}
}

var cc = 0
function addcc()
{
cc++
trix(cc)
}
function trix(n)
{
switch(n)
{
case 23:
		fts= 1
		imgatt[1][3]="url(assets/crack.gif)";
 		fadeout(1);
		intervalID = setInterval("checkonit(fts)", 250)//waits for the fade out
 	break;
case 10:
	if(document.getElementById('box').contentWindow.location.href.match('video.html') != null)
		{
		imgatt[0][3]="url(assets/lines.gif)";
		ft= 0;
 		fadeout(ft);
		intervalID = setInterval("checkonit(ft)", 250)//waits for the fade out
		}
 	break;
case 12:
	if(document.getElementById('box').contentWindow.location.href.match('multimedia.html') != null)
		{
		imgatt[0][3]="url(assets/f_texture2.gif)";
		fx= 0;
 		fadeout(fx);
		intervalID = setInterval("checkonit(fx)", 250)//waits for the fade out
		}
 	break;
case 7:
	if(document.getElementById('box').contentWindow.location.href.match('video.html') != null)
		{
		imgatt[0][3]="url(assets/crack2.gif)";
		fsx= 0;
 		fadeout(fsx);
		intervalID = setInterval("checkonit(fsx)", 250)//waits for the fade out
		}
 	break;
case 4:
	fadein(1);
 	break;
case 30:
	fadein(0);
 	break;
case 13:
	if(document.getElementById('box').contentWindow.location.href.match('graphics.html') != null)
		{
		
		ftz= 0;
		imgatt[ftz][3]="url(assets/circles.gif)";
 		fadeout(ftz);
		intervalID = setInterval("checkonit(ftz)", 250)//waits for the fade out
		}
case 11:
	//if (document.getElementById('box').contentWindow.location.href.match('video.html') != null)
	//	{
		fme= 0
		//d.getElementById('bod').style.backgroundImage="url(assets/lines.gif)"
		imgatt[fme][3]="url(assets/lines.gif)";
		fadeout(fme);
		intervalID = setInterval("checkonit(fme)", 250)//waits for the fade out
		//}
 	break;	
case 6:	
	if (document.getElementById('box').contentWindow.location.href.match('hypertext.html') != null)
		{
		weq = 1;
		imgatt[weq][3]="url(assets/walltile.gif)";
		fadeout(weq);
		intervalID = setInterval("checkonit(weq)", 250)//waits for the fade out
		}
 	break;
case 8:
		fg= 1;
		imgatt[fg][3]="url(assets/crack.gif)";
 		fadeout(fg);
		intervalID = setInterval("checkonit(fg)", 250)//waits for the fade out
 	break;	
default:
}

}
function checkonit(cme)
{
	if (browser=="Microsoft Internet Explorer")
	{
		opstr=d.getElementById(imgatt[cme][0]).style.filter
		if (opstr.match("opacity=0") != null)
		{
		d.getElementById(imgatt[cme][0]).style.backgroundImage = imgatt[cme][3]
		clearInterval(intervalID);
		if (imgatt[cme][3]== 'url(assets/walltile.gif)')
			{
			d.getElementById(imgatt[cme][0]).style.backgroundRepeat="repeat-x";
			} else {
			d.getElementById(imgatt[cme][0]).style.backgroundRepeat="repeat-y";
			}
		fadein(cme);
		}
	}else{
		if (d.getElementById(imgatt[cme][0]).style.opacity <= 0.0)
		{
		d.getElementById(imgatt[cme][0]).style.backgroundImage = imgatt[cme][3]
		clearInterval(intervalID);
			if (imgatt[cme][3]== 'url(assets/walltile.gif)')
			{
			d.getElementById(imgatt[cme][0]).style.backgroundRepeat="repeat-x";
			} else {
			d.getElementById(imgatt[cme][0]).style.backgroundRepeat="repeat-y";
			}
		fadein(cme);
		}
	}
}
function navClix(pg)//this function reserved for main area button triggers
{
	addcc();
//	if (pg=="video") file = "lines.gif"
//	if (pg=="websites") file = "crack2.gif"
//	if (pg=="multimedia") file = "circles.gif"
//	nme= 0
//	imgatt[0][3]="url(assets/"+file+")";
//	fadeout(0);
//	intervalID = setInterval("checkonit(nme)", 250)//waits for the fade out
}
