function confirm_quantity(){

		   var qtyfield;
	    	
			if(document.getElementById)
	   			qtyfield = document.getElementById("quantity_input");
			else if(document.layers)
	   			qtyfield = window.document.layers["quantity_input"];
			else if(document.all)
	   			qtyfield = window.document.all["quantity_input"];
				
		   	
	        window.location="viewcart.php?quantity_input=" + qtyfield.value;
				
				
}



function confirm_newpass(){

         

		   var passfield;
	    	
			if(document.getElementById)
	   			passfield = document.getElementById("pw");
			else if(document.layers)
	   			passfield = window.document.layers["pw"];
			else if(document.all)
	   			passfield = window.document.all["pw"];
				
				
		   var cpassfield;
	    	
			if(document.getElementById)
	   			cpassfield = document.getElementById("pwc");
			else if(document.layers)
	   			cpassfield = window.document.layers["pwc"];
			else if(document.all)
	   			cpassfield = window.document.all["pwc"];
				
				
			var ctext;
	    	
			if(document.getElementById)
	   			ctext = document.getElementById("confirmation_text");
			else if(document.layers)
	   			ctext = window.document.layers["confirmation_text"];
			else if(document.all)
	   			ctext = window.document.all["confirmation_text"];
				
			
				
           if(cpassfield.value == "")
		        ctext.innerHTML = "";
		   else if(passfield.value == cpassfield.value)
		        	      ctext.innerHTML = "Password confirmed!";
		   else if((passfield.value != cpassfield.value) && (cpassfield.value != ""))
		        ctext.innerHTML= "No Match: Reconfirm password!"; 
} 





function clear_all()
{
    
	
	var radioarray = new Array("title1","title2","title3","title4");
	
	var x;

	for (x in radioarray){

		var radiofield;
	    	
			if(document.getElementById)
	   			radiofield = document.getElementById(radioarray[x]);
			else if(document.layers)
	   			radiofield = window.document.layers[radioarray[x]];
			else if(document.all)
	   			radiofield = window.document.all[radioarray[x]];
	       
		   if(radiofield)
			    radiofield.checked=false;   
     }
		
		

	var alltextfields = new Array("f_name","i_name","l_name","ph_name","e_m","pw","pwc","b_addr","b_cty","b_prov2","b_cntry2","b_pcode","s_addr","s_cty","s_prov2","s_cntry2","s_pcode");
    var allselectfields = new Array("b_prov_opt","b_cntry_opt","s_prov_opt","s_cntry_opt");
	
	
	var x;

	for (x in alltextfields){

    	var thetextFields;

    	if(document.getElementById)
	   		thetextFields = document.getElementById(alltextfields[x]);
		else if(document.layers)
	   		thetextFields = window.document.layers[alltextfields[x]];
		else if(document.all)
	   		thetextFields = window.document.all[alltextfields[x]];
			
			if(thetextFields)
				thetextFields.value = "";   
	}
	
	
	
	
	
	for (x in allselectfields){

    	var theselectFields;

    	if(document.getElementById)
	   		theselectFields = document.getElementById(allselectfields[x]);
		else if(document.layers)
	   		theselectFields = window.document.layers[allselectfields[x]];
		else if(document.all)
	   		theselectFields = window.document.all[allselectfields[x]];
	
	   if(theselectFields){
			theselectFields.selected=true;   
			theselectFields.text="..........................."; 
	   }
	}
	
	

		
	

}





function make_visible(otherlayer,visstate)
{
	
    	var theotherField;

    	if(document.getElementById)
	   		theotherField = document.getElementById(otherlayer);
		else if(document.layers)
	   		theotherField = window.document.layers[otherlayer];
		else if(document.all)
	   		theotherField = window.document.all["otherlayer"];
	
	
	   if(visstate == "YES")
		  theotherField.style.visibility="visible";  
		  
	   if(visstate == "NO")
		  theotherField.style.visibility="hidden";
		  
	 
	
}




function hide_otherfields()
{
    var allotherfields = new Array("b_prov2","s_prov2","b_cntry2","s_cntry2");
	   
	var x;

	for (x in allotherfields)
	{

    	var theotherField;

    	if(document.getElementById)
	   		theotherField = document.getElementById(allotherfields[x]);
		else if(document.layers)
	   		theotherField = window.document.layers[allotherfields[x]];
		else if(document.all)
	   		theotherField = window.document.all[allotherfields[x]];
	
	    if(theotherField)
		   theotherField.style.visibility="hidden"; 
	 }


}



function copy_from_billing()
{

	var b_textfields = new Array("b_addr","b_cty","b_prov2","b_cntry2","b_pcode","b_prov","b_cntry");
	var s_textfields = new Array("s_addr","s_cty","s_prov2","s_cntry2","s_pcode","s_prov","s_cntry");

	//var b_textfields = new Array("b_addr","b_cty","b_pcode","b_prov");
	//var s_textfields = new Array("s_addr","s_cty","s_pcode","s_prov");
	
	
	var x;

	for (i=0;i<7;i++){

    	var fromtextFields;

    	if(document.getElementById)
	   		fromtextFields = document.getElementById(b_textfields[i]);
		else if(document.layers)
	   		fromtextFields = window.document.layers[b_textfields[i]];
		else if(document.all)
	   		fromtextFields = window.document.all[b_textfields[i]];
		
		
		var totextFields;

    	if(document.getElementById)
	   		totextFields = document.getElementById(s_textfields[i]);
		else if(document.layers)
	   		totextFields = window.document.layers[s_textfields[i]];
		else if(document.all)
	   		totextFields = window.document.all[s_textfields[i]];

	    if(totextFields)
			totextFields.value = fromtextFields.value;   
	}
	

}

   
   

 
 

