
		function showWindow(filename){
		  //var win1;
		  win1 = window.open(filename,'test', 'toolbar=yes,location=no, directories=yes, status=no');

		  //alert(win1.location);
		  //win1.location.replace(
		 // var parentwin = external.menuArguments;
          //win1.document.title = "test";
     

		 // win1.document.write("<HEAD><TITLE>Message window</TITLE></HEAD>");
		 // win1.open(filename,");
		}
	
	function CheckTimeOut(){
		isBack=0;
		var frm=document.forms[0];
		if (frm.action.value==''){
			//frm.target="_top";
			writecookie("expirecookie" , "Expired");
			writeSignout(frm.loginID.value);
			frm.action.value="CheckTimeOut";
			frm.submit();
		}
	}

	function showHomePage(){
		
		var frm=document.forms[0];
		//frm.target="_top";
		frm.action.value="Home";
		frm.submit();

	}

	function doAction(optName){
		var frm=document.forms[0];

		//frm.target="_parent";
		
	//alert(optName);
		if (optName=="SignOut"){
			writeSignout(frm.loginID.value);
            writecookie("expirecookie" , "Expired");
			frm.action.value="SignOut";
		}
		else if (optName=="PreviousRpt"){
			frm.action.value="PreviousRpt";
		}
		else if (optName=="MainPage"){
			frm.action.value="MainPage";
		}
		else if (optName=="InvRpt"){
			frm.reportType.value="Invoice";
			frm.action.value="InvoiceReport"
		}
		else if (optName=="BillFiles"){
			frm.action.value="BillFiles"
		}
		else if (optName=="UsageInfo"){
			frm.reportType.value="Usage";
			frm.action.value="UsageInfo";
		}
		else if (optName=="AniUsage"){
			frm.reportType.value="Participant Usage";
			frm.action.value="AniUsage";
		}
		else if (optName=="HistAniUsage"){
			frm.reportType.value="Historical Participant Usage";
			frm.action.value="HistAniUsage";
		}
		else if (optName=="ChangeCriteria"){
			if (frm.reportType.value=="Participant Usage")
			{
            frm.formname.value="MainForm";
            frm.action.value="AniUsage";
			}
			else
            {
			frm.action.value="InvoiceReport";
			}
		}else if (optName=="mailreport"){
			frm.formname.value="InvoiceReportForm";
			frm.action.value="mailreport";
		}else if (optName=="ModSearch"){
		//	frm.searchcriteria.value="";
			frm.formname.value="MainForm";
			frm.action.value="ModRpt";
		}		 	
		else if (optName=="ModRefSearch"){
			frm.formname.value="MainForm";
			frm.action.value="ModRpt";
		}
		else{
			//alert(optName);
			frm.action.value=optName;
		}
				
		frm.submit();
		
	}

	function diplayMessage(wndtype)	{

		var features = 'menubar=no,toolbar=no,location=no,top=400,left=520,status=no,scrollbars=no,resizable=no,width=250,height=100';
		if (wndtype=="HistAniUsage")
			window.open("histMessage.htm","",features);
		else if (wndtype=="AniUsage")
			window.open("UnPartMsg.htm","",features);
		else if (wndtype=="Usage")
			window.open("unbilledMessage.htm","",features);
		else
			alert("Under Construction");
	}
	
	function showPrintPage(fileName) {
		
		var features = 'menubar=no,toolbar=no,location=no,top=0,left=0,status=yes,scrollbars=yes,resizable=yes,width=780,height=520';

		window.open(fileName,"PrintPage",features);
	}

	function showEmailPage(fileName) {
		
		var features = 'menubar=no,toolbar=no,location=no,top=30,left=50,status=yes,scrollbars=no,resizable=no,width=550,height=430';

		window.open(fileName,"PrintPage",features);
	}

	function printThis(){
		document.forms[0].printButton.visible=false;
		var usertype=navigator.userAgent.toLowerCase();
		if (window.print) {
			setTimeout('window.print();',200);
		}
		else if (usertype.indexOf("mac") != -1) {
			alert("Press 'Cmd+p' on your keyboard to print article.");
		}
		else {
			alert("Press 'Ctrl+p' on your keyboard to print article.")
		}
	}

	function printFrame(){

		var usertype=navigator.userAgent.toLowerCase();
		//printFrame = parent.frames[1];
		
		printFrame = parent.preview;

		if (printFrame.print) {
			//alert(printFrame.name);
			printFrame.focus();
			printFrame.print();
			//setTimeout('printFrame.print();', 200);
		}
		else if (usertype.indexOf("mac") != -1) {
			alert("Press 'Cmd+p' on your keyboard to print article.");
		}
		else {
			alert("Press 'Ctrl+p' on your keyboard to print article.")
		}
	}

function emailCheck (emailStr) {

	/* The following variable tells the rest of the function whether or not
	to verify that the address ends in a two-letter country or well-known
	TLD.  1 means check it, 0 means don't. */

	var checkTLD=1;

	/* The following is the list of known TLDs that an e-mail address must end with. */

	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

	/* The following pattern is used to check if the entered e-mail address
	fits the user@domain format.  It also is used to separate the username
	from the domain. */

	var emailPat=/^(.+)@(.+)$/;

	/* The following string represents the pattern for matching all special
	characters.  We don't want to allow special characters in the address. 
	These characters include ( ) < > @ , ; : \ " . [ ] */

	var specialChars="\\(\\)><@;:\\\\\\\"\\.\\[\\]";

	/* The following string represents the range of characters allowed in a 
	username or domainname.  It really states which chars aren't allowed.*/

	var validChars="\[^\\s" + specialChars + "\]";

	/* The following pattern applies if the "user" is a quoted string (in
	which case, there are no rules about which characters are allowed
	and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
	is a legal e-mail address. */

	var quotedUser="(\"[^\"]*\")";

	/* The following pattern applies for domains that are IP addresses,
	rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
	e-mail address. NOTE: The square brackets are required. */

	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

	/* The following string represents an atom (basically a series of non-special characters.) */

	var atom=validChars + '+';

	/* The following string represents one word in the typical username.
	For example, in john.doe@somewhere.com, john and doe are words.
	Basically, a word is either an atom or quoted string. */

	var word="(" + atom + "|" + quotedUser + ")";

	// The following pattern describes the structure of the user

	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

	/* The following pattern describes the structure of a normal symbolic
	domain, as opposed to ipDomainPat, shown above. */

	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

	/* Finally, let's start trying to figure out if the supplied address is valid. */

	/* Begin with the coarse pattern to simply break up user@domain into
	different pieces that are easy to analyze. */

	var matchArray=emailStr.match(emailPat);

	if (matchArray==null) {

	/* Too many/few @'s or something; basically, this address doesn't
	even fit the general mould of a valid e-mail address. */

	alert("Email address seems incorrect (check @ and .'s)");
	return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];

	// Start by checking that only basic ASCII characters are in the strings (0-127).

	for (i=0; i<user.length; i++) {
	if (user.charCodeAt(i)>127) {
	alert("This Email username contains invalid characters.");
	return false;
	   }
	}
	for (i=0; i<domain.length; i++) {
	if (domain.charCodeAt(i)>127) {
	alert("This Email address domain name contains invalid characters.");
	return false;
	   }
	}

	// See if "user" is valid 

	if (user.match(userPat)==null) {

	// user is not valid

	alert("The Email Address is not valid.");
	return false;
	}

	/* if the e-mail address is at an IP address (as opposed to a symbolic
	host name) make sure the IP address is valid. */

	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {

	// this is an IP address

	for (var i=1;i<=4;i++) {
	if (IPArray[i]>255) {
	alert("Destination IP address is invalid!");
	return false;
	   }
	}
	return true;
	}

	// Domain is symbolic name.  Check if it's valid.
 
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {
	if (domArr[i].search(atomPat)==-1) {
	alert("The domain name does not seem to be valid.");
	return false;
	   }
	}

	/* domain name seems valid, but now make sure that it ends in a
	known top-level domain (like com, edu, gov) or a two-letter word,
	representing country (uk, nl), and that there's a hostname preceding 
	the domain or country. */

	if (checkTLD && domArr[domArr.length-1].length!=2 && 
	domArr[domArr.length-1].search(knownDomsPat)==-1) {
	alert("The Email address must end in a well-known domain or two letter " + "country.");
	return false;
	}

	// Make sure there's a host name preceding the domain.

	if (len<2) {
	alert("This Email address is missing a hostname!");
	return false;
	}

	// If we've gotten this far, everything's valid!
	return true;
}

function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}
function inValidDate(strdate){
		dtVal = strdate.split("/");

		if (dtVal.length!=3) return true;
		if (isNaN(dtVal[0])||isNaN(dtVal[1])||isNaN(dtVal[2])) return true;

		if (dtVal[0]<1 || dtVal[0]>12) return true;
		if (dtVal[2]<1000 || dtVal[2]>9999) return true;
		if (isLeapYear(dtVal[2])) nodays[1]=29;
		if (dtVal[1]<1 || dtVal[1]>nodays[dtVal[0]-1]) return true;

		return false;
	}

	function isLeapYear(year){
		if ((year%4==0) && ((year%400==0)||(year%100!=0))) return true ;
		return false; 
	 }

	 function IsValidName(str) {
		var ch;
			
		for (i=0; i<str.length; i++) {
			ch= str.charCodeAt(i);
			if (ch<=44) return false;
			if (ch==46 || ch==47 ) return false; 
			if (ch>57 && ch< 65 ) return false; 
			if (ch>90 && ch< 95 ) return false; 
			if (ch==96 || ch>122 ) return false; 
        }
       return true;
	 }


	  function RemoveSpaces(str) {
		var ch;
		var retval='';	
		for (i=0; i<str.length; i++) {
			ch=str.substring(i,i+1);
	
			if (ch!=' ') 
			 retval=retval+ch;
        }
       return retval;
	 }