//
//  Licensed Materials - Property of IBM
//  5724I83
//  (C) Copyright IBM Corp. 1995, 2007 All Rights Reserved.
//
// ***** DO NOT EDIT THIS FILE *****

var IE = document.all?true:false
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;

var tempX = 0
var tempY = 0
var pre_product_top = 0;
var pre_product_left = 0;
var pre_product_right = 0;
var pre_product_bottom = 0;
var div = null;

function getMouseXY(e) {
	if (IE) { // grab the x-y pos.s if browser is IE
		tempX = event.clientX + document.body.scrollLeft
		tempY = event.clientY + document.body.scrollTop
	} else {  // grab the x-y pos.s if browser is NS
		tempX = e.pageX
		tempY = e.pageY
	}  
	if (tempX < 0) tempX = 0
	if (tempY < 0) tempY = 0
	
	if( tempY < pre_product_top 
		|| tempY > pre_product_bottom
		|| tempX < pre_product_left
		|| tempX > pre_product_right)
	{
		HpbAffiliateHidePopupWindow();
	}
}

function HpbAffiliateHidePopupWindow(){

	if( div != null)
	{
		document.body.removeChild(div )
		div = null;
	}

	pre_product_top = 0;
	pre_product_left = 0;
	pre_product_right = 0;
	pre_product_bottom = 0;
}

function HpbAffiliateShowPopupWindow(strName, strLink, strImage, strDes){
	HpbAffiliateHidePopupWindow()
	if( strName == ''
		&& strImage == ''
		&& strDes == '')
	{
		return;
	}
	div=document.createElement("div")
	var str='';
	pre_product_left = tempX - 20;
	pre_product_right = tempX + 100;
	pre_product_top = tempY - 20;
	pre_product_bottom = tempY + 100;

	str = '<DIV style="width : auto; height : auto;';
	str += 'top : '+ pre_product_top+'px;';
	str += 'left : '+pre_product_left+'px;';
	str += ' background-color: rgb(255, 255, 255); position : absolute;  z-index : 1;  visibility : visible;" id="Layer1" onclick="HpbAffiliateLink('
	str += "'" + strLink + "'" + ')">'
		str += '<TABLE border="1"><TBODY><TR>'
			if( strImage != '')
			{
				str += '<TD><IMG class="hpb-affiliate-image" src="'
				str += strImage
				str += '" border="0"></TD>'
			}
			
			if( strName != '' || strDes != '')
			{
				str += '<TD>'
					if( strName != '')
					{
						str += '<SPAN class="hpb-affiliate-name">'
						str += strName
						str += '</SPAN><BR>'
					}
					if( strDes != '')
					{
						str += '<SPAN class="hpb-affiliate-description">'
						str += strDes
						str += '</SPAN>'
					}
				str += '</TD>'
			}
		str += '</TR></TBODY></TABLE>'
	str += '</DIV>'
	div.innerHTML = str;
	document.body.appendChild(div)
	pre_product_right = pre_product_left + div.childNodes[0].offsetWidth
	pre_product_bottom = pre_product_top + div.childNodes[0].offsetHeight
}

function HpbAffiliateLink(strURL) {
    if (strURL != "" ) {
		document.location.href = strURL;
	}
};
