var ab_newin=null;
function newWindow(myurl, myname, w, h, scroll) {
w=(screen.width)?screen.width*w: 620;
h=(screen.height)?screen.height*h:420;
LeftPos=(screen.height)?screen.width-w-200:0;
TopPos=(screen.height)?100:0;
settings='height='+h+',width='+w+',top='+TopPos+',left='+LeftPos+',scrollbars='+scroll+',resizable';
var ab_newin = window[myname];
if(ab_newin==null || ab_newin.closed) {
	ab_newin=window.open(myurl, myname, settings);
	window[myname]=ab_newin;
}else {
	ab_newin.location=myurl;
}
ab_newin.focus();
if(myurl == null) return ab_newin;
}

function changeStyle(ele, sty) {
	ele.className=sty;
}

function setCssPropByID(eid, prop, val) {
	var ele = document.getElementById(eid);
	if(ele!=null) ele.style[prop]=val;

}


function submitButtonClicked(btn) {
	btn.className='clickedButtonStyle';
        if(!btn.disabled) {
		if(btn.form.target == window.name || btn.form.target==null) {
			btn.value= please_wait_label;
			if (typeof btn.form.onsubmit == "function") {
				btn.form.onsubmit();
			}

			window._tmfunc = function() { btn.form.submit(); }
			btn.disabled = true;
			setTimeout("_tmfunc()", 350);
			return false;
		}else {
			return true;
		}
	}else {
		return false;
	}
}


var cm=null;
var cobj=null;
document.onclick = new Function("hide_m()");

function getPos(el,sProp) {
	var iPos = 0
	while (el!=null) {
		iPos+=el["offset" + sProp]
		el = el.offsetParent
	}
	return iPos

}

var tid = null;
function hide_m() {
	if(cm!=null) {
		 cm.style.display='none';
	}
	cm = null;
}

function show_m(el,mn) {
        var m = document.getElementById(mn);
	if(el==null) {
		el = cobj;
	}
	if(m && m == cm) {
		clearTimeout(tid);
		tid = null;
	}else {
		if (cm != null) {
			clearTimeout(tid);
			tid = null;
			hide_m();
		}
	}

	if (m) {
		m.style.display='';
		m.style.pixelLeft = getPos(el,"Left") + 4;
		m.style.pixelTop = getPos(el,"Top") + el.offsetHeight +0;
	}
	cm=m;
	cobj=el;
}

function out_m(mn) {
        var m = document.getElementById(mn);
	if(m!=null) {
		tid = window.setTimeout('hide_m()', 550);
		
	} 
	cm=m;
}

function activateListMenu(nav) {

    /* currentStyle restricts the Javascript to IE only */
	if (document.all && document.getElementById(nav).currentStyle) {  
        var navroot = document.getElementById(nav);
        
        /* Get all the list items within the menu */
        var lis=navroot.getElementsByTagName("LI");  
        for (i=0; i<lis.length; i++) {
        
           /* If the LI has another menu level */
            if(lis[i].lastChild.tagName=="UL"){
            
                /* assign the function to the LI */
             	lis[i].onmouseover=function() {	
                
                   /* display the inner menu */
                   this.lastChild.style.display="block";
                }
                lis[i].onmouseout=function() {                       
                   this.lastChild.style.display="none";
                }
            }
        }
    }
}

