
$(document).ready(function(){	
	if($("#contact_form")){
		$("#email").focus();
	};
	var categ = $("#projects dt");
	categ.each(function(){
		categ.click(function(){
			$("dt").removeClass("active");
			$("dd").removeClass("active");
			$("dd a.selected").removeClass("selected");
			$(this).addClass("active");
			$(this).next("dd").addClass("active");
		});
	});
});

function slideSwitch(switchSpeed) {
    var $active = $('#slide img.active');
    
    if ( $active.length == 0 ) $active = $('#slide img:last');

    var $next =  $active.next('img').length ? $active.next('img')
        : $('#slide img:first');

    $active.addClass('last-active');
	
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, switchSpeed, function() {
            $active.removeClass('active last-active');
        });
}
function slideSwitch1(switchSpeed) {
    var $active = $('#slide_design img.active');
    
    if ( $active.length == 0 ) $active = $('#slide_design img:last');

    var $next =  $active.next('img').length ? $active.next('img')
        : $('#slide_design img:first');

    $active.addClass('last-active');
	
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, switchSpeed, function() {
            $active.removeClass('active last-active');
        });
}
function slideSwitch2(switchSpeed) {
    var $active = $('#slide_exp img.active');
    
    if ( $active.length == 0 ) $active = $('#slide_exp img:last');

    var $next =  $active.next('img').length ? $active.next('img')
        : $('#slide_exp img:first');

    $active.addClass('last-active');
	
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, switchSpeed, function() {
            $active.removeClass('active last-active');
        });
}
$(function() {
    setInterval ( "slideSwitch(1000)", 5000 );
    setInterval ( "slideSwitch1(1000)", 5000 );
    setInterval ( "slideSwitch2(1000)", 5000 );
});
