var backgroundCursorBox;

function globalMakeClickbackgrund(url, infoLabel, bottom ){
	
	function getDocSize() {
		
		if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		}
		myWidth = myWidth-17;
	}

	var myWidth = 0, myHeight = 0;
	var webWidth = 950;
	var adColumnWidth = 0;
	
	getDocSize();
	
	if( url ){
		
		dv = document.createElement('div');
		dv.setAttribute('id',"globalClickBaground");
		dv.className="globalClickBaground";
		
		if(infoLabel){
			
			dv.onmouseover = function(){ backgroundCursorBox.style.display = ''; };
			dv.onmouseout = function(){ backgroundCursorBox.style.display = 'none'; };
			dv.onmousemove = backgroundGetCursorXY;
			
			infoYellowBox = document.createElement('div');
			infoYellowBox.setAttribute('id',"globalNoteBox");
			infoYellowBox.style.display = 'none';
			infoYellowBox.innerHTML = infoLabel;
			
			document.body.appendChild(infoYellowBox);
			
			backgroundCursorBox = document.getElementById('globalNoteBox');
		}
		
		document.body.appendChild(dv);
		
		var body = document.body,
	    html = document.documentElement;
		
	    var height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
		
		dv.innerHTML='<a href="'+url+'" target="_blank"><img src="http://i47.vbox7.com/design/blank.gif" alt="" border="0" width="'+myWidth+'" height="'+height+'"/></a>';
	}
	
	//footer image
	if( bottom ){
		
		dvBottom = document.createElement('div');
		dvBottom.setAttribute('id',"globalBrandSiteFooter");
		dvBottom.className = bottom;
		dvBottom.innerHTML = '&nbsp;';
		dvBottom.style.width= myWidth+'px';
		
		document.body.appendChild(dvBottom);
	}
}

function backgroundGetCursorXY(e) {
	
	e = e || window.event;
	var cursor = {x:0, y:0};
	
	if (e.pageX || e.pageY) {
		cursor.x = e.pageX;
		cursor.y = e.pageY;
	} else {
		var de = document.documentElement;
		var b = document.body;
		cursor.x = e.clientX + 
			(de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
		cursor.y = e.clientY + 
			(de.scrollTop || b.scrollTop) - (de.clientTop || 0);
	}
	
	var winWidth = getWindowWidth();
	
	if( (cursor.x+15) + backgroundCursorBox.offsetWidth > winWidth-15){
		backgroundCursorBox.style.left = (cursor.x-backgroundCursorBox.offsetWidth)+'px';
	}else {
		backgroundCursorBox.style.left = (cursor.x+15)+'px';
	}
	
	backgroundCursorBox.style.top = (cursor.y+20)+'px';
}

