// Free for any type of use so long as original notice remains unchanged.
// Report errors to feedback@ashishware.com
//Copyrights 2006, Ashish Patil , ashishware.com
//////////////////////////////////////////////////////////////////////////
var imagetype = "";
var videotype = "";

var place     = "";
var zipcode   = "";

function getWindowWidth()
{
	return window.innerWidth ? window.innerWidth : document.body.offsetWidth;
}


function getposOffset(overlay, offsettype){
	var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
	var parentEl=overlay.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent; 
	}
	return totaloffset;
}


function ToolTip(id,isAnimated,aniSpeed)
{
	
  var isInit = -1;
  var div,divWidth,divHeight;
  var xincr=10,yincr=10;
  var animateToolTip =false;
  var html;
  
  function Init(id)
  {
   div = document.getElementById(id);
   isInit++; 
  }
  this.Show =  function(e,strHTML)
  {
	if(strHTML==2){
			var mouserover = document.getElementById("test").innerHTML;
			var onclick	   = document.getElementById("hideonclick").value
			document.getElementById("test").innerHTML=onclick;
			document.getElementById("hideonclick").value = mouserover
	}
	document.getElementById("imageCheck").style.display='none';
	document.getElementById("check").style.display='block';
	var type;
    if(isInit<0) return;
	var newhtml = '<div id="map" style="width:143px;height:149px;">&nbsp;</div>';
	document.getElementById('check').innerHTML = newhtml;
    if(animateToolTip){
    	ToolTip.animate(a,162,150);}
	}
   this.Hide= function(e,id)
    { 
	if(id==2){
			var mouserover = document.getElementById("test").innerHTML;
			var onclick	   = document.getElementById("hideonclick").value
			document.getElementById("test").innerHTML=onclick;
			document.getElementById("hideonclick").value = mouserover	
	}
	document.getElementById("imageCheck").style.display='block';
	document.getElementById("check").style.display='none';
    if(!animateToolTip)return;
    div.style.height= "0px";
    div.style.width= "0px";
	}
    
   this.SetHTML = function(strHTML)
   {html = strHTML;
    div.innerHTML=html;} 
    
    ToolTip.animate = function(a,iHeight,iWidth)
  { a = document.getElementById(a);
         
   var i = parseInt(a.style.width)+xincr ;
   var j = parseInt(a.style.height)+yincr;  
   
   if(i <= iWidth)
   {a.style.width = i+"px";}
   else
   {a.style.width = iWidth+"px";}
   
   if(j <= iHeight)
   {a.style.height = j+"px";}
   else
   {a.style.height = iHeight+"px";}
   
    if(!((i > iWidth) && (j > iHeight)))  {     
   		setTimeout( "ToolTip.animate('"+a.id+"',"+iHeight+","+iWidth+")",1);
    } else {
		if(imagetype == "video"){
		 showpopup(videotype);
	   } 	
	}
	 
    }   
   Init(id);
   
}

function findPosition( oElement ) {
  if( typeof( oElement.offsetParent ) != 'undefined' ) {
    for( var posX = 0, posY = 0; oElement; oElement = oElement.offsetParent ) {
      posX += oElement.offsetLeft;
      posY += oElement.offsetTop;
    }
    return [ posX, posY ];
  } else {
    return [ oElement.x, oElement.y ];
  }
  
}
