$(document).ready(function() {
    // JQuery Cycle slideshow
    $('#slideshow').cycle({
		fx: 'fade',
        speed: 2500
	});

    // 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").validate();

    // IE6 Upgrade Message
    var ie6 = $.browser.msie && parseInt($.browser.version) === 6 && typeof window['XMLHttpRequest'] !== "object";
    if(ie6) {
        $('body').prepend('<div style="padding:8px;border:1px solid #bbbbbb;background-color:#f2f3f8;margin:2px 8px;font-size: 11px;"><h2 style="margin: 0px;">Upgrade your browser for a better web experience!</h2><p>You are using a browser that is <b>10 Years Old!</b><p>Why not download <a style="color: #62120f;" href="http://ie.microsoft.com/" target="_blank">Internet Explorer 9</a>, <a style="color: #62120f;" href="http://www.mozilla.com/en-US/firefox/" target="_blank">Mozilla Firefox</a> or <a style="color: #62120f;" href="http://www.google.com/chrome/" target="_blank">Google Chrome</a> for <b>free</b>?</p></div>');
    }
});

// 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");
            });
        });
    });
}
