// JavaScript Document
var oldTab = "ltab1";
var oldTtab = "tab-1";

function switchLeftTab(newTab)
{
	$(oldTab).removeClassName('active');
	$('form-'+oldTab).hide();
	$(''+newTab).addClassName('active');
	$('form-'+newTab).show();
	oldTab = newTab;
}

function switchTopTab(newTTab, switchURL)
{
	$(oldTtab).removeClassName(oldTtab+'-active');
	$(oldTtab).addClassName(oldTtab+'');
	$(newTTab).addClassName(newTTab+'-active');
	oldTtab = newTTab;
	
	if(switchURL == 1)
	{
		switch(newTTab)
		{
			case "tab-1":
			$('typeTournois').value = "Online";
			$('ltab4-li').show();
			$('ltab5-li').show();
			$('ltab4-b-li').hide();
			$('ltab5-b-li').hide();
			$('ltab2-li').show();
			$('goToUrl').value = 'http://www.poker-agenda.fr/calendrier-des-tournois-de-poker-online-en-argent-reel.htm';
			$('goToUrl2').value = 'http://www.poker-agenda.fr/calendrier-des-tournois-de-poker-online-en-argent-reel.htm';
			$('goToUrl3').value = 'http://www.poker-agenda.fr/calendrier-des-tournois-de-poker-online-en-argent-reel.htm';
			break;
			
			case "tab-2":
			$('typeTournois').value = "Live";
			$('ltab4-li').hide();
			$('ltab5-li').hide();
			$('ltab4-b-li').show();
			$('ltab5-b-li').show();
			$('ltab2-li').show();
			$('goToUrl').value = 'http://www.poker-agenda.fr/calendrier-des-tournois-de-poker-live-dans-les-cercles-et-casinos.htm';
			$('goToUrl2').value = 'http://www.poker-agenda.fr/calendrier-des-tournois-de-poker-live-dans-les-cercles-et-casinos.htm';
			$('goToUrl3').value = 'http://www.poker-agenda.fr/calendrier-des-tournois-de-poker-live-dans-les-cercles-et-casinos.htm';
			break;
			
			case "tab-3":
			$('typeTournois').value = "Freeroll";
			$('ltab4-li').show();
			$('ltab5-li').show();
			$('ltab4-b-li').hide();
			$('ltab5-b-li').hide();
			$('ltab2-li').hide();
			$('goToUrl').value = 'http://www.poker-agenda.fr/calendrier-des-tournois-de-poker-freeroll-gratuit.htm';
			$('goToUrl2').value = 'http://www.poker-agenda.fr/calendrier-des-tournois-de-poker-freeroll-gratuit.htm';
			$('goToUrl3').value = 'http://www.poker-agenda.fr/calendrier-des-tournois-de-poker-freeroll-gratuit.htm';
			break;
		}
	}
}

function setLimits(number)
{
	var currentVal = $('search_limit').value;
	$('set_'+currentVal).removeClassName('setlimit-activelimit');
	$('set_'+currentVal).addClassName('setlimit');
	
	$('set_'+number).addClassName('setlimit-activelimit');
	$('search_limit').value = number;
}

function selectAll(targetId)
{
    if($(targetId))
    {
        var descandants = $(targetId).descendants();

        for(var i = 0; i < descandants.length; i++)
        {
            if(descandants[i].type == "checkbox")
            {
                descandants[i].checked = true;
            }
        }
    }
}

function deselectAll(targetId)
{
    if($(targetId))
    {
        var descandants = $(targetId).descendants();

        for(var i = 0; i < descandants.length; i++)
        {
            if(descandants[i].type == "checkbox")
            {
                descandants[i].checked = false;
            }
        }
    }
}

