/* Show all "PhaseShow#" elements and hide all "PhaseHide#" elements except
   the requested IDs whose are inversed */

function Show(idName){
    //"../Images/Design/Homepage/prochain_match.jpg"
    //"../Images/Design/Homepage/dernier_match.jpg"
    //"../Images/Design/Homepage/classement.jpg"
    //alert ("show : " + idName);
    if(idName == "Prochain") {
        document.getElementById("Prochain").style.display="block";
        document.getElementById("IMGProchain").style.background="url('../Images/Design/Homepage/prochain_match_on.jpg')";
		
        document.getElementById("Dernier").style.display="none";
        document.getElementById("IMGDernier").style.background="url('../Images/Design/Homepage/dernier_match.jpg')";
		
        document.getElementById("Classement").style.display="none";
        document.getElementById("IMGClassement").style.background="url('../Images/Design/Homepage/classement.jpg')";
		
    } else if (idName == "Dernier") {
        document.getElementById("Prochain").style.display="none";
        document.getElementById("IMGProchain").style.background="url('../Images/Design/Homepage/prochain_match.jpg')";
		
        document.getElementById("Dernier").style.display="block";
        document.getElementById("IMGDernier").style.background="url('../Images/Design/Homepage/dernier_match_on.jpg')";
		
        document.getElementById("Classement").style.display="none";
        document.getElementById("IMGClassement").style.background="url('../Images/Design/Homepage/classement.jpg')";
		
    }  else {
        document.getElementById("Prochain").style.display="none";
        document.getElementById("IMGProchain").style.background="url('../Images/Design/Homepage/prochain_match.jpg')";
		
        document.getElementById("Dernier").style.display="none";
        document.getElementById("IMGDernier").style.background="url('../Images/Design/Homepage/dernier_match.jpg')";
		
        document.getElementById("Classement").style.display="block";
        document.getElementById("IMGClassement").style.background="url('../Images/Design/Homepage/classement_on.jpg')";
    }
}	


function showMenu(idNumber, langue) {
    var menuCount = 9;
	
    // Hide Empty Submenu
    document.getElementById("Empty").style.display="none";
	
    //alert(idNumber);
    //alert(langue);
	
    // Highlight Menu and displays Submenu
    for (i=0; i< menuCount; i++) {
        if(i == idNumber) { // Highlight & Show submenu
            try {
                if(langue == "fr") {
                    document.getElementById("img" + i).src="../Images/Design/Menus_fr/img" + i + "_on.gif";
                } else {
                    document.getElementById("img" + i).src="../Images/Design/Menus_en/img" + i + "_on.gif";
                }
                document.getElementById("M" + i).style.backgroundColor = "#9E0933";
                document.getElementById("SUBM" + i).style.display="block";
            } catch(err) {
            //alert("Please check menuCount : " + i);
            }
        } else {
            try {
                if(langue == "fr") {
                    document.getElementById("img" + i).src="../Images/Design/Menus_fr/img" + i + ".gif";
                } else {
                    document.getElementById("img" + i).src="../Images/Design/Menus_en/img" + i + ".gif";
                }
                document.getElementById("M" + i).style.backgroundColor = "#2A0001";
                document.getElementById("SUBM" + i).style.display="none";
            } catch(err) {
            //alert("Please check menuCount : " + i);
            }
        }
    }
}	

/* Show all "PhaseShow#" elements and hide all "PhaseHide#" elements except
   the requested IDs whose are inversed */

function changeStyle(thumbnailNumber) {
    //alert("styleChange(" + thumbnailNumber + ")");

    //
    if(thumbnailNumber == 0) {
		//--- Background pictures
        document.getElementById("thumbnail_0").style.backgroundImage='url(../Images/Design/fond_thb.gif)';
        document.getElementById("thumbnail_1").style.backgroundImage='url(../Images/Design/fond_thb_out_1.gif)';
        document.getElementById("thumbnail_2").style.backgroundImage='url(../Images/Design/fond_thb_out_2.gif)';
		
		//--- Text color
		document.getElementById("thumbnail_0_txt").style.color='#FFFFFF';
        document.getElementById("thumbnail_1_txt").style.color='#000000';
        document.getElementById("thumbnail_2_txt").style.color='#000000';
		
    } else if(thumbnailNumber == 1) {
		//--- Background pictures
        document.getElementById("thumbnail_0").style.backgroundImage='url(../Images/Design/fond_thb_out_0.gif)';
        document.getElementById("thumbnail_1").style.backgroundImage='url(../Images/Design/fond_thb.gif)';
        document.getElementById("thumbnail_2").style.backgroundImage='url(../Images/Design/fond_thb_out_2.gif)';
		
		//--- Text color
		document.getElementById("thumbnail_0_txt").style.color='#000000';
        document.getElementById("thumbnail_1_txt").style.color='#FFFFFF';
        document.getElementById("thumbnail_2_txt").style.color='#000000';
		
    } else if(thumbnailNumber == 2) {
		//--- Background pictures
        document.getElementById("thumbnail_0").style.backgroundImage='url(../Images/Design/fond_thb_out_0.gif)';
        document.getElementById("thumbnail_1").style.backgroundImage='url(../Images/Design/fond_thb_out_1.gif)';
        document.getElementById("thumbnail_2").style.backgroundImage='url(../Images/Design/fond_thb.gif)';
		
		//--- Text color
		document.getElementById("thumbnail_0_txt").style.color='#000000';
        document.getElementById("thumbnail_1_txt").style.color='#000000';
        document.getElementById("thumbnail_2_txt").style.color='#FFFFFF';
    }


   /*
   var thumbnailsCount = 3; // Number of thumbnails displayed

	// Highlight Menu and displays Submenu
	for (i=0; i< thumbnailsCount; i++) {
		if(i == thumbnailNumber) { // Highlight
			try {
				document.getElementById("thumbnail_" + i).style.backgroundImage='url(../Images/Design/fond_thb.gif)';
			} catch(err) {
				alert("Please check thumbnailsCount : " + i);
			}
		} else {
			try {
                //var myUrl = "../Images/Design/fond_thb_out_0" + thumbnailNumber + ".gif";
                //alert("myUrl : " + myUrl);
                if(thumbnailNumber == 0) {
                    document.getElementById("thumbnail_2").style.backgroundImage='url(../Images/Design/fond_thb_out_02.gif)';
                    document.getElementById("thumbnail_3").style.backgroundImage='url(../Images/Design/fond_thb_out_03.gif)';
                } else if(thumbnailNumber == 1) {
                    document.getElementById("thumbnail_" + i).style.backgroundImage='url(../Images/Design/fond_thb_out_02.gif)';
                } else if(thumbnailNumber == 2) {
                    document.getElementById("thumbnail_" + i).style.backgroundImage='url(../Images/Design/fond_thb_out_03.gif)';
                }
				
				//document.getElementById("M" + i).style.backgroundColor = "#2A0001";
			} catch(err) {
				alert("Please check thumbnailCount : " + i);
			}
		}
	}*/
}

function onNewsSearchSubmit() {
    year = document.getElementById('archive_annee').value;
    month = document.getElementById('archive_mois').value;

    document.getElementById('newsSearch').action = "News.php?newsdep=0&annee=" + year + "&mois=" + month;
		
    document.getElementById('newsSearch').submit();
}

function onNewsSponsorSearchSubmit() {
    year = document.getElementById('archive_annee').value;
    month = document.getElementById('archive_mois').value;

    document.getElementById('newsSponsorSearch').action = "News_sponsor.php?newsdep=0&annee=" + year + "&mois=" + month;
		
    document.getElementById('newsSponsorSearch').submit();
}


function onCalendarSearchSubmit() {
    turn = document.getElementById('tours').value;
    season = document.getElementById('archive_saison').value;
	
    //alert("turn : " + turn + ", season : " + season);
	
    if(document.getElementById('tours').selectedIndex == 0) {
        document.getElementById('calendarSearch').action = "Resultats_all.php?saison_courante=" + season + "&type_equipe=Equipe%20premi%E8re&menu=2";
    } else {
        document.getElementById('calendarSearch').action = "Resultats.php?id_type=" + turn + "&saison_courante=" + season + "&type_equipe=Equipe%20premi%E8re&menu=2";
    }
	
    document.getElementById('calendarSearch').submit();
}	

function onCalendarVisuelSearchSubmit() {
    mois = document.getElementById('mois').value;
    annee = document.getElementById('annee').value;
		
    document.getElementById('calendarVisuelSearch').action = "Calendrier_visuel.php?mois=" + mois + "&annee=" + annee + "&menu=2";
    document.getElementById('calendarVisuelSearch').submit();
}

function onClassementSearchSubmit() {
    year = document.getElementById('archive_saison').value;
		
    document.getElementById('classementSearch').action = "Classement.php?saison_courante=" + year + "&type_equipe=Equipe%20premi%E8re&menu=2";
		
    document.getElementById('classementSearch').submit();
}

function onShopSearchSubmit() {
    article = document.getElementById('articles').value;
		
    document.getElementById('shopSearch').action = "Shop.php?categorie=" + article +"&menu=5";
		
    document.getElementById('shopSearch').submit();
}

function onTeamSearchSubmit() {
    season = document.getElementById('archive_saison').value;
		
    document.getElementById('teamSearch').action = "Equipe.php?saison_courante=" + season + "&id_type=-1&menu=1";
		
    document.getElementById('teamSearch').submit();
}

function onStatistiqueSearchSubmit() {
    season = document.getElementById('archive_saison').value;
    turn = 0;
    if(document.getElementById('tours')) {
        turn = document.getElementById('tours').value;
    }

    if(season == 1 || season == 2) {
        document.getElementById('statistiqueSearch').action = "Statistiques.php?saison_courante=" + season + "&id_type=-1&order=nom&menu=1";
    } else {
        document.getElementById('statistiqueSearch').action = "Statistiques_completes.php?saison_courante=" + season + "&tours=" + turn + "&id_type=-1&order=nom&menu=1";
    }
	
    document.getElementById('statistiqueSearch').submit();
}

function onStatistiqueTeamSearchSubmit() {
    season = document.getElementById('archive_saison').value;
    turn = document.getElementById('tours').value;
	
    document.getElementById('statistiqueTeamSearch').action = "Statistiques_equipe.php?saison_courante=" + season + "&tours=" + turn + "&order=date&menu=1";

    document.getElementById('statistiqueTeamSearch').submit();
}

function onStatistiquePlayerSearchSubmit(id_joueur) {
    season = document.getElementById('archive_saison').value;
    turn = document.getElementById('tours').value;
	
    document.getElementById('statistiquePlayerSearch').action = "Statistiques_joueur.php?id_joueur=" + id_joueur + "&saison_courante=" + season + "&tours=" + turn + "&order=date&menu=1";

    document.getElementById('statistiquePlayerSearch').submit();
}

function onStatistiqueGardienSearchSubmit(id_joueur) {
    season = document.getElementById('archive_saison').value;
    turn = document.getElementById('tours').value;
	
    document.getElementById('statistiqueGardienSearch').action = "Statistiques_gardien.php?id_joueur=" + id_joueur + "&saison_courante=" + season + "&tours=" + turn + "&menu=1";

    document.getElementById('statistiqueGardienSearch').submit();
}

function onPhotoSearchSubmit() {
    seasonCalendarId = document.getElementById('archive_saison').value.split("-");
	
    season = seasonCalendarId[0];
    calendarId = seasonCalendarId[1];
	
    document.getElementById('photoSearch').action = "Photos_index.php?id_saison=" + season + "&id_calendrier=" + calendarId +"&menu=4";
		
    document.getElementById('photoSearch').submit();
}
function onGestassurSearchSubmit() {
    year = document.getElementById('archive_saison').value;
		
    document.getElementById('gestassurSearch').action = "BL_cup.php?saison_courante=" + year + "&menu=1";
		
    document.getElementById('gestassurSearch').submit();
}
function onTypeVideoSearchSubmit() {
    type_video = document.getElementById('type_video_select').value;
    mois = document.getElementById('archive_mois').value;
    annee = document.getElementById('archive_annee').value;

    document.getElementById('TypeVideoSearch').action = "GSHC_TV.php?type_video=" + type_video + "&mois=" + mois + "&annee=" + annee;
		
    document.getElementById('TypeVideoSearch').submit();
}


