//######################################## TOOLTIP ########################################
var x,y,zInterval,zTitle,zText;
document.onmousemove = setMouseCoords;

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
/*
function init() {
	for(i=0;i<document.getElementsByTagName("a").length;i++) {
		if(document.getElementsByTagName("a")[i].className == "toolLink") {
			document.getElementsByTagName("a")[i].onmouseout = hideToolTip;
		}
	}
}
*/
function setMouseCoords(e) {
	if(document.all) {
		x = event.clientX+ietruebody().scrollLeft;
		y = event.clientY+ietruebody().scrollTop;
		//x = window.event.clientX;
		//y = window.event.clientY;
	} else {
		x = e.pageX;
		y = e.pageY;
	}
}

function showToolTip(id,obj) {
	//clearInterval(zInterval);
	switch(id)
	{
		case 'country' :
			zTitle = "Country";
			zText = "Please select \"Other\" if your country is not listed";
			break;
		case 'locality' :
			zTitle = "Locality";
			zText = "Entering correct locality will help locate your business";
			break;
		case 'landmark' :
			zTitle = "Landmark";
			zText = "Landmark will enable a potential customer to locate your business";
			break;
		case 'pincode' :
			zTitle = "Pin code";
			zText = "Please enter your complete pin code - for example 400018";
			break;
		case 'telephonenumber' :
			zTitle = "Telephone number";
			zText = "Please include your STD code. Eg. 022-24952277";
			break;
		case 'contactemail' :
			zTitle = "Contact email";
			zText = "This email will be displayed on your contact details";
			break;
		case 'category' :
			zTitle = "Category";
			zText = "Picking relevant category is required for your business listing to appear in search results";
			break;
		case 'companyname' :
			zTitle = "Company";
			zText = "Correct business name will help create identity with potential customers";
			break;
		case 'conteactname' :
			zTitle = "Contact Name";
			zText = 'Enter the name of the business owner';
			break;
		case 'email' :
			zTitle = "Email";
			zText = 'A valid email ID is required to communicate with you';
			break;
		case 'description' :
			zTitle = "Description";
			zText = 'A detailed business description will help your business get higher ranking in the search results and help you get more leads from potential customers';
			break;
		case 'upload' :
			zTitle = "Upload Image";
			zText = 'A nice picture will help create a brand identity';
			break;
	}
	zInterval = setTimeout("doShowToolTip('" + zText + "','"+ obj +"')",1);
}

function doShowToolTip(zText,obj) {
	zDiv = "<table cellspacing='0' cellpadding='0' border='0s' width='30%' style='background: #FFFFFF; border: 4px double #d1dada;'><tr><td width='3' rowspan='2'><spacer type='block' width='3'></td><td ><!--<div style='background: F7F7F7; padding: 3 5px; font: normal 11px Arial; color: #000000'><b>"+ zTitle +"</b><br clear='all'></div>--><div style='padding: 7px; font: normal 11px Arial; color: #000000'>"+ zText +"</div></td><td><br></td></tr></table>";
//<div style='text-align: right;'><a href=# class='noborder' onmouseover="showToolTip('zonetitle');" onclick='hideToolTip(); return false'>[x]</a></div>
	
	clearInterval(zInterval);
	var obj=document.getElementById(obj);
	var x=findPosX(obj);
	var y=findPosY(obj);
	document.getElementById("toolTip").style.top = (y) + "px";
	document.getElementById("toolTip").style.left = (x+35) + "px";
	document.getElementById("toolTip").innerHTML = zDiv;
	document.getElementById("toolTip").style.display = "block";
	document.getElementById("toolTip").style.position="absolute";
	document.getElementById("toolTip").style.zIndex="1";
	//zInterval = setTimeout("hideToolTip()",15000);
	
}

function hideToolTip() {
	document.getElementById("toolTip").style.display = "none";
	//clearInterval(zInterval);
}

//this.onload = init;

function toggleMe(a){
	var e=document.getElementById(a);
	if(!e)return true;

	e.style.display="block";
	/*if(e.style.display=="none")
	{
		e.style.display="block"
	}
	else
	{
		e.style.display="none"
	}*/

	return true;
}

function hideMe(a)
{
	var e=document.getElementById(a);
	if(!e)return true;

	e.style.display="none";
	return true;
}


function show_block(divID1, divID2, errorDiv, colorID)
{
	document.getElementById(divID1).style.display = 'none';
	document.getElementById(divID2).style.display = 'block';
	document.getElementById(errorDiv).style.display = 'none';
	document.getElementById(divID1).style.background = colorID;
}

function show_color(divID, colorID)
{
	document.getElementById(divID).style.background = colorID;
}

//---Funation to get postion of text
function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }

