/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */



$(document).ready(function(){
    $("#resform").submit(function(){
        $(this).children().children().children("select").each(function(){
            if($(this).attr("value") == '')
                {
                    $(this).remove();
                }
        });
        
        if($("#promo").attr("value") != "Promo Code")
        {

            $.post("promo.php",{data:$("#promo").attr("value")}, function(data){
                if(data != "")
                {
                    $("#promo").remove();
                    window.location = $("#resform").attr("action")+"?"+$("#resform").serialize()+data;
                    return false;
                }else
                {
                    alert("please enter a valid promo code.");
                    return false;
                }
                
            });
            return false;
        }else
        {
            $("#promo").remove();
        }
    });

    $("#promo").focus(function(){
       $(this).attr("value", "");
    });
})


