var requestTarget = "classes/RequestControl/General/index.RequestControl.php";

function currencySelectionChanged()
{
    $.post(requestTarget, {currencySelect: $("#currencySelect option:selected").val(), pageAction: $("#pageAction").val()});
}

function mailingListSubscriptionSubmitButtonClick(eventObj){
    $.post(requestTarget, {SubmitButton: $(this).val() , pageAction: "subscriptionRequest"}, function(xml){
        if($(xml).find('exception').text() != false){

        }
        else{
            //if returning from successful Subscribe request
            //set the button value to Unsubscribe
            //Set the text after button to show success message (and slowly fade away?)
            //else if returning from successful unsubscribe rquest
            //set the button value to subscribe
            //set the text after button to show success message (and slowly fade away?)
        }
    }, "xml");
}

function ajaxRequestStarted(){
    $("#mailingListSubscriptionSubmitButton").attr("disabled", "disabled");
}

function ajaxRequestFinished(){
    $("#mailingListSubscriptionSubmitButton").removeAttr("disabled");
}

jQuery(document).ready(function() {
    $("#currencySelect").change(currencySelectionChanged);

    $("#mailingListSubscriptionSubmitButton").click(mailingListSubscriptionSubmitButtonClick);
});
