function redirect(select)
{
	var url = window.location.href;
	
	// On recupere le 5e element de l'URL. En mode grille c'est le bouquet.
	var urlparts = url.split('/');
	
	if (urlparts[4] == 'grille')
	{
		url = url.replace('grille/' + urlparts[5], 'grille/' + select.options[select.selectedIndex].value);
	}
	if (urlparts[4] == 'chaine')
	{
		url = url.replace('chaine/' + urlparts[5] + '/' + urlparts[6], 'grille/' + select.options[select.selectedIndex].value);
	}
	window.location.href = url;
}

function fiche(id){
	//window.open("/fiche/emi_"+id,"pop_emi","width=710,height=630,scrollbars=yes,resizable=yes");
	
	//Redimensionnement du menu
	vObj = top.window.document.getElementById("droite");
	if(vObj!=null) vObj.rows = "0,*";
	//Affichage de la fiche
	vObj = top.window.document.getElementById("grille");
	if(vObj!=null) vObj.src = "/programmes-tv/emission/"+id;

}

function affinerSelection(thm,sgr)	{
	window.open("/gtv/affinerselection?openform&thm="+thm+"&sgr="+sgr,"pop_affinerSelection","width=730,height=500,scrollbars=yes,resizable=yes,status");
}
	
function goChaine ( id , d , h )	{
	if (top.frames["menu"] ){
		var doc = top.frames["menu"].document;
		var url = "/gtv/menu?openform&c=" + id ;
		if ( d != "" ) url += "&d=" + d;
		if ( h != "" ) url += "&h=" + h;
		doc.location.href = url;
	}
	else { }			
}
	
function retourGrille (){
	//Retour � la grille
	vObj = top.window.document.getElementById("menu");
	if(vObj!=null) vObj.src = "/gtv/menu?openform";
	
}


function hlt(id) {
        var o, ar;
        var doc;
        //doc = parent.top.frames["grille"].document
        doc = parent.grille.document
        if (doc.all || doc.getElementById) {
                for (var t=1; t<8; t++) {
                        if (doc.all) ar = doc.all["t"+t];
                        else if (doc.getElementById) ar = doc.getElementById("t"+t);
                        if (ar==null) continue;
                        if (t==id) {
                        		  if (ar.length)
                        		  	{
		                                for (var i=0; i<ar.length; i++){
	                                        o = ar[i];
     	                                   o.oldcolor = o.style.color;
          	                              o.style.color = "#990000";
               		                     }
               		           }
                                    else {
    	                                   ar.oldcolor = ar.style.color;
          	                         ar.style.color = "#990000";
                                    }
                        } else {
                    		  if (ar.length)
                        		  	{
		                                for (var i=0; i<ar.length; i++) {
          	                              o = ar[i];
               	                         o.oldcolor = o.style.color;
                    	                    o.style.color = "#cccccc";
                         		       }
                         		}
                         	else {
             	                         ar.oldcolor = ar.style.color;
                   	                    ar.style.color = "#cccccc";
                         		}
                        }
                }
        }
}


function uhlt(id) {
        var o, ar;
        var doc;
         //doc = parent.top.frames["grille"].document
	doc = parent.grille.document
        if (doc.all || doc.getElementById) {
                for (var t=1; t<8; t++) {
                        if (doc.all) ar = doc.all["t"+t];
                        else if (doc.getElementById) ar = doc.getElementById("t"+t);
                        if (ar==null) continue;
                        		if ( ar.length ) {
	                                for (var i=0; i<ar.length; i++) {
     	                                   o = ar[i];
          	                              o.style.color = o.oldcolor;
               		                 }
               		     }
               		     else {
    	                              ar.style.color = ar.oldcolor;
               		     }
                }
        }
}


