$(document).ready(function(){

	/*----------------------- skate_or_die animated expanding --------------------- */
	
  	$("#skate_or_die").addClass('expandable');
  	$("#sod_hide").hide();
	var getSodPostHeight = $("#sod_post").height() + 80;
	if(getSodPostHeight < 445) {
		getSodPostHeight = 445;
	}
	var sodPostHeight = getSodPostHeight + "px";
	var sodCategoriesHeight = (getSodPostHeight-55) + "px";
	
	$("#sod_tab").toggle(
		
	
		function () {
			$(".expandable").animate({
			"width": "958px",
			"height": sodPostHeight
			}, "slow");
			$("#sod_categories").animate({
			"height": sodCategoriesHeight
			}, "slow");
			$("#sod_hide").show();
			$("#sod_show").hide();
			//$("#sod_post").text(sodPostHeight);
		},
		function () {
			$(".expandable").animate({
			"width": "555px",
			"height": "100px"
			}, "slow");
			$("#sod_hide").hide();
			$("#sod_show").show();
		}
	);
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	$("a.iframe").fancybox({
			'padding'			: 	20,
			'autoScale'			: 	false,
			'width'				:	1000,
			'height'			:	800,
			'onComplete'			: function() {
				$("#main_wrap").addClass('lightbox_bg');
			},
			'onCleanup'			: function() {
				$("#main_wrap").removeClass('lightbox_bg');
				
			},
			'onClosed'			: function() {
				$("#main_wrap").removeClass('lightbox_bg');
			},
			'onCancel'			: function() {
				$("#main_wrap").removeClass('lightbox_bg');
			}

	});

	$("a[href$=.jpg], a[href$=.gif], a[href$=.png], a[href$=.JPG], a[href$=.GIF], a[href$=.PNG]").fancybox({
			'padding'			: 	20,
			'autoScale'			: 	false,
			'autoDimensions'	:	true,
			'onComplete'			: function() {
				$("#main_wrap").addClass('lightbox_bg');
			},
			'onCleanup'			: function() {
				$("#main_wrap").removeClass('lightbox_bg');
			},
			'onClosed'			: function() {
				$("#main_wrap").removeClass('lightbox_bg');
			},
			'onCancel'			: function() {
				$("#main_wrap").removeClass('lightbox_bg');
			}

	});
	
	
	
	
	
  	
	/*$("#sod_show").click(function(){
								  
		$(".expandable").animate({
			"width": "960px",
			"height": "400px"
			}, "slow");
		$(this).hide();
		$("#sod_hide").show();
	});
	$("#sod_hide").click(function(){
		$(".expandable").animate({
			"width": "555px",
			"height": "75px"
			}, "slow");
		$(this).hide();
		$("#sod_show").show();
	});*/
	/*----------------------- END skate_or_die animated expanding --------------------- */



	/* ---------------------- blog feed ----------------------
	$(".feed_item a").addClass("iframe");
	
	$(".feed_item a[target$=_blank], .feed_item a[href$=.jpg], .feed_item a[href$=.gif], .feed_item a[href$=.png]").removeClass("iframe");
	
		
	
	$(".feed_item a[href$=.jpg], .feed_item a[href$=.gif], .feed_item a[href$=.png]").fancybox({
			'padding'			: 	20,
			'autoScale'			: 	false,
			'autoDimensions'	:	true,
			'onStart'			: function() {
				$("#main_wrap").addClass('lightbox_bg');
			},
			'onCleanup'			: function() {
				$("#main_wrap").removeClass('lightbox_bg');
			}

	}); */
	/* ---------------------- END blog feed ---------------------- */
	
	/* ---------------------- video feed ---------------------- 
	$(".video_feed_item a").addClass("video_link");
	$(".video_feed_item a.iframe").removeClass("video_link");;
	
	$(".video_feed_item a[target$=_blank], .video_feed_item a[href$=.jpg], .video_feed_item a[href$=.gif], .video_feed_item a[href$=.png]").removeClass("video_link");
	
	$("a.iframe").fancybox({
			'padding'			: 	20,
			'autoScale'			: 	false,
			'width'				:	1000,
			'height'			:	800,
			'onStart'			: function() {
				$("#main_wrap").addClass('lightbox_bg');
			},
			'onCleanup'			: function() {
				$("#main_wrap").removeClass('lightbox_bg');
				
			}

	})
	
	
	$("a.video_link").fancybox({
			'padding'			: 	20,
			'autoScale'			: 	false,
			'autoDimensions'	:	true,
			'onStart'			: function() {
				$("#main_wrap").addClass('lightbox_bg');
			},
			'onCleanup'			: function() {
				$("#main_wrap").removeClass('lightbox_bg');
			}

	});*/
	/* ---------------------- END video feed ---------------------- */
	




	/* ---------------------------- TABS --------------------------- */
	//hide all tabs except the first one
	$(".tab:not(:first)").hide();

	//to fix IE
	$(".tab:first").show();
	
	//mark first item as selected onLoad
	$("#tabs li:first a").addClass("selected");
	
	
	//click handling
	$("#tabs li a").click(function(){
		
		//get the ID of the element(tab) we need to show
		stringref = $(this).attr("href").split('#')[1];
		
		//hide the tabs that don't match the ID
		$('.tab:not(#'+stringref+')').hide();
		
		//remove the selected class from all tab buttons in list
		$(this).parent().siblings().children("#tabs li a").removeClass("selected");
		
		//mark selected tab button
		$(this).addClass("selected");
		
		//IE fix
		if ($.browser.msie && $.browser.version.substr(0,3) == "6.0") {
			$('.tab#' + stringref).show();
		}
		else 
			//display our tab fading it in
			$('.tab#' + stringref).fadeIn(600);
		
		return false;
	});
	/* ---------------------------- END TABS --------------------------- */
	
	
	
	
	
	/* ---------------------------- current_nav marking --------------------------- 
	
	$('#main_nav li a').click(function(){
		
		//remove the selected class from all tab buttons in list
		$(this).parent().siblings().children("a").removeClass("selected");
		
		//mark selected tab button
		$(this).addClass("selected");
		
		
	});
	*/
	/* ---------------------------- END current_nav marking --------------------------- */
	
	
	
	
	
	
	
	
});
