// Custom written jquery Scripts

/*-- Switch on No Conflict mode --*/
jQuery.noConflict();

/*************** TABS *****************/
tabs = {
	init : function(){
		jQuery('.tabs').each(function(){	
			var th=jQUery(this);
			tContent=jQuery('.tab-content',th);
			navA=jQuery('ul.nav a',th);
			
			tContent.not().hide();
			tab_act=jQuery('ul.nav .selected a').attr('href');
			jQuery(tab_act).show();
			
			navA.click(function(){
				var th=jQuery(this);
				tmp=th.attr('href');
				tContent.not(jQuery(tmp.slice(tmp.indexOf('#'))).fadeIn(2000)).hide();
				jQuery(th).parent().addClass('selected').siblings().removeClass('selected');
				Cufon.refresh();
				return false;
			});
		});	
	}
}
// Tabs 2
jQuery(document).ready(function(){
	jQuery('#tabs div.pane').hide();
	jQuery('#tabs div.pane:first').show();
	jQuery('#tabs ul li:first').addClass('active');
	jQuery('#tabs ul li a').click(function(){ 
		jQuery('#tabs ul li').removeClass('active');
		jQuery(this).parent().addClass('active'); 
		var currentTab = jQuery(this).attr('href'); 
		jQuery('#tabs div').hide();
		jQuery(currentTab).show();
		Cufon.refresh();
		return false;
	});
});
/**************************************/


/*********** Scroll to Top ************/
jQuery(function() {
	jQuery(window).scroll(function() {
		if(jQuery(this).scrollTop() != 0) {
			jQuery('#toTop').fadeIn();	
		} else {
			jQuery('#toTop').fadeOut();
		}
	});
	jQuery('#toTop').click(function() {
		jQuery('body,html').animate({scrollTop:0},800);
	});	
});
/**************************************/


/********* Cufon Replacement **********/

Cufon.replace('#search-button, .quote-text, .read-more, .widget li a, .widget span', { fontFamily: 'Bebas Neue' });
Cufon.replace('h1, h2, h3, h4, h5, h6, .button, blockquote.type1, .toggle-trigger a, #tabs li a', { fontFamily: 'Bebas Neue' });
Cufon.replace('#portfolio-filter li a, #portfolio-list p', { fontFamily: 'Bebas Neue' });
Cufon.replace('.footerlinks, .comment-block, .comment-caption', { fontFamily: 'Bebas Neue' });
Cufon.replace('#contactFormWidget label, #contact-form label, #contact-form input#send', { fontFamily: 'Bebas Neue' });
Cufon.replace('.menu li a, #contact-details p, #contact-details span', { fontFamily: 'Bebas Neue' });


/**************************************/
jQuery(document).ready(function(){			
	// Feature box hover							
	jQuery('.feature-box a.read-more img').hover(function() {													  
		jQuery(this).attr("src", 'images/features_read_more_hover.png');
	},function() {
		jQuery(this).attr("src", 'images/features_read_more.png');
	});
	
	// Portfolio overlay on hover 
	jQuery('#portfolio-list li').hover(function() {													  
		jQuery(this).find('.overlay').fadeIn(700);
	},function() {
		jQuery(this).find('.overlay').fadeOut(400);
	});
	
	// Toggles
	jQuery(".toggle-container").hide();
	jQuery(".toggle-trigger").click(function(e){
		e.preventDefault;
		jQuery(this).toggleClass("active").next().slideToggle("normal");
		return false;
	});
	
	// Widgets hover
	
	jQuery('.widget li a').hover(function() {
		jQuery(this).animate({'padding-left' : '6px'}, 250);
	},function() {
		jQuery(this).animate({'padding-left' : '0'}, 250);
	});
	
});


