var startTag = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"200\" height=\"75\"><tr><td colspan=\"3\" width=\"198\" style=\"border-left: 1 solid #660000; border-right: 1 solid #660000; border-top: 1 solid #660000; padding: 5\" bgcolor=\"#FAC0C0\" height=\"0%\" align=center bordercolor=\"#FFFFFF\">";
  
var endTag = "</tr><tr><td width=\"50%\" style=\"border-top: 1 solid #660000\" bordercolor=\"#660000\"><img src=\"/portal/pickoftheday/images/tran.gif\"></td><td width=\"15\" valign=\"top\" align=\"left\"><img border=\"0\" src=\"/portal/pickoftheday/images/popup_arrow.gif\" width=\"15\" height=\"8\"></td><td width=\"50%\" style=\"border-top: 1 solid #660000\"><img src=\"/portal/pickoftheday/images/tran.gif\"></td></tr></table>";


//Window Title End
// position of the tooltip relative to the mouse in pixel //
var offsetx = 125;
var offsety =  390;

function newelement(newid)
{ 
    if(document.createElement)
    { 
        var el = document.createElement('div'); 
        el.id = newid;     
        with(el.style)
        { 
            display = 'none';
            position = 'absolute';
        } 
        el.innerHTML = '&nbsp;'; 
        document.body.appendChild(el); 
    } 
} 
var ie5 = (document.getElementById && document.all); 
var ns6 = (document.getElementById && !document.all); 
var ua = navigator.userAgent.toLowerCase();
var isapple = (ua.indexOf('applewebkit') != -1 ? 1 : 0);

function mmtooltip(tip, e, reference, currentIndex, g_nPositionValue)
{
	var ylength = 74;
	if(currentIndex == g_nPositionValue) return ;
	if( tip == null || tip == "" ) return ;
	if( ie5 && document.readyState !='complete' ) return;
    if(!document.getElementById('mmtooltip')) newelement('mmtooltip');
    var m4m_tooltip = document.getElementById('mmtooltip');

	if( m4m_tooltip ){
		var yAbsolutePos = getAbsolutePosition(document.getElementById("mainfeature_pagination") );
		m4m_tooltip.innerHTML = startTag+ tip +endTag ;
		m4m_tooltip.style.display = 'block';
		var f = getAbsolutePosition(reference);
		m4m_tooltip.style.position = 'absolute';
		m4m_tooltip.style.left = (f.x-95) + 'px';
		m4m_tooltip.style.top = (yAbsolutePos.y-ylength) + 'px';
		//m4m_tooltip.style.top = (f.y-tip.length) + 'px';
	}
}
function exit()
{
	try {
    document.getElementById('mmtooltip').style.display = 'none';
	}catch(error){}
}

function getAbsolutePosition(element) {
  var r = { x: element.offsetLeft, y: element.offsetTop };
  if (element.offsetParent) {
    var tmp = getAbsolutePosition(element.offsetParent);
    r.x += tmp.x;
    r.y += tmp.y;
  }
 

  return r;
};
