$(function()
{
	var slideActive = false;
	$('#claimImg').css('width',0);

	$('img#imgFace').css({
		position:'absolute',
		top:'-200px'
	});

	$('img#imgFace').animate({
		top:'-62px'
	},{duration: 1000, easing: 'easeOutBounce',complete:function()
	{
		$('#claimImg').animate({
			width:300
		},750);
	}});

	/*
	$('.post').not(':first')
		.css({
			height:'124px',
			opacity:.30
		})
		.hover(
		function()
		{
			$(this).stop();
			$(this).animate({
				opacity:'1',
				height:'457'
			});
		},
		function()
		{
			
			$(this).stop();
			$(this).animate({
				opacity:'.2',
				height:'124px'
			});
		});
	*/
	$('div[id^=post-]').each(function()
	{		
		var i = this.id.split("-")[1];
		$('#img-navigator-'+i+' li div').not(':first').hide();
		$('#post-'+i+' .nav ul li a').click(function()
		{
			if ( this.className == "selected" ) {
				$(this).blur();
				return false;
			}
			
			var that = this;
			setTimeout(function(){ $(that).fadeTo(1000,0.1) } , 1 );
			if (slideActive==false)
			{
				slideActive = true;
				var i = $(this).parents('div[id^=post-]:first')[0].id.split('-')[1];
				
				var id = $(this).attr('href');
				var $this = $(this);
									
				$('#img-navigator-'+i+' li div:visible').animate(
				{
					width:0,
					opacity:0
				},
				{									
					easing:'easeOutBounce',
					duration: 1250, 
					complete:function()
					{
						$('#img-navigator-'+i+' li div:visible').hide();
						$(id).find('div').css('width',0).show().animate(
						{
							width:'100%',
							opacity:1
						},{duration: 1000, easing: 'easeOutBack'});
						$('#post-'+i+' .nav ul li a.selected').removeClass('selected');
						$this.addClass('selected');
						slideActive = false;
						$(that)
							.stop()
							.fadeTo(1,1);
					}
				});
			}
			$(this).blur();
			return false;
		});
	});
	/*
	$('.swf').each(function()
	{
		var id = this.id.split("v_")[1];
		var url= "http://vimeo.com/moogaloop.swf?";
		url = url + "clip%5Fid=" + id + "&";
		url = url + "server=vimeo%2Ecom&";
		url = url + "autoplay=0&";
		url = url + "fullscreen=1&";
		url = url + "md5=0&";
		url = url + "show%5Fportrait=0&";
		url = url + "show%5Ftitle=0&";
		url = url + "show%5Fbyline=0&";
		url = url + "context=user%3A434740&";
		url = url + "context%5Fid=&";
		url = url + "force%5Fembed=0&";
		url = url + "multimoog=&";
		url = url + "color=ffffff";

		swfobject.embedSWF(url, this.id, "400", "235", "9.0.0","false", {}, {wmode: "transparent"}, {});
	});
	*/
	
	$('.swf.vimeo').each(function()
		{
			var id = this.id.split("v_")[1];
			var url= "http://vimeo.com/moogaloop.swf?";
			url = url + "clip%5Fid=" + id + "&";
			url = url + "server=vimeo%2Ecom&";
			url = url + "autoplay=0&";
			url = url + "fullscreen=1&";
			url = url + "md5=0&";
			url = url + "show%5Fportrait=0&";
			url = url + "show%5Ftitle=0&";
			url = url + "show%5Fbyline=0&";
			url = url + "context=user%3A434740&";
			url = url + "context%5Fid=&";
			url = url + "force%5Fembed=0&";
			url = url + "multimoog=&";
			url = url + "color=ffffff";
			swfobject.embedSWF(url, this.id, "600", "360", "9.0.0","false", {}, {wmode: "transparent"}, {});
		});
		
	$('.swf.youtube').each(function()
	{
		var id = this.id.split("v_")[1];
		var url= "http://www.youtube.com/v/";
		url = url + id + "&hl=es&fs=1&showinfo=0&egm=0&rel=0";
		swfobject.embedSWF(url, this.id, "600", "360", "9.0.0","false", {}, {wmode: "transparent"}, {});
	});
	
	$('.flash').each(function()
	{
		var url= "/media/swf/" + this.id.split("f_")[1].replace("-",".");

		swfobject.embedSWF(url, this.id, "598", "401", "9.0.0","false", {}, {wmode: "transparent"}, {});
	});
	
	$('a[rel=external]').attr("target","_blank");

});
