// JavaScript Document
var offsetfrommouse=[15,15]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var displayduration=0; //duration in seconds image should remain visible. 0 for always.
var currentimageheight = 270;	// maximum image size.
if (document.getElementById || document.all){
	document.write('<div id="trailimageid">');
	document.write('</div>');
}
var enabletip=false
function showtrail(img,height){
	//var imagename="http://devjs.infoedge.com/profile/photo_serve.php?profileid="+photochecksum+"&photo=PROFILEPHOTO";
		//var imagename="http://devjs.infoedge.com/profile/photo_serve.php?profileid="+photochecksum+"&photo=ALBUMPHOTO1";
		var imagename=img;
		//var imagename="http://devjs.infoedge.com/profile/photo_serve.php?profileid="+photochecksum+"&photo=ALBUMPHOTO2";         
	
	
	if (height > 0){
		currentimageheight = height;
	}

	document.onmousemove=followmouse;

	cameraHTML = '';

	newHTML = '<div style="padding: 0px; background-color: #FFF; border: 0px solid #888; font: normal 11px verdana,arial">';
	/*if(username!='')
		newHTML = newHTML + title ;*/
	newHTML = newHTML + '<div align="center" style="padding: 2px 2px 2px 2px;">';
	newHTML = newHTML + '<img src="' + imagename + '" border="0"></div>';

	
	newHTML = newHTML + '</div>';
	gettrailobjnostyle().innerHTML = newHTML;
	gettrailobj().display="inline";
}
function followmouse(e){
	var xcoord=offsetfrommouse[0]
	var ycoord=offsetfrommouse[1]
	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

	//if (document.all){
	//	gettrailobjnostyle().innerHTML = 'A = ' + truebody().scrollHeight + '<br>B = ' + truebody().clientHeight;
	//} else {
	//	gettrailobjnostyle().innerHTML = 'C = ' + document.body.offsetHeight + '<br>D = ' + window.innerHeight;
	//}

	if (typeof e != "undefined"){
		if (docwidth - e.pageX < 380){
		//alert('if1');
			xcoord = e.pageX - xcoord - 190; // Move to the left side of the cursor
		} else {
		//alert('else1');
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < (currentimageheight + 110)){
		//alert('if2');
			ycoord += e.pageY - Math.max(0,(110 + currentimageheight + e.pageY - docheight - truebody().scrollTop));
		} else {
		//alert('else2');
			ycoord += e.pageY;
		}
		//alert(xcoord);
		//alert( ycoord);

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < 380){
		//alert('ifx');
			xcoord = event.clientX + truebody().scrollLeft - xcoord - 190; // Move to the left side of the cursor
		} else {
		//alert('elsex');
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (currentimageheight + 110)){
		//alert('ify');
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(110 + currentimageheight + event.clientY - docheight));
		} else {
		//alert('elsey');
			ycoord += truebody().scrollTop + event.clientY;
		}

		if(ycoord<200)
			ycoord=205;
	}
	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)
		if(ycoord < 0) { ycoord = ycoord*-1; }

	gettrailobj().left=xcoord+"px"
	gettrailobj().top=ycoord+"px"

	//alert(ycoord);

}
function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function gettrailobj(){
if (document.getElementById)
return document.getElementById("trailimageid").style
else if (document.all)
return document.all.trailimagid.style
}
function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
{
//move the horizontal position of the menu to the left by it's width
//section added by Gaurav on 7 Nov 2006 to handle position of Tip in top band
	//added to find screen resolution
	if(ie)
	{
		if ((screen.width>=1024) && (screen.height>=768))
		{
			x_pos=610;
			tipobj.style.left=635+"px";
		}
		else
		{
			x_pos=650;
			tipobj.style.left=550+"px";
		}
	}
	else
	{
		//alert(tipobj.style.fontsize);
		//tipobj.style.left=window.pageXOffset+e.clientX-tipobj.offsetWidth+"px";
		x_pos=560;
		//tipobj.style.left=618+"px"; //for 1024*768
		//tipobj.style.left=480+"px"; // for 800*600
		tipobj.style.left=550+"px";
	}
	if(type_for_tooltip=='payment_tip')
		tipobj.style.left=150+"px";
//alert('1');
	//tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
//end of section added by Gaurav on 7 Nov 2006 to handle position of Tip in top band
}
else if (curX<leftedge)
{
//alert('2');
	x_pos=5;
	tipobj.style.left=5+"px";
	if(type_for_tooltip=='payment_tip')
		tipobj.style.left=150+"px";
}
else
{
//alert('3');
//position the horizontal position of the menu where the mouse is positioned
	x_pos=curX+offsetxpoint;
	//alert(x_pos);
	tipobj.style.left=curX+offsetxpoint+"px";
	if(type_for_tooltip=='payment_tip')
		tipobj.style.left=150+"px";
}

if(x_pos<100)
{
	if ((screen.width>=1024) && (screen.height>=768))
		tipobj.style.left=150+"px";
	else
	{
		//alert(type_for_tooltip)
		//if(type=='top_band_tip')
		if(type_for_tooltip=='top_band_tip')
			tipobj.style.left=150+"px";
		else
			tipobj.style.left=140+"px";
	}
}
//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
{
	//section added by Gaurav on 7 Nov 2006 to handle position of Tip in top band
	if(ie)
	{
		if(type_for_tooltip=='clustering_profession_tip')
                {
                        tipobj.style.top=35+"px";
                }
		else
		{
			if(ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint<0)
				tipobj.style.top=18+"px";
			else
			{
				tipobj.style.top=ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px"
				tipobj.style.top=245+"px";
			}
			if(type_for_tooltip=='mem_comparison_tip')
			{
				tipobj.style.top=530+"px";
			}
		}
	}
	else if(navigator.userAgent.indexOf("Firefox")==-1)
	{
		if(type_for_tooltip=='clustering_profession_tip')
			tipobj.style.top=32+"px";
	}
	else
	{
		if(type_for_tooltip=='clustering_profession_tip')
		{
			tipobj.style.top=35+"px";
		}
		else
		{
			if(window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint<0)
				tipobj.style.top=10+"px";
			else
				tipobj.style.top=window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
			//alert(tipobj.style.top)
		}
	}
	
	//tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
	//end of section added by Gaurav on 7 Nov 2006 to handle position of Tip in top band
}
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
if(tipobj.style.top<0)
	{
		tipobj.style.top=20+"px";
	}

}

}
function hidetrail(){
	gettrailobj().innerHTML = " ";
	gettrailobj().display="none"
	document.onmousemove=positiontip;
	//document.onmousemove=""
	gettrailobj().left="-500px"

}
function gettrailobjnostyle(){
if (document.getElementById)
return document.getElementById("trailimageid")
else if (document.all)
return document.all.trailimagid
}