function setSelectList(list_arr,selval)
{
	for(i=0;i < list_arr.length;i++)
	{
		if(list_arr[i].value == selval)
		{
			list_arr[i].selected=true;
			break;
		}
	}
}	

function checkvalid()
{
	if(document.frmadd.vFirstName.value.length < 1)
	{
		alert("Please Enter FirstName");
		document.frmadd.vFirstName.focus();
		return false;
	}
	if(document.frmadd.vLastName.value.length < 1)
	{
		alert("Please Enter LastName");
		document.frmadd.vLastName.focus();
		return false;
	}
	if(document.frmadd.vCompany.value.length < 1)
	{
		alert("Please Enter Compnay Name");
		document.frmadd.vCompany.focus();
		return false;
	}
	if(document.frmadd.vBank.value.length < 1)
	{
		alert("Please Enter Bank name");
		document.frmadd.vBank.focus();
		return false;
	}
	if(document.frmadd.vAccount.value.length < 1)
	{
		alert("Please Enter Account Number");
		document.frmadd.vAccount.focus();
		return false;
	}
	
	if(document.frmadd.vPayTo.value.length < 1)
	{
		alert("Please Enter Payable To?");
		document.frmadd.vPayTo.focus();
		return false;
	}
	if(document.frmadd.vAddress.value.length < 1)
	{
		alert("Please Enter Address");
		document.frmadd.vAddress.focus();
		return false;
	}
	if(document.frmadd.vCity.value.length < 1)
	{
		alert("Please Enter City");
		document.frmadd.vCity.focus();
		return false;
	}
	if(document.frmadd.vState.value.length < 1)
	{
		alert("Please Enter State");
		document.frmadd.vState.focus();
		return false;
	}
	if(document.frmadd.vZip.value.length < 1)
	{
		alert("Please Enter Zip");
		document.frmadd.vZip.focus();
		return false;
	}
	if(document.frmadd.vPhone.value.length < 1)
	{
		alert("Please Enter Phone #");
		document.frmadd.vPhone.focus();
		return false;
	}
	if(document.frmadd.vEmail.value.length < 1)
	{
		alert("Please Enter Email");
		document.frmadd.vEmail.focus();
		return false;
	}
	

	
	// Start Email Validation
	var i;
	var input = document.frmadd.vEmail.value;
	var lenth = input.length ;
	var ctr=0 ;


	if ( ( document.frmadd.vEmail.value.charAt(i) == '!' ) || ( 	document.frmadd.vEmail.value.charAt(i) == '#' ) )
    {
	  alert("Please enter a proper email address") ;
	  document.frmadd.vEmail.focus();
      return false;
    }
	if (input =="")
	{
		alert("Please enter email address") ;
	    document.frmadd.vEmail.focus();
		return false ;
	}
	if(input.length == 40)
	{
		alert("Please enter a proper email address") ;
	    document.frmadd.vEmail.focus();
		return false ;
	}

	for ( i=0; i < lenth; i++ )
	{
		var oneChar = input.charAt(i) ;
		if(oneChar == "@")
		{
			ctr = ctr+1 ;
		}
		if ( (i == 0 && oneChar == "@") || (i == 0 && oneChar == ".") || ( oneChar == " " ) )
		{
			alert ( "This does not seem to be a proper email address" ) ;
	        document.frmadd.vEmail.focus();
			return false ;
		}
		if ( (oneChar == "@" && input.charAt(i+1) == ".") || 
			(oneChar == "." && input.charAt(i+1) == "@") ||
			(oneChar == "." && input.charAt(i+1) == ".") )
		{
			alert ( "This does not seem to be a proper email address" ) ;
	        document.frmadd.vEmail.focus();
			return false ;
		}
		if( input.indexOf("@") < 2 )
		{
			alert ( "This does not seem to be a proper email address" ) ;
	        document.frmadd.vEmail.focus();
			return false ;
		}
		if(input.indexOf(".") < 4)
		{
			alert ( "This does not seem to be a proper email address" ) ;
	        document.frmadd.vEmail.focus();
			return false ;
		}
		if (ctr > 1)
		{
			alert ( "This does not seem to be a proper email address" ) ;
	        document.frmadd.vEmail.focus();
			return false ;
		}
	}	// End Email Validation Script
	if(document.frmadd.vLogin.value.length < 5)
	{
		alert("Please Enter Login of minimum length 5 cahrecters");
		document.frmadd.vLogin.focus();
		return false;
	}

	if(document.frmadd.vPassword.value.length < 5)
	{
		alert("Please Enter Password  of minimum length 5 cahrecters");
		document.frmadd.vPassword.focus();
		return false;
	}
	if(document.frmadd.vCPassword.value.length < 5)
	{
		alert("Please Enter Confirm Password  of minimum length 5 cahrecters");
		document.frmadd.vCPassword.focus();
		return false;
	}
	
	if(document.frmadd.vCPassword.value!=document.frmadd.vPassword.value)
	{
		alert("Password and Confirm password does not match");
		document.frmadd.vPassword.value="";
		document.frmadd.vCPassword.value=""
		document.frmadd.vPassword.focus();
		return false;
	}
	if (document.frmadd.action.value=='Add')
	 {
		if(!(document.frmadd.checkTerm.checked))
		{
			alert("Please accept the terms to complete the registration");
			document.frmadd.checkTerm.focus();
			return false;
		}	
	}		
}

function pollwin()
{
	pollwindow=window.open('','pollwindow','top=0,left=0,status=no,toolbars=no,scrollbars=yes,width=600,height=450,maximize=no,resizable')

}


