$(window).load(function(){
						   
	// -- NIVO SLIDER --

	$('#fader').nivoSlider({
		effect:'fold', 		//sliceDownRight, sliceDownLeft, sliceUpRight, sliceUpLeft, sliceUpDown, sliceUpDownLeft, fold, fade
		slices:15,								//Number of slices
		animSpeed:250,							//Speed of animation
		pauseTime:5000,							//Time for which slides remain visible
		directionNav:false, 					//Next & Prev
		directionNavHide:true,					//Only show on hover		
		startSlide:0, 							//Set starting Slide (0 index)
		controlNav:true, 						//Nav Bullets
		keyboardNav:true, 						//Use left & right arrows
		pauseOnHover:true, 						//Stop animation while hovering
		captionOpacity:0 						//We're using custom captions. So hide default ones using '0' opacity.
	})
	
}) // -- End window.load call	
						   
$(document).ready(function(){
						   
	// -- NAVIGATION MENU --

	$('.navigation ul').css({display: "none"});
	$('.navigation li:has(ul)').addClass('has_child');
	$('.navigation li').hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).slideDown(250);
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
	})
	
	// -- JQUERY TABS --

	//$("#tabs").tabs({fx:{ height: 'toggle', opacity: 'toggle', duration: 300 }})
	$(".combat_tabs").tabs({fx:{ opacity: 'toggle', duration: 150 }})
	

	// -- ACCORDION --
	$('ul.accordion').accordion()
	
	
	// -- PRETTYPHOTO INIT --

	$("a[rel^='prettyPhoto[group1]'], a[rel^='prettyPhoto[group2]'], a[rel^='prettyPhoto[group3]']").prettyPhoto({theme:'dark_square', showTitle:false, opacity:0.6})
	
	// -- PORTFOLIO THUMBNAIL HOVER MINI PLUGIN --

	jQuery.fn.thumbHover = function(options) {
	   var settings = jQuery.extend({ xOffset: 0, yOffset: 0 }, options);
		$(this).each(function() 
		{	
			$action = 'play';		
			if($(this).attr('href').match(/(jpg|jpeg|jpe|png|gif|tif|tiff)/)) 
				$action = 'zoom';			
			var $item = $(this).contents("img");
			if ($item.length > 0)
			{	
				var $mediaIcon = $("<div class='"+$action+"'></div>").appendTo($(this));
				$mediaIcon.css({display: "none"});
				$(this).hover(function()
					{
						$x = $item.width();											
						$y = $item.height();
						$xy =  $item.position();
						$mediaIcon.css({width:$x, height:$y, top:$xy.top + settings.xOffset, left:$xy.left + settings.yOffset});
						$(this).contents("img").stop().animate({"opacity": "0.5"}, 200);
						$mediaIcon.css({visibility: "visible",display: "none"}).fadeIn();
					}, function() {
						$(this).contents("img").stop().animate({"opacity": "1"}, 200);
						$mediaIcon.css({visibility: "visible"}).fadeOut();
					}
				);
			}	
		}); 
		return this;
	 };
	 $("a[rel^='prettyPhoto[group1]']").thumbHover({ xOffset: 8, yOffset: 8 });
	 $("a[rel^='prettyPhoto[group2]']").thumbHover({ xOffset: 2, yOffset: 2 });
	 $("a[rel^='prettyPhoto[group3]']").thumbHover({ xOffset: 3, yOffset: 3 });
	

	// -- FLICKR IMAGE GALLERY HOVER --	
	$('.flickr_badge_image > a').each(function() 
	{	
		var $items = $(this).contents("img");
		if ($items.length > 0)
		{	
			var $fl = $("<span class=\"flickr_ico\"></span>").appendTo($(this));
			$fl.css({display: "none"});
			$(this).hover(function()
				{
					$ab =  $items.position();		
					$fl.css({width:24, height:24, top:$ab.top, left:$ab.left});
					$(this).contents("img").stop().animate({"opacity": "0.4"}, 350);
					$fl.css({visibility: "visible",display: "none"}).fadeIn();
				}, function() {
					$(this).contents("img").stop().animate({"opacity": "1"}, 350);
					$fl.css({visibility: "visible"}).fadeOut();
				}
			);
		}	
	})
}) // end document.ready call
