//-------------------------------popup4--------------------------------------------
var ua = navigator.userAgent.toLowerCase();
var divw=0;
var divh=0;
var xto;

if (document.getElementById || document.all)
	document.write('<div id="imgtrailer" style="position:absolute;visibility:hidden;"></div>')

function gettrailobject()
	{
	if (document.getElementById)
		return document.getElementById("imgtrailer")
	else if (document.all)
		return document.all.trailimagid
	}

function gettrailobj()
	{
	if (document.getElementById)
		return document.getElementById("imgtrailer").style
	else if (document.all)
		return document.all.trailimagid.style
	}

function truebody()
	{
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
	}

function trailOff()
	{
		if (xto && xto > 0)
		{
			clearTimeout(xto);
		}

		document.onmousemove='';
		gettrailobj().visibility="hidden";
	}

function trailOn(thumbimg,SCat,SKU,thw,thh){
		if (navigator.userAgent.indexOf("Opera")==-1){
		gettrailobj().left="-500px";
		divthw = parseInt(thw) + 2;
		smthw = parseInt(thw) + 2;			
		halfthh = 50;
		halfthh = Math.ceil(parseInt(thh)/2);
		topx = halfthh - 9;
		smthh = parseInt(thh) + 2;	
		if (navigator.userAgent.indexOf("Firefox")!=-1 || navigator.userAgent.indexOf("Safari")!=-1)
			gettrailobject().innerHTML = '<div style="background-color: #D3DEE4; layer-background-color: #D3DEE4; border: 1px none #5B7C7C; padding:10px; width:'+divthw+'px;height:100%;z-index:51"><div style="background-color: #5B7C7C; layer-background-color: #5B7C7C;width:'+thw+'px;z-index:51">'+'<div style="border-width:0px;margin:0px;padding:0px;background-color: #5B7C7C; layer-background-color: #5B7C7C;z-index:51;position:absolute;width:'+thw+'px;height:'+smthh+'px;text-align:center"><img  src="'+thumbimg+'"  width="'+smthw+'" height="'+smthh+'" border="0"></div><div style="border-width:0px;margin:0px;padding:0px;z-index:52;position:absolute;width:'+thw+'px;top:'+topx+'px;text-align: center;"><img src="http://stargems.com/NewSite/Images/loadingnew.gif"></div><div style="border-width:0px;margin:0px;padding:0px;z-index:53;position:absolute;width:'+thw+'px;"><div style="border: 1px solid #000000;width:'+thw+'px;"><img name="btcontainer" id="btcontainer" src="http://stargems.com/NewSite/Images/sep.gif" border="0" width="'+thw+'" height="'+thh+'" ><div id="div_2" style="border-width:0px;margin:0px;z-index:53;layer-background-color: #5B7C7C;background-color:#5B7C7C;padding:3px;">'+SCat+'<br>'+(thw>=233?'<nobr>':'')+'Website: '+SKU+'<br>'+(thw>=233?'<nobr>':'')+'</div></div></div><div style="visibility:hidden"><div style="height:'+thh+'px">&nbsp;</div><div id="div_2" style="padding:3px;">'+SCat+'<br>'+(thw>=233?'<nobr>':'')+'Website '+SKU+'<br>'+(thw>=233?'<nobr>':'')+'</div>';

		if (navigator.userAgent.indexOf("MSIE")!=-1)
			gettrailobject().innerHTML = '<div style="background-color: #D3DEE4; layer-background-color: #D3DEE4; border: 1px none #5B7C7C; padding:10px; width:'+divthw+'px;height:100%;z-index:51"><div style="background-color: #5B7C7C; layer-background-color: #5B7C7C;width:'+thw+'px;z-index:51">'+'<div style="border-width:0px;margin:0px;padding:0px;background-color: #5B7C7C; layer-background-color: #5B7C7C;z-index:51;position:absolute;width:'+thw+'px;height:'+smthh+'px;text-align:center"><img  src="'+thumbimg+'"  width="'+smthw+'" height="'+smthh+'" border="0"></div><div style="border-width:0px;margin:0px;padding:0px;z-index:52;position:absolute;width:'+thw+'px;top:'+topx+'px;text-align: center;"><img src="http://stargems.com/NewSite/Images/loadingnew.gif"></div><div style="margin:0px;padding:0px;z-index:53;position:absolute;width:'+thw+'px;"><div style="border: 1px solid #000000;width:'+thw+'px;"><img name="btcontainer" id="btcontainer" src="http://stargems.com/NewSite/Images/sep.gif" border="0" width="'+thw+'" height="'+thh+'"  ><div id="div_2" style="margin:0px;width:'+thw+'px;z-index:53;layer-background-color: #5B7C7C;background-color:#5B7C7C;padding:3px;">'+SCat+'<br>'+(thw>=233?'<nobr>':'')+'Website '+SKU+'<br>'+(thw>=233?'<nobr>':'')+'</div></div></div></div><div style="visibility:hidden"><div style="height:'+thh+'px">&nbsp;</div><div id="div_2" style="padding:3px;">'+SCat+'<br>'+(thw>=233?'<nobr>':'')+'Website '+SKU+'<br>'+(thw>=233?'<nobr>':'')+'</div>';
		
		
		
		//setTimeOut
		
		
		
		
		xto = setTimeout("xtimeOut('"+thumbimg+"')",100);
		
		gettrailobj().visibility="visible";
		divw = parseInt(thw)+25;
		divh = parseInt(thh)+130;
		document.onmousemove=followmouse;
	}	
}
function xtimeOut(thumbimgg){
	if (document.getElementById)
		document.getElementById('btcontainer').src = thumbimgg;
	else if (document.all)
		document.all.btcontainer.src = thumbimgg;

}
function followmouse(e)
	{
	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(document.body.offsetHeight, window.innerHeight)
if(typeof e != "undefined")
	{
	if(docwidth < 15+e.pageX+divw)
		xcoord = e.pageX-divw-5;
	else
		xcoord = 15+e.pageX;
	if(docheight < 15+e.pageY+divh)
		ycoord = 15+e.pageY-Math.max(0,(divh + e.pageY - docheight - truebody().scrollTop - 30));
	else
		ycoord = 15+e.pageY;
	}
else if (typeof window.event != "undefined")
	{
	if(docwidth < 15+truebody().scrollLeft+event.clientX+divw)
		xcoord = truebody().scrollLeft-5+event.clientX-divw;
	else
		xcoord = truebody().scrollLeft+15+event.clientX;

	if(docheight < 15+truebody().scrollTop+event.clientY+divh)
		ycoord = 15+truebody().scrollTop+event.clientY-Math.max(0,(divh + event.clientY - docheight - 30));
	else
		ycoord = truebody().scrollTop+15+event.clientY;
	}
	gettrailobj().left=xcoord+"px"
	gettrailobj().top=ycoord+"px"
	}
//--------------------------------------------------------------------------
//-----------------------------popup5---------------------------------------
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);
   if(div==null) return;
   
   if((div.style.width=="" || div.style.height==""))
   {alert("Both width and height must be set");
   return;}
   
   divWidth = parseInt(div.style.width);
   divHeight= parseInt(div.style.height);
   if(div.style.overflow!="hidden")div.style.overflow="hidden";
   if(div.style.display!="none")div.style.display="none";
   if(div.style.position!="absolute")div.style.position="absolute";
   
   if(isAnimated && aniSpeed>0)
   {xincr = parseInt(divWidth/aniSpeed);
    yincr = parseInt(divHeight/aniSpeed);
    animateToolTip = true;
    }
        
   isInit++; 
   
  }
  
    
  this.Show =  function(e,strHTML)
  {
    if(isInit<0) return;
    
    var newPosx,newPosy,height,width;
    if(typeof( document.documentElement.clientWidth ) == 'number' ){
    width = document.body.clientWidth;
    height = document.body.clientHeight;}
    else
    {
    width = parseInt(window.innerWidth);
    height = parseInt(window.innerHeight);
    
    }
    var curPosx = (e.x)?parseInt(e.x):parseInt(e.clientX);
    var curPosy = (e.y)?parseInt(e.y):parseInt(e.clientY);
    
    if(strHTML!=null)
    {html = strHTML;
     div.innerHTML=html;}
    
    if((curPosx+divWidth+10)< width)
    newPosx= curPosx+10;
    else
    newPosx = curPosx-divWidth;

    if((curPosy+divHeight)< height)
    newPosy= curPosy;
    else
    newPosy = curPosy-divHeight-10;

   if(window.pageYOffset)
   { newPosy= newPosy+ window.pageYOffset;
     newPosx = newPosx + window.pageXOffset;}
   else
   { newPosy= newPosy+ document.body.scrollTop;
     newPosx = newPosx + document.body.scrollLeft;}

    div.style.display='block';
    //debugger;
    //alert(document.body.scrollTop);
    div.style.top= newPosy + "px";
    div.style.left= newPosx+ "px";

    div.focus();
    if(animateToolTip){
    div.style.height= "0px";
    div.style.width= "0px";
    ToolTip.animate(div.id,divHeight,divWidth);}
      
    
    }

    

   this.Hide= function(e)
    {div.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);
    }
    
   Init(id);
}
//--------------------------------------------------------------------------------------------
