/** 
	*	File	: ToolTip.js
 	*  Purpose	: This is a comman javascript file user for showing error popup
 	*  Methods	: ddrivetip()
 				: hideddrivetip()
 				: closeCallout()
 	*  Created Date: OCT 25, 2006
 	*  Author  :Balamurughan
 */

/* Declaration of global variables*/
var dropdowncount=0;
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false

//This creates two default divs to display error messages on every page where tooltip.js is called
document.write('<div id="dhtmltooltip"></div>');
document.write('<img id="dhtmlpointer" style="visibility:hidden;" src="'+contextPathStatic+'/images/arrow-ToolTip.gif">');

/****
	Function : 	This method is used to hide the dhtml tool tip
	Input    :	placeCode
	returns  :	none
****/
function ddrivetip(thetext, thewidth,theheight, pttop, ptleft, top, left, thecolor){

	if (ns6||ie){
	if (typeof thewidth!="undefined") document.getElementById("dhtmltooltip").style.width= thewidth +"px"
	if (typeof theheight!="undefined") document.getElementById("dhtmltooltip").style.height= theheight +"px"	
	if (typeof thecolor!="undefined" && thecolor!="") document.getElementById("dhtmltooltip").style.backgroundColor=thecolor
	document.getElementById("dhtmltooltip").innerHTML=thetext;
	enabletip=true
	document.getElementById("dhtmlpointer").style.top= pttop + "px";
	document.getElementById("dhtmlpointer").style.left= ptleft + "px";
	if(thetext.indexOf("sorry") != -1)
		document.getElementById("dhtmltooltip").style.top = top - 10+ "px";
	else
		document.getElementById("dhtmltooltip").style.top = top  + "px";
	document.getElementById("dhtmltooltip").style.left = left + "px";
	document.getElementById("dhtmlpointer").style.visibility='visible';
	document.getElementById("dhtmltooltip").style.visibility='visible';
	dropdowncount=0;
	if(thetext.indexOf("sorry") != -1)
		setTimeout(closeCallout,5000);
	}
}


/****
	Function : 	This method displays the error message tooltip
	Input    :	none
	returns  :	none
****/
function hideddrivetip(){
	if (ns6||ie)
	{
	enabletip=false
	document.getElementById("dhtmltooltip").style.visibility="hidden" 
	document.getElementById("dhtmlpointer").style.visibility="hidden"
	}
}

/****
	Function : 	This method is called onclick of  jsp body
	Input    :	none
	returns  :	none
****/
function closeCallout(){
 	if((document.getElementById("dhtmltooltip").style.visibility=='visible') && (dropdowncount == 0)){
		document.getElementById("dhtmltooltip").style.visibility ='hidden';
		document.getElementById("dhtmlpointer").style.visibility='hidden';
		}
		if(dropdowncount == 1) 
		dropdowncount = 0;
}
