jQuery("document").ready(function() {

	// LOGIN FORM DROPDOWN
		
	jQuery(".nav .login a.button").click(function() {
		jQuery(this).toggleClass("hover");
		jQuery(".nav .login .login-form").slideToggle(500);
		
		return false;
	});

	// SLIDING DROPDOWNS
		
	jQuery(".nav li").each(function() {	
		
		var jQuerysublist = jQuery(this).find("ul:first");
		
		jQuery(this).hover(function() {	
			jQuery(this).addClass("hover");
			jQuerysublist.stop().css( {height:"auto", overflow:"hidden", display:"none"} ).slideDown(500, function() {
				jQuery(this).css( {height:"auto", overflow:"visible"} );
			});	
		},
		function() {	
			jQuery(this).removeClass("hover");
			jQuerysublist.stop().slideUp(200, function()	{	
				jQuery(this).css( {display:"none", overflow:"hidden"} );
			});
		});	
	});
	
		// CONTENT TABS
	
                jQuery(function () {
                        var tabContainers = jQuery('div.content-tab > div');
                        tabContainers.hide().filter(':first').show();
                        
                        jQuery('div.content-tab ul.tabNavigation a').click(function () {
                                tabContainers.hide();
                                tabContainers.filter(this.hash).show();
                                jQuery('div.content-tab ul.tabNavigation a').removeClass('selected');
                                jQuery(this).addClass('selected');
                                return false;
                        }).filter(':first').click();
                });
 
		// CONTENT TOGGLE                
                
jQuery(document).ready(function () {
	
	jQuery('#toggle-view li').click(function () {

		var text = jQuery(this).children('p');

		if (text.is(':hidden')) {
			text.slideDown('200');
			jQuery(this).children('span').html('<img src="img/collaps.png" alt="" class="" />');		
		} else {
			text.slideUp('200');
			jQuery(this).children('span').html('<img src="img/expand.png" alt="" class="" />');		
		}
		
	});

});
	
	
	// FEATURED SLIDER 
	
	jQuery('.featured-nav').show();
	
	jQuery('.featured .slider').cycle({ 
	    fx:     'fade', 
	    speed:  '800', 
	    timeout: 7000, 
	    pager:  '.featured-nav li',
	    prev:	'p.prev',
	    next:	'p.next', 
	     
	    // callback fn that creates a thumbnail to use as pager anchor 
	    pagerAnchorBuilder: function(idx, slide) {
	        return '<li><a href="#"><img src="' + slide.src + '" /></a></li>'; 
	    } 
	});
	
	// TABS NAVIGATION HOVERS 
	
	jQuery(".tab-nav ul li a").hover(function() { 
		jQuery(this).parent().addClass("hover")}, function() {
		jQuery(this).parent().removeClass("hover")
	});
	
	// SORTABLE PORTFOLIO

jQuery(document).ready(function() {
	jQuery('ul#filter a').click(function() {
		jQuery(this).css('outline','none');
		jQuery('ul#filter .current').removeClass('current');
		jQuery(this).parent().addClass('current');
		
		var filterVal = jQuery(this).text().toLowerCase().replace(' ','-');
				
		if(filterVal == 'all') {
			jQuery('ul#portfolio li.hidden').fadeIn('slow').removeClass('hidden');
		} else {
			
			jQuery('ul#portfolio li').each(function() {
				if(!jQuery(this).hasClass(filterVal)) {
					jQuery(this).fadeOut('slow').addClass('hidden');
				} else {
					jQuery(this).fadeIn('slow').removeClass('hidden');
				}
			});
		}
		
		return false;
	});
});

	// PORTFOLIO SLIDER

jQuery(document).ready(function (){
	jQuery('#button a').click(function(){
		var integer = jQuery(this).attr('rel');
		jQuery('#portfolio-slider .cover').animate({left:-619*(parseInt(integer)-1)})  /*----- Width of div mystuff (here 619) ------ */
		jQuery('#button a').each(function(){
		jQuery(this).removeClass('active');
			if(jQuery(this).hasClass('button'+integer)){
				jQuery(this).addClass('active')}
		});
	});
});


	// COLOR TIP

jQuery(document).ready(function(){

	/* Adding a colortip to any tag with a title attribute: */

	jQuery('[title]').colorTip({color:'yellow'});

});

	// NIVO ZOOM LIGHTBOX

jQuery(window).load(function() {
	jQuery('body').nivoZoom({
		speed:500,
		zoomHoverOpacity:0.8,
		overlay:true,
		overlayColor:'#333',
		overlayOpacity:0.5,
		captionOpacity:0.8
	});
});
	
	
	// TABS SWITCHING
	
	jQuery(function() {
		var contentWrapper = jQuery("#container .tabs .tab");
		// only show the first item, hide the rest
		contentWrapper.hide().filter(":first").show();
		
		jQuery("div.tab-nav ul li a").click(function () {
		
		    // check if this item doesn"t have class "current"
		    // if it has class "current" it must not execute the script again
		    if (this.className.indexOf("current") == -1){
		    	contentWrapper.hide();
		    	contentWrapper.filter(this.hash).show();
		    	jQuery("div.tab-nav ul li a").removeClass("current");
		    	jQuery(this).addClass("current");
		    }
		    return false;
		});
	});
	
});
