$(document).ready(function() {
	$('#cc_dialog').dialog({
		modal: true,
		resizable: false,
		autoOpen: false,
		close: function(event, ui) {
			$('#ccresult').html('');
		}
	});
	$('#cc_amount2').change(function() {
		if($('#cc_amount2').hasClass('ui-state-error'))
			$('#cc_amount2').removeClass('ui-state-error');
	});
	$('#ccbutton').click(function() {
		$('#cc_amount2').val($('#cc_amount').val());
		$('#cc_dialog').dialog('open');
	});
	$('#cc_convert').click(function() {
		if(($('#cc_amount2').val()=='') || (!$.isNumeric($('#cc_amount2').val())) || ($('#cc_amount2').val()<1)) {
			$('#cc_amount2').addClass('ui-state-error');
			$('#ccresult').html('');
		}
		else {
			$('#ccresult').load("http://booking.polrail.com/includes/convert_currency.php?amount="+$('#cc_amount2').val()+"&cct="+$('#cct').val());
		}
	});
});
