	
	//////////////////////////////////////////////////////////////////
        // Skipjack Direct Post Integration - Field Verification        //
        // Ajax Integration 2.0                                         //
        //////////////////////////////////////////////////////////////////
        // Written by Kris Wilkinson                                    //
        // Owned & Copyright by SIRKit Ltd.                             //
        // Duplication, copying & distribution is strictly prohibited   //
        //////////////////////////////////////////////////////////////////

	var ordernumber, company, sjname, streetaddress, city, state, zipcode, shiptophone, email, accountnumber, month, year, expDate, cvv2;
	var currentDate = new Date(); currentDate = dateFormat(currentDate, "yymm");

	function verifyBillTo() {

		ordernumber     = document.getElementById('ordernumber').value;
		company         = document.getElementById('company').value;
		sjname        	= document.getElementById('sjname').value;
		streetaddress   = document.getElementById('streetaddress').value;
		city            = document.getElementById('city').value;
		state           = document.getElementById('state').value;
		zipcode         = document.getElementById('zipcode').value;
		shiptophone     = document.getElementById('shiptophone').value;
		email           = document.getElementById('email').value;
		accountnumber 	= document.getElementById('accountnumber').value;
		month        	= document.getElementById('month').value;
		year         	= document.getElementById('year').value;
		cvv2       	= document.getElementById('cvv2').value;
		expDate         = year + month; expDate = parseInt(expDate);

                if ( sjname && streetaddress && city && state && state != '-1' && zipcode && shiptophone && email && expDate >= currentDate && accountnumber && cvv2 ) { 
			ajaxRequest('sirkJax.php', null, 'debug', 'div', false, 'type=storeBillTo&billTo='+encodeURIComponent(company)+'<br>'+encodeURIComponent(sjname)+'<br>'+encodeURIComponent(streetaddress)+'<br>'+encodeURIComponent(city)+' |'+encodeURIComponent(state)+'|<br>'+encodeURIComponent(zipcode)+'<br>'+encodeURIComponent(shiptophone)+'<br>'+encodeURIComponent(email)+'<br>&orderID='+encodeURIComponent(ordernumber));
			return true;
		} else { return false; }

	}

	function notifyBillTo() {

              	if (!sjname)                         	alert ('Your name is required');
		else if (!streetaddress)            	alert ('Your address is required');
		else if (!city)                         alert ('Your city is required');
		else if (!state || state == '-1')       alert ('Your country & province are required');
		else if (!zipcode)                      alert ('Your postal/zip code is required');
		else if (!shiptophone)               	alert ('Your phone number including country and area code is required');
		else if (!email)                        alert ('Your email address required');
		else if (!accountnumber)             	alert ('The credit card number you entered is incorrect.');
		else if (expDate < currentDate)         alert ('The expiry date selected has expired.');
		else if (!cvv2)                    	alert ('The CVV2 code you entered is incorrect.');
        	else                                    alert ('There was an error validating your information. Please confirm you have completely filled out all fields and try again');

   	}


