jQuery.fn.countryStateSelect = function() {

	this.bind("change", updateStateSelect);

};



function updateStateSelect() {

	var country = $("#country").val();

	switch (country) {

    case '':

  		$("#state").show();

  		$("#state").attr("disabled", "disabled");

  		$("#state").attr("value", "Please Select Country...");

  		$("#provinceSelect").hide();

  		$("#stateSelect").hide();

  		break;

    case 'Canada':

    	$("#state").hide();

    	$("#stateSelect").hide();

    	$("#provinceSelect").show();

    	$("#provinceSelect").removeAttr("disabled");

      	break;

    case 'United States':

    	$("#state").hide();

    	$("#provinceSelect").hide();

    	$("#stateSelect").show();

    	$("#stateSelect").removeAttr("disabled");

    	break;

    default:

    	$("#state").show();

    	$("#state").removeAttr("disabled");

    	$("#state").attr("value", "");

    	$("#provinceSelect").hide();

    	$("#stateSelect").hide();

    	break;

  }

}
