/***********************************************************************************************************************
DESCRIPTION: SCROLL TO TOP
DEVELOPED BY: 
NOTE: 
************************************************************************************************************************/
$(document).ready(function(){
    $(".scroll").click(function(event){
        //prevent the default action for the click event
        event.preventDefault();
 
        //get the full url - like mysitecom/index.htm#home
        var full_url = this.href;
 
        //split the url by # and get the anchor target name - home in mysitecom/index.htm#home
        var parts = full_url.split("#");
        var trgt = parts[1];
 
        //get the top offset of the target anchor
        var target_offset = $("#"+trgt).offset();
        var target_top = target_offset.top;
 
        //goto that anchor by setting the body scroll top to anchor top
        $('html, body').animate({scrollTop:target_top}, 500);
    });
});

// Clear Search Fields

$(function() {
$("#colone").hide();
$("#coltwo").hide();	
$("#colthree").hide();
$("#colfour").hide();
$("#colfive").hide();
	
$("#colone").fadeIn(1000, 0.0).fadeIn(0); 
$("#coltwo").fadeIn(1000, 0.0).fadeIn(0); 
$("#colthree").fadeIn(1000, 0.0).fadeIn(0); 
$("#colfour").fadeIn(1000, 0.0).fadeIn(0); 
$("#colfive").fadeIn(1000, 0.0).fadeIn(0); 

});

jQuery(document).ready(function($) {
    $("#newsletter input[type='text']").focus(function(){$(this).val("");});
	$("#calculator #input_5_1").focus(function(){$(this).val("");});
	$("#calculator #input_5_2").focus(function(){$(this).val("");});
	$(".demo #input_4_1").focus(function(){$(this).val("");});
	$(".demo #input_4_2").focus(function(){$(this).val("");});
});


$(function() {
        $('#sidebar').hide();
		$('#sidebar').delay(500);
        $('#sidebar').slideDown(1000);
});

/***********************************************************************************************************************
DESCRIPTION: Adds First / Last Child etc.
DEVELOPED BY: 
NOTE: 
************************************************************************************************************************/
$(document).ready(function() {
$("ul li:last-child").addClass("last");
$("ul li:first-child").addClass("first");
$("ol li:last-child").addClass("last");
$("ol li:first-child").addClass("first");
$("#content table tr:first-child").addClass("first");
$("#content table tr:last-child").addClass("last");
$("#content table tr th:first-child").addClass("th-first");
$("#content table tr td:first-child").addClass("td-first");
$("#content table tr td:last-child").addClass("td-last");
$("#content table tr th:last-child").addClass("th-last");
$("#content table tr:even").addClass("even");
$("#content table tr td:odd").addClass("odd");
$("#content table tr td:even").addClass("even");
});

$(document).ready(function() {
$("#steps ol li:nth-child(1)").addClass("step1");
$("#steps ol li:nth-child(2)").addClass("step2");
$("#steps ol li:nth-child(3)").addClass("step3");
$("#steps ol li:nth-child(4)").addClass("step4");
$("#steps ol li:nth-child(5)").addClass("step5");
$("#steps ol li:nth-child(6)").addClass("step6");
$("#steps ol li:nth-child(7)").addClass("step7");
$("#steps ol li:nth-child(8)").addClass("step8");
$("#steps ol li:nth-child(9)").addClass("step9");
$("#steps ol li:nth-child(10)").addClass("step10");
$("#steps ol li:nth-child(11)").addClass("step11");
$("#steps ol li:nth-child(12)").addClass("step12");
$("#steps ol li:nth-child(13)").addClass("step13");
$("#steps ol li:nth-child(14)").addClass("step14");
$("#steps ol li:nth-child(15)").addClass("step15");
$("#steps ol li:nth-child(16)").addClass("step16");
$("#steps ol li:nth-child(17)").addClass("step17");
$("#steps ol li:nth-child(18)").addClass("step18");
$("#steps ol li:nth-child(19)").addClass("step19");
$("#steps ol li:nth-child(20)").addClass("step20");
});

/***********************************************************************************************************************
DESCRIPTION: Adds a class "focus" to inputs, select, etc while active.
DEVELOPED BY: 
NOTE: 
************************************************************************************************************************/
function focusfix(selector, className) {
$(selector).focus(function() {
$(this).addClass(className);
});

$(selector).blur(function() {
$(this).removeClass(className);
});
}

jQuery(document).ready(function($) {
focusfix('input', 'focus');
});

jQuery(document).ready(function($) {
focusfix('textarea', 'focus');
});

jQuery(document).ready(function($) {
focusfix('select', 'focus');
});


/***********************************************************************************************************************
DESCRIPTION: Twitter
DEVELOPED BY: SEA OF CLOUDS
NOTE: 
************************************************************************************************************************/
jQuery(function($){
	$(".tweet").tweet({
	});
});

/***********************************************************************************************************************
DESCRIPTION: NIVO SLIDER
DEVELOPED BY: NIVO
NOTE: 
************************************************************************************************************************/
$(window).load(function() {
    $('#slider').nivoSlider({
        effect: 'slideInRight', // Specify sets like: 'fold,fade,sliceDown'
        slices: 15, // For slice animations
        boxCols: 8, // For box animations
        boxRows: 4, // For box animations
        animSpeed: 500, // Slide transition speed
        pauseTime: 6000, // How long each slide will show
        startSlide: 0, // Set starting Slide (0 index)
        directionNav: true, // Next & Prev navigation
        directionNavHide: true, // Only show on hover
        controlNav: true, // 1,2,3... navigation
        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: true, // Use left & right arrows
        pauseOnHover: true, // Stop animation while hovering
        manualAdvance: false, // Force manual transitions
        captionOpacity: 0.8, // Universal caption opacity
        prevText: 'Prev', // Prev directionNav text
        nextText: 'Next', // Next directionNav text
        randomStart: false, // Start on a random slide
        beforeChange: function(){}, // Triggers before a slide transition
        afterChange: function(){}, // Triggers after a slide transition
        slideshowEnd: function(){}, // Triggers after all slides have been shown
        lastSlide: function(){}, // Triggers when last slide is shown
        afterLoad: function(){} // Triggers when slider has loaded
    });
});
