$(document).ready(function(){
	
	////// SMOKE ANIMATION //////////////////////////////////////////

	$('body').append('<div id="smoke1"></div><div id="smoke2"></div>');
	
	setInterval("bloooming_smoke('smoke1','smoke2')", 50);
	
		
	///// SHOW LOADING IMAGE ON AJAX ACTIVITY ////////////////
	$('.ajax')
	    .hide()  // hide it initially
	    .ajaxStart(function() {
	        $(this).show();
	    })
	    .ajaxStop(function() {
	        $(this).delay(350).fadeOut();
	    });
    


	///// DROP DOWN MENU //////////////////////////////////////
	

	$('#nav ul li ul').prepend('<li class="first"></li>');	
	$('#nav ul li ul').append('<li class="last"></li>');	

	$('#nav ul').supersubs({
		'minWidth' : 15
	
	}).superfish({
		'autoArrows':    false,
		'speed':         'fast'

	});
	

	// disable tooltip on home button 
	 $('.menu li:first a').removeAttr('title');
	
	/////// SHOP ////////////////////////////////////////////////
	$('.shopwrapper').bloooming_shop();

	///// SLIDER 1,2,3 ////////////////////////////////////////

	$('#slider1').anythingSlider({
		easing: 'swing',
		autoPlay: true,
		delay: 3000,
        animationTime: 1000 	
	});
	
	$('#slider3').anythingSlider({
		easing: 'swing',
		autoPlay: true,
		delay: 3000,
        animationTime: 1000 	
	});
	
	
	$('#slider2').nivoSlider({
		animSpeed:500,
		pauseTime:7000,
		directionNav:true, 
		keyboardNav:true,
		directionNavHide:false
	});
	

	
	/// NIVO SLIDER DOTS //////////////////////////
	
	$('.nivo-controlNav').wrapInner('<div class="nivo-controlInner" />');

	
	
	/// CURVY CORNERS ON IMAGES FOR FIREFOX //////////////////////////
	
 	   	$('#tabs img').bloooming_roundPic();
 	 	$('.content_left img').bloooming_roundPic();
 	   	
 	   	$('.product img').bloooming_roundPic();
 	   	$('.littlegal img').bloooming_roundPic();
 	   	$('.portfolio img').bloooming_roundPic();
 	   	
 	   	$('.content_right img').bloooming_roundPic();
 	   	$('#generalfullwidth img').bloooming_roundPic();
		
		// littlegal fix 
		$('.littlegal .rounded').css('width','85px');
		$('.littlegal .rounded').css('height','85px');
				
		
	///// ADD REL TAG TO ALL LINKED PICTURES /////////////////////////
		
	$('#tab1 a.zoom').attr('rel','tab1rel');
	$('#tab2 a.zoom').attr('rel','tab2rel');
	$('#tab3 a.zoom').attr('rel','tab3rel');
	$('#tab4 a.zoom').attr('rel','tab4rel');
	$('#tab5 a.zoom').attr('rel','tab5rel');
	


	/// TABS ////////////////////////////////////////////
	
	$(".tabcontent").hide(); 
	$("ul.tabs li:first").addClass("active").show(); 
	$(".tabcontent:first").show(); 

		//On Click Event
		$("ul.tabs li").click(function() {
			$("ul.tabs li").removeClass("active"); 
			$(this).addClass("active"); 
			$(".tabcontent").hide(); 
			var activeTab = $(this).find("a").attr("href"); 
			$(activeTab).fadeIn(); 
			return false;
		});


	/// FOOTER LINK ////////////////////////////////////////////
	$('.logo_small').click(function(){
   		 $('html, body').animate({scrollTop:0}, 'slow');
   		 return false;
	});
	
	
	/// ALTERNATING COLS /////////////////////////////////
	
	$('.tabcontent .tabcol').bloooming_alternate(3);
	
	
	/// CUFON ////////////////////////////////////////////
 
    Cufon.replace('h1');
	Cufon.replace('h2');
	Cufon.replace('h3');
	Cufon.replace('.price');
	Cufon.replace('caption');
	

	/// COLLAPSIBLE MENU //////////////////////////////////

	$('.collapsmenu').bloooming_wpcollaps();


	$('.content_right .littlegal li').bloooming_alternate(2);
	

	/// GALLERIES FUNCTIONS //////////////////////////////////
	$('.zoom').colorbox({
		opacity:0.6
	});	
	

	$('.videozoom').colorbox({
		iframe:true, innerWidth:425, innerHeight:344,opacity:0.6
	});	
	$('.zoom').bloooming_picHover();
	$('.videozoom').bloooming_picHover();
	
	$('.alignright').parent().addClass('floatright');
	$('.alignleft').parent().addClass('floatleft');
	
	
	//// STRIPES for GENERAL CONTENT LAYOUT ////////////
	
	$('#generalcontent').append('<div id="stripes"></div>');
	
	
});
