/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


function showThisChoiceList()
{	
    $(this).unbind('mouseenter', showThisChoiceList);
    $(this).children("ul.choiceList").slideDown(
        function(){
            $(this).parent().bind('mouseenter',showThisChoiceList);
        }
    );
}

function hideThisChoiceList()
{
    $(this).unbind('mouseenter', showThisChoiceList);
    $(this).children("ul.choiceList").slideUp(
        function()
        {
            $(this).parent().bind('mouseenter',showThisChoiceList);
        }
    );
}

function changeNew(id, count)
{
    activeNew  = id;
    //clearInterval(changeNewsLandscape);
    $('#newsSlider ul li').hide();
    $('#newsSlider ul li#'+id).fadeIn();
    
    $('#pager a').css('background-color', '#5b5b5b');
    $('#pager a#page'+id).css('background-color','#323232');
    //setInterval(changeNewsLandscape, 8000, count);
}


function changeHomeImage(id)
{
    activeHomeImage = id;
    //clearInterval(changeHomeLandscape);
    $('#homeImage div.image').hide();
    $('#homeImage div#image'+id).fadeIn('slow');
    
    $('#homePager a').css('background-color', '#5b5b5b');
    $('#homePager a#page'+id).css('background-color','#AA9150');
    $('#reopen').fadeOut('slow');
    $('.titleBox').fadeIn('slow');
    //setInterval(changeHomeLandscape, 8000); 
}

var activeHomeImage = 0;

function autoPlayHomeImages()
{
   setInterval(changeHomeLandscape, 8000); 
}

function changeHomeLandscape()
{
    //console.log("activeHomeImage: "+activeHomeImage);
    activeHomeImage++;
    if(activeHomeImage > 6)
        activeHomeImage = 0;
    
    changeHomeImage(activeHomeImage);
}

var activeNew = 0;

function autoPlayNews(count)
{
   setInterval(changeNewsLandscape, 8000, count); 
}

function changeNewsLandscape(count)
{
    console.log("count: "+count);
    console.log("activeNew: "+activeNew);
    activeNew++;
    
    if(activeNew >count-1)
        activeNew = 0;
    
    changeNew(activeNew, count);
}

function showMoreText()
{
	$('.hidden_legenda').fadeIn();
	
    $('.hiddenText').fadeIn();
    $('#know-more-button').hide();
	
}

