
function PopUp(textKeyBody,textKeyTitle,width,height) {
   win=window.open('/pan/helpTextServlet?helpText='+textKeyBody+'&helpTextTitle='+textKeyTitle+'&helpTextWidth='+width+'&helpTextHeight='+height,'wnd','toolbar=no,location=no,menu=no,scrollbars=yes,directories=no,resizable=yes,width='+width+',height='+height+',screenX=0,screenY=0,top=0,left=0');
   win.focus();
}

function HelpWindow(src) {
    win=window.open('/pan/helpTextServlet?helpText=' + src,'wnd','toolbar=no,location=no,menu=no,scrollbars=yes,directories=no,resizable=yes,width=300,height=300,screenX=0,screenY=0,top=0,left=0');
    win.focus();
}

function CustomWindow(url, width, height) {
   win=window.open(url,'CustomWindow','toolbar=no,location=no,menu=no,scrollbars=yes,directories=no,resizable=yes,width='+width+',height='+height+',screenX=0,screenY=0,top=0,left=0');
   win.focus();
}

function isEmailAddress(str_) {
    var str = new String;
    var valid = true;

    str = str_;
    if (str.indexOf("@", 0) == -1)
        valid = false;
    else
        if (str.indexOf(".", str.indexOf("@", 0)) == -1)
            valid = false;

    return valid;
}

function checkLoginEmailAddress(email, errorMessage) {
		return true;
	}

function getById(id) {
    return document.getElementById?document.getElementById(id):(document.all?document.all(id):null);
}

function gotoUrl(url) {
	this.location.href=url;
}

////////////////////////////////////////////////////////////////////
////                  Popup link window                         ////
////////////////////////////////////////////////////////////////////
var timeout;
function showPopBox(e,w,h,code) {
	var x = (window.event) ? window.event.x : e.pageX;
	var y = (window.event) ? window.event.y : e.pageY;
	if (document.all) {
		var scroll = getScroll();
		y = y + scroll.y;
	}
	getById('popBox').style.width = w;
	getById('popBox').style.height = h;
	getById('popBoxShadow').style.width = w;
	getById('popBoxShadow').style.height = h;
	getById('popBox').style.top = y+10;
	getById('popBox').style.left = x;
	getById('popBoxShadow').style.top = y+13;
	getById('popBoxShadow').style.left = x+3;
	getById('popBox').innerHTML = code;
	showDiv('popBox');
	showDiv('popBoxShadow');

	timeout = setTimeout("hideDiv('popBox');hideDiv('popBoxShadow');", 3000);
}

function showPopBox2(e,code) {
	var x = (window.event) ? window.event.x : e.pageX;
	var y = (window.event) ? window.event.y : e.pageY;
	if (document.all) {
		var scroll = getScroll();
		y = y + scroll.y;
	}
	getById('popBox').style.top = y+10;
	getById('popBox').style.left = x;
	getById('popBoxShadow').style.top = y+13;
	getById('popBoxShadow').style.left = x+3;
	getById('popBox').innerHTML = code;
	showDiv('popBox');
	showDiv('popBoxShadow');

	timeout = setTimeout("hideDiv('popBox');hideDiv('popBoxShadow');", 3000);
}

function popBoxOut(){
    timeout = setTimeout("hideDiv('popBox');hideDiv('popBoxShadow');", 0);
}

function popBoxOut2(e) {
	if (!e) var e = window.event;
	var tg = (window.event) ? e.srcElement : e.target;
	if (tg.id != 'popBox') return;
	var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
	while (reltg != tg && (reltg.nodeName != 'BODY' && reltg.nodeName != 'HTML')) { // BODY in IE and HTML in Mozilla.
		reltg= reltg.parentNode
	}
	if (reltg== tg) return;
	// Mouseout took place when mouse actually left layer
	// Handle event
	hideDiv('popBox');
	hideDiv('popBoxShadow');
}

function hideDiv(id) {
   getById(id).style.visibility = "hidden";
   getById(id).style.display = "none";
}

function showDiv(id) {
   	getById(id).style.visibility = "visible";
   	getById(id).style.display = "inline";
}

function doNothing() {
}

function replace(a,b,c) {
	while (a.indexOf(b)>-1) {
		pos = a.indexOf(b);
		a = '' + (a.substring(0, pos) + c + a.substring((pos + b.length), a.length));
	}
	return a;
}

function getScroll() {
	if (document.all) {
		var ieBox = document.compatMode != "CSS1Compat";
		var cont = ieBox ? document.body : document.documentElement;
		return {x:cont.scrollLeft, y:cont.scrollTop};
	} else {
		return {x:window.pageXOffset, y:window.pageYOffset};
	}
}

////////////////////////////////////////////////////////////////////
////                END Popup link window                       ////
////////////////////////////////////////////////////////////////////