// JavaScript CODE from lx1CommonScript.jsp
function LX1_OnLoadTop() {
  // The top_jsp can redefine this function to insert scripts needed to be
  // run after the page is loaded
}

function LX1_OnLoadLeft() {
  // The left_jsp can redefine this function to insert scripts needed to be
  // run after the page is loaded
}

function LX1_OnLoad() {
  // The main_jsp can redefine this function to insert scripts needed to be
  // run after the page is loaded
}

function LX1_OnLoadBottom() {
  // The bottom_jsp can redefine this function to insert scripts needed to be
  // run after the page is loaded
}

function LX1_GoToTop() {
  window.location.hash = "lx1top"
}

function GetCookie(cookieName)
{
        var cookie = document.cookie;
        var index = cookie.indexOf(cookieName + "=");
        if (-1 == index) return "";
        index = cookie.indexOf("=", index) + 1;
        var endstr = cookie.indexOf(";", index);
        if (-1 == endstr) endstr = cookie.length;
        var theCookie = unescape(cookie.substring(index, endstr));
        if ((theCookie == "") || (theCookie == null) || (theCookie == "null") || (theCookie.indexOf("undefined") >= 0) || (theCookie == (cookieName + "="))) theCookie = ""
        return theCookie;
}

function TopNav_loginAction(openUrl, returnValue) {
        var returnURL;
        var returnParams;
		returnURL = escape(window.location.href);
		returnParams = escape(returnValue);
		if (returnParams != "NULL"){
         returnURL = returnParams;
        }
        if (GetCookie("PUID") == "") {
                window.location.href = openUrl+"/lx1/pserv/login?action=display_logon&mode=content&forcedlogin=N"+"&returnURL="+returnURL;
        }
        else {
                window.location.href = openUrl+"/lx1/pserv/login?action=logout&mode=content&forcedlogin=N"+"&returnURL="+returnURL;
        }
}

// Function added to implement seperation of registration page 
// for R19
function TopNav_RegisterAction(openUrl, returnParam) {
        var returnURL;
        var returnParams;
        returnURL = escape(window.location.href);        
        returnParams = escape(returnParam);
        if (returnParams != "") {
        	returnURL = returnParams;
        }
        window.location.href = openUrl+"/lx1/pserv/login?action=display_register&mode=content&forcedlogin=N"+"&returnURL="+returnURL;
}

// Function added to implement special Offer POPup Window linka as JS to HTML
// for R28.1 SEO Changes
function LX1_SOPopUp()
{
	var x = document.getElementsByTagName('a');
	for (var i=0;i<x.length;i++) 
	{
		if (x[i].getAttribute('type') == 'contentListingPopup') 
		{
			x[i].onclick = function () 
			{
				return pop(this.href)
			}
		}
	}
}
function Footer_CopyYear()
{
	return (new Date().getFullYear());
}
function printThisPage(){  
  if (window.print) {
    window.print();  
  } else {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
    document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(6, 2);
  }
}
function TopNav_loginAction() {
 	var returnURL;
 	returnURL = escape(window.location.href);
         if (GetCookie("PUID") == "") {
                 window.location.href = "/pserv/login?action=display_logon&mode=open&forcedlogin=N"+"&returnURL="+returnURL;
         }
         else {
                 window.location.href = "/pserv/login?action=logout&mode=open"+"&returnURL="+returnURL;
         }
 }
function TopNav_registerAction() {
        if (GetCookie("PUID") == "") {
		window.location.href = "/pserv/registration?action=displayTermsAndConditions&mode=content";
        }
        else {
                window.location.href = "/pserv/login?action=logout&mode=content";
        }
}

function getSearch(s) {
 var st =  document.getElementById('searchterms');
 var sel = document.getElementById('searchchecker');
 if(st.value.length > 0 & st.value != "Site Search"){
  if(sel.value == "-1"){
   window.location = "http://law.lexisnexis.com/webcenters/search.aspx?s="+s+"&st=" + escape(st.value);
  } else {
   window.location = "http://law.lexisnexis.com/webcenters/search.aspx?s="+s+"&st="+escape(st.value)+"&y=" + sel.value;
  }
 }
 else{
  var req = document.getElementById('searchtermsreq');
  req.style.display = 'block';
 }
}
