// Script copyright (C) 2008 http://www.cryer.co.uk/.
// Script is free to use provided this copyright header is included.
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)
{
  var id = id;
  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)
  else if (opacity>100)
    SetOpacity(element,100)
  else
  {
    SetOpacity(element,opacity);
    element.timer = window.setTimeout("ChangeOpacity('" + id + "'," + msDuration + "," + msStart + "," + fromO + "," + toO + ")",1);
  }
}
function FadeIn(id)
{
  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)",1);
}
function FadeOut(id)
{
  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)",1); 
}

function upd(n,t){ 	
	document.getElementById('text').innerHTML = txt[n];
	document.getElementById('counter').innerHTML = n+"/"+t;
} 

function showmail(){
var e1 = "sale";
var e2 = "s@";
var e3 = "fotom";
var e4 = "atiz.";
var e5 = "es";
document.getElementById('semail').innerHTML = e1+e2+e3+e4+e5;
} 

function imagerollover(){
	var allimages=document.getElementsByTagName("img")
	var preloadimages=[]
	for (var i=0; i<allimages.length; i++){
		if (allimages[i].getAttribute("data-over")){ //if image carries "data-over" attribute
			preloadimages.push(new Image()) //preload "over" image
			preloadimages[preloadimages.length-1].src=allimages[i].getAttribute("data-over")
			allimages[i].onmouseover=function(){
				this.src=this.getAttribute("data-over")
			}
			allimages[i].onmouseout=function(){
				this.src=this.getAttribute("data-out")
			}
		} //end if
	} //end for loop
}

