/* 
 * The script to set the seo content div's X position
 */

/*
 * Tests which browser is viewing the file by testing the User Agent
 */
function TestBrowser()
{
    if(/Firefox/.test(navigator.userAgent)) return 'Firefox';
    if(/MSIE 6/.test(navigator.userAgent)) return 'MSIE6';
	if(/MSIE 7/.test(navigator.userAgent)) return 'MSIE7';
	if(/MSIE 8/.test(navigator.userAgent)) return 'MSIE8';
    if(/Chrome/.test(navigator.userAgent)) return 'Chrome';
    if(/Safari/.test(navigator.userAgent)) return 'Safari';
    else return 'Other';
}

/*
 * FudgeFactor is the factor to add to the holder div's offsetTop to position
 * the content correctly
 */
function FudgeFactor(){
    browserName=TestBrowser();
//	alert('Browser is '+browserName+'\n');
    switch(browserName){
	case 'Firefox': return 202;
			break;

	case 'MSIE6':
	case 'MSIE7':
	case 'MSIE8': 	return 200;
			break;
	case 'Chrome':  return 200;
			break;
	default:	    return 200;
    }
}


function addLoadEvent(func) { 
	var oldonload = window.onload; 
	if (typeof window.onload != 'function') { 
		window.onload = func; 
	} else { 
		window.onload = function() { 
		  oldonload(); 
		  func(); 
		} 
	} 
}

addLoadEvent(function(){
    var overlayDiv=document.getElementById("SEOcontent");
    var holderDiv=document.getElementById("SEOHolder");
	var browserName=TestBrowser();
	var FF=FudgeFactor();
	if(browserName == 'MSIE7')
	{
		FF+=holderDiv.parentNode.offsetTop;
	}
    overlayDiv.style.top=holderDiv.offsetTop+FF+'px';
    overlayDiv.style.zindex='100';
    //alert('Overlay :\nstyle Top is '+overlayDiv.style.top+'px\nHolder:\n style top is '+holderDiv.offsetTop+'px\nParent Node top is '+holderDiv.parentNode.offsetTop+'px');
}
);