

document.write('<div id="overlayDiv" style="z-index:1000;display:none;position: absolute;top: 0px;left: 0px;width: 100%; height: 100%; background-color:#000000;-moz-opacity: 0.8;opacity:.80;filter: alpha(opacity=80);"></div><div id="loginbox" style="display:none;z-index:1001;background:#ffffff;height:275px;width:350px;position:absolute;top:50%;left:50%;margin-left:-175px;padding:5px;"><div style="float:left;padding-right:10px;"><img src="/images/icons/smhdrMemberOnlyPortal.GIF" border="0"></div><div style="font-size:10pt;float:left;color:#000;"><div style="font-size: 24px; color: #069;">Members Only Portal</div></div><div style="padding:5px;clear:both;"><div>Please enter your username and password to login to the HAR Members Only Portal to access this page.</div><iframe id="loginForm" style="width:320px;height:160px;border:0px" frameborder="0" scrolling="no" src="http://www.har.com/ajaxcall/loading.cfm" ></iframe></div><div style="float:right;margin-right:10px;" onclick="hideLogin();"><img src="http://www.har.com/images/buttons/close.gif" style="cursor:pointer;" title="Close Window" align="absmiddle">&nbsp;Close</div></div>');

var targURL="";

function hideLogin(){
	document.getElementById("overlayDiv").style.display='none';
	document.getElementById("loginbox").style.display='none';
	showFlash();
	
}
function showLogin(hobj){
	targURL=hobj.href;
	var logixBox=document.getElementById("loginbox");
	var overLayBox=document.getElementById("overlayDiv");

	var pageh=getDocHeight();
	var objPos=findPos(hobj)[1];
	var oloc=(pageh/2);
	
	var xtop=findScroll();
	
	if(xtop=="undefined"){
			xtop=0;
	}
	logixBox.style.top= xtop+200 +"px"; //"50%";//oloc+"px";
	overLayBox.style.height=pageh+"px";
	var fobj=document.getElementById("loginForm");
	fobj.src="http://members.har.com/proxyLogin.cfm?redirurl="+escape(targURL);
	
	hideFlash();
	document.getElementById("overlayDiv").style.display='block';
	document.getElementById("loginbox").style.display='block';
//	window.scrollTo(0,0);
	return false;
}

function getDocHeight() {
    var D = document;
	
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}

function findScroll(){

    if (window.pageYOffset){

        ScrollTop = window.pageYOffset;
	}
    else{

        ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;

		}
		
		return ScrollTop;
	
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft

				curtop += obj.offsetTop;
		
		}
	}
	return [curleft,curtop];
}


function hideFlash(){
	var fObj=document.getElementsByTagName("embed");
	for(i=0;i<fObj.length;i++){
		fObj[i].style.display='none';	
	}
}
function showFlash(){
	var fObj=document.getElementsByTagName("embed");
	for(i=0;i<fObj.length;i++){
		fObj[i].style.display='block';	
	}	
}
function doLoginCheck(){
	var username=document.getElementById("usernamepl");
	var password=document.getElementById("passwordpl");
	if(username.value=="" || password==""){
		alert("Please type in your username and password");
		return;
	}
var genReq=getXmlHttpRequestObject();
	var url="http://members.har.com/proxyLogin.cfm";
	var gparam="IMS="+username.value+"&PWD="+password.value+"&redirurl="+escape(targURL);
	genReq.open("GET",url+"?"+gparam,false);
	genReq.send(gparam);
	alert(genReq.responseText);
	
}
function getXmlHttpRequestObject() {if (window.XMLHttpRequest) {return new XMLHttpRequest();} else if(window.ActiveXObject) {return new ActiveXObject("Microsoft.XMLHTTP");} else {document.getElementById('p_status').innerHTML = 'Status: Cound not create XmlHttpRequest Object.  Consider upgrading your browser.';}}
