
var lisiwelcome;
var pdfwin;
function trak(url){

	reg1 = new RegExp('.doc');
	reg2 = new RegExp('.xls');
	reg3 = new RegExp('.DOC');
	reg4 = new RegExp('.XLS');
	reg = new RegExp('.pdf');
	reg5 = new RegExp('sform');
	reg6 = new RegExp('lisi.*com');
//alert( 'it is '+reg5);
//alert('url.search(reg5) = '+url.search(reg5));
	if (url.search(reg5)>0){
	   prot = 'https://';
	}else{
	   prot = 'http://';
	}

	if (url.search(reg6)>1){
	   // it has the full designation so remove front
			var urlPat=/^.*lisi.*com(.*)$/;
			var matchArray=url.match(urlPat);
			var url = matchArray[1];
	}

	if ((url.search(reg1) > 1)|(url.search(reg2) > 1)|(url.search(reg3) > 1)|(url.search(reg4) > 1)){
		// it is an xls or doc so skip PHPSESSID

		window.pdfwin=window.open(url,"PDF","toolbar=0,width=795,height=555 location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");
		window.pdfwin.location.href = url;
		window.pdfwin.focus();
	} else {
		if (url.search(reg) == -1){

			// it is not a pdf so load it directly
			var urlPat=/^([^?]*)\?*(.*)$/;
			var matchArray=url.match(urlPat);
			var len=matchArray.length;
			if (matchArray[2]!=''){
				var url = prot + window.mydom + matchArray[1] + "?" + matchArray[2] + "&" +"PHPSESSID=" + window.sessID;
			} else {
				var url = prot + window.mydom + matchArray[1] + "?PHPSESSID=" + window.sessID ;
			}
			window.document.location.href = url;
		} else {

			// it IS a pdf so check it out
			reg = new RegExp('members');

			if (url.search(reg) == -1){
				// not a members item so continue
				reg = new RegExp('showpdf.php');
				if (url.search(reg) == -1){
					// add the showpdf cause it wasn't there
					url = prot + window.mydom + "/showpdf.php?src=" + url + "&PHPSESSID=" + window.sessID;
				}else{
					// split out src and add sessID
					url =  prot + window.mydom + url + "&PHPSESSID=" + window.sessID;
				}

				window.pdfwin=window.open(url,"PDF","toolbar=0,width=795,height=555 location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1");
				window.pdfwin.focus();
			}else{

				// IS a members item so check login
				if (window.loggedIn == 1){
					// Logged in so show it
					reg = new RegExp('showpdf.php');
					if (url.search(reg) == -1){
						// add the showpdf cause it wasn't there
					url = prot + window.mydom + "/showpdf.php?src=" + url + "&PHPSESSID=" + window.sessID;
					}else{
						// split out src and add sessID
					url =  prot + window.mydom + url + "&PHPSESSID=" + window.sessID;
					}

					window.pdfwin=window.open(url,"PDF","toolbar=1,width=795,height=555 location=1,directories=0,status=0,menubar=1,scrollbars=1,resizable=1");
					window.pdfwin.focus();
			}else{
					// not logged in, so complain
					alert("You must be a registered user to view this pdf. Please log in first.");
				}
			}
		}
	}
}

function formtrak(){
	var inpt = "<input type='hidden' name='PHPSESSID' value='" + window.sessID + "'>";
	document.write(inpt);
}



function lisiwelcome() {
	urlcommand = "/form/lisiwelcome.php?PHPSESSID=" + window.sessID;
//alert ("email win " + urlcommand);
lisiwelcome=window.open(urlcommand,"welcome","toolbar=0,width=780,height=600 location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0");
// this focus command creates an error in ie301 for pc test other browsers.
     lisiwelcome.focus();
}