$(document).ready(function(){
    $('.maintabs > div.tabholder').hide(); // Hide all divs
    $('.maintabs > div.tabholder:first').show(); // Show the first div
    $('.maintabs > ul.featuredVideos > li:first > span').addClass('active'); // Set the class of the first link to active
    $(".maintabs > ul.bestOf > li a[rel!='normal-link']").click(function(){ //When any link is clicked
    $('.maintabs > ul.featuredVideos > li > span').removeClass('active'); // Remove active class from all links
    $(this).parent().addClass('active'); //Set clicked link class to active
		var currentTab = $(this).attr('href'); // Set variable currentTab to value of href attribute of clicked link
		$('.maintabs > div.tabholder').hide(); // Hide all divs
		$(currentTab).show(); // Show div with id equal to variable currentTab
		return false;
    });
});

$(document).ready(function(){
    $('.maintabs2 > div').hide(); // Hide all divs
    $('.maintabs2 > div:first').show(); // Show the first div
    $('.maintabs2 > ul.bestOf > li:first > span').addClass('active'); // Set the class of the first link to active
    $(".maintabs2 > ul.bestOf > li a[rel!='normal-link']").click(function(){ //When any link is clicked
		$('.maintabs2 > ul.bestOf > li span').removeClass('active'); // Remove active class from all links
		$(this).parent().addClass('active'); //Set clicked link class to active
		var currentTab = $(this).attr('href'); // Set variable currentTab to value of href attribute of clicked link
		$('.maintabs2 > div').hide(); // Hide all divs
		$(currentTab).show(); // Show div with id equal to variable currentTab
		return false;
    });
});

$(document).ready(function(){
    $('.maintabs > div').hide(); // Hide all divs
    $('.maintabs > div:first').show(); // Show the first div
    $('.maintabs > ul.featuredVideos > li:first > span').addClass('active'); // Set the class of the first link to active
    $(".maintabs > ul.featuredVideos > li a[rel!='normal-link']").click(function(){ //When any link is clicked
		$('.maintabs > ul.featuredVideos > li span').removeClass('active'); // Remove active class from all links
		$(this).parent().addClass('active'); //Set clicked link class to active
		var currentTab = $(this).attr('href'); // Set variable currentTab to value of href attribute of clicked link
		$('.maintabs > div').hide(); // Hide all divs
		$(currentTab).show(); // Show div with id equal to variable currentTab
        $('.footer > div').hide();
        $('.footer > div').show();
		return false;
    });
});

function toggleMenuCategory(menucategory_id) {
    var menu = $("#"+menucategory_id);
    menu.slideToggle('slow');
}

function showTabEmedia(aux) {
    if (aux == 2) {
        document.getElementById("tabFeatured").style.display = "none";
        document.getElementById("tabMostRelated").style.display = "block";
    } else {
        document.getElementById("tabFeatured").style.display = "block";
        document.getElementById("tabMostRelated").style.display = "none";
    }
    
}

function reload_letter(url, letter, param) {
    location.href = url + "?letter=" + letter + "&" + param;
}

function setCookieVideo(div1, div2) {
 var today = new Date();
 var expire = new Date();

 
    document.getElementById(div1).style.display = "block";
    document.getElementById(div2).style.display = "none";
 
 
 expire.setTime(today.getTime() + 3600000*24);
 document.cookie = div1+"="+escape("block")
                 + ";expires="+expire.toGMTString();
 document.cookie = div2+"="+escape("none")
                 + ";expires="+expire.toGMTString();
}


function SetCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}

function addFavorite(url, title) {

	if (window.sidebar) {
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) {
		window.external.AddFavorite( url, title);
	}
	else if(window.opera && window.print) {
		return true; }

	return false;
}
