                                                                   
function validatecontactform()
{
	var ok = true;
	if (document.getElementById("Name").value === "" && ok===true)
	{
		document.getElementById("Name").focus();
		alert("Please include your name");
		ok = false;
	}
	if (document.getElementById("email").value === "" || document.getElementById("email").value != document.getElementById("emailC").value && ok===true)
	{
		document.getElementById("email").focus();
		alert("Please enter your email address and make sure it matches the confirmation email address");
		ok = false;
	}
	if (document.getElementById("query").value === "" && ok===true)
	{
		document.getElementById("query").focus();
		alert("Please include a message");
		ok = false;
	}
	if (document.getElementById("captcha_code").value === "" && ok===true)
	{
		document.getElementById("captcha_code").focus();
		alert("Please enter the anti spam word verification in the text box provided");
		ok = false;
	}
	if (ok===true)
	{
		document.contactform.submit();	
	}
}

function $odv() 	{ 

return document.getElementById(arguments[0]); }











var itemCount = 0;           





function changePrice(ckBox, price){


	$odv(ckBox).value =price;


}











 function dont()


 {


 alert("inside dont");


		


 }





function Format$odv() 					{ return CurrencyFormatted(arguments[0]); }  





/** string textbox_id,int o, optional arg[2] == cboList */








/** Show Member Number */


function showMN(show) {setExisting(show);}  /** THE CB() call is so the membership details follow through */


function setExisting(is_existing) {





   if(is_existing) {  ShowDIV('mem_no_div'); ShowDIV('MemberNumber'); $odv('MemberNumber').value = "";  }


   else {  HideDIV('mem_no_div'); HideDIV('MemberNumber'); $odv('MemberNumber').value = "N/A - New member !!"; }       





}














function SetDisplay(i,o) {
	if (document.getElementById(i))
	{
		document.getElementById(i).style.display=o;
	}
}


function HideDIV(id) { SetDisplay(id,"none");  }


function ShowDIV(id) { SetDisplay(id,"block"); }      





function hide(id) { SetDisplay(id,"none");  }


function show(id) { SetDisplay(id,"block"); }


  


function ShowHideDiv_CheckBox(c,id) { if(c.checked) { SetDisplay(id,"block"); } else SetDisplay(id,"none"); }














/** Formats a number into decimal 2 dec places for currency */


function CurrencyFormatted(amount) {  var i = parseFloat(amount); if(isNaN(i)) { i = 0.00; } var minus = '';  if(i < 0) { minus = '-'; } i = Math.abs(i); i = parseInt((i + .005) * 100); i = i / 100;  s = new String(i); if(s.indexOf('.') < 0) { s += '.00'; }  if(s.indexOf('.') == (s.length - 2)) { s += '0'; } s = minus + s;  return s; }





    


 


/**  Function Wrapper.*/


function MenuSection_CheckBox(_C,id,label_id) {  if(_C.checked) { SetDisplay(id,"block");  if(HIDE_CHECKBOX_ON_SELECT ==true){ SetDisplay(_C.id,"none");  $odv(label_id).innerHTML=""; } }else {  SetDisplay(id,"none"); }}





function pF(o){return parseFloat(o);}    


function FloatTryParse(id) { return (isNaN(pF($odv(id).innerHTML)))?0:pF($odv(id).innerHTML);}       





/** Returns True if object can be parsed. */


function Float_TryParse(object) { if (isNaN(pF(object))) return false; else { if(arguments.length==2) arguments[1] = pF(object);; return true; }}





/** Pop up window for Terms and Conditions*/ 


function popupWindow(url) {   name = "Terms"; w = POPUP_WIDTH; h = POPUP_HEIGHT; w += 32;  h += 96; wleft = (screen.width - w) / 2; wtop = (screen.height - h) / 2; if (wleft < 0) {  w = screen.width;  wleft = 0;  }  if (wtop < 0) {  h = screen.height; wtop = 0; } var win = window.open(url, name, 'width=' + w + ', height=' + h + ', left=' + wleft + ', top=' + wtop + ', location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no');   win.resizeTo(w, h); win.moveTo(wleft, wtop); win.focus();  }       





/**check that the terms and contditions are met in the page */


function termsValidator(){


/* not functioning as terms are not included in this form...


//checkTitle is selected


		  var radioSelected = false;


		  for (i = 0;  i < document.OrderForm.chkTerms.length;  i++)


		  {


		    if (document.OrderForm.chkTerms[i].checked)


		        return true;


		  }


		  if (!radioSelected)


		  {


		    alert("Please Accept the Terms and Conditions");


			 document.OrderForm.chkTerms[0].focus();


		    return (false);


		  }


 */


 return (true);


 }








	// checks that the input is all characters and that it is the length of constraint c


function checkInput(itemNum, l, min, max){


	


 var maxlen = parseInt(max);


 var minlen = parseInt(min);	


var len = parseInt(l);





 	if(len > maxlen ){	 		


 		alert("Your Length Chosen is too long ("+min+"-"+max+"cm). Please try again");


 		$odv('custLen'+itemNum).value = max;


 		 	return false;


 		}


 	if(len < minlen ){


 		alert("Your Length Chosen is too short ("+min+"-"+max+"cm). Please try again");


 		$odv('custLen'+itemNum).value = min;


 		return false;


 		}else{ 		


 	return len ;


 	}


}//end check Input








function updateCustomLen(itemNum, length, min, max){


	if(val = checkInput(itemNum, length,min, max)){


		//fill in the custom length radio button


		$odv('cust-'+itemNum).value = val;


		//alert($odv('cust-'+itemNum).value);


		$odv('cust-'+itemNum).checked = true;


// hide('opt3-'+itemNum+'-div');


 //showselected('3',itemNum,length + 'cm');


 }


}








/** This function is used to validate before the postback validate. */


function submitit(oform) { if(termsValidator() && User_Data_Validator(oform) ) return true;
 else return false; 

					


}


/**  This function is used to determin is JS is enabled  */


function validate_js() {


      	


              


    $odv('JavascriptEnabled').value = "Y";


 }


 


/** ticks off all any checkbos associated with a quantity if the qty is filled and the checkbox is not


	also checks the qty value entered for validity and changes it to a 


**/





 function tickCheck(q, m){


	  //var _q = parseFloat($odv(q).value);; //turn the quantity into a number
		

		var _q = document.getElementById(q).value;;


	//data validation on quantity _q 


	if((_q=='undefined')|| (_q==undefined)) 


	{ 


        alert('Not a valid input'); 


		$odv(q).value = '0'; //set the real value to 0


		


		


    };


    if(isNaN(_q)) { 


        alert('The Quantity You enetered is not Numeric..\r\nPlease Try again');  


        $odv(q).value = '0';


	};


		if(_q == 0){	$odv(m).checked = false;}		


		else { 		$odv(m).checked = true;}


	 


 }


 








 


// find the quantity of items ordered and the price per item needs to be added multiply together and return a subtotal for that imem


function calcSubTotal(subLabel,price, qty) { 


    //var _q = parseFloat($odv(qtyField).value);; //turn the quantity into a number
   
  
    var result = qty * price;  


    if(isNaN(result)) { 


        alert('The Quantity You enetered is not Numeric.\r\nPlease Try again'); return 0 ; 


    }else { //place the result on the page right in the appropriate label position


        $odv(subLabel).innerHTML = "$ " + CurrencyFormatted(result); 


        if(pF(qty) > 0) { 


            itemCount = ($odv(chkBox).checked)? pF(itemCount)+pF(qty):itemCount; 


        } 


        return result;


     }//end else


}//end function








/** Updates Membership cost details on order form */


function updateMembershipSelection() { 


	if ( $odv('isExisting').checked )  


		if ( $odv('isRenewing').checked) { 


			return ANUAL_MEMBERSHIP_FEE;


		}


		else return 0;


	else{


 		return 0; //usually = ANUAL_MEMBERSHIP_FEE; changed due to onlineSPECIAL


		}


 }	  





/**  Shows Hides a Layer by request of the PHP settings  */  


function ShowOnLoad(id,_b,_c) { if(_b==true) { $odv(id).style.display="block";  }  else { 	$odv(id).style.display="none"; }$odv(_c).checked = _b; }  


 


/** This is a simple function that is called at the end of render of order.php page */


/*


    Does not get called for OrderN.php as the call has been removed


*/


function init(val) {


  if(val==1) {


  


     	


			/*
			if(!ALLOW_CHECKBOX_GROUPS){  


        	


        		HideDIV('spacer5'); 


        		HideDIV('chkOrderBracelets'); 


        		HideDIV('chkOrderNecklace');   


        		HideDIV('chkOrderWALLCard');  


        		HideDIV('chkOrderKEYRing'); 


        		HideDIV('chkOrderDT');   


        		HideDIV('lblBraceletes');   


        		HideDIV('lblNecklaces');   


        		HideDIV('lblWalletCardText'); 


        		HideDIV('lblKeyRingText');  


        		HideDIV('lblDogTags'); 


        	}
			*/


        





        


        	ShowOnLoad("WALLCardOrder",SHOW_ORDER_WALLCard_ON_LOAD,'chkOrderWALLCard');


        	ShowOnLoad("DogTagsOrder",SHOW_ORDER_DOGTAG_ON_LOAD,'chkOrderDT');


        	ShowOnLoad("KEYRingOrder",SHOW_ORDER_KEYRing_ON_LOAD,'chkOrderKEYRing');


        	ShowOnLoad("NecklaceOrder",SHOW_ORDER_NECKLACE_ON_LOAD,'chkOrderNecklace');


        	ShowOnLoad("BraceleteOrder",SHOW_ORDER_BRACELET_ON_LOAD,'chkOrderBracelets');


        	


        	


	


	}


	else if (val==2) { }


	


	CB();


}  


/** Page & Document Events */


function onload() {

	//validate_js(); 

}   















