$(window).load(function() {
	// Aviaslider for IOS
	$('#aviaslider').aviaSlider();
	
	$('#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:true, //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
	});

    // History
    $('a.col1').hover(function(){
        $(this).addClass('active').siblings().removeClass('active');
        $('p.col1').fadeIn('slow').siblings().hide();
    });

    $('a.col2').hover(function(){
        $(this).addClass('active').siblings().removeClass('active');
        $('p.col2').fadeIn('slow').siblings().hide();
    });

    $('a.col3').hover(function(){
        $(this).addClass('active').siblings().removeClass('active');
        $('p.col3').fadeIn('slow').siblings().hide();
    });

    // Service
    $('.service_item').click(function(){
        // Reset
        normal_color = '#808184';//$(this).css('background-color');
        $('.service_detail').html('').hide();
        $('.service_item').css({ "background-color":normal_color, "border-color":"#fff" });

        // Load client list
        service_info_id = 's' + $(this).attr('id');
        info = $('#' + service_info_id).html();

        if(info == '') return;
        $(this).siblings('.service_detail').html(info);

        active_class = 'bg_' + $(this).find('a').attr('class');
        $serviceDetail = $(this).addClass('border').siblings('.service_detail');
        $serviceDetail.removeClass('bg_richard bg_moore bg_associates').addClass(active_class).hide().fadeIn('fade');
        active_color = $serviceDetail.css('background-color');
        $(this).css({ "background-color":active_color, "border-color":active_color });
	});

    $('.process_list > div.row1').hover(
        function() {
            $(this).addClass('active1');
        },
        function() {
            $(this).removeClass('active1');
        }
    );

    $('.process_list > div.row2').hover(
        function() {
            $(this).addClass('active2');
        },
        function() {
            $(this).removeClass('active2');
        }
    );

    $('.process_list > div.row3').hover(
        function() {
            $(this).addClass('active3');
        },
        function() {
            $(this).removeClass('active3');
        }
    );
});
