
var oldid="";
var oldid2="";	
function closediv(url,w,h)
{
	if(oldid!="")
	{
	   document.getElementById(oldid).className="image";
	}
	document.getElementById('d1').style.display = 'none';
	document.test.src='img/blank.gif';
}

function opendiv(url,w,h)
{

	var str=document.test.src;
	if (!str.match(url)){
		
		document.getElementById('d1').style.background= '#f5f5e8 no-repeat center url(\'img/loader.gif\')';
		document.test.style.opacity = 0;
		document.test.style.filter = 'alpha(opacity=0)';
		document.test.style.MozOpacity = 0;
		document.getElementById('d1').style.display = '';
		
		document.test.src=url;
		document.test.width=w;
		document.test.height=h;
		
		var iWidth=w;
		var iHeight=h;
		var iRealWidth = iWidth ? iWidth : 800 ;
		var iRealHeight = iHeight ? iHeight : screen.height - 30 ;
		var iLeft = Math.round ((screen.width - iRealWidth) / 2)-23;
		var iTop =  Math.round ((screen.height - iRealHeight) / 2) - 100 ;
		document.getElementById('d1').style.left= iLeft ;	
	  
		if(document.all) {
			document.getElementById('d1').style.top= iTop + document.body.scrollTop;
		}
		else if(document.getElementById) {
			document.getElementById('d1').style.top= iTop + window.pageYOffset;
		}
	}
}
	
	
function initAppear()
{
	for (var i=0;i<11;i++){
		setTimeout('setOpacity('+i+')',35*i);
	}
	document.getElementById('d1').style.background= '#000000';
	return false;
}
	
function setOpacity(value)
{
		document.getElementById("test").style.opacity = value/10;
		document.getElementById("test").style.filter = 'alpha(opacity=' + value*10 + ')';
		document.getElementById("test").style.MozOpacity = value/10;
}

var fo="img1";
function select_div(id)
{

	if(oldid=="" & fo=="")
	{	oldid=id;
		document.getElementById(id).className="image active";
	
	}
	else if(fo!="")
	{
		document.getElementById(fo).className="image";
		document.getElementById(id).className="image active";
		oldid=id;
		fo="";
	}
	else
	{
		document.getElementById(oldid).className="image";
		document.getElementById(id).className="image active";
		oldid=id;
	}
}
	
function closediv2(url,w,h)
{
	if(oldid!="")
	{
	   document.getElementById(oldid).className="image";
	}
	document.getElementById('d2').style.display = 'none';
	document.test.src='img/blank.gif';
}

function opendiv2(url,w,h)
{
	var str=document.getElementById("openedimg").src;
	if (!str.match(url))
	{
		document.getElementById('d2').style.background= '#f5f5e8 no-repeat center url(\'img/loading.gif\')';
		document.getElementById("openedimg").style.opacity = 0;
		document.getElementById("openedimg").style.filter = 'alpha(opacity=0)';
		document.getElementById("openedimg").style.MozOpacity = 0;
		document.getElementById('d2').style.display = '';
		
		document.getElementById("openedimg").src=url;
		document.getElementById("openedimg").width=w;
		document.getElementById("openedimg").height=h;
		
		var iWidth=w;
		var iHeight=h;
		var iRealWidth = iWidth ? iWidth : 800 ;
		var iRealHeight = iHeight ? iHeight : screen.height - 30 ;
		var iLeft = Math.round ((screen.width - iRealWidth) / 2)-23;
		var iTop =  Math.round ((screen.height - iRealHeight) / 2) - 100 ;
		document.getElementById('d2').style.left= iLeft ;	
	  
		if(document.all) {
			document.getElementById('d2').style.top= iTop + document.body.scrollTop;
		}
		else if(document.getElementById) {
			document.getElementById('d2').style.top= iTop + window.pageYOffset;
		}
	}
}	
	
function initAppear2()
{
	for (var i=0;i<11;i++)
	{
		setTimeout('setOpacity2('+i+')',35*i);
	}
	document.getElementById('openedimg').style.background= '#000000';
	return false;
}	
	
function setOpacity2(value)
{
	document.getElementById("openedimg").style.opacity = value/10;
	document.getElementById("openedimg").style.filter = 'alpha(opacity=' + value*10 + ')';
	document.getElementById("openedimg").style.MozOpacity = value/10;
}
	