$(document).ready(function() {

function aleatorio(inferior,superior){
	numPosibilidades = superior - inferior
	aleat = Math.random() * numPosibilidades
	aleat = Math.round(aleat)
	return parseInt(inferior) + aleat
}

	$('.videoIcon').click(function(){
		$('#flyinvideo iframe').attr({
		  width: 550,
		  height: 309
		});
		$('#flyinvideo').toggle();return false;
	});

	$('ul.lang li:last-child').css({'margin-right':0});

	$('ul.featured li:last-child').addClass('last');
	var featuredH = $('#carousel-demo5B').outerHeight(true);
	$('#wrapper.home #content').css({
		'padding-top' : (featuredH + 40) + 'px',
		'background-position' : 'left ' + (featuredH + 30) + 'px'
	});
	$('<img class="imageBack" src="/_myimages/featuredBack.jpg" />').prependTo('ul.featured');

	//Default Action
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content
	$('ul.lastVisited li:last-child').css({'margin-bottom':0});

	//On Click Event
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});

	//Default Action
	$(".tab_contentFix").hide(); //Hide all content
	$("ul.tabsFix li:first").addClass("active").show(); //Activate first tab
	$(".tab_contentFix:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabsFix li").click(function() {
		$("ul.tabsFix li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_contentFix").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});

	$("<img class='imageBack' src='/_myimages/tabBack.jpg' />").prependTo(".tab_container:not(.tab_container.small):not(.tab_container.big)");
	$("<img class='imageBack' src='/_myimages/tabBack.jpg' />").prependTo(".tab_containerFix");
	$("<img class='imageBack' src='/_myimages/sidebarBack.jpg' />").prependTo(".tab_container.small");
	$("<img class='imageBack' src='/_myimages/960Back.jpg' />").prependTo(".tab_container.big");

	$('ul.properties-box li:nth-child(3n)').css('margin-right', 0);
	$('ul.properties-box li p:last-child').css('margin-bottom', 0);
	$('<div class="clear"></div>').insertAfter('ul.properties-box li:nth-child(3n)');

	//Property TPL
	$('ul.features li:odd:not(:first)').addClass('odd');

});
