
var offsetfromcursorX=12 //Customize x offset of tooltip
var offsetfromcursorY=10 //Customize y offset of tooltip

var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=14 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).

document.write('<div id="dhtmltooltip"></div>') //write out tooltip DIV
document.write('<img id="dhtmlpointer" src="../skin2/images/arrow_l.gif">') //write out pointer image

var oImage = new Image()
oImage.src = "../skin2/images/arrow_r.gif"
oImage.src = "../skin2/images/arrow_lb.gif"
oImage.src = "../skin2/images/arrow_rb.gif"

var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false

var fixed=false
var fixedpositionX = 590
var fixedpositionY = 490

if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""

function ietruebody()
{
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(description, title, length, genres, subgenres, theater, origin, thewidth, thecolor)
{
	if (ns6||ie)
	{
		hidedropdowns()
		if (typeof thewidth!="undefined") 
			tipobj.style.width=thewidth+"px"
		if (typeof thecolor!="undefined" && thecolor!="") 
			tipobj.style.backgroundColor=thecolor

		var catName = title.replace(/&qut;/g, "'");
		var description1 = description.replace(/&qut;/g, "'");
		//description1 = description1.replace(/&quote;/g, "&quot;");
		description1 = description1.replace(/&quote;/g, '"');
		var theatName = theater.replace(/&qut;/g, "'");

		var newtext =  '<html><head></head><body>'
		newtext += '<table width="250" border="0" cellspacing="0" cellpadding="0"><tr><td>';
		newtext += '<table width="250" border="0" cellspacing="0" cellpadding="0">'
		newtext += '<tr><td width="12"><img src="../skin2/images/bubble_topleft_cr.gif" width="9" height="11"></td><td width="100%" bgcolor="CAE465"><img src="../skin2/images/spacer.gif" width="1" height="1"></td><td width="13"><img src="../skin2/images/bubble_topright_cr.gif" width="9" height="11"></td></tr>';
		newtext += '<tr><td height="31" bgcolor="CAE465">&nbsp;</td><td bgcolor="CAE465" class="bubbletitle">'+ catName +'</td><td bgcolor="CAE465">&nbsp;</td></tr></table>';
		newtext += '</td></tr><tr><td height="40" bgcolor="#ffffff" valign="top" class="cellpad4"><p class="bodytext">'+ description1 +'</p></td></tr><tr><td>';
		newtext += '<table width="250" border="0" cellspacing="0" cellpadding="0"><tr><td colspan="3" class="bubblebdr">'
		newtext += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
		newtext += ' <tr><td width="35%" height="18" align="right" bgcolor="EDEEEB" class="cellpad4"><span class="bubbletxtbold">Genre:&nbsp;</span></td><td width="65%" bgcolor="EDEEEB" class="cellpad4"><span class="bubbletxt">'+ genres +'</span></td></tr>';
		newtext += '<tr><td height="18" align="right" bgcolor="EDEEEB" class="cellpad4"><span class="bubbletxtbold">Sub-Genre:&nbsp;</span></td><td bgcolor="EDEEEB" class="cellpad4"><span class="bubbletxt">' + subgenres +'</span></td></tr>';
		newtext += '<tr><td height="18" align="right" bgcolor="EDEEEB" class="cellpad4"><span class="bubbletxtbold">Locale:&nbsp;</span></td><td bgcolor="EDEEEB" class="cellpad4"><span class="bubbletxt">'+ origin +'</span></td></tr>';
		newtext += '<tr><td height="18" align="right" bgcolor="EDEEEB" class="cellpad4"><span class="bubbletxtbold">Duration:&nbsp;</span></td><td bgcolor="EDEEEB" class="cellpad4"><span class="bubbletxt">' + length + '</span></td></tr>';
		newtext += '<tr><td height="18" align="right" bgcolor="EDEEEB" class="cellpad4"><span class="bubbletxtbold">Theater:&nbsp;</span></td><td bgcolor="EDEEEB" class="cellpad4"><span class="bubbletxt">'+ theatName +'</span></td></tr>';
		newtext += '</table>';
		newtext += '</td></tr>';
		newtext += '<tr><td width="9"><img src="../skin2/images/bubble_bottomleft_cr.gif" width="9" height="11"></td><td width="100%" background="../skin2/images/bubble_bottombg.gif"><img src="../skin2/images/bubble_bottombg.gif" width="1" height="11"></td><td width="9"><img src="../skin2/images/bubble_bottomright_cr.gif" width="9" height="11"></td></tr>';
		newtext += '</table></td></tr></table></body></html>';

		tipobj.innerHTML= newtext

		enabletip=true
		fixed = false
		return false
	}
}

function ddrivetiphome(description, title, length, genres, subgenres, theater, origin, thewidth, thecolor)
{
	if (ns6||ie)
	{
		hidedropdowns()
		if (typeof thewidth!="undefined") 
			tipobj.style.width=thewidth+"px"
		if (typeof thecolor!="undefined" && thecolor!="") 
			tipobj.style.backgroundColor=thecolor

		var catName = title.replace(/&qut;/g, "'");
		var description1 = description.replace(/&qut;/g, "'");
		description1 = description1.replace(/&quote;/g, "&quot;");
		var theatName = theater.replace(/&qut;/g, "'");

		var newtext =  '<html><head></head><body>'
		newtext += '<table width="250" border="0" cellspacing="0" cellpadding="0"><tr><td>';
		newtext += '<table width="250" border="0" cellspacing="0" cellpadding="0">'
		newtext += '<tr><td width="12"><img src="skin2/images/bubble_topleft_cr.gif" width="9" height="11"></td><td width="100%" bgcolor="CAE465"><img src="skin2/images/spacer.gif" width="1" height="1"></td><td width="13"><img src="skin2/images/bubble_topright_cr.gif" width="9" height="11"></td></tr>';
		newtext += '<tr><td height="31" bgcolor="CAE465">&nbsp;</td><td bgcolor="CAE465" class="bubbletitle">'+ catName +'</td><td bgcolor="CAE465">&nbsp;</td></tr></table>';
		newtext += '</td></tr><tr><td height="40" bgcolor="#ffffff" valign="top" class="cellpad4"><span class="bodytext">'+ description1 +'</span></td></tr><tr><td>';
		newtext += '<table width="250" border="0" cellspacing="0" cellpadding="0"><tr><td colspan="3" class="bubblebdr">'
		newtext += '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
		newtext += ' <tr><td width="35%" height="18" align="right" bgcolor="EDEEEB" class="cellpad4"><span class="bubbletxtbold">Genre:&nbsp;</span></td><td width="65%" bgcolor="EDEEEB" class="cellpad4"><span class="bubbletxt">'+ genres +'</span></td></tr>';
		newtext += '<tr><td height="18" align="right" bgcolor="EDEEEB" class="cellpad4"><span class="bubbletxtbold">Sub-Genre:&nbsp;</span></td><td bgcolor="EDEEEB" class="cellpad4"><span class="bubbletxt">' + subgenres +'</span></td></tr>';
		newtext += '<tr><td height="18" align="right" bgcolor="EDEEEB" class="cellpad4"><span class="bubbletxtbold">Locale:&nbsp;</span></td><td bgcolor="EDEEEB" class="cellpad4"><span class="bubbletxt">'+ origin +'</span></td></tr>';
		newtext += '<tr><td height="18" align="right" bgcolor="EDEEEB" class="cellpad4"><span class="bubbletxtbold">Duration:&nbsp;</span></td><td bgcolor="EDEEEB" class="cellpad4"><span class="bubbletxt">' + length + '</span></td></tr>';
		newtext += '<tr><td height="18" align="right" bgcolor="EDEEEB" class="cellpad4"><span class="bubbletxtbold">Theater:&nbsp;</span></td><td bgcolor="EDEEEB" class="cellpad4"><span class="bubbletxt">'+ theatName +'</span></td></tr>';
		newtext += '</table>';
		newtext += '</td></tr>';
		newtext += '<tr><td width="9"><img src="skin2/images/bubble_bottomleft_cr.gif" width="9" height="11"></td><td width="100%" background="skin2/images/bubble_bottombg.gif"><img src="skin2/images/bubble_bottombg.gif" width="1" height="11"></td><td width="9"><img src="skin2/images/bubble_bottomright_cr.gif" width="9" height="11"></td></tr>';
		newtext += '</table></td></tr></table></body></html>';

		tipobj.innerHTML= newtext

		enabletip=true
		fixed = false
		return false
	}
}


function ddrivetipQ(description, thewidth, thecolor)
{
	if (ns6||ie)
	{
		if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
		if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor

		var newtext =  '<html><body>'
		newtext += '<table width="100%" bgcolor="#CAE465" border="0" cellspacing="0" cellpadding="1">'
		newtext += '<tr><td height="30"><table><tr><td bgcolor="#FFFFFF" class="cellpad4"><span class="bodytext">' + description + '</span></td></tr></table></td></tr>'
		newtext += '</table></body></html>'

		tipobj.innerHTML=newtext

		enabletip=true
		fixed = false

		return false
	}
}

function ddrivetipc(description, thewidth)
{
	if (ns6||ie)
	{
		if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
		if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor

		var newtext =  '<html><body>'
		newtext += '<table width="100%" bgcolor="#CAE465" border="0" cellspacing="0" cellpadding="1">'
		newtext += '<tr><td height="30"><table width="100%"><tr><td bgcolor="#FFFFFF" class="cellpad6">' + description + '</td></tr></table></td></tr>'
		newtext += '</table></body></html>'

		tipobj.innerHTML=newtext

		enabletip=true
		fixed = false

		return false
	}
}

function ddrivetipuser(ownerId, ownerName, ownerEmailId, thewidth)
{
	if (ns6||ie)
	{
		if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
		if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor

		var newtext =  '<html><body>'
		newtext += '<table width="100%" bgcolor="#CAE465" border="0" cellspacing="0" cellpadding="0">'
		newtext += '<tr><td><table width="100%"><tr><td bgcolor="#FFFFFF" class="cellpad4" width="40%"><span class="lbltext">Main user id</span></td>'
		newtext += '<td bgcolor="#FFFFFF" width="50%" class="cellpad4"><span class="lbltext">' + ownerId + '</span></td></tr><tr>'
		newtext += '<td class="cellpad4" bgcolor="#FFFFFF" width="40%"><span class="lbltext">Main user name</span></td>'
		newtext += '<td bgcolor="#FFFFFF" width="50%" class="cellpad4"><span class="lbltext">' + ownerName + '</span></td></tr>'
		newtext += '<tr><td bgcolor="#FFFFFF" width="40%" class="cellpad4"><span class="lbltext">Main user email-id</span></td>'
		newtext += '<td class="cellpad4" bgcolor="#FFFFFF" width="50%"><span class="lbltext">' + ownerEmailId + '</span></td></tr></table></td></tr>'
		newtext += '</table></body></html>'

		tipobj.innerHTML=newtext

		enabletip=true
		fixed = false

		return false
	}
}

function ddrivetipPrice(description)
{
	if (ns6||ie)
	{
		if (typeof thewidth=="undefined") tipobj.style.width=100+"px"
		if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
		
		var newtext =  '<html><body>'
		newtext += '<table width="100%" bgcolor="#CAE465" border="0" cellspacing="0" cellpadding="1">'
		newtext += '<tr><td height="30"><table><tr><td bgcolor="#FFFFFF" width="100%" height="30px" class="cellpad4"><font size="1" face="Arial, Helvetica, sans-serif">' + description + '</font></td></tr></table></td></tr>'
		newtext += '</table></body></html>'
		
		
		//var newtext =  '<html><body>'
		//newtext += '<table width="100%" bgcolor="#f0f0f0" border="0" cellspacing="0" cellpadding="1">'
		//newtext += '<tr><td height="28"><table><tr><td bgcolor="#FFFFFF"><font size="1" face="Arial, Helvetica, sans-serif">' + description + '</font></td></tr></table></td></tr>'
		//newtext += '</table></body></html>'

		tipobj.innerHTML=newtext

		enabletip=true
		fixed = false
		return false
	}
}

function ddriveMsg(description, posX, posY, thewidth, thecolor)
{
	if (ns6||ie)
	{
		if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
		if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor

		var newtext =  '<html><body>'
		newtext += '<table width="100%" bgcolor="#F0F0F0" border="0" cellspacing="0" cellpadding="1">'
		newtext += '<tr><td height="30"><table><tr><td bgcolor="#FFFFFF" class="cellpad4"><font size="1" face="Arial, Helvetica, sans-serif"><b>' + description + '</b></font></td></tr></table></td></tr>'
		newtext += '</table></body></html>'

		tipobj.innerHTML=newtext

		enabletip=true
		fixed = true
		fixedpositionX = posX;
		fixedpositionY = posY;
		return false
	}
}

function hidedropdowns()
{
	var controls = new Array();
	controls.push("ddlCategory");
	controls.push("ddlGenre");
	controls.push("ddlViewbyCountry");
	controls.push("ddlViewbyLanguage");
	controls.push("ddlSubGenre");
	controls.push("ddlSort");
	controls.push("ddlPrice");
	controls.push("ddlLength");
	
	var controltohide = new Array();
	for(j=0; j < controls.length; j++)
	{	
		var ddl = document.getElementById(controls[j]);
		if(ddl)
			controltohide.push(ddl);
	}
	/*
	controltohide[0] = document.getElementById("ddlCategory");
	controltohide[1] = document.getElementById("ddlGenre");
	controltohide[2] = document.getElementById("ddlViewbyCountry");
	controltohide[3] = document.getElementById("ddlViewbyLanguage");
	*/
	for(i = 0; i < controltohide.length; i++ )
	{
		if(controltohide[i]);
		{
			controltohide[i].style.display = "none";
		}
		
	}
}

function showdropdowns()
{
	var controls = new Array();
	controls.push("ddlCategory");
	controls.push("ddlGenre");
	controls.push("ddlViewbyCountry");
	controls.push("ddlViewbyLanguage");
	controls.push("ddlSubGenre");
	controls.push("ddlSort");
	controls.push("ddlPrice");
	controls.push("ddlLength");
	
	var controltohide = new Array();
	for(j=0; j < controls.length; j++)
	{	
		var ddl = document.getElementById(controls[j]);
		if(ddl)
			controltohide.push(ddl);
	}
	for(i = 0; i < controltohide.length; i++ )
	{
		if(controltohide[i]);
		{
			controltohide[i].style.display = "block";
		}
		
	}
}
function positiontip(e)
{
	if (enabletip)
	{
		var pointersrc = "../skin2/images/arrow_";
		var nondefaultpos=false
		var curX
		var curY
		if(!fixed)
		{
			curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
			curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
		}
		else
		{
			curX = fixedpositionX;
			curY = fixedpositionY;
		}
		//Find out how close the mouse is to the corner of the window
		var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
		var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20

		var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
		var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY

		var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000

		/* Marisan Start Code */
		//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
			tipobj.style.left=curX-tipobj.offsetWidth+"px"
			pointerobj.style.left=curX-pointerobj.offsetWidth-offsetfromcursorX+"px"
			pointersrc += "r"
			nondefaultpos=true
		}		
		else
		{
			//position the horizontal position of the menu where the mouse is positioned
			tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
			pointerobj.style.left=curX+offsetfromcursorX+"px"
			pointersrc += "l"
		} 

		//same concept with the vertical position
		if (bottomedge<tipobj.offsetHeight)
		{
			tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
			nondefaultpos=true
			pointerobj.style.top=curY-pointerobj.offsetHeight-(offsetfromcursorY/2)+"px"
			pointersrc += "b";
		}
		else
		{
			tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
			pointerobj.style.top=curY+offsetfromcursorY+"px"
		} /* End Code Marisan*/ 

		tipobj.style.visibility="visible"
		pointerobj.src = pointersrc + ".gif";
		pointerobj.style.visibility="visible"
		/*
		if (!nondefaultpos)
			pointerobj.style.visibility="visible"
		else
			pointerobj.style.visibility="hidden"
		
		tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
		pointerobj.style.left=curX+offsetfromcursorX+"px"

		tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
		pointerobj.style.top=curY+offsetfromcursorY+"px"
		*/
	} 
}

function hideddrivetip()
{
	if (ns6||ie)
	{
		showdropdowns();
		enabletip=false
		tipobj.style.visibility="hidden"
		pointerobj.style.visibility="hidden"
		tipobj.style.left="-1000px"
		tipobj.style.backgroundColor=''
		tipobj.style.width=''
	}
}

document.onmousemove=positiontip