
function popup (url, width, height, haut, gauche) {
if (!width) width=353;
if (!height) height=410;
if (!haut) haut=50;
if (!gauche) gauche=50;
	var pop = window.open(url,"popup_unique","width="+ width +",height="+ height +",top="+ haut +",left="+ gauche +",toolbar=no,location=no,directories=no,menubar=no,status=no,scrollbars=yes,resizable=no");
}


function openWindow(url,w,h) {
     var windowprops = "top=50,left=50,resizable=no,menubar=no,scrollbars=no,width=" + w + ",height=" + h;
     popup= window.open(url,'remote',windowprops);
}

function popupchannel(url, width, height, haut, gauche) {
if (!width) width=353;
if (!height) height=410;
if (!haut) haut=50;
if (!gauche) gauche=50;
	var pop = window.open(url,"popupchannel","width="+ width +",height="+ height +",top="+ haut +",left="+ gauche +",toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0");
}
	
//pour offre television	
function popmstv(page)
{
	var hauteur_popup=414;
	var Hv = (screen.height - hauteur_popup) / 2;
	var largeur_popup=750;
	var Wv = ((screen.width - largeur_popup) / 2) + 0.5;

	window.open(page,"Popup","status=no,scrollbars=no,resizable=no,height="+hauteur_popup+",width="+largeur_popup+",left="+Wv+",top="+Hv+"");
}

function Media(id, media){
    if (document.getElementById) {
        document.getElementById(id).innerHTML = media;
    }
}

function AjusteFrameHeight() 
{
	setTimeout("AjusteFrameHeight2();",1000);
}

function AjusteFrameHeight2() {
	
	if (document.all) {
		
		nb_article = document.frames('myIframe').document.getElementById('nb_article').value;
		if ( nb_article == 0 )
		{
			document.all.myIframe.style.height = 0; 
		}
		else 
		{
			h = document.frames('myIframe').document.body.scrollHeight;
			document.all.myIframe.style.height = h + 0; 
		}
	}
	else {
		
		nb_article = document.getElementById('myIframe').contentDocument.getElementById('nb_article').value;
		
		if ( nb_article == 0 ){
			document.getElementById('myIframe').style.height = 0; 
		}
		else {
			h = document.getElementById('myIframe').contentDocument.body.scrollHeight;
			// alert(h);
			var somme=h+8;
			document.getElementById('myIframe').style.height = somme+'px'; 
		}
	}
}

function check_panier(ofr_id)
{
	var Frame = document.getElementById("myIframe");
	var FrameWindow = Frame.window?Frame.window:Frame.contentWindow;
	var FrameDocument = FrameWindow.document;
	var liste_ofr_id = FrameDocument.getElementById("liste_ofr_id").value;
	
	if (liste_ofr_id=='') {
		return true;
	}
	
	var tester=liste_ofr_id.indexOf(ofr_id);
	if (tester==-1) {
		return true;
	}
	else {
		alert('Vous avez déjà choisi cette option.');
		return false;
	}
}

//pour ouvrir et fermer les rubriques chaines TV


function montre(cible)
{
	var truc = document.getElementById(cible);
	truc.style.display="";
}
function cache(cible)
{
	var truc = document.getElementById(cible);
	truc.style.display="none";
}


/** 
* Permet de récupérer les données d'un fichier via les XmlHttpRequest: 
*/ 
function getFile(page, cont) 
{ 
	if(document.all) var XhrObj = new ActiveXObject("Microsoft.XMLHTTP"); //Internet Explorer
	else             var XhrObj = new XMLHttpRequest(); //Mozilla 

	//définition de l'endroit d'affichage: 
	if(cont!=null) var content = document.getElementById(cont); 

	XhrObj.open("POST", page); 

	//Ok pour la page cible 
	//Avec mise en place info de chargement du contenu
	XhrObj.onreadystatechange = function() 
	{
		if (XhrObj.readyState != 4) 
		{
			if(cont!=null) content.innerHTML = '<br><center>Chargement en cours...</center><br>';
		}
		else 
		{
			if (XhrObj.readyState == 4 && XhrObj.status == 200 )
			{
				var chaine=XhrObj.responseText;
				if (chaine.search("codeError") >=0 )
				{
					document.location.href='/commun.erreur.phtml?'+chaine;
					return;
				}
				if(cont!=null) content.innerHTML = chaine;
			} 
			else 
			{
				alert('Un problème technique est survenu. Merci de réessayer.');
			}
		}
	}

	XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
	XhrObj.send('null'); 
}

function popupsize (url, width, height, haut, gauche) 
{
	if (!width) width=353;	if (!height) height=410;	if (!haut) haut=50;	if (!gauche) gauche=50;
	var pop = window.open(url,"popup_unique","width="+ width +",height="+ height +",top="+ haut +",left="+ gauche +",toolbar=0,location=0,directories=0,menuBar=0,scrollbars=1,resizable=1");
}
