var bolInternalPg=true;
function pgInit(){
	strUserAgent=navigator.userAgent;
	strAppName=navigator.appName;
	strBrowser="MS";
	RegExSupport=false;
	strVersion=navigator.appVersion.substring(0,1);
	
   if(strUserAgent.indexOf("AOL") != -1){
		strBrowser="AOL";
		RegExSupport=false;
	}	
   else if(strAppName=="Netscape"){
		strBrowser="NS";	
		RegExSupport=true;
	}
   else if(strAppName=="Microsoft Internet Explorer"){
		strBrowswer="MS";
		RegExSupport=true;
   }
	if(document.forms[0].frmBrowserUA)
		document.forms[0].frmBrowserUA.value=strUserAgent;

	
}

function menuPost(strAction){
	document.forms[0].frmActionPg.value=strAction;
	switch(strAction){
		case "newreg" :
			document.forms[0].frmActionPg.value="newreg";
			document.forms[0].action="../subscribe/subscribecase.asp";
			break;
		case "newregmain" :
			document.forms[0].frmActionPg.value="newreg";
			document.forms[0].action="subscribe/subscribecase.asp";
			break;
		case "upgrade" :
			document.forms[0].frmActionPg.value="upgrade";
			document.forms[0].action="../general/login.asp?ActionPg=upgrade";
			break;
		case "upgrademain" :
			document.forms[0].frmActionPg.value="upgrade";
			document.forms[0].action="general/login.asp?ActionPg=upgrade";
			break;
		case "zurich" :
			document.forms[0].frmActionPg.value="zurich";
			document.forms[0].action="../subscribe/nsub_proccer.asp";
			break;
		case "renewstudent" :
			document.forms[0].frmActionPg.value="renewstudent";
			document.forms[0].action="../general/login.asp";
			break;
		case "lawstudent" :
			document.forms[0].frmActionPg.value="lawstudent";
			document.forms[0].action="../subscribe/nsub_proccer.asp";
			break;
		case "paralegal" :
			document.forms[0].frmActionPg.value="paralegal";
			document.forms[0].action="../subscribe/nsub_proccer.asp";
			break;
		case "login" :
			document.forms[0].frmActionPg.value="upgrade";
			document.forms[0].action="../general/login.asp?ActionPg=upgrade";
			break;
		case "loginmain" :
			document.forms[0].frmName.value="frmLogin";
			document.forms[0].frmActionPg.value="research";
			document.forms[0].action="general/login.asp";
			break;
		case "loginpartner" :
			document.forms[0].frmName.value="frmLogin";
			document.forms[0].frmActionPg.value="research";
			document.forms[0].action="../general/login.asp";
			break;
		case "promo" :
			document.forms[0].frmActionPg.value="promo";
			document.forms[0].action="../subscribe/subscribecase?ActionPg=promo";
			break;
		case "research" :
			document.forms[0].frmActionPg.value="upgrade";
			document.forms[0].action="../general/login.asp?ActionPg=research";
			break;
			
	}
	document.forms[0].submit();
}

function NewWindow(mypage,myname,w,h,pos,infocus){
	if(pos=="random"){
		myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}
	if(pos=="center"){
		myleft=(screen.width)?(screen.width-w)/2:100;
		mytop=(screen.height)?(screen.height-h)/2:100;
		}
	else 
		if((pos!='center' && pos!="random") || pos==null){
			myleft=0;mytop=20
		}
	settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";
	win=window.open(mypage,myname,settings);
	win.focus();
}
function popUp(url) {
	sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=500,height=450');
	self.name = "mainWin";
}
function testEmail(src) {
	emailReg = /^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
	var regex = new RegExp(emailReg);
	return regex.test(src);	
}
function opensavedsearches(){
	myleft=(screen.width)?(screen.width-470)/2:100;
	mytop=(screen.height)?(screen.height-590)/2:100;
		
	window.open("wfrmSavedSearches.aspx", "_blank", "width=470,height=590,top=" + mytop + ",left=" + myleft + ",scrollbars=yes")
}
function opensavesearch(){
	myleft=(screen.width)?(screen.width-310)/2:100;
	mytop=(screen.height)?(screen.height-400)/2:100;	
	window.open("wfrmSaveSearch.aspx", "_blank", "width=500,height=600,top=" + mytop + ",left=" + myleft + ",scrollbars=yes" + ",resize=yes")
	//window.open("wfrmSaveSearch.aspx", "_blank", "width=310,height=400,top=" + mytop + ",left=" + myleft)
}
function opensearchpreferences(){
	myleft=(screen.width)?(screen.width-310)/2:100;
	mytop=(screen.height)?(screen.height-450)/2:100;	
	window.open("wfrmPreferences.aspx", "_blank", "width=310,height=450,top=" + mytop + ",left=" + myleft + ",scrollbars=No")
}
function anArray(n) {
	this.length = n;
	for (var i = 0; i < n; i++)
		this[i] = 0;
	return this
}

var textMonth = new anArray(12);
	textMonth[0] = "Jan", textMonth[1] = "Feb", textMonth[2] = "Mar"
	textMonth[3] = "Apr", textMonth[4] = "May", textMonth[5] = "Jun"
	textMonth[6] = "Jul", textMonth[7] = "Aug", textMonth[8] = "Sep"
	textMonth[9] = "Oct", textMonth[10] = "Nov", textMonth[11] = "Dec"

 var modDate = new Date(document.lastModified);
 var modDay = modDate.getDate();
 var modMonth = modDate.getMonth();
 var modYear = modDate.getFullYear();
 var copyDate = new Date();
 var copyYear = copyDate.getFullYear();

function defineword(txt) {
    window.status = txt;
    setTimeout("blankit()",5000); 
}

function blankit() {
     window.status="";
}

function getPrevious() {
	return document.referrer
}

function optUscCfrTopic_CheckChanged(srcElement){
	var gObjXML;
	gObjXML = new ActiveXObject("MSXML.DOMDocument");	//xml source object
	gObjXML.async=false;
	gObjXML.validateOnParse = true;
	gObjXML.load("..\\Library\\topicText.xml");							//Load DataIsland object
	if (gObjXML.parseError.errorCode != 0) 
		//tgtResults.innerHTML = showError(gobjXML);
		alert(showError(gObjXML));
	//alert("docLoaded");
	//alert(srcElement);
	var xmlQuery = "topics/topic[@id='" + srcElement + "']";
	var nodeList=gObjXML.selectNodes(xmlQuery);
	alert(nodeList.item(0).firstChild.nodeValue);
	var topicTitle = nodeList.item(0).firstChild.nodeValue;
	//alert(topicTitle);
	//pnlUscTopicSearch.style.display='none';
}

function showError(objDocument) {
  // create the error message
  var strError = new String;
  strError = 'Invalid XML file !<BR />'
           + 'File URL: ' + objDocument.parseError.url + '<BR/>'
           + 'Line No.: ' + objDocument.parseError.line + '<BR/>'
           + 'Character: ' + objDocument.parseError.linepos + '<BR/>'
           + 'File Position: ' + objDocument.parseError.filepos + '<BR/>'
           + 'Source Text: ' + objDocument.parseError.srcText + '<BR/>'
           + 'Error Code: ' + objDocument.parseError.errorCode + '<BR/>'
           + 'Description: ' + objDocument.parseError.reason
  return strError;
}

