
function openPrintWindow(pURL)
{
	if(window.location.search)
	{
		pURL = pURL + window.location.search + "&print=true";
	}
	else
	{
		pURL = pURL + "?print=true";
	}

	var lWindowName = "printWindow";
	var lWindowAttrs = "width=900,height=700,toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes";
	window.open(pURL,lWindowName,lWindowAttrs);

	return false;
}

function addListener(obj, evType, fn) 
{
      	if (obj.addEventListener){ 
 		obj.addEventListener(evType, fn, false); 
 		return true;
      	} 
      	else if (obj.attachEvent){ 
 		var r = obj.attachEvent("on"+evType, fn); 
 		return r; 
      	} 
      	else { 
 		return false;  
 } 
}

function getURLParam(strParamName)
{
	var strReturn = "";
	var strHref = window.location.href;
	if ( strHref.indexOf("?") > -1 )
	{
		var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
		var aQueryString = strQueryString.split("&");
		for ( var iParam = 0; iParam < aQueryString.length; iParam++ )
		{
			if (aQueryString[iParam].indexOf(strParamName + "=") > -1 )
			{
				var aParam = aQueryString[iParam].split("=");
				strReturn = aParam[1];
				break;
			}
		}
	}
	return strReturn;
}

function hideBits() 
{
    var strHTML = "";
	if(document.getElementById("resultTable"))
	{
		strHTML += "<div id='wrapper' class='search-results'><div id='content'><div id='rightcol'>";
		strHTML += "<div id='col1'>";
		strHTML += document.getElementById("col1").innerHTML;
		strHTML += "</div>";
		strHTML += "<div id='resultTable'>";
		strHTML += document.getElementById("resultTable").innerHTML;
		strHTML += "</div>";
	}
	
	else if(document.getElementById("col1"))
	{
	    strHTML += "<div id='wrapper' class='becoming-member'><div id='content'><div id='rightcol'>";
		strHTML += "<div id='col1'>";
		strHTML += document.getElementById("col1").innerHTML;
		strHTML += "</div>";
	}
	
	document.body.innerHTML = strHTML + "</div></div></div>";
	
	window.print();
}


if(getURLParam("print") == "true")
{
	addListener(window, "load", hideBits);
}

function resizeText(multiplier) {
	if (document.body.style.fontSize == "") {
		document.body.style.fontSize = "1.0em";
	}
	if (multiplier=="1") {
		if (document.body.style.fontSize == "1em" || document.body.style.fontSize == "1.1em") {
			document.body.style.fontSize = parseFloat(document.body.style.fontSize) + (multiplier * 0.1) + "em";
		}
	}
	if (multiplier=="-1") {
		document.body.style.fontSize = "1.0em";
	}
}


function ValidateUserRegistrationForm()
{
	var frm = document.frmRegistration;
	
	if(frm.firstName.value.length == 0)
	{
		alert("Invalid First Name","Error");
		frm.firstName.focus();
	}
	else if(frm.lastName.value.length == 0)
	{
		alert("Invalid Last Name");
		frm.lastName.focus();
	}
	else if(frm.solicitorNbr.value.length == 0 || isNaN(frm.solicitorNbr.value))
	{
		alert("Invalid Solicitor Number");
		frm.solicitorNbr.focus();
	}
	else
	{
		frm.submit();
	}
	
	return false;
}

function ValidateChangePasswordForm()
{
	var frm = document.frmChangePassword;
	
	if(frm.userID.value.length == 0)
	{
		alert("Invalid User Name","Error");
		frm.userID.focus();
	}
	else if(frm.password.value.length < 6)
	{
		alert("Invalid Password.  Passwords must be at least 6 characters in length.");
		frm.password.focus();
	}
	else
	{
		frm.submit();
	}
	
	return false;
}


function popForm(page) {
        window.open ( page,"toolwindow","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,top=28,left=190,screenX=190,screenY=28,width=700,height=900");
}

		





