function swapradio(on,off){
document.getElementById(on+"_img").src="images/radio-on.jpg";
document.getElementById(on).value="on";
document.getElementById(off+"_img").src="images/radio-off.jpg";
document.getElementById(off).value="off";
}
function Search_Postcode(){	
	postcode=document.storesearchform.postcode.value;
	if (postcode.length==0 || postcode==" Postcode"){
		alert("Please enter a Postcode");
		document.storesearchform.postcode.focus( );
   		return false;
	}
	result = /^\d{4}$/.test(postcode);
	if (result==false){
		alert("Postcode must be a four digit number");
		document.storesearchform.postcode.value="";
		document.storesearchform.postcode.focus( );
   		return false;
	
	}
	/*if (postcode.length!=4){
		alert("Postcode must be 4 digits long");
		document.store_seach_form.postcode.focus( );
   		return false;
	}*/	

	
	document.storesearchform.submit();
	return result;
}
function bulkOrderOptions(value){
	if (value!="" && value!=0){
		document.getElementById('bulk_options').style.display="";	
	}else{
		document.getElementById('bulk_options').style.display="none";
	}
}

String.prototype.trim = function() {
                return this.replace(/^\s+|\s+$/g,"");
            }


function send_password(){
    //var customer_no = document.forms['login_form'].customer_no.value.trim();
    //var country = document.forms['login_form'].country.value
    //var user_name = country+customer_no;
    //if(customer_no==""){
    //    alert("Customer No. must be provided");
    //}else{


    //    remote_send_password(user_name)

    //}
    window.location ='forgotten_password.php';


}

function remote_send_password(user_name){

    xmlHttp_o=GetXmlHttpObject()
    if (xmlHttp_o==null)
     {
     alert ("Browser does not support HTTP Request")
     return
     }
    var url="forgotten_password_handller.php?r="+Math.random()+"&user_name="+encodeURIComponent(user_name);
    xmlHttp_o.onreadystatechange=send_password_change;
    xmlHttp_o.open("GET",url,true)
    xmlHttp_o.send(null)
    
}


function send_password_change(){
    if (xmlHttp_o.readyState==4 || xmlHttp_o.readyState=="complete"){
        if(xmlHttp_o.responseText == "no_user"){
            alert("The Customer No. is not exist");
        }else{
            alert("Your password has been sent to your email address");
        }
    }
}