// -------------------------------------------------------------------------------
// Barre de menu dans le haut de la page (Genres, Collections, A-Z, etc.)

function menuGenresOpen() {
    //document.getElementById('menugenres').style.background = "url('http://static.tou.tv/images/boutons_menu.gif') 0 -31px no-repeat";
    document.getElementById('liensMenuGenres').style.display = "block";
}

function menuGenresClose() {
    //document.getElementById('menugenres').style.background = "url('http://static.tou.tv/images/boutons_menu.gif') 0 0 no-repeat";
    document.getElementById('liensMenuGenres').style.display = "none";
}

function boutonGenresHover() {
    //document.getElementById('menugenres').style.background = "url('http://static.tou.tv/images/boutons_menu.gif') 0 -31px no-repeat";
}

function boutonGenresOff() {
    //document.getElementById('menugenres').style.background = "url('http://static.tou.tv/images/boutons_menu.gif') 0 0 no-repeat";
}

function menuCollectionsOpen() {
    //document.getElementById('menuCollections').style.background = "url('http://static.tou.tv/images/boutons_menu.gif') -378px -31px no-repeat";
    document.getElementById('liensMenuCollections').style.display = "block";
}

function menuCollectionsClose() {
    //document.getElementById('menuCollections').style.background = "url('http://static.tou.tv/images/boutons_menu.gif') -378px 0 no-repeat";
    document.getElementById('liensMenuCollections').style.display = "none";
}

function boutonCollectionsHover() {
    //document.getElementById('menuCollections').style.background = "url('http://static.tou.tv/images/boutons_menu.gif') -378px -31px no-repeat";
}

function boutonCollectionsOff() {
   //document.getElementById('menuCollections').style.background = "url('http://static.tou.tv/images/boutons_menu.gif') -378px 0 no-repeat";
}

// -------------------------------------------------------------------------------
// Autres

function checkRadio(_this) {
	group = document.forms[0][_this.name];
	n = group.length - 1;
	if (n > 0) {
		do {
			if (group[n].checked == true) {
				document.getElementById(group[n].value).className = "radiozone selected";
			} else {
				group[n].checked = false;
				document.getElementById(group[n].value).className = "radiozone";
			}
		}
		while (--n >= 0);
	}
}


function openFormulaire() {
	document.getElementById('btnform').style.display = "none";
	document.getElementById('formulaire').style.display = "block";
 }
//function openFormulaire(id) {
//	if (id == "formulaire") {
//		document.getElementById('petitformulaire').style.display = "none";
//	document.getElementById(id).style.display = "block";
//	}
//	else {
//	document.getElementById('conteneurincidenttechnique').style.display = "none";
//	document.getElementById('form-comm-sugg').style.display = "none";
//	document.getElementById(id).style.display = "block";
//	}
// }
 
 function revealAnswer(id) {
	var $blocquestion = document.getElementById('blocquestion'+id);
	if ($blocquestion.className == "blocquestion open") {
		document.getElementById('answer'+id).style.display = "none";
		$blocquestion.className = "blocquestion";
	}
	else {
		document.getElementById('answer'+id).style.display = "block";
		$blocquestion.className = "blocquestion open";
	}
 }
 
 function precisez(id) {
	document.getElementById(id).style.display = "block";
}


// functions pour le barre  de recherche

function showHideBulleRecherches(id) {
    var $recherches = document.getElementById('ombreBulle');
    if ($recherches.style.display == "none") {
        document.getElementById(id).style.display = "block";
    }
    else {
        document.getElementById(id).style.display = "none";
    }
}

function hideSlowly(id) {
    setTimeout("showHideBulleRecherches('ombreBulle')", 1000);
}

function focusBlocRecherches(id) {
    if (id == "q3") {
        if (document.getElementById(id).value == "RECHERCHE") {
            document.getElementById(id).style.background = "#fff";
            document.getElementById(id).style.fontWeight = "normal";
            document.getElementById(id).value = "";
            document.getElementById('SearchSubmitImageButton' + id).style.backgroundPosition = "0 -19px";
        }
        else {
            document.getElementById('SearchSubmitImageButton' + id).style.backgroundPosition = "0 -19px";
        }
    }
    else {
        if (document.getElementById(id).value == "RECHERCHE") {
            document.getElementById(id).style.background = "#fff";
            document.getElementById(id).style.fontWeight = "normal";
            document.getElementById(id).value = "";
            document.getElementById('ombreBulle' + id).style.display = "block";
            document.getElementById('SearchSubmitImageButton' + id).style.backgroundPosition = "0 -19px";
        }
        else {
            document.getElementById('ombreBulle' + id).style.display = "block";
            document.getElementById('SearchSubmitImageButton' + id).style.backgroundPosition = "0 -19px";
        }
    }
}

function blurBlocRecherches(id) {
    if (id == "q3") {
        if (document.getElementById(id).value == "") {
            document.getElementById(id).style.background = "url('http://static.tou.tv/images/bg_recherche.gif') repeat-x";
            document.getElementById(id).style.fontWeight = "bold";
            document.getElementById(id).value = "RECHERCHE";
            document.getElementById('SearchSubmitImageButton' + id).style.backgroundPosition = "0 0";
        }
        else {
            document.getElementById('SearchSubmitImageButton' + id).style.backgroundPosition = "0 0";
        }
    }
    else {
        if (document.getElementById(id).value == "") {
            document.getElementById(id).style.background = "url('http://static.tou.tv/images/bg_recherche.gif') repeat-x";
            document.getElementById(id).style.fontWeight = "bold";
            document.getElementById(id).value = "RECHERCHE";
            document.getElementById('ombreBulle' + id).style.display = "none";
            document.getElementById('SearchSubmitImageButton' + id).style.backgroundPosition = "0 0";
        }
        else {
            document.getElementById('ombreBulle' + id).style.display = "none";
            document.getElementById('SearchSubmitImageButton' + id).style.backgroundPosition = "0 0";
        }
    }
}


// function pour la bulle de géolocalisation

function bulleGeolocalisation(id) {
    //alert("Toto");
    var $nongeo = document.getElementById(id);
    if ($nongeo.style.display == "none") {
        document.getElementById(id).style.display = "block";
    }
    else {
        document.getElementById(id).style.display = "none";
    }
}

// fonction pour voir plus de détails dans la page répertoire

function plusDetails(id) {
	var btndetail = document.getElementById('btnPlusDetails_' + id);
	var divdetail = document.getElementById('plusDetails_' + id);
	btndetail.style.backgroundPositionY = "-14px";
	if (divdetail.style.display == "none") {
		divdetail.style.display = "block";
	}
	else {
		btndetail.style.backgroundPositionY = "0";
		divdetail.style.display = "none";
	}
	
	//_this.style.backgroundPosition = "0 -14px";
	//if (detail.style.display = "none") {
	//	detail.style.display = "block";
	//}
	//else {
	//	_this.style.backgroundPosition = "0 0";
	//	detail.style.display = "none";
	//}
}

// fonction pour voir plus de détails dans la page répertoire

function plusDetailsMouseAction2(id, state) {

    var btndetail = document.getElementById('btnPlusDetails_' + id);
    var divdetail = document.getElementById('wrapperDetailsEmission_' + id);
    btndetail.style.backgroundPositionY = "-14px";

    if (state != 'off') {
        divdetail.style.display = "block";
    }
    else {
        btndetail.style.backgroundPositionY = "0";
        divdetail.style.display = "none";
    }
}
