document.write("<div id='fade' class='black_overlay'></div>");

function lightBox(url, val)
{
	
/*	var objBody = document.getElementsByTagName("body").item(0);
	var lightDiv = document.createElement("div");
    lightDiv.setAttribute('id','popup');
    lightDiv.setAttribute('class','white_content');
	objBody.appendChild(lightDiv);

	var imgDiv = document.createElement("div");

	imgDiv.setAttribute('id','imgDiv');
	lightDiv.appendChild(imgDiv);
	*/
	document.getElementById("fade").style.visibility="visible";
    itemimg = new Image();
    itemimg.src = url;
	
    
	width = screen.width;
	width = (width - 395)/2;
	height = screen.height;
	height = (height - 600)/2;
	lightDiv = document.getElementById("popup");
	lightDiv.style.display = "block";
//	document.getElementById('imgdiv').innerHTML = "<img src='" + url + "'/>";
	for(i=1; i<=5;i++)
	{
		if(document.getElementById('light' + i))
		{
			if(i == val)
			{
				document.getElementById('light' + i).style.display = "";
			}
			else
			{	
				document.getElementById('light' + i).style.display = "none";
			}
		}
	}

	lightDiv.style.width =  "395px";
	lightDiv.style.height = "610px";

	lightDiv.style.left = Number(width) + "px";
	lightDiv.style.top = Number(height) + "px";
	

    
}


/*var t;
var bln = true;
var count = 0;
var newcount = 0;
var ld = true;
var stylesheet = "<style> .black_overlay { display: none; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; background-color: #000;  z-index:1001; -moz-opacity: 0.8; opacity:.80; filter: alpha(opacity=80);} </style>";
document.write(stylesheet);
	
/*
function lightboxImage(url)
{
	image = new Image();
	image.src = url;

	var stylesheet = "<style> .black_overlay { display: none; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%; background-color: #000;  z-index:1001; -moz-opacity: 0.8; opacity:.80; filter: alpha(opacity=80);} .white_content { display: none;  position: absolute;   width: " + (image.width + 20) + "px;  height: " + (image.height + 10) + "px; padding: 3px; background-color: white;  z-index:1002;  overflow: auto;  top:0px; left:150px; border:5px solid #000; } </style>";
			
	
	stylesheet += "<div class='white_content' id='popup'>";
	stylesheet +=  "<img src='" + url + "'></div>";
	document.getElementById("fade").style.display = "";
	alert(stylesheet);
	document.getElementById("popup").innerHTML = "sssssss";
}
	
	
function loading(url)
{
		count = 0;
		bln = true;
	if(ld == true)
	{
		if(newcount == 0)
		{
			setIntDn = setInterval("dissolve_in()",100);
		}
		popupbox = document.getElementById("loading");
		
		width = screen.width;
		width = (width - 400)/2;
		document.getElementById("loading").style.left = Number(width) + "px";
		
		height = screen.height;
		height = (height - 105)/2;
		document.getElementById("loading").style.top = Number(height) + "px";
		
		
		popupbox.style.display='block';
		document.getElementById("fade").style.display="block";
		t = setTimeout("loading('" + url + "')", 1000);
		num = 0;

	}
	else
	{
		clearTimeout(t);
		document.getElementById("loading").style.display = 'none';
		appear_box(url);
	}
	
	newcount++;
	if(newcount == 5)
	{
		ld = false;
	}
}


function appear_box(url) {

	if(count == 5)
	{
		bln = false;
	}
		
	popupbox = document.getElementById("popup");
	popupbox.style.display='block';
	image = new Image();
	image.src = url;
	
	width = screen.width;
	width = (width - image.width)/2;

	height = screen.height;
	height = (height - image.height)/2;
	

	document.getElementById("popup").style.width = (image.width + 10) + "px";
	document.getElementById("popup").style.height = (image.height + 10) + "px";

	document.getElementById("popup").style.left = Number(width) + "px";
	document.getElementById("popup").style.top = Number(height) + "px";
	
	document.getElementById("fade").style.display="block";
	
	t = setTimeout("appear_box('" + url + "')", 1000);
	num = 0;
	count++;

}
	
function temp()
{
	document.getElementById('popup').style.display='none';
	document.getElementById('fade').style.display='none';
	clearInterval(t);
}


function dissolve_in(){
	popupbox.style.opacity = num/100;
	//popupbox.style.filter='alpha(opacity='+num+')';
	if(num < 110){num=num+15;}
	else{clearInterval(setIntDn);}
}


function swapimage(val)
{
	for(i=1;i<=4;i++)
	{
		if(document.getElementById("moreimage" + i))
		{
			if(i==val)
			{
				document.getElementById("moreimage" + i).style.display='';
			}
			else
			{
				document.getElementById("moreimage" + i).style.display='none';
			}
				
		}
	}
}

function close_lightbox()
{
	document.getElementById('popup').style.display='none';
	document.getElementById('fade').style.display='none';
	ld = true;
	newcount = 0;
	clearInterval(t);
}	*/


