﻿function ContactUsFormSubmit() {
    var flag = true;
    $(".CheckField").each(function(i) {
        if (typeof $(this).attr("regex") != 'undefined') {
            var regex = new RegExp($(this).attr("regex"));
            if ($(this).attr("class").indexOf("required") != -1) {
                if (!(regex).test($(this).val())) {
                    $(this).addClass("RedBorder");
                    flag = false;
                }
                else $(this).removeClass("RedBorder");
                //else $("#" + ($(this).attr("ErrMsg"))).css("display","none"); 
            }
            else // IF IT NOT A REQUIRED FIELD
            {
                if ($(this).val().length > 0) {
                    if (!(regex).test($(this).val())) {
                        $(this).addClass("RedBorder");
                        flag = false;
                    }
                    else $(this).removeClass("RedBorder");
                }
            }
        }
    })
    if (flag) {
        $("#ContactUsSendBtn").attr("onclick", "");
        $(".ErrMsg").css("display", "none");
        document.ContactUsForm.submit();
    }
    else $(".ErrMsg").css("display","block");
 
}
var First = true;
var Second = true;
var Third = true;
var Forth = true;
var Fifth = true;
$(document).ready(function() {
    $(".BottonCont").mouseover(function() {
        $(this).css("margin-top", "-10px");
        $(this).css("height", "37px");
    });
    $(".BottonCont").mouseout(function() {
        $(this).css("margin-top", "0px");
        $(this).css("height", "27px");
    });
    // Show and Hide First Fop
    $("#ShowFirst").click(function() {
        if (First) {
            $("#First").show("slow");
            $("#ShowFirst").html("-");
            First = false;
        }
        else {
            $("#First").hide("slow");
            $("#ShowFirst").html("+");
            First = true;
        }
    });
    // Show and Hide Second Fop
    $("#ShowSecond").click(function() {
        if (Second) {
            $("#Second").show("slow");
            $("#ShowSecond").html("-");
            Second = false;
        }
        else {
            $("#Second").hide("slow");
            $("#ShowSecond").html("+");
            Second = true;
        }
    });
    // Show and Hide Third Fop
    $("#ShowThird").click(function() {
        if (Third) {
            $("#Third").show("slow");
            $("#ShowThird").html("-");
            Third = false;
        }
        else {
            $("#Third").hide("slow");
            $("#ShowThird").html("+");
            Third = true;
        }
    });
    // Show and Hide Forth Fop
    $("#ShowForth").click(function() {
        if (Forth) {
            $("#Forth").show("slow");
            $("#ShowForth").html("-");
            Forth = false;
        }
        else {
            $("#Forth").hide("slow");
            $("#ShowForth").html("+");
            Forth = true;
        }
    });
    // Show and Hide Fifth Fop
    $("#ShowFive").click(function() {
        if (Fifth) {
            $("#Five").show("slow");
            $("#ShowFive").html("-");
            Fifth = false;
        }
        else {
            $("#Five").hide("slow");
            $("#ShowFive").html("+");
            Fifth = true;
        }

    });
    $(".InputNum").keypress(function(e) {
        if (e.whice != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) return false;
    })
})

$(document).ready(function() {
    // add a "rel" attrib if Opera 7+
    if (window.opera) {
        if ($("a.jqbookmark").attr("rel") != "") {
            $("a.jqbookmark").attr("rel", "sidebar");
        }
    }

    $("a.jqbookmark").click(function(event) {
        event.preventDefault();
        var url = this.href;
        var title = this.title;

        if (window.sidebar) { // Mozilla Firefox Bookmark
            window.sidebar.addPanel(title, url, "");
        } else if (window.external) { // IE Favorite
            window.external.AddFavorite(url, title);
        } else if (window.opera) { // Opera 7+
            return false; // do nothing
        } else {
            alert('Unfortunately, this browser does not support the requested action,'
			 + ' please bookmark this page manually.');
        }

    });
});
