self.location='http://www.calleja.com.mt';

var baseopacity=75

function slowhigh(which2)
{
	imgobj=which2
	browserdetect=which2.filters? "ie" : typeof which2.style.MozOpacity=="string"? "mozilla" : ""
	instantset(baseopacity)
	highlighting=setInterval("gradualfade(imgobj)",75)
}

function slowlow(which2)
{
	cleartimer()
	instantset(baseopacity)
}

function instantset(degree)
{
	if (browserdetect=="mozilla")
	imgobj.style.MozOpacity=degree/100
	else if (browserdetect=="ie")
	imgobj.filters.alpha.opacity=degree
}

function cleartimer()
{
	if (window.highlighting) clearInterval(highlighting)
}

function gradualfade(cur2)
{
	if (browserdetect=="mozilla" && cur2.style.MozOpacity<1)
		cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)+0.1, 0.99)
	else if (browserdetect=="ie" && cur2.filters.alpha.opacity<100)
		cur2.filters.alpha.opacity+=10
	else if (window.highlighting)
		clearInterval(highlighting)
}

/*----------------------------------------------------------------------------------------------------*/

function blendimage(divid, imageid, imagefile, millisec) 
{ 
	var speed = Math.round(millisec / 100); 
	var timer = 0; 

	//set the current image as background 
	document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")"; 

	//make image transparent 
	changeOpac(0, imageid); 

	//make new image 
	document.getElementById(imageid).src = imagefile; 

	//fade in image 
	for(i = 0; i <= 100; i++) 
	{ 
		setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed)); 
		timer++; 
	} 
}

/*----------------------------------------------------------------------------------------------------*/

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 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 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);
}

/*----------------------------------------------------------------------------------------------------*/


