var ptotal=0;

function gh(i) { 
	var ival = (i.innerHeight ? i.innerHeight : (i.offsetHeight ? i.offsetHeight : i.screen.availHeight)); 
	return ival;
}
function gw(i) { 
	var ival =  (i.innerWidth ? i.innerWidth : (i.offsetWidth ? i.offsetWidth : i.screen.availWidth)); 
	return ival;
}
function wH(){
		
		if (document.all){ // msie of opera
			var HVal=(document.compatMode=="CSS1Compat")?document.documentElement.clientHeight:document.body.clientHeight;
		}else{ // mozilla
			var HVal = window.innerHeight;
		}
		return HVal;
}

function wW(){
		if (document.all){ // msie of opera
			var HVal=(document.compatMode=="CSS1Compat")?document.documentElement.clientWidth:document.body.clientWidth;
		}else{ // mozilla
			var HVal = window.innerWidth;
		}
		return HVal;
}

function windowInnerHeight(){
		
	if (document.all){ // msie of opera
		var HVal=(document.compatMode=="CSS1Compat")?document.documentElement.clientHeight:document.body.clientHeight;
		
	}else{ // mozilla
		var HVal = window.innerHeight;

	}
	return HVal;
}

function windowInnerWidth(){

		if (document.all){ // msie of opera
			var HVal=(document.compatMode=="CSS1Compat")?document.documentElement.clientWidth:document.body.clientWidth;
			
		}else{ // mozilla
			var HVal = window.innerWidth;

		}
		
		return HVal;
	
}



function getRealPos(ele,dir){
	(dir=="x") ? pos = ele.offsetLeft : pos = ele.offsetTop;
	tempEle = ele.offsetParent;
	while(tempEle != null)
	{
		pos += (dir=="x") ? tempEle.offsetLeft : tempEle.offsetTop;
		tempEle = tempEle.offsetParent;
	}
	return pos;
}

function getMouseXY(e){ 
    if (!e){ e = window.event;} 

    if (e){ 
        if (e.pageX || e.pageY){ // this doesn't work on IE6!! (works on FF,Moz,Opera7)
            mousex = e.pageX;
            mousey = e.pageY;
            algor = '[e.pageX]';
            if (e.clientX || e.clientY){ algor += ' [e.clientX] ';}
        }
        else if (e.clientX || e.clientY){ // works on IE6,FF,Moz,Opera7
       		if (document.documentElement && document.documentElement.scrollTop){
		   		mousex = e.clientX + document.documentElement.scrollLeft;
           		 mousey = e.clientY + document.documentElement.scrollTop;
			}else if (document.body){
		   		mousex = e.clientX + document.body.scrollLeft;
           		mousey = e.clientY + document.body.scrollTop;
			}
            algor = '[e.clientX]';
            if (e.pageX || e.pageY){ algor += ' [e.pageX] ';}
        }  
    }
}


//window.onerror=ErrorHandler
function ErrorHandler(){
	//alert('A customized error message');
	//return true;
}

function ToggleDisplay(butt,items) {

	var oButton = document.getElementById(butt);
	var oItems = document.getElementById(items);
	

	
	if (!oButton || !oItems){ return 0;}

	if (oItems.style.display == "none") {
		
		oItems.style.display = "";
		oButton.src = "/tree/minus.gif";
		
	}	else {
		
		oItems.style.display = "none";
		oButton.src = "/tree/plus.gif";
	}

	return false;
}
function HideDisplay(oItems) {
	oItems.style.display = "none";

}

function ShowDisplay(oItems) {
	oItems.style.display = "";
}
