$(document).ready(function() {  

	/* index */
if ($("body#index")){
		$("#fallback").hide();
		$("#mycarousel").show();
		$("#feature_control").show();

	function mycarousel_initCallback(carousel) {
	
	    $('a.jcarousel-control').bind('click', function() {
	        carousel.scroll($(this).attr('title'));
	        return false;
	    });
	    
	    $('#mycarousel-next').bind('click', function() {
	        carousel.next();
	        return false;
	    });
	
	    $('#mycarousel-prev').bind('click', function() {
	        carousel.prev();
	        return false;
	    });
	    
	    $("#feature_control").hover(function() {
			carousel.stopAuto();
		}, function() {
			carousel.startAuto();
    	});

	};
	
	function mycarousel_itemVisibleInCallbackBeforeAnimation(carousel, item, idx, state) {
	    if (state == 'init')
	        return;
	    $('a.jcarousel-control[title='+idx+']').addClass('selected');
	    $('a.jcarousel-control[title!='+idx+']').removeClass('selected');
	};

}
	if ($("body#index")){
	    $("#mycarousel").jcarousel({
			scroll: 1,
			auto: 4,
			easing: 'swing',
			wrap: 'both',
	        initCallback: mycarousel_initCallback,
	        itemVisibleInCallback: {
	        	onBeforeAnimation: mycarousel_itemVisibleInCallbackBeforeAnimation
	        },
	        buttonNextHTML: null,
	        buttonPrevHTML: null
	    });
	    
	    
    }

	/* blog */
	
	
		$("#blog_sidebar #search").hide();
	     
		$("#blog_sidebar #search_button a").click(function(event){
			$("#blog_sidebar #search").slideToggle('fast');
			event.preventDefault();
	     });
	     
		$(".comment_form_content label").hide();
		$(".comment_form_content textarea").text('Type your message here');
		
		if ($(".comment_form_content input.name").attr('value') == "") {
    		$(".comment_form_content input.name").attr('value', 'Your Name');
    	}
    	
    	if ($(".comment_form_content input.email").attr('value') == "") {
    		$(".comment_form_content input.email").attr('value', 'Your Email');
    	}
    	
    	if ($(".comment_form_content input.link").attr('value') == "") {
    		$(".comment_form_content input.link").attr('value', 'Your Website');
    	}
		
		
		$(".comment_form_content textarea").focusin(function() {
			if ($(this).text() == "Type your message here") {
				$(this).text('');
			}
		});
		
		$(".comment_form_content input").focusin(function() {
			if ($(this).attr('value') == "Your Name" || $(this).attr('value') == "Your Email" || $(this).attr('value') == "Your Website") {
				$(this).attr('value', '');
			}
		});
		
		$(".comment_form_content input").click(function() {
			if ($(this).attr('value') == "Your Name" || $(this).attr('value') == "Your Email" || $(this).attr('value') == "Your Website") {
				$(this).attr('value', '');
			}
		});
		
		$('#commentform').submit(function() {
    		if ($(".comment_form_content input.link").attr('value') == "Your Website") {
    			$(".comment_form_content input.link").attr('value', '');
    		}
		});

		
        
	/* footer */
	
	$('#web_box div.wrap').hide();  
	$('#web_box div.wrap:first').show();  
	
	$('#web_tabs > li').click(function(){  
	    if (!$(this).hasClass('selected')) {      
	    	$('#web_tabs > li').removeClass('selected');  
	    	$(this).addClass('selected');  
	    	$('#web_box div.wrap').hide();  
	    	$('#web_box div.wrap:eq(' + $('#web_tabs > li').index(this) + ')').fadeIn('fast');  
		}  
	  
	}).mouseover(function() {  
	    $(this).addClass('mouseover');  
	    $(this).removeClass('mouseout');     
	}).mouseout(function() {   
	    $(this).addClass('mouseout');  
	    $(this).removeClass('mouseover');      
	});  

	$("#contact label").hide();
	$("#contact textarea").text('Type your message here');
	$("#contact input.name").attr('value', 'Your Name');
	$("#contact input.email").attr('value', 'Your Email');
		
	$("#contact textarea").focusin(function() {
		if ($(this).text() == "Type your message here") {
			$(this).text('');
		}
	});
		
	$("#contact input").focusin(function() {
		if ($(this).attr('value') == "Your Name" || $(this).attr('value') == "Your Email") {
			$(this).attr('value', '');
		}
	});
      
});


	$('portfolio-list').filterable({
	});

