



$(document).ready(function(){
    $("#doButton").click(function(){   
    	   var useForm=$(this).parent("form").get(0);
           $.post("/cgi-bin/validateCoupon.cgi",
                {product: 695, coupon: $("#namefield")[0].value},
                function(data){
                    var message="";
                    var newAmount="";
                    if(data.indexOf("amount")>=0){
                        newAmount=data.substring(data.indexOf("amount")+8);
                        message="Your License Code was accepted. Thank you";
                        useForm.disprice.value=newAmount;
                        useForm.disdes.value=" with valid coupon";
                        $("#amount").text("$"+newAmount);
                    }else{
                        message="We're sorry, this License Code is invalid";
                    }
                    $("#msg").html(message);

                    }    );
                    
    });
});



$(document).ready(function(){
	$("input[src='https://www.paypal.com/en_US/i/btn/btn_cart_LG.gif']").each(function(i){
		var tmp=$(this).parent("form").get(0);
		$(tmp).submit( function() {
			var getForm="#"+this.couForm.value;
			var usePrice=$(getForm)[0].disprice.value;
			var useDesc=$(getForm)[0].disdes.value;
			if(usePrice.length>0 && useDesc.length>0){
				this.amount.value=usePrice;
				this.item_name.value+=useDesc;
			}
			return true;
		});
	});
});



 