var popWin1 = null;
var popWin2 = null;
var iFrame = null;
var popupOpacity = 0.65;

function showHideLayers(objIn, display) {
	var obj = objIn;
	if (typeof(objIn) != 'object')
		obj = document.getElementById(objIn);
	if (obj == null)
		return;

	if (obj.style) {
		obj.style.visibility = (display) ? 'visible' : 'hidden';
	} else {
		obj.visibility = (display) ? 'show' : 'hide';
	}

	if (display) {
		obj.style.display = 'block';
	} else {
		obj.style.display = 'none';
	}
}

function popWindow(url, width, height) {
	// If no window exists, create it
	// set the url

	if (popWin1 === null) {
		popWin1 = document.createElement('DIV');
		popWin1.style.width = '100%';
		popWin1.style.height = '100%';
		popWin1.style.zIndex = 3;
		popWin1.style.position = 'absolute';
		popWin1.style.top = '0px';
		popWin1.style.backgroundColor = '#000';
		popWin1.style.opacity = popupOpacity;
		if (document.all)
			popWin1.style.filter = "alpha(opacity ="
					+ (popupOpacity * 100) + ")";
		else if (!document.all && document.getElementById)
			popWin1.style.MozOpacity = popupOpacity;

		document.body.appendChild(popWin1);

		popWin2 = document.createElement('DIV');

		popWin2.style.position = 'absolute';		
		popWin2.style.zIndex = 3;
		popWin2.style.textalign = 'center';		
		popWin2.style.backgroundColor = '#000';
		popWin2.style.paddingLeft = '2px';
		popWin2.style.paddingRight = '2px';
		popWin2.style.paddingBottom = '2px';

		var divCloseEl = document.createElement('DIV');
		divCloseEl.setAttribute('width', '100%');
		divCloseEl.style.textAlign = 'right';

		var aCloseEl = document.createElement('A');
		aCloseEl.setAttribute('href', 'javascript:closepopWindow()');
		aCloseEl.style.color = '#FFF';
		aCloseEl.style.textDecoration = 'none';
		aCloseEl.style.fontSize = '9px';
		aCloseEl.style.fontFamily = 'Verdana,Tahoma,Helvetica,Arial';
		aCloseEl.style.fontWeight = 'bold';
		aCloseEl.innerHTML = 'Loka';

		divCloseEl.appendChild(aCloseEl);

		popWin2.appendChild(divCloseEl);

		iFrame = document.createElement('IFRAME');
		iFrame.style.border = '0';
		iFrame.style.width = '100%';
		iFrame.style.height = (height - 12) + 'px';
		popWin2.appendChild(iFrame);

		document.body.appendChild(popWin2);
		
	}
	popWin2.style.width = width + 'px';
	popWin2.style.height = height + 'px';
	popWin2.style.left = '50%';
	popWin2.style.marginLeft = -(width / 2) + 'px';
	popWin2.style.top = '50%';
	popWin2.style.marginTop = -(height / 2) + 'px';
	
	iFrame.setAttribute('src', url);
	showHideLayers(popWin1, true);
	showHideLayers(popWin2, true);
}

function closepopWindow() {
	showHideLayers(popWin1, false);
	showHideLayers(popWin2, false);
}

