var c = 0;
var d = 0.99;
var speed = 1;
var width = 10;
var height = 10;

function and_lightbox(divid, commands, Width, Height)
{
	w_div = divid;
	w_commands = commands;
	maxWidth = Width;
	maxHeight = Height;
	 
	
	if(w_commands == 'open'){
		
		fade = document.getElementById('and_fade');
		fade.style.display = "block";
		
		close = document.getElementById('and_close');
		close.style.display = "block";
		
		
		div2 = document.getElementById(w_div);
		div2.style.display = "block";
		
		and_lightbox_open(w_div, maxWidth, maxHeight);
	}
	
	if(w_commands == 'close'){
		div = document.getElementById(w_div);
		and_lightbox_close(w_div, maxWidth, maxHeight);
		
	}
}

function and_lightbox_open(w_div, maxWidth, maxHeight)
{
	div = document.getElementById(w_div);	
	
	div.style.width = parseInt(div.style.width) + width + "px";
	div.style.height = parseInt(div.style.height) + height + "px";
	div.style.opacity = parseInt(div.style.opacity) + c;
	
	
	if(div.style.width == maxWidth){}
	else if (div.style.height == maxHeight){}
	
	else
	{
		setTimeout("and_lightbox_open(w_div, maxWidth, maxHeight)",speed);
	}
	
		c_opacity = eval(maxHeight.replace(/px/g, "")) / (height);
		c = c + 1/c_opacity;

}


function and_lightbox_close(w_div)
{
	div = document.getElementById(w_div);
	div.style.width = parseInt(div.style.width) + -width + "px";
	div.style.height = parseInt(div.style.height) + -height + "px";
	div.style.opacity = parseInt(div.style.opacity) + d;
	
	d_opacity = eval(maxHeight.replace(/px/g, "")) / (height);
	d = d - 1/c_opacity;
	
	close.style.display = "none";
	
	if(div.style.width == maxWidth){
		div.style.display = "none";
		fade.style.display = "none";
	}
	else if (div.style.height == maxHeight){}
	
	else
	{
		setTimeout("and_lightbox_close(w_div, maxWidth, maxHeight)",speed);
	}
	
	
}
