<!--
function MM_openBrWindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}

function MM_swapImgRestore() { //v3.0
	var i, x ,a=document.MM_sr; 
	for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) 
		x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
	var d=document; 
	if(d.images) { 
		if(!d.MM_p) d.MM_p=new Array();
    	var i, j=d.MM_p.length, a=MM_preloadImages.arguments; 
    	for(i=0; i<a.length; i++) {
    		if (a[i].indexOf("#")!=0) {
    			d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];
    		}
    	}
    }
}

function MM_findObj(n, d) { //v4.01
	var p, i, x;  
	if(!d) d=document; 
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; 
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) {
		x=d.all[n]; 
	}
	for (i=0;!x&&i<d.forms.length;i++) {
		x=d.forms[i][n];
	}
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) {
		x=MM_findObj(n,d.layers[i].document);
	}
	if(!x && d.getElementById) {
		x=d.getElementById(n); 
	}	
	return x;
}

function MM_swapImage() { //v3.0
	var i, j=0, x, a=MM_swapImage.arguments; 
	document.MM_sr=new Array; 
	for(i=0;i<(a.length-2);i+=3) {
		if((x=MM_findObj(a[i]))!=null) {
			document.MM_sr[j++]=x; 
			if(!x.oSrc) x.oSrc=x.src; 
			x.src=a[i+2];
		}
	}
}

var windowClose = true;

function ePop(where_to_go)
{
	if(windowClose == true)
	{
		window.open(where_to_go + 'pop.html','ePop','width=400,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no');
	}
	window.focus();
}


	function checkQuantity(i){
			if(i.value >= 20){
				
				if (confirm("Are you sure you want to order " + i.value + " items?")){
					i.form.billing_fname.focus();
					return true;		
				}
				else {
					i.form.qty.focus();
					return false;
				}
			}
	}
	
	
	function fillForm(theForm){
		theForm.billing_fname.value =  "Blue";
		theForm.billing_lname.value =  "Crowley";
		theForm.billing_add1.value =  "19 sagamore road";
		theForm.billing_add2.value =  "test";
		theForm.billing_city.value =  "Townsend";
		theForm.billing_state.value =  "MA";
		theForm.billing_zip.value =  "01244";
		theForm.billing_phone.value =  "805";
		theForm.billing_phone2.value =  "754";
		theForm.billing_phone3.value =  "6384";
		theForm.billing_email.value =  "lcrowley@itvdirect.com";
		
		theForm.cc_type.value = "1";
		theForm.billing_expmo.value =  "10";
		theForm.billing_ccnum.value =  "4111111111111111";
		theForm.billing_expyr.value =  "2008";
		theForm.billing_cvv.value = '111';
		}



	function validForm(theForm){		
			//validate BILLING inputs
				if(Trim(theForm.billing_fname.value).length == 0){
					alert("Please enter your FIRST NAME\nIn the Billing Information form.");
					theForm.billing_fname.focus();
					return false;
				}
				if(Trim(theForm.billing_lname.value).length == 0){
					alert("Please enter your LAST NAME\nIn the Billing Information form.");
					theForm.billing_lname.focus();
					return false;
				}
				if(Trim(theForm.billing_add1.value).length == 0){
					alert("Please enter your STREET ADDRESS\nIn the Billing Information form.");
					theForm.billing_add1.focus();
					return false;
				}
				if(Trim(theForm.billing_city.value).length == 0){
					alert("Please enter your CITY\nIn the Billing Address form.");
					theForm.billing_city.focus();
					return false;
				}
				if(Trim(theForm.billing_state.value).length <= 1){
					alert("Please select your STATE/PROVINCE\nIn the Billing Address form.");
					theForm.billing_state.focus();
					return false;
				}
				if(Trim(theForm.billing_state.value) == 'Outside US/Canada'){
					alert("Sorry, but we can only accept payment from accounts based in the United States and Canada at this time.");
					theForm.billing_state.focus();
					return false;
				}
				if(Trim(theForm.billing_zip.value).length == 0){
					alert("Please enter your ZIP/POSTAL CODE\nIn the Billing Information form.");
					theForm.billing_zip.focus();
					return false;
				}
				
				if(Trim(theForm.billing_phone.value).length == 0){
					alert("Please enter your BILLING PHONE NUMBER\nIn the Billing Address form.");
					theForm.billing_phone.focus();
					return false;
				}
				if(Trim(theForm.billing_phone2.value).length == 0){
					alert("Please enter your BILLING PHONE NUMBER\nIn the Billing Address form.");
					theForm.billing_phone.focus();
					return false;
				}
				if(Trim(theForm.billing_phone3.value).length == 0){
					alert("Please enter your BILLING PHONE NUMBER\nIn the Billing Address form.");
					theForm.billing_phone.focus();
					return false;
				}
				if(Trim(theForm.billing_email.value).length == 0){
					alert("Please enter your BILLING EMAIL ADDRESS\nIn the Billing Address form.");
					theForm.billing_email.focus();
					return false;
				}
				if(!validateEmail(theForm.billing_email.value)){
					alert('Your EMAIL ADDRESS does not appear to be valid.\nPlease correct any errors and submit again.');
					theForm.billing_email.focus();
					return false;
				}
				
				
				if(theForm.cc_type.value == 0){
					alert("Please enter your CREDIT CARD NAME\nIn the Billing Information form.");
					theForm.cc_type.focus();
					return false;
				}
				if(Trim(theForm.billing_ccnum.value).length == 0){
					alert("Please enter your CREDIT CARD NUMBER\nIn the Billing Information form.");
					theForm.billing_ccnum.focus();
					return false;
				}
				if(!luhnCheckCC( Trim(theForm.billing_ccnum.value) ) ){
					alert("The CREDIT CARD NUMBER you've entered is incorrect.\nPlease check your entry for errors and try again.");
					theForm.billing_ccnum.focus();
					return false;
				}
							
				if(!validateCCExpDate(theForm.billing_expmo.value, theForm.billing_expyr.value)){
					alert('Your credit card appears to be expired.');
					theForm.billing_expmo.focus();
					return false;
				}
				
				if(Trim(theForm.billing_cvv.value).length == 0){
					alert("Please enter your CREDIT CARD CVV NUMBER\nIn the Billing Information form.");
					theForm.billing_cvv.focus();
					return false;
				}
				
			
				//finally ... if all is well ... submit the form and move on...	
				//theForm.action="https://secure.tryalmightycleanse.com/redirect.php";
				return true;
			}


//-->