var feedbackPopUpId = "#feedbackPopUp";
var feedbackEmailId = "#feedback_email";
var emailEmptyValue = "";
var browser, version = null;

function sendFeedback() {
    //close popup
    hideFeedbackPopUp();
    var isCommercial = $("#feedback_commercial").val();
    var subject = $("#feedback_subject").val();

    var params = {
        //subject for consumer = Feedback, for commercial = text from drop down
        "subject" : subject,
        "isCommercial": isCommercial,
        "(03)EmailAddress" : $(feedbackEmailId).val(),
        "(16)Message" : $("#feedback_message").val(),
        "(90)Browser Version": $('#feedback_browser_version').val()
    }
    ContactUsAction.sendFeedback(params);

}

function showFeedbackPopUp() {
    clearFeedbackFields();
    $(feedbackPopUpId).show();
    $(feedbackEmailId).blur();
    $("#feedback_message").focus();
}

function hideFeedbackPopUp() {
    if ($(feedbackPopUpId).find('fieldset').hasClass('ERROR')) {
        ErrorHandler.removeAllErrors();
    }
    $(feedbackPopUpId).hide();
}

function clearFeedbackFields() {
    $(feedbackEmailId).val("");
    $("#feedback_message").val("");
    $("#feedback_subject").val("");
}

function updateEmailIfEmpty() {
    if ($(feedbackEmailId).val() == emailEmptyValue) {
        $(feedbackEmailId).val("");
    }
    return true;
}

function onEmailBlur(event) {
    if ($(feedbackEmailId).val() == "") {
        $(feedbackEmailId).val(emailEmptyValue);
        $(feedbackEmailId).css("color", "#CCC");
    }
}

function onEmailFocus(event) {
    if ($(feedbackEmailId).val() == emailEmptyValue) {
        $(feedbackEmailId).val("");
        $(feedbackEmailId).css("color", "#000");
    }
}



