// JavaScript Document


function getPosition(ele) {
		var x = 0;
		var y = 0;
		var ScrollTop = 0;
		while (ele&&ele.id!="container") {
			x += ele.offsetLeft;
			y += ele.offsetTop;
			ele = ele.offsetParent;
			
		}
		if (navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined") {
			x += document.body.leftMargin;
			offsetTop += document.body.topMargin;
		}
	
		var xy = new Array(x,y);
		return xy;
}

/// Setup a text input box to be a calendar box.
function setsubMenuDialog(icon_Id, hint_text) {
		if(!document.getElementById(icon_Id))
			return;
		var icon =  document.getElementById(icon_Id);
		if(!icon) return; //If the input field is not there, exit.

		var div = document.createElement('div');
		//div.className="hint_help";
		//div.align = "center";
		div.style.position = 'absolute';

		var elts=document.getElementById("container");
		
		elts.insertBefore(div,elts.firstChild);
		
		icon.onmouseover=function(){
			var xy = getPosition(icon);
	
			div.style.left=(xy[0])+"px";
			div.style.top=(xy[1]+26)+"px";
			div.innerHTML = hint_text;
			div.style.display="block";
			if(getPageName()!="land.html")
				this.style.background='url(images/land_on.gif) no-repeat';
		};
		icon.onmouseout=function(){
			div.style.display="none";
			if(getPageName()!="land.html")
				this.style.background='url(images/land_off.gif) no-repeat';
		};
		
		div.onmouseover=function(){
			div.style.display="block";
			
		};
		div.onmouseout=function(){
			div.style.display="none";
		};
	}

	
function getPageName(){
	var sPath = window.location.pathname;
	//var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	return sPage;
}
