$(document).ready(function()
{
	$("#priceForm").submit(function()
	{
		//remove all the class add the messagebox classes and start fading
		$("#msgbox").removeClass().addClass('messageboxquote').text('Please be patient while we are calculating your price...').fadeIn(1000);
		
		$.post("./ajax/ajax_anchor.php",{ Weight:$('#Weight').val(),Length:$('#Length').val(),Width:$('#Width').val(),Height:$('#Height').val(),DestinationCountry:$('#DestinationCountry').val(),ToCurrency:$('#ToCurrency').val() } ,function(data)
        {
		  if(data=='error') //if error detail
		  {
		  	$("#msgbox").fadeTo(200,0.1,function()  //start fading the messagebox
			{ 
			  //add message and change the class of the box and start fading
			  $(this).html('There was an error please try again later...').addClass('messageboxquoteerror').fadeTo(900,1);
			  
			});
		  }
		  else 
		  {
		  	$("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
			{ 
			  //add message and change the class of the box and start fading
			  $(this).html(data).addClass('messageboxquoteok').fadeTo(900,1);
			});		
          }
				
        });
 		return false; //not to post the  form physically
	});
	//now call the ajax also focus move from 
	$("#Height").blur(function()
	{
		$("#priceForm").trigger('Anchor');
	});
});
