$(document).ready(function () {
    $('#slider').nivoSlider({
        effect: 'fade', //Specify sets like: 'fold,fade,sliceDown'
        slices: 15,
        animSpeed: 500, //Slide transition speed
        pauseTime: 3000,
        startSlide: 0, //Set starting Slide (0 index)
        directionNav: true, //Next & Prev
        directionNavHide: true, //Only show on hover
        controlNav: false, //1,2,3...
        controlNavThumbs: false, //Use thumbnails for Control Nav
        controlNavThumbsFromRel: false, //Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', //Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
        keyboardNav: false, //Use left & right arrows
        pauseOnHover: true, //Stop animation while hovering
        manualAdvance: false, //Force manual transitions
        captionOpacity: 0.8, //Universal caption opacity
        beforeChange: function(){},
        afterChange: function(){},
        slideshowEnd: function(){}, //Triggers after all slides have been shown
        lastSlide: function(){}, //Triggers when last slide is shown
        afterLoad: function(){} //Triggers when slider has loaded
    });

    $("#newsFeed").getTwitter({
        userName: "d3c3it",
        numTweets: 1,
        loaderText: "Loading tweet...",
        slideIn: false,
        showHeading: false,
        headingText: "",
        showProfileLink: false
    });

    $('a#itemHome')
        .css( {backgroundPosition: "0px 0px"} )
        .mouseover(function(){
            $(this).stop().animate({backgroundPosition:"(0px 85px)"}, {duration: 150})
        })
        .mouseout(function(){
            $(this).stop().animate({backgroundPosition:"(0px 0px)"}, {duration: 150, complete:function(){
                $(this).css({backgroundPosition: "0px 0px"})
            }})
        })

    $('a#itemPortfolio')
        .css( {backgroundPosition: "-150px 0px"} )
        .mouseover(function(){
            $(this).stop().animate({backgroundPosition:"(-150px 85px)"}, {duration: 150})
        })
        .mouseout(function(){
            $(this).stop().animate({backgroundPosition:"(-150px 0px)"}, {duration: 150, complete:function(){
                $(this).css({backgroundPosition: "-150px 0px"})
        }})
    })

    $('a#itemAbout')
        .css( {backgroundPosition: "-343px 0px"} )
        .mouseover(function(){
            $(this).stop().animate({backgroundPosition:"(-343px 85px)"}, {duration: 150})
        })
        .mouseout(function(){
            $(this).stop().animate({backgroundPosition:"(-343px 0px)"}, {duration: 150, complete:function(){
                $(this).css({backgroundPosition: "-343px 0px"})
        }})
    })

    $('a#itemContact')
        .css( {backgroundPosition: "-494px 0px"} )
        .mouseover(function(){
            $(this).stop().animate({backgroundPosition:"(-494px 85px)"}, {duration: 150})
        })
        .mouseout(function(){
            $(this).stop().animate({backgroundPosition:"(-494px 0px)"}, {duration: 150, complete:function(){
                $(this).css({backgroundPosition: "-494px 0px"})
        }})
    })
    
    $('input[type="text"], input[type="password"], textarea').focus(function() {
        $(this).addClass('focusField');
        if (this.value == this.defaultValue){ 
            this.value = '';
        }
        if(this.value != this.defaultValue){
            this.select();
        }
    });

    $('input[type="text"], input[type="password"], textarea').blur(function() {
        $(this).removeClass('focusField');
        if ($.trim(this.value) == ''){
            this.value = (this.defaultValue ? this.defaultValue : '');
        }
    });
});


var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-8645363-2']);
_gaq.push(['_trackPageview']);

(function() {
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
