/* Version 1.4 @ 27 Sep 2010 */
/*
SET formConfig["languageType"] :
- aspx for ASP.NET
- php for PHP


*/

var validCaptcha = false;
$(function () {

    var objFormContact = $("form#frmContact");
    var formConfig = new Array;

    formConfig["languageType"] = "aspx"; /* aspx, php */
    formConfig["showBalloon"] = true;
    formConfig["showAlertButton"] = false;
    //formConfig["arrowLeft"] = 545;
    formConfig["arrowLeft"] = -40;
    formConfig["arrowTop"] = 0;
    formConfig["module"] = "Contact Us";
    formConfig["styleName"] = "style1";
    formConfig["alertMsg"] = strAlert; /* FOR ASP.NET */

    initForm(objFormContact, formConfig);
    //$("body select").hide();

    objFormContact.submit(function () {
        alert(validCaptcha);
        if (!validCaptcha) {
            if (!isTop) {
                var formValid = true;
                //alert(objFormContact.find("input#contact").val())
                //alert($.trim($("#Firstname").val()))
                // Validate Standard Form
                if (!ValidateForm(objFormContact)) {
                    formValid = false;
                }
                if ($.trim($("#contact").val()) == "") {
                    showAlert($('#contact'));
                    formValid = false;
                }
                if ($.trim($("#contactType").val()) == "") {
                    showAlert($('#contactType'));
                    formValid = false;
                }
                //alert($.trim($("#Firstname").val())+"ชื่อ")
                if ($.trim($("#Firstname").val()) == "ชื่อ") {
                    showAlert($('#Firstname'));
                    formValid = false;
                }
                if ($.trim($("#Lastname").val()) == "นามสกุล") {
                    showAlert($('#Lastname'));
                    formValid = false;
                }

                if (formValid) {
                    // Do Anythig : AJAX, Redirect Page

                    //				alert("Send Value : " + $(this).serialize());
                    //$("input#btnSubmitContact").hide();
                    //$("div#submitWaiting").show();
                    //  return true;
                    validateCaptcha();
                    return false;
                } else {
                    //	alert(objFormContact.find("input#btnSubmitContact").attr("id"));
                    /*checkBox = objFormContact.find("input:checkbox[name='alertType']");
                    if (checkBox.filter(":eq(0):checked").length > 0) {
                    AlertPanel(objFormContact.data("alertMessage"));
                    }
				
                    if (checkBox.filter(":eq(1):checked").length > 0) {
					
                    AlertToolTip(objFormContact.find("input#btnSubmitContact") , objFormContact.data("alertMessage") );	
                    }*/

                    AlertToolTip(objFormContact.find("input#btnSubmitContact"), objFormContact.data("alertMessage"));
                    return false;
                }
            } else {
                return true;
            }
        } else {
            return true;
        }
    });


    //============================//

    // Validate Form 2 //		

});


