// Opacity and Fade in script.// Script copyright (C) 2008 http://www.cryer.co.uk/.// Script is free to use provided this copyright header is included.var fotky = new Array(3);fotky[0] = "/assets/templates/panskydum/img/header-01.jpg";fotky[1] = "/assets/templates/panskydum/img/header-03.jpg";fotky[2] = "/assets/templates/panskydum/img/header-04.jpg";fotky[3] = "/assets/templates/panskydum/img/header-05.jpg";function SetOpacity(object, opacityPct) {	// IE.	object.style.filter = 'alpha(opacity=' + opacityPct + ')';	// Old mozilla and firefox	object.style.MozOpacity = opacityPct/100;	// Everything else.	object.style.opacity = opacityPct/100;}function ChangeOpacity(id, msDuration, msStart, fromO, toO, img) {	var element=document.getElementById(id);	var opacity = element.style.opacity * 100;	var msNow = (new Date()).getTime();	opacity = fromO + (toO - fromO) * (msNow - msStart) / msDuration;	if (opacity < 0) {		SetOpacity(element, 0);		img++;		if (img > fotky.length) {			img = 1;		}		element.src = fotky[img - 1];		FadeIn(id, img);	} else if (opacity > 100) {    	SetOpacity(element, 100)		element.timer = window.setTimeout("FadeOut('" + id + "'," + img + ")", 10000);	} else {		SetOpacity(element, opacity);		element.timer = window.setTimeout("ChangeOpacity('" + id + "'," + msDuration + "," + msStart + "," + fromO + "," + toO + "," + img + ")", 20);	}}function FadeIn(id, img) {  	var element=document.getElementById(id);	if (element.timer) {		window.clearTimeout(element.timer); 	}	var startMS = (new Date()).getTime();	element.timer = window.setTimeout("ChangeOpacity('" + id + "',1000," + startMS + ",0,100," + img + ")", 1);}function FadeOut(id, img) {  	var element=document.getElementById(id);  	if (element.timer) {  		window.clearTimeout(element.timer);   	}  	var startMS = (new Date()).getTime();  	element.timer = window.setTimeout("ChangeOpacity('" + id + "',1000," + startMS + ",100,0," + img + ")", 1);}function FadeInImage(foregroundID, newImage, backgroundID) {	var foreground=document.getElementById(foregroundID);  	if (backgroundID) {    	var background=document.getElementById(backgroundID);    	if (background) {      		background.style.backgroundImage = 'url(' + foreground.src + ')';			background.style.backgroundRepeat = 'no-repeat';		}  	}  	SetOpacity(foreground, 0);	foreground.src = newImage;  	if (foreground.timer) {  		window.clearTimeout(foreground.timer);   	}  	var startMS = (new Date()).getTime();  	foreground.timer = window.setTimeout("ChangeOpacity('" + foregroundID + "',1000," + startMS + ",0,100)", 10);}
