function checkValuesTell(){
	var firstName	 = document.TellABTForm.firstName.value;
	if (firstName == null || firstName == "") {
		alert("Please enter your first name.");
		document.TellABTForm.firstName.focus();
		return false;
	}
	var lastName	= document.TellABTForm.lastName.value;
	if (lastName == null || lastName == "") {
		alert("Please enter your last name.");
		document.TellABTForm.lastName.focus();
		return false;
	}
	var userName = document.TellABTForm.userName.value;
	if (userName == null || userName == "") {
		alert("Please enter a name for your new account.");
		document.TellABTForm.userName.focus();
		return false;
	}else { 
		var space1 = 0;
		for(var j=0;j<=userName.length-1;j++) {
			if(userName.charAt(j) == ' ') {
				space1 = 1;
			}
		}
		if(space1 == 1 ) {
			alert("Not a valid sitename.") ;
			return false;
		}
	}
	var strng = document.TellABTForm.userName.value;
	var illegalChars= /[\-\(\)\<\>\{\}\%\~\'\`\$\^\&\*\?\|\@\#\+\!\=\,\;\:\\\/\"\[\]]/ ;
	if (strng.match(illegalChars)) {
		alert("Invalid Account-Name !");
		return false;
	}
	var noofseats = document.TellABTForm.noofseats.value;
	if ( noofseats == null || noofseats  == "" ){
		alert("Number of seats required.");
		document.TellABTForm.noofseats.focus();
		return false;
	}
	if( isNaN(noofseats) ) {
		alert("Only numeric digits are allowed in number of seats.");
		document.TellABTForm.noofseats.focus();
		return false;
	}
	var passWord = document.TellABTForm.passWord.value;
	if (passWord == null || passWord == "") {
		alert("Please enter a password.");
		document.TellABTForm.passWord.focus();
		return false;
	}
	
	if ( passWord.length < 8 ) {
		alert("Password must be atleast 8 characters.");
		document.TellABTForm.passWord.focus();
		return false;
	}
	var rpassWord = document.TellABTForm.rpassWord.value;
	if (rpassWord == null || rpassWord == "") {
		alert("Please enter your password again in the Re-enter Password field.");
		document.TellABTForm.rpassWord.focus();
		return false;
	}
	if (rpassWord != passWord ) {
		alert("Passwords entered do not match; please re-enter the passwords.");
		document.TellABTForm.rpassWord.focus();
		return false;
	}	
	var homeNumber1 = document.TellABTForm.phoneNumber.value;
	if (homeNumber1 == null || homeNumber1 == "") {
		alert("Please enter your current phone number.");
		document.TellABTForm.phoneNumber.focus();
		return false;
	}	
	var emailAddress = document.TellABTForm.emailAddress.value;
	if (emailAddress == null || emailAddress == "") {
		alert("Email addr Address required.");
		document.TellABTForm.emailAddress.focus();
		return false;
	}
	if(!emailCheck(document.TellABTForm.emailAddress.value)) {
		alert("Please enter valid email addr.");
		document.TellABTForm.emailAddress.focus();
		return false;
	}
	var remailAddress = document.TellABTForm.remailAddress.value;
	if (remailAddress == null || remailAddress == "") {
		alert("Retype Email addr Address.");
		document.TellABTForm.remailAddress.focus();
		return false;
	}
	if (emailAddress != remailAddress ) {
		alert("Emails entered did not match.");
		document.TellABTForm.remailAddress.focus();
		return false;
	}
	var provider = document.TellABTForm.provider.value;
	if (provider == null || provider == "") {
		alert("Email addr Address required.");
		document.TellABTForm.provider.focus();
		return false;
	}
	var payccnum = document.TellABTForm.PAY_CCNUM.value;
	if (payccnum == null || payccnum == "") {
		alert("Credit Card Number required.");
		document.TellABTForm.PAY_CCNUM.focus();
		return false;
	}
	if( isNaN(payccnum) ) {
		alert("Credit Card Number must be numeric.");
		document.TellABTForm.PAY_CCNUM.focus();
		return false;
	}
	if ( payccnum.length  < 16 ) {
		alert("Credit Card Number must be greater than 16 digits.");
		document.TellABTForm.PAY_CCNUM.focus();
		return false;
	}
	var cvv = document.TellABTForm.cvv.value;
	if (cvv == null || cvv == "") {
		alert("Credit Card Id required.");
		document.TellABTForm.cvv.focus();
		return false;
	}
	if( isNaN(cvv) ) {
		alert("Credit Card Id must be numeric.");
		document.TellABTForm.cvv.focus();
		return false;
	}
	var payname = document.TellABTForm.PAY_NAME.value;
	if (payname == null || payname == "") {
		alert("Name on Credit Card required.");
		document.TellABTForm.PAY_NAME.focus();
		return false;
	}
	var timeZone = document.TellABTForm.timeZone.value;
	var address1 = document.TellABTForm.address1.value;
	if (address1 == null || address1 == "") {
		alert("Address required.");
		document.TellABTForm.address1.focus();
		return false;
	}
	var city = document.TellABTForm.city.value;
	if ( city == null || city == "") {
		alert("City is required.");
		document.TellABTForm.city.focus();
		return false;
	}

	var shipState = document.TellABTForm.shipState.options[document.TellABTForm.shipState.options.selectedIndex].value;
	if (shipState == "") {
		alert("State required.");
		document.TellABTForm.shipState.focus();
		return false;
	}
	var zip = document.TellABTForm.zip.value;
	if (zip == null || zip == "") {
		alert("ZIP/Postal Code required.");
		document.TellABTForm.zip.focus();
		return false;
	}
	
	var payexpiremonth = document.TellABTForm.PAY_EXPIRE_M.value;
	var payexpireyear = document.TellABTForm.PAY_EXPIRE_Y.value;
	var d = new Date();
	var t_mon = d.getMonth();      // Returns the month as a digit
	var t_year = d.getFullYear();  // Returns 4 digit year
	if ( (payexpireyear < t_year) || ( (payexpireyear == t_year) && (payexpiremonth <= t_mon ))) {
		alert("Your Credit Card expiry date is less than the current date.");
		document.TellABTForm.PAY_EXPIRE_M.focus();
		return false;
    }
	
//	var shipCountry = document.TellABTForm.shipCountry.options[document.TellABTForm.shipCountry.options.selectedIndex].value;
//    var noofphones = document.TellABTForm.noofphones.value;
/*	if (noofphones == null || noofphones == "") {
		alert("Number of phones required.");
		document.TellABTForm.noofphones.focus();
		return false;
	}*/
	
	var term = document.TellABTForm.term.value;
	if(term == "n") {
		alert("Please agree the terms.");
		document.TellABTForm.term.focus();
		return false;
	}

	var objTargetElement = document.TellABTForm.selephones;
	for (ni=0; ni<objTargetElement.length; ni++ ){
		objTargetElement.options[ni].selected = true;
	}
	
//	document.TellABTForm.serverURL.value = document.domain
	return true;
}

function tabmove(object1, object2, objectsize){
    if (object1.value.length == objectsize)
    object2.focus()
  }

function tabmove1(object1, object2,object3, prize){
	object2.value = object1.value * prize;
	object3.value = object1.value * prize;
  }

  	function clearText(obj){		
		if ( navigator.appName == "Netscape" ){
			document.TellABTForm.noofphones.vlaue = "";
		}else if (navigator.appName == "Microsoft Internet Explorer") {
			obj.value = "";
		}
	}

	function toSetmaxlen() {
		var phn = document.TellABTForm.noofphones.value.length;
		if ( phn > 3) {
			alert("specify 4 digit number only.");
			return false;
		}
	}

	function confirmChoice() {
		question = confirm("Are you sure you want to decline the Terms of Service? Click Cancel to continue with registration."); 
		if (question == true) { 
			location='/index.html'; 
		}else{
			document.TellABTForm.term.checked = true;
		}
	}

	function ClearForm() {
		document.TellABTForm.firstName.value = "";
		document.TellABTForm.lastName.value = "";
		document.TellABTForm.userName.value = "";
		document.TellABTForm.noofseats.value = "";
		document.TellABTForm.passWord.value = "";
		document.TellABTForm.rpassWord.value = "";
		document.TellABTForm.phoneNumber.value = "";
		document.TellABTForm.emailAddress.value = "";
		document.TellABTForm.remailAddress.value = "";
		document.TellABTForm.provider.value = "";
		document.TellABTForm.timeZone.value = "";
		document.TellABTForm.address1.value = "";
		document.TellABTForm.city.value = "";
		document.TellABTForm.shipState.value = "";
		document.TellABTForm.zip.value = "";
		document.TellABTForm.PAY_CCNUM.value = "";
		document.TellABTForm.cvv.value = "";
		document.TellABTForm.PAY_NAME.value = "";
		document.TellABTForm.noofphones.value = "";
		document.TellABTForm.selephones.value = "";
		document.TellABTForm.firstName.focus();
	return false;
}

function checkvalid(){
	var accname = document.form1.accountname.value;
	if (accname == null || accname == "") {
		alert("Account Name required.");
		document.form1.accountname.focus();
		return false;
	}
	return true;
}

function emailCheck(emailStr)
{
    var emailPat=/^(.+)@(.+)$/;
    var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]";
    var validChars="\[^\\s" + specialChars + "\]";
    var quotedUser="(\"[^\"]*\")";
    var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
    var atom=validChars + '+';
    var word="(" + atom + "|" + quotedUser + ")";
    var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
    var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

    var matchArray=emailStr.match(emailPat);
    if (matchArray==null) {
	return false;
    }
    var user=matchArray[1];
    var domain=matchArray[2];
    if (user.match(userPat)==null) {
	return false;
    }
    var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
	    for (var i=1;i<=4;i++) {
		if (IPArray[i]>255) {
		    return false;
		}
	    }
	    return true;
	}
    var domainArray=domain.match(domainPat)
	if (domainArray==null) {
	    return false;
	}
    var atomPat=new RegExp(atom,"g");
    var domArr=domain.match(atomPat);
    var len=domArr.length;
    if (domArr[domArr.length-1].length<2 ||
	    domArr[domArr.length-1].length>4) {
	return false;
    }
    if (len<2) {
	return false;
    }
    return true;
}

/*  Sign-up Pages Validations  12/17/2005*/
function formValidations1() {
/*	var firstName	 = document.form1.firstName.value;
	if (firstName == null || firstName == "") {
		alert("First Name required.");
		document.form1.firstName.focus();
		return false;
	}
	var lastName	= document.form1.lastName.value;
	if (lastName == null || lastName == "") {
		alert("Last Name required.");
		document.form1.lastName.focus();
		return false;
	}
	var userName = document.form1.userName.value;
	if (userName == null || userName == "") {
		alert("Account Name required.");
		document.form1.userName.focus();
		return false;
	}else { 
		var space1 = 0;
		for(var j=0;j<=userName.length-1;j++) {
			if(userName.charAt(j) == ' ') {
				space1 = 1;
			}
		}
		if(space1 == 1 ) {
			alert("Not a valid sitename.") ;
			return false;
		}
	}
	var strng = document.form1.userName.value;
	var illegalChars= /[\-\(\)\<\>\{\}\%\~\'\`\$\^\&\*\?\|\@\#\+\!\=\,\;\:\\\/\"\[\]]/ ;
	if (strng.match(illegalChars)) {
		alert("Invalid Account-Name !");
		return false;
	}
	var noofseats = document.form1.noofseats.value;
	if ( noofseats == null || noofseats  == "" ){
		alert("Number of seats required.");
		document.form1.noofseats.focus();
		return false;
	}
	if( isNaN(noofseats) ) {
		alert("Number of Seats must be in numeric.");
		document.form1.noofseats.focus();
		return false;
	}*/
	
	var passWord = document.form1.passWord.value;
	if (passWord == null || passWord == "") {
		alert("Please enter a password.");
		document.form1.passWord.focus();
		return false;
	}
	if ( passWord.length < 6 ) {
		alert("Password must be atleast 6 characters.");
		document.form1.passWord.focus();
		return false;
	}
     var illegalQuotes = /[\'\"]/;
	if (passWord.match(illegalQuotes)) {
			alert("Quotes are not allowed in password.");
			document.form1.passWord.focus();			
			return false;
	}	
	var rpassWord = document.form1.rpassWord.value;
	if (rpassWord == null || rpassWord == "") {
		alert("Please enter your password again in the Re-enter Password field.");
		document.form1.rpassWord.focus();
		return false;
	}
	if (rpassWord != passWord ) {
		alert("Passwords entered do not match; please re-enter the passwords.");
		document.form1.rpassWord.focus();
		return false;
	}	
	/*var homeNumber1 = document.form1.phoneNumber.value;
	if (homeNumber1 == null || homeNumber1 == "") {
		alert("Phone number required.");
		document.form1.phoneNumber.focus();
		return false;
	}	*/
	var emailAddress = document.form1.emailAddress.value;
	if (emailAddress == null || emailAddress == "") {
		alert("Please enter your email address.");
		document.form1.emailAddress.focus();
		return false;
	}
	if(!emailCheck(document.form1.emailAddress.value)) {
		alert("Please enter a valid email address.");
		document.form1.emailAddress.focus();
		return false;
	}
	var remailAddress = document.form1.remailAddress.value;
	if (remailAddress == null || remailAddress == "") {
		alert("Please enter your email address again in the Re-enter Email field.");
		document.form1.remailAddress.focus();
		return false;
	}
	if (emailAddress != remailAddress ) {
		alert("Email addresses entered do not match; please re-enter the email addreses.");
		document.form1.remailAddress.focus();
		return false;
	}
	return true;
}

function formValidations2() {
	var payccnum = document.form2.PAY_CCNUM.value;
	if (payccnum == null || payccnum == "") {
		alert("Credit Card Number required.");
		document.form2.PAY_CCNUM.focus();
		return false;
	}
	if( isNaN(payccnum) ) {
		alert("Credit Card Number must be numeric.");
		document.form2.PAY_CCNUM.focus();
		return false;
	}
	if ( payccnum.length  < 16 ) {
		alert("Credit Card Number must be greater than 16 digits.");
		document.form2.PAY_CCNUM.focus();
		return false;
	}
	var cvv = document.form2.cvv.value;
	if (cvv == null || cvv == "") {
		alert("Credit Card Id required.");
		document.form2.cvv.focus();
		return false;
	}
	if( isNaN(cvv) ) {
		alert("Credit Card Id must be numeric.");
		document.form2.cvv.focus();
		return false;
	}
	var payname = document.form2.PAY_NAME.value;
	if (payname == null || payname == "") {
		alert("Name on Credit Card required.");
		document.form2.PAY_NAME.focus();
		return false;
	}
	var address1 = document.form2.address1.value;
	if (address1 == null || address1 == "") {
		alert("Address required.");
		document.form2.address1.focus();
		return false;
	}
	var city = document.form2.city.value;
	if ( city == null || city == "") {
		alert("City is required.");
		document.form2.city.focus();
		return false;
	}

	var shipState = document.form2.shipState.options[document.form2.shipState.options.selectedIndex].value;
	if (shipState == "") {
		alert("State required.");
		document.form2.shipState.focus();
		return false;
	}
	var zip = document.form2.zip.value;
	if (zip == null || zip == "") {
		alert("ZIP/Postal Code required.");
		document.form2.zip.focus();
		return false;
	}
	return true;
}

	function confirmChoice1() {
		question = confirm("Are you sure you want to decline the Terms of Service? Click Cancel to continue with registration."); 
		if (question == true) { 
			location='/index.html'; 
		}else{
			document.form3.term.checked = true;
		}
	}

	function confirmChoice2() {
		if( document.subscribe.term.checked == false ) {
			question = confirm("Are you sure you want to decline the Terms of Service? Click Cancel to continue with subscription."); 
			if (question == true) { 
				location='/index.html'; 
			}else{
				document.subscribe.term.checked = true;
			}
		}
	}

function validateCard(){		
	document.form2.method = "POST";
	document.form2.action = "http://192.168.68.20:8080/YourPay/freetrailauthentication.jsp";
	document.form2.submit();
}

function gotoBackpage1() {
	document.form2.action = "freetrialone.jsp";
	document.form2.submit();
}

function gotosignupBackpage1() {
	document.form2.action = "signupone.jsp";
	document.form2.submit();
}

function gotoBackpage2() {
	document.form3.action = "freetrialtwo.jsp";
	document.form3.submit();
}

function gotosignupBackpage2() {
	document.form3.action = "signuptwo.jsp";
	document.form3.submit();
}

function selectphonenumbers() {
	var objTargetElement = document.form3.selephones;
	for (ni=0; ni<objTargetElement.length; ni++ ){
		objTargetElement.options[ni].selected = true;
	}
}

