﻿PopUp=new Array();

//function openPopUp(path, width, height) {
//    return openPopUp('PopUp',path,width,height);
//}

function openPopUp(name, path, width, height) {
	if (PopUp[name] != null) { PopUp[name].close(); }
	var top=(screen.height-height)/2; 
	var left=(screen.width-width)/2; 
	PopUp[name] = window.open(path,name,'left='+left+', top='+top+', status=0,toolbar=0,location=0,directories=0,menubar=0,scrollbars=auto,resizable=0,width='+width+',height='+height);
	//if (PopUp.opener == null) PopUp.opener = self;
	return false;
}

function openNewsPopUp(path) {
    var name="News";
    var width=900;
    var height=600;
	if (PopUp[name] != null) { PopUp[name].close(); }
	var top=10; // (screen.height-height)/2; 
	var left=10; // (screen.width-width)/2; 
	PopUp[name] = window.open(path,name,'screenX='+left+',screenY='+top+', left='+left+', top='+top+',resizable=yes,toolbar=no,location=yes,directories=yes,addressbar=yes,scrollbars=yes,status=yes,menubar=no,width='+width+',height='+height);
	//if (PopUp.opener == null) PopUp.opener = self;
	return false;
}

function ClosePopUpRedirect(name, page) {
    if (PopUp[name] != null) { 
        PopUp[name].close(); PopUp[name]=null; 
     }
     location.href = page;
}

function ClosePopUpReload(name) {
    if (PopUp[name] != null) { 
        PopUp[name].close(); PopUp[name]=null; 
     }
     location.href = location.href;
}

function ClosePopUp(name) {
    if (PopUp[name] != null) { 
        PopUp[name].close(); PopUp[name]=null; 
     }
}

function html_entity_decode(str)
{
    try
	{
		var  tarea=document.createElement('textarea');
		tarea.innerHTML = str; return tarea.value;
		tarea.parentNode.removeChild(tarea);
	}
	catch(e)
	{
		//for IE add <div id="htmlconverter" style="display:none;"></div> to the page
		document.getElementById("htmlconverter").innerHTML = '<textarea id="innerConverter">' + str + '</textarea>';
		var content = document.getElementById("innerConverter").value;
		document.getElementById("htmlconverter").innerHTML = "";
		return content;
	}
}