(function($){
	$.fn.getPaymentMethod = function(){
		$("#payment-btn").attr("disabled", false);
		var optionKey = $("#pm-payment-method-list-gateways").find(":selected").data("option");
		var option = getOption(optionKey);
		console.log(option);
		var html = "<div class=\"pm-img\"><img src=\""+option.gateway_icon+"\"></div>";
		html += "<div class=\"pm-desc\">"+option.gateway_description+"</div>";
		$("#pm-payment-method-description").html(html);
		$("#pm-make-payment-form").attr("action", option.gateway_page);
		$("#payment-btn").attr("disabled", false);
	}
})(jQuery);

jQuery(document).ready(function($){
	$("#pm-payment-method-description").getPaymentMethod();
	$(document).on("click", "#payment-btn", function(e){
		e.preventDefault();
		$(this).closest("form").submit();
	})
	$(document).on("change", "#pm-payment-method-list-gateways", function(e){
		$("#pm-payment-method-description").getPaymentMethod();
	})
})