var newWindow = null;

function closeWin(){
	if (newWindow != null){
		if(!newWindow.closed)
			newWindow.close();
	}
}

function popUp(url, id, strWidth, strHeight){
	
	closeWin();
	strTop = (screen.height-strHeight)/3;
	strLeft = (screen.width-strWidth)/2;
	
	var tools="";
	tools = "width="+strWidth+",height="+strHeight+",top="+strTop+", left="+strLeft+", resizable=no,toolbar=no,location=no,scrollbars=no";
	/*newWindow = window.open(url, 'newWin', tools);
	newWindow.resizeBy(+23, +27);*/
	
	if (id == "thumbimage")
	{
		newWindow = window.open(url, 'newWin', tools);
		newWindow.resizeBy(+23, +27);
		with (newWindow.document)
		{
			writeln('<body id="bodyID" bgcolor=#000000 scroll="no" onload="changeBGc">');
			writeln('<img name="thumbimage" src='+url+' style="display:block"></body>');
			newWindow.onload = changeBGc;
			newWindow.focus();
		} 
	} else { 
		if (id == "free_preview") {
			newWindow = window.open(url, 'newWin', tools);
			newWindow.focus();
		}
	}
}


function changeBGc() 
{
	newWindow.document.getElementsByTagName("bodyID")[0].style.backgroundColor = "#000"; 
}