if (parent.frames.length > 0) 
{
parent.location.href = location.href;
}

function Loading() {
	document.getElementById("loading").style.display="none"
}

function _goto( f )
{
    var baseurl = "";
    selecteditem = f.selectedIndex ;
    newurl = f.options[ selecteditem ].value ;
    if (newurl.length != 0) {
      location.href = baseurl + newurl ;
    }
}

function ChangePic(controlName,PicName)
{
	document.images[controlName].src = PicName	
}

function pop_up(url,wp,hp) {
var w = 480, h = 340;
if (document.all) {
   w = document.body.clientWidth;
   h = document.body.clientHeight;
}
else if (document.layers) {
   w = window.innerWidth;
   h = window.innerHeight;
}
else {
   w = window.innerWidth;
   h = window.innerHeight;	
}
var popW = wp, popH = hp;
var leftPos = (w-popW)/2, topPos = (h-popH)/2;
window.open(url,'popup','width='+popW+',height='+popH+',top='+topPos+',scrollbars=yes,resizable=yes,menubar=no,left='+leftPos);

//height=200,width=215,scrollbars=no,resizable=yes,toolbar=no,menubar=no
}

function Launch(url,n,w,h) {
   lWin=window.open(url,n,"menubar=no,scrollbars=no,status=no,width="+w+",height="+h+",top=300,left=300")
}

function LaunchScrl(url,n,w,h) {
   lWin=window.open(url,n,"menubar=no,scrollbars=yes,status=no,width="+w+",height="+h+",top=300,left=300")
}

function validEmail(name) {
	if (name=="")
		return false;
	
	var badchars="<> ;,'!#$%^&*()+=";
	for (var i=0; i < name.length; i++) {
		temp = "" +name.substring(i, i+1);
		if (badchars.indexOf(temp) != -1) {
			return false;
		}
	}
	var arr;
	arr = name.split('@');

	// check for 1 and only 1 @ sign
	if (arr.length != 2)
		return false;
		
	// check for blank before or after @
	if ((arr[0] == "") || (arr[1] == ""))
		return false;
		
	// check for dot at first or last position
	if ((arr[1].charAt(0) == '.') || (arr[1].charAt(arr[1].length-1) == '.'))
			return false;
			
	if ((arr[0].charAt(0) == '.') || (arr[0].charAt(arr[0].length-1) == '.'))
			return false;
			
	// check to make sure top level domain > 1 char					
	if ((arr[1].indexOf('.') > arr[1].length-3) || (arr[1].indexOf('.') == -1))
			return false;
		
	// check for ..
	if (name.indexOf("..") > 0)
		return false;

	return true;
}

	function submitItPrepaid(){
		bool = verifyCC2();
		if(bool){
			document.frmOrder.submit();
		}
	}
	function submitItRecharge(){
		bool = verifyCC4();
		if(bool){
			document.frmOrder.submit();
		}
	}
	function submitItVipRecharge(){
		bool = verifyCCvipRec();
		if(bool){
			alert("Please note that the charge will show under www.PPoutlet.com on your credit card statement");
			document.frmOrder.submit();
		}
	}
	function submitItCrepin(){
		bool = verifyCC5();
		if(bool){
			document.frmOrder.submit();
		}
	}
	function submitItApi(){
		bool = verifyCC3();
		if(bool){
			document.frmOrder.submit();
		}
	}
	function submitItVip(){
		bool = verifyCCvip();
		if(bool){
			document.frmOrder.submit();
		}
	}
	function submitItVipCre(){
		bool = verifyCCvipCre();
		if(bool){
			document.frmOrder.submit();
		}
	}
	function submitIt(){
		bool = verifyCC();
		if(bool){		
			document.frmOrder.submit();
		}
	}
	function submitItAge(){
		bool = verifyCCAge();
		if(bool){
			document.frmOrder.submit();
		}
	}
	function submitLogin()
	{
	    bool = verifyLogin();
		if(bool){
			document.frmLogin.submit();
		}
	}
	function verifyLogin()
	{
	    var err;
	    err="";
	    Uname = document.frmLogin.txtUid.value;
		pwd = document.frmLogin.txtPwd.value;
		if(Uname=="")
		{
		    err=err+"\n - Username field cannot be blank.";
			ccOK = false;
		}
		if(pwd=="")
		{
		    err=err+"\n - Password field cannot be blank.";
			ccOK = false;
		}
		if(err!="")
		{
		    alert ("\nThe following error(s) occurred:\n"+err);
			return false;
		}
		else
		{
		    return true;
		}
	}
	function verifyCCAge(){
	    var err;
		var thedate = new Date();
		themonth = thedate.getMonth();
		theyear = thedate.getYear();
		FName = document.frmOrder.txtFName.value;
		LName = document.frmOrder.txtLName.value;
		uid = document.frmOrder.txtUid.value;
		pwd1 = document.frmOrder.txtPwd1.value;
		pwd2 = document.frmOrder.txtPwd2.value;
		addr = document.frmOrder.txtAddr1.value;
		city = document.frmOrder.txtCity.value;
		state = document.frmOrder.selState.options[document.frmOrder.selState.selectedIndex].value;
		zip = document.frmOrder.txtZip.value;
		hPh = document.frmOrder.txtPhH.value;
		email = document.frmOrder.txtEmail.value;		
		
		err="";
		if ((FName.length<1)||(LName.length<1)) {
			err=err+"\n - Name fields cannot be blank.";
			ccOK = false;
		}

		if (uid=="") {
			err=err+"\n - Username field cannot be blank.";
			ccOK = false;
		}

		// check passwords
		if ((pwd1=="")||(pwd2=="")) {
			err=err+"\n - Password fields cannot be blank.";
			ccOK = false;
		}
		else {
		if (pwd1!=pwd2) {
			err=err+"\n - Password fields do not match.";
			ccOK = false;
		}
		}
		if (addr=="") {
			err=err+"\n - Street Address field cannot be blank.";
			ccOK = false;
		}
		if (city=="") {
			err=err+"\n - City field cannot be blank.";
			ccOK = false;
		}			
		
		if (state=="") {
			err=err+"\n - State field cannot be blank.";
			ccOK = false;
		}

		if (zip=="") {
			err=err+"\n - Zip / Postal Code field cannot be blank.";
			ccOK = false;
		}

		if (!CheckPhoneNumber(hPh)) {
			err=err+"\n - Home Phone field is invalid.";
			ccOK = false;
		}
		if (!validEmail(email)) {
			err=err+"\n - Email field is invalid.";
			ccOK = false;
		}
		
		if (err!="") {
			alert ("\nThe following error(s) occurred:\n"+err);
			return false;
		}
		
			
		else {
			return true;
		}
		
		
	}//End funct
	function verifyCC(){
	    var err="";
		var thedate = new Date();
		themonth = thedate.getMonth();
		theyear = thedate.getYear();
		FName = document.frmOrder.txtFName.value;
		LName = document.frmOrder.txtLName.value;
		//uid = document.frmOrder.txtUid.value;
		pwd1 = document.frmOrder.txtPwd1.value;
		pwd2 = document.frmOrder.txtPwd2.value;
		addr = document.frmOrder.txtAddr1.value;
		city = document.frmOrder.txtCity.value;
		state = document.frmOrder.selState.options[document.frmOrder.selState.selectedIndex].value;
		zip = document.frmOrder.txtZip.value;
		hPh = document.frmOrder.txtPhH.value;
		email = document.frmOrder.txtEmail.value;
		email2 = document.frmOrder.txtCEmail.value;
		number = document.frmOrder.number.value;
		verify= document.frmOrder.txtverify.value;
		//alert(email2);
		
		if ((FName.length<1)||(LName.length<1)) {
			err=err+"\n - Name fields cannot be blank.";
			ccOK = false;
		}
		
		if ((pwd1=="")) {
			err=err+"\n - Password fields cannot be blank.";
			ccOK = false;
		}
		if (pwd1!=pwd2) {
			err=err+"\n - Password fields do not match.";
			ccOK = false;
		}
		if (addr=="") {
			err=err+"\n - Street Address field cannot be blank.";
			ccOK = false;
		}
		if (city=="") {
			err=err+"\n - City field cannot be blank.";
			ccOK = false;
		}			
		
		if (state=="") {
			err=err+"\n - State field cannot be blank.";
			ccOK = false;
		}

		if (zip=="") {
			err=err+"\n - Zip / Postal Code field cannot be blank.";
			ccOK = false;
		}

		if (!CheckPhoneNumber(hPh)) {
			err=err+"\n - Home Phone field is invalid.";
			ccOK = false;
		}
		if (!validEmail(email)) {
			err=err+"\n - Email field is invalid.";
			ccOK = false;
		}
		if (email!=email2) {
			err=err+"\n - Email fields do not match.";
			ccOK = false;
		}
		if(verify==""){
		err=err+"\n - Please enter verification code.";
			ccOK = false;}
			
			if(verify!="")			{                            
                if (document.frmOrder.textfield2.value!=verify.toLowerCase())             
                {	
                    err=err+"\n - Please enter correct verification code.";
			        ccOK = false;	
                }
	        }
	
		if (err!="") {
			alert ("\nThe following error(s) occurred:\n"+err);
			return false;
		}
		if(number!="")
		{
		     if (!isValidCreditCardNumber(document.frmOrder.number,cardtype,'Credit Card Number', true))
		     {
  	    	    err=err+"\n - Credit Card Number is invalid.";
                return false
             }
             else
             {
		        return true;
		     }
		}
		else {
			return true;
		}
		
		
	}//End funct
function ccCheck() {
   var err="";
   bname = document.frmOrder.bname.value;
   baddr1 = document.frmOrder.baddr1.value;
   bcity = document.frmOrder.bcity.value;
   email = document.frmOrder.bemail.value;
   orderTotal = document.frmOrder.chargetotal.value;
   totalAll = document.frmOrder.totalall.value;
   totalToday = document.frmOrder.totaltoday.value;
   view_help = document.frmOrder.view_help.value;
   cnumber=document.frmOrder.cardnumber.value;
   orderTotal = orderTotal - 0;
	
	if ((bname==" ")||(bname=="")) {
		err=err+"\n - First and Last Name fields cannot be blank.";
		ccOK = false;
	}
	if (baddr1=="") {
		err=err+"\n - Address field cannot be blank.";
		ccOK = false;
	}
	if (bcity=="") {
		err=err+"\n - City field cannot be blank.";
		ccOK = false;
	}
	if (!validEmail(email)) {
		err=err+"\n - Email field is invalid.";
		ccOK = false;
	}
	if(orderTotal < 1){
		err=err+"\n - Your shopping cart is empty.";
	}
	if(orderTotal > 200){
		err=err+"\n - The daily order limit is $200.00      ";
	}

	if ((totalToday > 200)||(totalAll > 200)) {
		err=err+"\n - There is a purchase limit of $200.00 per day. Please try again tomorrow or try selecting fewer cards.";
	}
	if(cnumber=="")
	{
		err=err+"\n - Credit card number missing      ";
		ccOK = false;
	}
//	if (view_help=="") {
//		err=err+"\n - Please read the Security Settings by clicking Help at the top of the page to continue.";
//	}
   if (err!="") {
		alert ("\nThe following error(s) occurred:\n"+err+"\n");
		return false;
	}
	else {
		return true;
		
	}
}

function CheckPhoneNumber(TheNumber) {
	var valid = 1
	var GoodChars = "0123456789()-+ "
	var i = 0
	if (TheNumber=="") {
		// Return false if number is empty
		valid = 0
	}
	for (i =0; i <= TheNumber.length -1; i++) {
		if (GoodChars.indexOf(TheNumber.charAt(i)) == -1) {
// Note: Remove the comments from the following line to see this
// for loop in action.
// alert(TheNumber.charAt(i) + " is no good.")
			valid = 0
		} // End if statement
	} // End for loop
	return valid
}

//-------------------------------------------------------------------------------------

// whitespace characters
var whitespace = " \t\n\r";

// Check whether string s is empty.

function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}


expireDate = new Date("January 01, 2006 00:00:00");
function setCookie(name, value, expire) 
{
    strCookie = name + "=" + escape(value);
    if (expire)
        strCookie += "; expires=" + expire.toGMTString();

    document.cookie = strCookie;
}

// Returns true if string s is empty or 
// whitespace characters only.

function isSpace (s)

{   var i;

    // Is s empty?
    if (isEmpty(s)) return true;

    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);

        if (whitespace.indexOf(c) == -1) return false;
    }

    // All characters are whitespace.
    return true;
}

function xMerchant() {
	alert("\nYour credit card information will now be sent for processing.\n\nPlease do not click the back button or close your browser\nuntil your transaction is processed. Please be patient until your \ntransaction is processed. This may take several minutes.")
}

function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}



function verifyCC2(){
	var thedate = new Date();
	themonth = thedate.getMonth();
	theyear = thedate.getYear();
	phone = document.frmOrder.txtANIPhone.value;
	//pwd1 = document.frmOrder.txtANIPassword1.value;
	//pwd2 = document.frmOrder.txtANIPassword2.value;
	fname = document.frmOrder.txtFName.value;
	lname = document.frmOrder.txtLName.value;

	addr1 = document.frmOrder.txtAddr1.value;
	city = document.frmOrder.txtCity.value;
	state = document.frmOrder.selState.options[document.frmOrder.selState.selectedIndex].value;
	zip = document.frmOrder.txtZip.value;
	email = document.frmOrder.txtEmail.value;
	cardnumber = document.frmOrder.cardnumber.value;
    cardtype = document.frmOrder.card;
    sale_amount = document.frmOrder.sale_amount.options[document.frmOrder.sale_amount.selectedIndex].value;

	err="";
	if (!CheckPhoneNumber(phone)) {
		err=err+"\n - Phone Number field is missing or invalid.";
		ccOK = false;
	}

	/* check passwords
	if ((pwd1.length<=7)||(pwd2.length<7)) {
		err=err+"\n - Password is less than 7 characters long.";
		ccOK = false;
	}	
	else {
	    if (pwd1!=pwd2) {
		    err=err+"\n - Password fields do not match.";
		    ccOK = false;
	    }
	}
	*/
	if (!validEmail(email)) {
		err=err+"\n - Email Address field is missing or invalid.";
		ccOK = false;
	}
	
	if ((fname.length<1)||(lname.length<1)) {
		err=err+"\n - Name fields cannot be blank.";
		ccOK = false;
	}


	if (addr1=="") {
		err=err+"\n - Street Address field cannot be blank.";
		ccOK = false;
	}
	if (city=="") {
		err=err+"\n - City field is missing or invalid.";
		ccOK = false;
	}			
	
	if (state=="") {
		err=err+"\n - State field is missing or invalid.";
		ccOK = false;
	}

	if (zip=="") {
		err=err+"\n - Zip / Postal Code is missing or invalid.";
		ccOK = false;
	}
    if (sale_amount=="0") {
		err=err+"\n - Charge Amount is missing or invalid.";
		ccOK = false;
    
    }

	if (err!="") {
		alert ("\nThe following error(s) occurred:\n"+err);
		return false;
	}
	else {
	    if (sale_amount!="2") {
            if (!isValidCreditCardNumber(document.frmOrder.cardnumber,cardtype,'Credit Card Number', true))
  	    ///	err=err+"\n - Credit Card Number is missing or invalid.";
                return false
            else
		        return true;
		}   
		else {
		     return true;
		}
		
	}
	
	
}//End funct
function verifyCC3(){
	var thedate = new Date();
	themonth = thedate.getMonth();
	theyear = thedate.getYear();
	phone = document.frmOrder.txtANIPhone.value;
	usrname = document.frmOrder.txtUsername.value;
	pwd1 = document.frmOrder.txtANIPassword1.value;
	pwd2 = document.frmOrder.txtANIPassword2.value;
	fname = document.frmOrder.txtFName.value;
	lname = document.frmOrder.txtLName.value;
	email_error = document.getElementById('divEmail').innerHTML;
	addr1 = document.frmOrder.txtAddr1.value;
	city = document.frmOrder.txtCity.value;
	state = document.frmOrder.selState.options[document.frmOrder.selState.selectedIndex].value;
	zip = document.frmOrder.txtZip.value;
	email = document.frmOrder.txtEmail.value;
	cardnumber = document.frmOrder.cardnumber.value;
    cardtype = document.frmOrder.card;
    sale_amount = document.frmOrder.sale_amount.options[document.frmOrder.sale_amount.selectedIndex].value;

	err="";
	if (!CheckPhoneNumber(phone)) {
		err=err+"\n - Phone Number field is missing or invalid.";
		ccOK = false;
	}
	/*if (usrname=="") {
		err=err+"\n - Username field is missing.";
		ccOK = false;
	}*/
	//check passwords
	if ((pwd1.length<=5)||(pwd2.length<5)) {
		err=err+"\n - Password is less than 6 characters long.";
		ccOK = false;
	}	
	else {
	    if (pwd1!=pwd2) {
		    err=err+"\n - Password fields do not match.";
		    ccOK = false;
	    }
	}
	
	if (!validEmail(email)) {
		err=err+"\n - Email Address field is missing or invalid.";
		ccOK = false;
	}
	if (email_error != "") {
		err=err+"\n - Email address is already taken.";
		ccOK = false;
	}
	
	if ((fname.length<1)||(lname.length<1)) {
		err=err+"\n - Name fields cannot be blank.";
		ccOK = false;
	}


	if (addr1=="") {
		err=err+"\n - Street Address field cannot be blank.";
		ccOK = false;
	}
	if (city=="") {
		err=err+"\n - City field is missing or invalid.";
		ccOK = false;
	}			
	
	if (state=="") {
		err=err+"\n - State field is missing or invalid.";
		ccOK = false;
	}

	if (zip=="") {
		err=err+"\n - Zip / Postal Code is missing or invalid.";
		ccOK = false;
	}
    if (sale_amount=="0") {
		err=err+"\n - Charge Amount is missing or invalid.";
		ccOK = false;
    
    }

	if (err!="") {
		alert ("\nThe following error(s) occurred:\n"+err);
		return false;
	}
	else {
	    if (sale_amount!="trial") {
            if (!isValidCreditCardNumber(document.frmOrder.cardnumber,cardtype,'Credit Card Number', true))
  	    ///	err=err+"\n - Credit Card Number is missing or invalid.";
                return false
            else
		        return true;
		}   
		else {
		     return true;
		}
		
	}
	
	
}//End funct
function verifyCCvip(){
	
	var thedate = new Date();
	themonth = thedate.getMonth();
	theyear = thedate.getYear();
	phone = document.frmOrder.txtANIPhone.value;
	usrname = document.frmOrder.txtUsername.value;
	pwd1 = document.frmOrder.txtANIPassword1.value;
	pwd2 = document.frmOrder.txtANIPassword2.value;
	fname = document.frmOrder.txtFName.value;
	lname = document.frmOrder.txtLName.value;
	email_error = document.getElementById('divEmail').innerHTML;
	addr1 = document.frmOrder.txtAddr1.value;
	city = document.frmOrder.txtCity.value;
	state = document.frmOrder.selState.options[document.frmOrder.selState.selectedIndex].value;
	zip = document.frmOrder.txtZip.value;
	email = document.frmOrder.txtEmail.value;
	cardnumber = document.frmOrder.cardnumber.value;
    cardtype = document.frmOrder.card;
    sale_amount = document.frmOrder.sale_amount.options[document.frmOrder.sale_amount.selectedIndex].value;
	
	
	err="";
	if (phone=="") {
		err=err+"\n - Phone Number field is missing or invalid.";
		ccOK = false;
	}
	if (isNaN(phone)) {
		err=err+"\n - Phone Number field is missing or invalid.";
		ccOK = false;
	}
	/*if (usrname=="") {
		err=err+"\n - Username field is missing.";
		ccOK = false;
	}*/
	//check passwords
	if ((pwd1.length<=5)||(pwd2.length<5)) {
		err=err+"\n - Password is less than 6 characters long.";
		ccOK = false;
	}	
	else {
	    if (pwd1!=pwd2) {
		    err=err+"\n - Password fields do not match.";
		    ccOK = false;
	    }
	}
	
	if (!validEmail(email)) {
		err=err+"\n - Email Address field is missing or invalid.";
		ccOK = false;
	}
	if (email_error != "") {
		err=err+"\n - Email address is already taken.";
		ccOK = false;
	}
	
	if ((fname.length<1)||(lname.length<1)) {
		err=err+"\n - Name fields cannot be blank.";
		ccOK = false;
	}


	if (addr1=="") {
		err=err+"\n - Street Address field cannot be blank.";
		ccOK = false;
	}
	if (city=="") {
		err=err+"\n - City field is missing or invalid.";
		ccOK = false;
	}			
	
	if (state=="") {
		err=err+"\n - State field is missing or invalid.";
		ccOK = false;
	}

	if (zip=="") {
		err=err+"\n - Zip / Postal Code is missing or invalid.";
		ccOK = false;
	}
    if (sale_amount=="0") {
		err=err+"\n - Charge Amount is missing or invalid.";
		ccOK = false;
    
    }

	if (err!="") {
		alert ("\nThe following error(s) occurred:\n"+err);
		return false;
	}
	else {
	    if (sale_amount!="trial") {
            if (!isValidCreditCardNumber(document.frmOrder.cardnumber,cardtype,'Credit Card Number', true))
  	    ///	err=err+"\n - Credit Card Number is missing or invalid.";
                return false
            else
		        return true;
		}   
		else {
		     return true;
		}
		
	}
	
	
}//End funct
function verifyCCvipCre(){
	
	var thedate = new Date();
	themonth = thedate.getMonth();
	theyear = thedate.getYear();
	//phone = document.frmOrder.txtANIPhone.value;
	fname = document.frmOrder.txtFName.value;
	lname = document.frmOrder.txtLName.value;

	addr1 = document.frmOrder.txtAddr1.value;
	city = document.frmOrder.txtCity.value;
	state = document.frmOrder.selState.options[document.frmOrder.selState.selectedIndex].value;
	zip = document.frmOrder.txtZip.value;
	email = document.frmOrder.txtEmail.value;
	cardnumber = document.frmOrder.cardnumber.value;
    cardtype = document.frmOrder.card;
    sale_amount = document.frmOrder.sale_amount.options[document.frmOrder.sale_amount.selectedIndex].value;
	
	
	err="";
	
	if ((fname.length<1)||(lname.length<1)) {
		err=err+"\n - Name fields cannot be blank.";
		ccOK = false;
	}


	if (addr1=="") {
		err=err+"\n - Street Address field cannot be blank.";
		ccOK = false;
	}
	if (city=="") {
		err=err+"\n - City field is missing or invalid.";
		ccOK = false;
	}			
	
	if (state=="") {
		err=err+"\n - State field is missing or invalid.";
		ccOK = false;
	}

	if (zip=="") {
		err=err+"\n - Zip / Postal Code is missing or invalid.";
		ccOK = false;
	}
    if (sale_amount=="0") {
		err=err+"\n - Charge Amount is missing or invalid.";
		ccOK = false;
    
    }

	if (err!="") {
		alert ("\nThe following error(s) occurred:\n"+err);
		return false;
	}
	else {
	    if (sale_amount!="trial") {
            if (!isValidCreditCardNumber(document.frmOrder.cardnumber,cardtype,'Credit Card Number', true))
  	    ///	err=err+"\n - Credit Card Number is missing or invalid.";
                return false
            else
		        return true;
		}   
		else {
		     return true;
		}
		
	}
	
	
}//End funct
function verifyCC4(){
	var thedate = new Date();
	themonth = thedate.getMonth();
	theyear = thedate.getYear();
	//phone = document.frmOrder.txtANIPhone.value;
	fname = document.frmOrder.txtFName.value;
	lname = document.frmOrder.txtLName.value;
	addr1 = document.frmOrder.txtAddr1.value;
	city = document.frmOrder.txtCity.value;
	state = document.frmOrder.selState.options[document.frmOrder.selState.selectedIndex].value;
	zip = document.frmOrder.txtZip.value;
	email = document.frmOrder.txtEmail.value;
	cardnumber = document.frmOrder.cardnumber.value;
    cardtype = document.frmOrder.card.value;
    sale_amount = document.frmOrder.sale_amount.options[document.frmOrder.sale_amount.selectedIndex].value;
	pin = document.frmOrder.selPinNumber.value;	
	expmonth=document.frmOrder.expmth.value;
    expyear=document.frmOrder.expyr.value;
	err="";
	
	if (pin == "0") {
		err=err+"\n - Pin Number field is missing or invalid.";
		ccOK = false;
	}
	
	
    if (sale_amount=="0") {
		err=err+"\n - Charge Amount is missing or invalid.";
		ccOK = false;
    
    }

	if (err!="") {
		alert ("\nThe following error(s) occurred:\n"+err);
		return false;
	}
	
	else {
	    if (!isValidCreditCardNumber(document.frmOrder.cardnumber,cardtype,'Credit Card Number', true))
  	        {
  	    	    err=err+"\n - Credit Card Number is invalid.";
                return false
             }
             else
             {
                if(!isValidExpDate1(expmonth,expyear,'Credit Card Expiration Date',true))
		          return false;
		        else
		       return true;
		     }
		
	}
	
	
}//End funct
function verifyCCvipRec(){
	var thedate = new Date();
	themonth = thedate.getMonth();
	theyear = thedate.getYear();
	//pwd1 = document.frmOrder.txtANIPassword1.value;
	//pwd2 = document.frmOrder.txtANIPassword2.value;
	fname = document.frmOrder.txtFName.value;
	lname = document.frmOrder.txtLName.value;

	addr1 = document.frmOrder.txtAddr1.value;
	city = document.frmOrder.txtCity.value;
	state = document.frmOrder.selState.options[document.frmOrder.selState.selectedIndex].value;
	zip = document.frmOrder.txtZip.value;
	email = document.frmOrder.txtEmail.value;
	cardnumber = document.frmOrder.cardnumber.value;
    cardtype = document.frmOrder.card;
    sale_amount = document.frmOrder.sale_amount.options[document.frmOrder.sale_amount.selectedIndex].value;
	pin = document.frmOrder.selPin.value;	
	err="";
	

	if (pin == "0") {
		err=err+"\n - Pin Number field is missing or invalid.";
		ccOK = false;
	}
	
    if (sale_amount=="0") {
		err=err+"\n - Recharge Amount is missing or invalid.";
		ccOK = false;
    
    }
	if ((fname.length<1)||(lname.length<1)) {
		err=err+"\n - Name fields cannot be blank.";
		ccOK = false;
	}


	if (addr1=="") {
		err=err+"\n - Street Address field cannot be blank.";
		ccOK = false;
	}
	if (city=="") {
		err=err+"\n - City field is missing or invalid.";
		ccOK = false;
	}			
	
	if (state=="") {
		err=err+"\n - State field is missing or invalid.";
		ccOK = false;
	}

	if (zip=="") {
		err=err+"\n - Zip / Postal Code is missing or invalid.";
		ccOK = false;
	}
	

	if (err!="") {
		alert ("\nThe following error(s) occurred:\n"+err);
		return false;
	}
	else {
	    if (sale_amount!="2") {
            if (!isValidCreditCardNumber(document.frmOrder.cardnumber,cardtype,'Credit Card Number', true))
  	    ///	err=err+"\n - Credit Card Number is missing or invalid.";
                return false
            else
		        return true;
		}   
		else {
		     return true;
		}
		
	}
	
	
}//End funct
function verifyCC5(){
	var thedate = new Date();
	themonth = thedate.getMonth();
	theyear = thedate.getYear();
	phone = document.frmOrder.txtANIPhone.value;
	//pwd1 = document.frmOrder.txtANIPassword1.value;
	//pwd2 = document.frmOrder.txtANIPassword2.value;
	fname = document.frmOrder.txtFName.value;
	lname = document.frmOrder.txtLName.value;

	addr1 = document.frmOrder.txtAddr1.value;
	city = document.frmOrder.txtCity.value;
	state = document.frmOrder.selState.options[document.frmOrder.selState.selectedIndex].value;
	zip = document.frmOrder.txtZip.value;
	email = document.frmOrder.txtEmail.value;
	cardnumber = document.frmOrder.cardnumber.value;
    cardtype = document.frmOrder.card.value;
    sale_amount = document.frmOrder.sale_amount.options[document.frmOrder.sale_amount.selectedIndex].value;
    expmonth=document.frmOrder.expmth.value;
    expyear=document.frmOrder.expyr.value;
	err="";
	
    if (sale_amount=="0") {
		err=err+"\n - Charge Amount is missing or invalid.";
		ccOK = false;
    
    }

	if (err!="") {
		alert ("\nThe following error(s) occurred:\n"+err);
		return false;
	}
	else {
	   if (!isValidCreditCardNumber(document.frmOrder.cardnumber,cardtype,'Credit Card Number', true))
  	        {
  	    	    err=err+"\n - Credit Card Number is invalid.";
                return false
             }
             else
             {
                if(!isValidExpDate1(expmonth,expyear,'Credit Card Expiration Date',true))
		          return false;
		        else
		       return true;
		     }
		
	}
	
	
}//End funct


function ccCheck1() {
   var err="";
   bname = document.frmOrder.bname.value;
   baddr1 = document.frmOrder.baddr1.value;
   bcity = document.frmOrder.bcity.value;
   email = document.frmOrder.bemail.value;
   orderTotal = document.frmOrder.chargetotal.value;
   totalAll = document.frmOrder.totalall.value;
   totalToday = document.frmOrder.totaltoday.value;
   view_help = document.frmOrder.view_help.value;
   cnumber=document.frmOrder.cardnumber.value;
   cctype=document.frmOrder.cctype.value;
   expmonth=document.frmOrder.expmonth.value;
   expyear=document.frmOrder.expyear.value;
   orderTotal = orderTotal - 0;
	
	if ((bname==" ")||(bname=="")) {
		err=err+"\n - First and Last Name fields cannot be blank.";
		ccOK = false;
	}
	if (baddr1=="") {
		err=err+"\n - Address field cannot be blank.";
		ccOK = false;
	}
	if (bcity=="") {
		err=err+"\n - City field cannot be blank.";
		ccOK = false;
	}
	if (!validEmail(email)) {
		err=err+"\n - Email field is invalid.";
		ccOK = false;
	}
	if(orderTotal < 1){
		err=err+"\n - Your shopping cart is empty.";
	}
	if(orderTotal > 200){
		err=err+"\n - The daily order limit is $200.00      ";
	}

	if ((totalToday > 200)||(totalAll > 200)) {
		err=err+"\n - There is a purchase limit of $200.00 per day. Please try again tomorrow or try selecting fewer cards.";
	}
	
//	if (view_help=="") {
//		err=err+"\n - Please read the Security Settings by clicking Help at the top of the page to continue.";
//	}
   if (err!="") {
		alert ("\nThe following error(s) occurred:\n"+err+"\n");
		return false;
	}
	else {
		 if (!isValidCreditCardNumber(document.frmOrder.cardnumber,cctype,'Credit Card Number', true))
  	        {
  	    	    err=err+"\n - Credit Card Number is invalid.";
                return false
             }
             else
             {
                if(!isValidExpDate1(expmonth,expyear,'Credit Card Expiration Date',true))
		          return false;
		        else
		       return true;
		     }
	}
}

function VerifyPwd() 
{
			
				fFName=document.frmSign.txtFName.value;
				fLName=document.frmSign.txtLName.value;
				addr = document.frmSign.txtAddr1.value;
				city = document.frmSign.txtCity.value;
				state = document.frmSign.selState.options[document.frmSign.selState.selectedIndex].value;
				zip = document.frmSign.txtZip.value;
				hPh = document.frmSign.txtPhH.value;
				email = document.frmSign.txtEmail.value;					
				cardnumber=document.frmSign.cardnumber.value;
				cardType=document.frmSign.card.value
                expmonth=document.frmSign.expmth.value;
                expyear=document.frmSign.expyr.value;
				err=""
				if ((fFName=="")) {
					err=err+ "\nPersonal Information\n - First Name field is missing";
				}
				if ((fLName=="")) {
					err=err+ "\n - Last Name field is missing";
				}
				if ((document.frmSign.txtPwd.value!=document.frmSign.txtPwd1.value)||(document.frmSign.txtPwd1.value=="")) {
					err=err+ "\n   - Password field(s) are missing or do not match";
					document.frmSign.txtPwd1.value="";
				}
				if ((addr=="")) {
					err=err+ "\n - Street Address field is missing";
				}
				if ((city=="")) {
					err=err+ "\n - City field is missing";
				}
				if ((state=="")) {
					err=err+ "\n - State field is missing ";
				}
				if ((zip=="")) {
					err=err+"\n - Zip field is missing";
				}
				if ((hPh=="")) {
					err=err+"\n - Home Phone field is missing";
				}
                if (!validEmail(email)) {
                err=err+"\n - Email field is invalid.";                   
                }
				if (err!="")
				{
				    alert("The following error(s) occurred:\n"+err);
				    return false;
				}					
				else
				{					
				    if(cardnumber!="")
				    {
					
					
                        if (!isValidCreditCardNumber(document.frmSign.cardnumber,cardType,'Credit Card Number', true))
                            {
                            err=err+"\n - Credit Card Number is invalid.";
                            return false
                            }
                        else
                        {
                       
                            if(!isValidExpDate2(expmonth,expyear,'Credit Card Expiration Date',true))
                            return false;
                            else
                            err="";
                        }
				    }
				}
        if (err=="")
            {
            document.frmSign.action = "edit_acc.asp";
            document.frmSign.submit();
            }
					
}				