
$(function(){
    $('#header h2').click(function(){
    window.location = 'index.php';
    return false;
}).css('cursor', 'pointer');

//------------------------------ Home Page Form
var formVal = [];

$('#contact > *').each(function(){
    var contId = $(this).attr('id');
    var contLabel = $('#contact label[for="'+contId+'"]').text();
    formVal[contId] = contLabel;
    var newVal = formVal[contId];
    $(this).attr('value', newVal);
    $('#contact label').css('text-indent','-9999px');
})
.addClass('greyedOut')
.addClass('autoFill')

$('#contact > *').focus(function(){
    var thisVal = $(this).attr('value');
    var contId = $(this).attr('id');
    var oldVal = formVal[contId];
    
    if(thisVal == oldVal){
        $(this).attr('value', "").removeClass('greyedOut');
    }
}).blur(function(){
    var contId = $(this).attr('id');
    var oldVal = formVal[contId];
    if($(this).attr('value') == ""){
        $(this).attr('value', oldVal).addClass('greyedOut');
    }
})

$('input#moreInfo').attr('value', 'Provide more info');

//------------------------------ Slide Show

$('.slideBox').each(function(){
    var proId = $(this).parent().attr('id');
    $('#'+proId+' .slideBox').cycle({
        fx:     'fade',
        speed:  1000,
        timeout: 0,
        pager:  '#'+proId+' .slideNav'
    });
})

//------------------------------ Add hover class with js

$('input[type=submit]').hover(function(){
$(this).addClass('hover');
}, function(){
$(this).removeClass('hover');
})

//------------------------------ Slide Show About Us

$('#slideNavAbout').cycle({
    fx:     'scrollRight',
    speed:  '1000',
    timeout: 0,
    pager:  '#teamNav',
    pagerAnchorBuilder: function(idx, slide) {
        var path = jQuery(slide).children("img").eq(0).attr('src');
        var newPath = path.replace('.jpg', '_thumb.jpg');
        return '<li><a href="#"><img src="' + newPath + '" height="150" width="150"/></a></li>';
    }

    }).css('width', '100%');

    $('#teamNav li:nth-child(5)').addClass('fifth');
    $('#theTeam').css('display', 'block');

})

