$(document).ready(function()
{



    $('#column-left').css({'left' : '-160px'});
    var $marginOne = $('#column-left');
    $marginOne.animate(
    {marginLeft:'160px'},500);


    $('#column-center').css({'left' : '-340px'});
    var $marginTwo = $('#column-center');
    $marginTwo.animate(
    {marginLeft:'500px'},1500);

    $('#column-center2').css({'left' : '-840px'});
    var $marginTwo = $('#column-center2');
    $marginTwo.animate(
    {marginLeft:'1000px'},1500);


   $('#column-right').css({'left' : '-500px'});
    var $marginThree = $('#column-right');
    $marginThree.animate(
    {marginLeft:'1000px'},2900);

    $('#rates').css({'bottom' : '-400px'});
    $('#rates-button').click(function ()
    {
        var ratesCheck = $('#rates').css('margin-bottom');
        if (ratesCheck=='-400px')
        {
            var $marginRates = $('#rates');
            $marginRates.animate(
            {marginBottom:'400px'},500);
        }
        else
        {
            var $marginRates = $('#rates');
            $marginRates.animate(
            {marginBottom:'-400px'},500);
        }
      });

    $('#gallery-button-1').click(function ()
     {
        var $marginFour = $('#column-right-inner');
        $marginFour.animate(
        {marginLeft:'-500px'},500);
        $('#column-right-inner').css({'left' : '-500px'});
        var $marginFour = $('#column-right-inner');
        $marginFour.animate(
        {marginLeft:'500px'},1000);

                $(this).delay(500,function(){
                $('#one').show();
                $('#two').hide();
                $('#three').hide();
                $('#four').hide();
                $('#five').hide();
                $('#six').hide();

        });

      });

      $('#gallery-button-2').click(function ()
     {
        var $marginFour = $('#column-right-inner');
        $marginFour.animate(
        {marginLeft:'-500px'},500);
        $('#column-right-inner').css({'left' : '-500px'});
        var $marginFour = $('#column-right-inner');
        $marginFour.animate(
        {marginLeft:'500px'},1000);

                $(this).delay(500,function(){
                $('#one').hide();
                $('#two').show();
                $('#three').hide();
                $('#four').hide();
                $('#five').hide();
                $('#six').hide();

        });

      });

      $('#gallery-button-3').click(function ()
     {
        var $marginFour = $('#column-right-inner');
        $marginFour.animate(
        {marginLeft:'-500px'},500);
        $('#column-right-inner').css({'left' : '-500px'});
        var $marginFour = $('#column-right-inner');
        $marginFour.animate(
        {marginLeft:'500px'},1000);

                $(this).delay(500,function(){
                $('#one').hide();
                $('#two').hide();
                $('#three').show();
                $('#four').hide();
                $('#five').hide();
                $('#six').hide();

        });

      });

       $('#gallery-button-4').click(function ()
     {
        var $marginFour = $('#column-right-inner');
        $marginFour.animate(
        {marginLeft:'-500px'},500);
        $('#column-right-inner').css({'left' : '-500px'});
        var $marginFour = $('#column-right-inner');
        $marginFour.animate(
        {marginLeft:'500px'},1000);

                $(this).delay(500,function(){
                $('#one').hide();
                $('#two').hide();
                $('#three').hide();
                $('#four').show();
                $('#five').hide();
                $('#six').hide();

        });

      });

        $('#gallery-button-5').click(function ()
     {
        var $marginFour = $('#column-right-inner');
        $marginFour.animate(
        {marginLeft:'-500px'},500);
        $('#column-right-inner').css({'left' : '-500px'});
        var $marginFour = $('#column-right-inner');
        $marginFour.animate(
        {marginLeft:'500px'},1000);

                $(this).delay(500,function(){
                $('#one').hide();
                $('#two').hide();
                $('#three').hide();
                $('#four').hide();
                $('#five').show();
                $('#six').hide();

        });

      });

       $('#gallery-button-6').click(function ()
     {
        var $marginFour = $('#column-right-inner');
        $marginFour.animate(
        {marginLeft:'-500px'},500);
        $('#column-right-inner').css({'left' : '-500px'});
        var $marginFour = $('#column-right-inner');
        $marginFour.animate(
        {marginLeft:'500px'},1000);

                $(this).delay(500,function(){
                $('#one').hide();
                $('#two').hide();
                $('#three').hide();
                $('#four').hide();
                $('#five').hide();
                $('#six').show();

        });

      });











    // 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");
            });
        });
    });
}

      jQuery.fn.delay = function(time,func){
    this.each(function(){
        setTimeout(func,time);
    });

    return this;
};

