// Cross browser DHTML functions for use in Netscape 4, IE 4 and 5, and all standards compliant browsers (and ones that fake it well enough like IE 5.5 and 6, and Safari / Konquerer )

// browser check
n4 = document.layers?1:0;
ie = (document.all && !document.getElementById)?1:0;
g = document.getElementById?1:0;
macIE = ((navigator.userAgent.indexOf("MSIE") != -1) && (navigator.userAgent.indexOf("Mac") != -1))?1:0;



/// To use, create an object reference with the below function, then use the methods on said object.
/* 
	EXAMPLE: I have a div named 'myDiv' (clever, eh?) and I want to figure out how tall it is and where 
	top is.
	
		myObj = getObj('myDiv');
		theHeight = getHeight(myObj);
		theTop = getTop(myObj);
		alert("your div is at " + theTop + " from the top, and it is " + theHeight + " pixels tall.");

*/

function deb(msg){
	if( (navigator.userAgent.indexOf("MSIE") != -1) && (navigator.userAgent.indexOf("Mac") != -1)){
			alert(msg);
	}
	
}

function getObj(divName){
	if(n4){		
		myObj = eval('document.' + divName);
	}else if(ie){
		myObj = eval('document.all.' + divName)
	}else{
		myObj = document.getElementById(divName);
	}	
	return myObj
}




// returns the top of a block element
function getTop(what){
	if(n4){
		myTop = what.top
	}else if(ie){
		myTop = what.style.pixelTop
	}else{
		myTop = what.offsetTop;
	}	
	return myTop;
}

function getLeft(what){
	if(n4){
		myLeft = what.left
	}else if(ie){
		myLeft = what.style.pixelLeft
			//myLeft = what.offestLef
	}else{
		myLeft =  what.offsetLeft;
	}	
	return myLeft;
}

function getHeight(what){
		if(n4){
			myHeight = what.document.height;
	}else if(ie){
		myHeight = what.offsetHeight
	}else{
		myHeight = what.offsetHeight;
	}	
	return myHeight;
}



function moveDiv(who,x,y){
		if(n4){
			who.left = x;
			who.top = y;
	}else if(ie){
		who.style.left = x;
		who.style.top = y;
	}else{
			who.style.left = x + "px";
			who.style.top = y + "px";
	}	

}

function showDiv(who){
		if(n4){
			who.visibility = 'visible'
	}else if(ie){
		who.style.visibility = 'visible';
	}else{
		who.style.visibility = 'visible';
	}	
	
}

function hideDiv(who){
	if(n4){
			who.visibility = 'hide'
	}else if(ie){
		who.style.visibility = 'hidden'
	}else{
		who.style.visibility = 'hidden'
	}		
}

function checkVis(what){
	if(n4){
			myVis = (what.visibility == 'visible' || what.visibility == 'show') ? 1 : 0;
	}else if(ie){
		myVis = (what.style.visibility == 'visible') ? 1 : 0;
	}else{
			myVis = (what.style.visibility == 'visible') ? 1 : 0;
	}	
	return myVis;
}

function toggleVis(who){
	var block;
	block = getObj(who);
	myVis = checkVis(block);
	if(myVis){
					hideDiv(block);
	}else{
			showDiv(block);
	}	
}
