/* cufon text replacement */
Cufon.replace('h2', { fontFamily: 'comfortaa-regular' });
Cufon.replace('#content .page-content.sub .content-blog-right .box h4', { fontFamily: 'comfortaa-regular' });

$(document).ready(function() {
	// once the document is ready - display the whole page //
    var bodyElems = document.getElementsByTagName("body");
    bodyElems[0].style.visibility = "visible";
 
    
    $(".home-slidetabs").tabs(".home-slideshow .images > div", {
	 
		// enable "cross-fading" effect
		effect: 'fade',
		fadeOutSpeed: 1500,
		fadeInSpeed: 1500,
		disabled: 'disabled',
	  	
		// start from the beginning after the last tab
		rotate: true
	 
	// use the slideshow plugin. It accepts its own configuration
	}).slideshow({autoplay: true, interval: 4000});// 5 second interval
    
    $(".page-slidetabs").tabs(".page-slideshow .images > div", {
	 
		// enable "cross-fading" effect
		effect: 'fade',
		fadeOutSpeed: 1500,
		fadeInSpeed: 1500,
		disabled: 'disabled',
	  	
		// start from the beginning after the last tab
		rotate: true
	 
	// use the slideshow plugin. It accepts its own configuration
	}).slideshow({autoplay: true, interval: 4000});// 5 second interval
    
    // media slider //
    $(".media-slidetabs .items").tabs(".media-slideshow .images > div", {
	 
		// enable "cross-fading" effect
		effect: 'fade',
		fadeOutSpeed: 500,
		fadeInSpeed: 500,
		disabled: 'disabled',
	  	
		// start from the beginning after the last tab
		rotate: true
	 
	// use the slideshow plugin. It accepts its own configuration
	}).slideshow({autoplay: false,clickable: false});

	// media scrollable //
	$("#content .page-content.sub .content-media .scrollable .media-slidetabs").scrollable({circular: true});
	
	$("#content .page-content.sub .content-media .scrollable .media-slidetabs .items div img").click(function() {
	
		// see if same thumb is being clicked
		if ($(this).hasClass("active")) { return; }
	
		// activate item
		$("#content .page-content.sub .content-media .scrollable .items .media-slidetabs div img").removeClass("active");
		$(this).addClass("active");
	
	// when page loads simulate a "click" on the first image
	}).filter(":first").click();

    
    // portfolio slider //
    $(".portfolio-slidetabs .items").tabs(".portfolio-slideshow .images > div", {
	 
		// enable "cross-fading" effect
		effect: 'fade',
		fadeOutSpeed: 500,
		fadeInSpeed: 500,
		disabled: 'disabled',
	  	
		// start from the beginning after the last tab
		rotate: true
	 
	// use the slideshow plugin. It accepts its own configuration
	}).slideshow({autoplay: false});
   
	// portfolio scrollable //
	$("#content .page-content.sub .content-portfolio .scrollable .portfolio-slidetabs").scrollable({circular: true});
	
	$("#content .page-content.sub .content-portfolio .scrollable .portfolio-slidetabs .items div img").click(function() {
	
		// see if same thumb is being clicked
		if ($(this).hasClass("active")) { return; }
	
	// when page loads simulate a "click" on the first image
	}).filter(":first").click();
	
	$("#header div.menu ul.login li a.log-in").click(function() {
		$('#header div.menu div.login-form').fadeIn();
	});
	
	$("#header div.menu div.login-form .close").click(function() {
		$('#header div.menu div.login-form').fadeOut();
	});
	
	$("#content #header div.menu ul li.drop").mouseover(function(){
		$("ul",this).css({'display' : 'block'});
		$(this).addClass('active');
	});
	$("#content #header div.menu ul li.drop").mouseout(function(){
		$("ul",this).css({'display' : 'none'});
		$(this).removeClass('active');
	});

	$("#content #header div.menu ul li.drop ul").mouseover(function(){
		$(this).css({'display' : 'block'});
		$(this).parent().addClass('active');
	});
	$("#content #header div.menu ul li.drop ul").mouseout(function(){
		$(this).css({'display' : 'none'});
		$("#content #header div.menu ul li.drop").removeClass('active');
	});

	//modal box init()
	$(".overlay[rel]").overlay({
		effect: 'fade',
		mask: '#000000'
	});
	
});
