	
$(document).ready(function(){

	
	//VARIABLES FOR QUICK MODS
	var navTarget = "ul#nav li a"  																				//menu link to target
	var contentHolder = "#content-wrapper"																		//specify gobal content holder
	var sideBarTarget ="#sideBar"																				//specify sidebar
	var sbToggleAmount 																							//create varible to hold sidebar toggle amount		

	
	
	
	//INITIATE/SET
	
	//html/wrapper
	$('#wrapper').css({overflow:'hidden'});																		//hide overflow
	$('html').css({overflow:'hidden'});																			//ie7 fix
	$('#launch-but #label').html(launchButTitle);																//toggle but initial title
	
	
	//check if raster is on/of
	if(ss_raster==0){
		$('#wrapper').addClass('raster');																		//add raster if 0, else remove
	}else{
		//nothing
	}
	
	
	//supersized control navigation
	if(ss_transitionType==0 || ss_transitionType==1 || ss_transitionType==3 || ss_transitionType==5 || ss_transitionType==6 || ss_transitionType==7){
		
		//use original horizontal
		
	}else if(ss_transitionType==2 || ss_transitionType==4){
		
		
		//use vertical
		$('#prevslide').css({backgroundPosition: '0px -300px'});
		$('#nextslide').css({backgroundPosition: '0px -200px'});
		
		$('#prevslide').hover(function(){							   
			$(this).css({backgroundPosition: '0px -350px'})                     
			},
			function(){
			$(this).css({backgroundPosition: '0px -300px'})                     
			});
 
			
		$('#nextslide').hover(function(){							   
			$(this).css({backgroundPosition: '0px -250px'})                     
			},
			function(){
			$(this).css({backgroundPosition: '0px -200px'})                     
			});
	
	}else{
		
		//nothing
		
	}
	
	
	
	//sidebar 
	$(window).load(function () {				 
			sbToggleAmount = $('#sideBar').height() 															//set toggle amount based on sidebar height
			$('#sideBar').css({marginTop: -sbToggleAmount});													//position sidebar
			$('#sideBar').fadeIn();																				//make side bar visible
			$('#launch-but').fadeIn();																		
	});
	
	/*init team div*/
	$('ul.listStyle li:last').css('border', 'none'); 															//make sure the last team has no border
	$('ul.listStyle li:last').css({margin :'0px',padding:'0px'});
	
	/*init blog div*/
	$('#blogContainer ul li div.post:last').css('border', 'none'); 												//make sure the last team has no border
	$('#blogContainer ul li div.post:last').css({margin :'0px'});
	
	//init pajinate containers
	$('#folioContainer').pajinate({start_page : folio_start_page, items_per_page : folio_items_per_page	});     //initialize pagination of folio items
	$('#blogContainer').pajinate({start_page : 0,items_per_page : blog_items_per_page	});     				//initialize pagination of folio items
	
	//init fancybox
	$("a[rel=folioGroup]").fancybox({
				'transitionIn'		: lightboxTransition,
				'transitionOut'		: lightboxTransition,
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
	});
	
	
	
	//TOGGLE CONTENT
	
	//launch but special effect
	  $('#launch-but').hover(
            function(){
                $('#circle').stop().animate({width : '92px', height : '92px', 'margin-top' : '-46px', 'margin-left' : '-46px'  }, 200);
				$('#circle-overlay').stop().delay(100).animate({width : '95px', height : '95px', 'margin-top' : '-47.5px', 'margin-left' : '-47.5px'  }, 200);
            },
            function(){
                $('#circle').stop().delay(200).animate({width : '80px', height : '80px', 'margin-top' : '-40px', 'margin-left' : '-40px'  }, 200);
			    $('#circle-overlay').stop().animate({width : '0px', height : '0px', 'margin-top' : '0px', 'margin-left' : '0px'    }, 200);
            }
        );
	
	//launch but actions
	$('#launch-but').click(function(){
								 
			$(sideBarTarget).animate({marginTop:0},sideBarToggleSpeed, menuEase);								//toggle sidebar
			$(contentHolder).show().animate({top:'0px', opacity:1}, contentToggleSpeed,pageEase);				//toggle content
			$('#close-but div').html(closeButTitle);															//set toggle but title
			$('#controls-wrapper').fadeOut();																	//fade out gallery nav
			$('#slidecaption-grande').fadeOut();																//*ie 7/8 fix- fade out slide caption
			$('#wrapper').css({overflow:'auto'});																//make scroll bar reappear
			$('html').css({overflow:'auto'});																	//*ie 7
			$('h1').stop().animate({opacity:1},pageFadeSpeed);													//fade out h tags for ie 7/8							 
			$('h2').stop().animate({opacity:1},pageFadeSpeed);	
			var pos = $(contentHolder).offset().top
			$(this).fadeOut();
			return false;
	
		 
	});
	
	//close but actions
	$('#close-but').click(function() {
		 	$(sideBarTarget).animate({marginTop:-sbToggleAmount},sideBarToggleSpeed, menuEase);
			$(contentHolder).animate({top:'300px',opacity:0}, contentToggleSpeed,pageEase, function(){			//hide content once animation is done, deactivate scrollbar
						$(contentHolder).hide();
			});										
			$('#controls-wrapper').delay(400).fadeIn();									
			$('#slidecaption-grande').delay(400).fadeIn();	
			$('h1').stop().animate({opacity:0},pageFadeSpeed);									 
			$('h2').stop().animate({opacity:0},pageFadeSpeed);
			$('#launch-but').delay(sideBarToggleSpeed).fadeIn('normal',menuEase); 
			return false;		   
								 
	});
	
	
	//MAIN MENU - PAGE SWITCH

	 //add ids to the menu links
	 $(navTarget).each(function(i){
		i++						
   		this.id = this.id +"_" +i ;
	 });
	 
	 //add ids to the pages
	 $(contentHolder).children('.content').each(function(i){
		i++													 
   		this.id = this.id + "page" +"_" + i;
	 });
	 
	 //hide all, then set the first
	 $(contentHolder).children('.content').hide();
	 $(contentHolder).children("#page_"+startPage).show();
	 $('#_'+startPage).addClass('active');
	
	
	 $(navTarget).click(function() {

			//ensure link isnt clickable when active
			if ($(this).hasClass('active')) return false;
	
			var PrevLink = $(navTarget+'.active')
			$(PrevLink).removeClass('active');
			var PrevId = $(PrevLink).attr('id');
			var NextLink = $(this).addClass('active');
			var NextId = $(this).attr('id');
		
			//set markers
			var prevPage = $("#content-wrapper").children("#page"+PrevId);
			var nextPage = $("#content-wrapper").children("#page"+NextId);	
			
			$(prevPage).css({opacity:1});
			$(nextPage).css({opacity:0});
			
			
			
			//fade out previous + call things once done
			$(prevPage).stop().animate({opacity:0},pageFadeSpeed, function(){
				//animation done, hide previous page												   
				$(this).hide();
				//show the next page
				$(nextPage).show();
				//fade it in
				$(nextPage).animate({opacity:1},pageFadeSpeed)
			
			})
			
			
			
	});	
	

	//HOVERS
	$("._rollover").animate({ "opacity": "0" });
	
	var targetHover
	
	/*folio hovers*/
	$("._logoThumb").hover(

			function() {
				targetHover = $(this).parent().children('._rollover')
				$(targetHover).animate({"opacity": "0.9"}, hoverFadeSpeed);
				
				if($(this).parent('.thumb_holder')){
					$(this).css({backgroundPosition:'-160px'});
					$(this).stop().animate({backgroundPosition:'0px'}, 200);
																																   
				}
				
		},
			function() {
				targetHover = $(this).parent().children('._rollover')
				$(targetHover).animate({"opacity": "0"}, hoverFadeSpeed);
				
				if($(this).parent('.thumb_holder')){
					
					$(this).stop().animate({backgroundPosition:'160px'}, 200);
					
				}
				
		});
	
		
		/*blog hovers*/
		$("._logoBlog").hover(

			function() {
				targetHover = $(this).parent().children('._rollover')
				$(targetHover).animate({"opacity": "0.9"}, hoverFadeSpeed);
				
				if($(this).parent('.blogImg_holder')){
					$(this).css({backgroundPosition:'-500px'});
					$(this).stop().animate({backgroundPosition:'0px'}, 300);
																																   
				}
				
		},
			function() {
				targetHover = $(this).parent().children('._rollover')
				$(targetHover).animate({"opacity": "0"}, hoverFadeSpeed);
				
				if($(this).parent('.blogImg_holder')){
					
					$(this).stop().animate({backgroundPosition:'500px'}, 300);
					
				}
				
		});
	
	
		/*icon hovers*/
		$("._rollover").hover(
			function() {
				$(this).animate({"opacity": "1"}, hoverFadeSpeed);
		},
			function() {
				$(this).animate({"opacity": "0"}, hoverFadeSpeed
								);
		});
		
		//SET SOCIAL URLS
		$("a#fb").attr("href", "http://www.facebook.com/pages/"+facebookPageID)
		$("a#twr").attr("href", "http://www.twitter.com/"+twitterID)
		$("a#msp").attr("href", "http://www.myspace.com/"+myspaceID)
		$("a#fkr").attr("href", "http://www.flickr.com/photos/"+flickrID)
		$("a#yt").attr("href", "http://www.youtube.com/user/"+youtubeID)
		
		
		
		
		
		
});

