$(document).ready(function(){
	// Looks for a change in the model number. Then goes off and loads the decscription
	$("#model_no").change(function(){
		 $("#friendlyname").html("loading....");
		getModel();
		 return false;
	});
	
	$("#country").change(function(){
		fadeCountry($("#country").val());
		
	});	
	
});


function fadeCountry(isoCode){
	if(isoCode == 'ie'){
		$("#fieldPostCode").slideUp('slow');
		$('#currency').children().eq(1).attr({selected:'selected'});
	}
	else {
		$("#fieldPostCode").slideDown('slow');
		$('#currency').children().eq(0).attr({selected:'selected'}); }	
}

function getModel(){
	 // POST
	 $.post("/model/geDAO.cfc?method=getModelName",{
	       modelnum: $("#model_no").val()
	     }, function(xml) {
	   addMessages(xml);
	 });
}

function addMessages(xml) {
		$("#friendlyname").html(xml);
		$("#type_of_appliance").val(xml)
}	