// JavaScript Document
function showPopupForm(formName,pars){
	$("darkBackgroundLayer").style.display = 'block';
	//$("darkBackgroundLayer").style.height = document.body.parentNode.scrollheight;
	$("popupForm").style.display = 'block';
	$("popupForm").style.display = "<img src='/images/loading.gif'/>"
	new Ajax.Updater('popupForm','ajax/'+formName,{method:"get",parameters:pars});
	//new Ajax.Request('ajax/'+formName,{method:"get",parameters:pars,onSuccess:function(transport){$('popupForm').innerHTML = transport.responseText;}})
	
	//alert(document.getHeight());
}
function hidePopupForm(){
	$("darkBackgroundLayer").style.display = 'none';
	$("popupForm").innerHTML = "";
	$("popupForm").style.display = 'none';

}
function closeModalDialog(){
	$("darkBackgroundLayer").style.display = 'none';
	$("modalDialog").style.display = 'none';
	$("modalOtherButtons").innerHTML = "";
}

var toolTipTimeout;
function showTip(url,pars,e){
	//mousePos = getMouseXY();
	var IE = document.all?true:false

	// If NS -- that is, !IE -- then set up for mouse capture
	if (!IE) document.captureEvents(Event.MOUSEMOVE)
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  

	$('toolTip').innerHTML = '';

	//url = "ajax/placeView_userToolTip.cfm";
	//pars = "userID=" + id;
	toolTipTimeout = setTimeout(function(dv,url,pars){
											//alert(dv+url+pars);
											new Ajax.Updater(dv,url,{parameters:pars,method:'get'});
												$('toolTip').style.display = 'block';
												$('toolTip').style.left = (tempX+30) + 'px';
												$('toolTip').style.top = (tempY-40) + 'px';

											},500,'toolTip',url,pars
											)
	//new Ajax.Updater('toolTip',url,{parameters:pars,method:'get'});

	//alert(tempX);
	
}
function loadTip(dv,url,pars){
	new Ajax.Updater(dv,url,{parameters:pars,method:'get'});

}
function hideTip(){
		//alert(toolTipTimeout);
	clearTimeout(toolTipTimeout);

	$('toolTip').style.display = 'none';
}
function toggleID(id){
	$(id).toggle();
}
//--------------------------------------------------------------------- tabs that switch the div
//--------------------------------------------------------- setup is <div> -> <ul> with tabs <divs> that have the contentDiv class for content that correspond to tabs

function showTab(clicked, box){
	var parentDiv = clicked.parentNode.parentNode.parentNode
	var contentDivs = parentDiv.getElementsByTagName("div");
	var openDiv = $(box);
	var allTabs = clicked.parentNode.parentNode.getElementsByTagName("li");
	for (var i=0;i<contentDivs.length;i++){
		//alert (contentDivs[i]);
		if (contentDivs[i].className == "contentDiv"){
			contentDivs[i].style.display = "none";
		}
	}
	openDiv.style.display = "block";
			//alert(allTabs[0]);

	for (var i = 0; i <allTabs.length;i++){
		allTabs[i].className = "";
	}
	clicked.parentNode.className = "hActive";
	//alert(contentDivs);
}


//checks to see if a string is numeric
function isNumeric(expression) {
	var nums = "0123456789";
	if (expression.length==0)return(false);
	for (var n=0; n < expression.length; n++){
		if(nums.indexOf(expression.charAt(n))==-1)return(false);
	}

return(true);

}
