function openWindowGeneral(name,lpos,tpos,winh,winw){
		window.name = name ;
		win = window.open(name, "guide", "resizable=NO,left=" +lpos+", top="+tpos+", height="+winh+",width="+winw+",status=no,toolbar=no,menubar=no,location=no,scrollbars=no" ) ;
		return( false ) ;
	}




function chkDate(nM,nD,nY){
//	window.onerror=null // for all other strange errors
	var err=0
	var psj=0;

	if (nY.length != 4) err=1
	d = nD // day
	b = nM // month
	f = nY // year

	//basic error checking
	if (b<1 || b>12) err = 1
	if (d<1 || d>31) err = 1
	if (f<0 ) err = 1
	
	//advanced error checking

	// months with 30 days
	if (b==4 || b==6 || b==9 || b==11){
		if (d==31) err=1
	}

	// february, leap year
	if (b==2){
		// feb
		var g=parseInt(f/4)
		if (isNaN(g)) {
			err=1
		}

		if (d>29) err=1
		//if (d==29 && ((f/4)!=parseInt(f/4))) err=1
		if (d == 29) {
			err = 1;
   			if ((f/4) == parseInt(f/4)) err = 0;
			if ((f/100) == parseInt(f/100)) err = 1;
   			if ((f/400) == parseInt(f/400)) err =0;
		}
	}

	if (err==1){
		return false;
	}
	else{
		return true;
	}

}

function isEmpty(usrInput)
{
	var rXP = new RegExp("^\\w+")
	if(rXP.test(usrInput))
		{return false}
	else
		{return true}
}

function chkmoney(usrInput)
{
	var rXP = new RegExp("^\\d+([.])\\d{2}$")
	
	if(rXP.test(usrInput))
		{return true}
	else
		{return false}
}

function chkNum(inString)
{
//	alert(" the value of the string is : " + inString);
	var iTemp; 
	var tmpArray = new Array();
	
	for (iTemp=0 ; iTemp < inString.length ; iTemp++)
	{
		tmpArray[iTemp] = inString.substring(iTemp, iTemp+1);
	}
	  	
	for (iTemp=0 ; iTemp < inString.length ; iTemp++)
	{
		if(!((parseInt(tmpArray[iTemp])>=0) && (parseInt(tmpArray[iTemp])<=9)))
		{
			return true;
		}

    	}
	
}

function chkCreditCard(c1,c2,c3,c4)
{
	


/*	if ((c1 == '') || (c2 == '') || (c3 == '') || (c4 == '')){
		alert("Invalid Credit card number entry");
		return true;
	}
			
	if ((c1.length < 4) || (c2.length < 4) || (c3.length < 4) || (c4.length < 4)){
		alert("Credit card number should be 16 digits");
		return true;
	}	*/
}


function isZipOK(usrInput)
{
	var rXP = new RegExp("\\d{5,6}$")
	if(rXP.test(usrInput))
		{return true}
	else
		{return false}
}	


function isPhoneOK(usrInput)
{
	var rXP = new RegExp("\\(?\\d{3,5}\\)?\\s?[-\\/]\\s?(\\d{4,7})$")
	if(rXP.test(usrInput))
		{return true}
	else
		{return false}
}
	

function isEmailOK(usrInput)
{
	var rXP = new RegExp("^\\w+([-.]\\w+)?[@]\\w+([-.]\\w+)*([.][a-zA-Z]+)$")
	
	if(rXP.test(usrInput))
		{return true}
	else
		{return false}
}


function isPosInt(usrInput)
{
	var rXP = new RegExp("^\\d+","g")
	if(rXP.test(usrInput))
		{return true}
	else
		{return false}
}

function isPwdConfOK(usrInput1,usrInput2)
{
	if(usrInput1=="" || usrInput2=="")
	{

		document.write("<BR><B><FONT FACE=Verdana COLOR=RED>ERROR</FONT></B><BR><BR>")
		document.write("The password fields can not be empty. Please go back and fill the fields.<BR>")
		document.write("<BR><HR><A HREF='JavaScript:history.back()'>Back</A>")
		return false
	}
	else if(usrInput1 != usrInput2)	
	{
		document.write("<BR><B><FONT FACE=Verdana COLOR=RED>ERROR</FONT></B><BR><BR>")
		document.write("Confirmation password does not match.<BR>")
		document.write("<BR><HR><A HREF='JavaScript:history.back()'>Back</A>")
		return false
	}
	else
	{
		document.write("<BR><B><FONT FACE=Verdana COLOR=DarkBlue>Registration Successfully Completed</FONT></B><BR><HR>")
		document.write("Please take a note and remember your Login ID and Password.")
		return true
	}	
}

// validtions done below

	function chkvalid(){
		if ((document.frmPDSKit.txt_ssn.value == '') && (document.frmPDSKit.txt_fedid.value == '')){
			alert("Please enter \'SSN or Fed ID\'");		
			document.frmPDSKit.txt_ssn.focus();
			return false;
		}
		
		if (document.frmPDSKit.txt_ssn.value != ''){
			if (chkNum(document.frmPDSKit.txt_ssn.value)){
				alert("Inavlid Entry: Please enter a numeric value for \'SSN\'");
				document.frmPDSKit.txt_ssn.focus();
				return false;
			}
			if (document.frmPDSKit.txt_ssn.value.length < 9){
				alert("Invalid Entry: SSN should be 9 digits");
				document.frmPDSKit.txt_ssn.focus();
				return false;
			} 
		}
		if (document.frmPDSKit.txt_fedid.value != ''){
			if (chkNum(document.frmPDSKit.txt_fedid.value)){
				alert("Inavlid Entry: Please enter a numeric value for \'Fed ID\'");
				document.frmPDSKit.txt_fedid.focus();
				return false;
			}
			if (document.frmPDSKit.txt_fedid.value.length < 9){
				alert("Invalid Entry: Fed ID should be 9 digits");
				document.frmPDSKit.txt_fedid.focus();
				return false;
			} 
		}


		if (isEmpty(document.frmPDSKit.txt_retype.value)){
			alert("Please Re-enter \'SSN/Fed ID\'");		
			document.frmPDSKit.txt_retype.focus();
			return false;
		}
		if (isEmpty(document.frmPDSKit.txt_fname.value)){
			alert("Please enter your \'First Name\'");		
			document.frmPDSKit.txt_fname.focus();
			return false;
		}
		if (isEmpty(document.frmPDSKit.txt_lname.value)){
			alert("Please enter your \'Last Name\'");
			document.frmPDSKit.txt_lname.focus();
			return false;
		} 
		if (isEmpty(document.frmPDSKit.txt_add1.value)){
			alert("Please enter \'Address 1\'");		
			document.frmPDSKit.txt_add1.focus();
			return false;
		}
		if (isEmpty(document.frmPDSKit.txt_city.value)){
			alert("Please enter your \'City\'");		
			document.frmPDSKit.txt_city.focus();
			return false;
		}
		if (isEmpty(document.frmPDSKit.chk_state.value)){
			alert("Please select your \'State\'");		
			document.frmPDSKit.chk_state.focus();
			return false;
		}
		if (isEmpty(document.frmPDSKit.txt_zip.value)){
			alert("Please enter your \'Zip\'");		
			document.frmPDSKit.txt_zip.focus();
			return false;
		}

		if (isEmpty(document.frmPDSKit.txt_phone.value)){
			alert("Please enter your \'Phone\'");		
			document.frmPDSKit.txt_phone.focus();
			return false;
		}	
		if (!isPhoneOK(document.frmPDSKit.txt_phone.value)){
			alert("Inavlid Entry: Please enter a numeric value for \'Phone\'\nFormat \'999-999-9999\'");
			document.frmPDSKit.txt_phone.focus();
			return false;
		}
		if (document.frmPDSKit.txt_phone.value.length < 10){
			alert("Invalid Entry: Phone should be 10 digits");
			document.frmPDSKit.txt_phone.focus();
			return false;
		}
		if (isEmpty(document.frmPDSKit.chk_app.value)){
			alert("Please Select your \'Application\'");		
			document.frmPDSKit.chk_app.focus();
			return false;
		}
		if (isEmpty(document.frmPDSKit.chk_item.value)){
			alert("Please Select your \'Item Code\'");		
			document.frmPDSKit.chk_item.focus();
			return false;
		}
		
		if (document.frmPDSKit.txt_ssn.value != ''){
			if (document.frmPDSKit.txt_ssn.value != document.frmPDSKit.txt_retype.value){
				alert("Invalid Entry: Mismatch in SSN and retype Value.");		
				document.frmPDSKit.txt_retype.focus();
				return false;	
			}
		}
		if (document.frmPDSKit.txt_fedid.value != ''){
			if (document.frmPDSKit.txt_fedid.value != document.frmPDSKit.txt_retype.value){
				alert("Invalid Entry: Mismatch in Fed ID and retype Value.");		
				document.frmPDSKit.txt_retype.focus();
				return false;	
			}
		}

	}