$(document).ready(function() {

    // Div Z-index fix
    /*$(function() {
        var zIndexNumber=1000;
        $('div').each(function(){
            $(this).css('zIndex', zIndexNumber);
            zIndexNumber-=10;
        });
    });*/

    // JQuery Validation for all applicable forms
    $(".validated-form").each(function(){
        $(this).validate();
    });
  

    
});

// Auto-fill default values back in on focus/blur on contact form inputs
function contactFormAutoValues(justCaptcha){
    $(document).ready(function() {
        justCaptcha=typeof(justCaptcha)!='undefined' ? justCaptcha : false;
        if(justCaptcha){
            var selector="#captcha-number";
        }
        else{
            var selector=".contact-form input:text, .contact-form textarea";
        }
        $(selector).each(function(){
            this.defaultText = this.value;
            $(this).focus(function(){
                if(this.value == this.defaultText) this.value = "";
                $(this).removeClass("default");
            })
            $(this).blur(function(){
                if (this.value == "" && this.defaultText) this.value = this.defaultText;
                $(this).addClass("default");
            });
        });
    });
}
