var newWindow = null;

function closeWin(){
	if (newWindow != null){
		if(!newWindow.closed)
			newWindow.close();
	}
}

function popUpWin(url, type, strWidth, strHeight)
{
	closeWin();
	
	if (type == "fullScreen"){
		strWidth = screen.availWidth - 10;
		strHeight = screen.availHeight - 160;
	}
	
	var tools="";
	if (type == "standard" || type == "fullScreen") tools = "resizable=yes,toolbar=yes,location=yes,scrollbars=yes,status=yes,menubar=yes,width="+strWidth+",height="+strHeight+",top=0,left=0";
	if (type == "console") tools = "resizable,toolbar=no,location=no,scrollbars=no,width="+strWidth+",height="+strHeight+",left=100,top=100";
	newWindow = window.open(url, 'newWin', tools);
	newWindow.focus();
}

// use:
// <a href="link" title="title" target="popUpWin" onclick="popUpWin(this.href,'console',640,480);return false;">link</a>

function show_preview(id, id2, url)
{
	if(!document.getElementById(id2))
	{
		var newDiv = document.createElement("div");
		newDiv.setAttribute("id", id2);
		newDiv.innerHTML = '<blockquote><iframe src="' + url + '" align="center" frameborder="0" scrolling="auto" style="width: 100%; height: 200px; border:1px solid; display: block;"></iframe></blockquote><br>';
		document.getElementById(id).appendChild(newDiv);
	} else {
		d = document.getElementById(id);
		d_nested = document.getElementById(id2);
		document.getElementById(id).removeChild(d_nested);
	}
}