// JavaScript Document

function itemOpen(id) {
	document.getElementById('menugenres').style.background = "url('http://static.tou.tv/images/boutons_menu.gif') 0 -31px no-repeat";
	document.getElementById(id).style.display = "block";
}

function itemClose(id) {
	document.getElementById('menugenres').style.background = "url('http://static.tou.tv/images/boutons_menu.gif') 0 0 no-repeat";
	document.getElementById(id).style.display = "none";
}

function boutonHover() {
	document.getElementById('menugenres').style.background = "url('http://static.tou.tv/images/boutons_menu.gif') 0 -31px no-repeat";
}

function boutonOff() {
	document.getElementById('menugenres').style.background = "url('http://static.tou.tv/images/boutons_menu.gif') 0 0 no-repeat";
}

//function checkRadio(_this){
//	var oDoc = document, 
//		group = oDoc.appreciation[_this.name],
//		n = group.length-1;
//	if(n>0){ 
//		do{
//			if(group[n].checked==true) { 
//				oDoc.getElementById(group[n].value).className = "radiozone selected"; 
//			}else{ 
//				group[n].checked=false;
//				oDoc.getElementById(group[n].value).className = "radiozone"; 
//			}
//		}
//		while(--n>=0);
//	}
//}

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";
    }
}