
var IFrameObj; // our IFrame object

/**
 */
function callToServer(URL) {
  if (!document.createElement) {return true};
  var IFrameDoc;
  if (!IFrameObj && document.createElement) {
  //if ((!IFrameObj || IFrameObj == null || typeof(IFrameObj) == 'undefined') && document.createElement) {
    // create the IFrame and assign a reference to the
    // object to our global variable IFrameObj.
    // this will only happen the first time 
    // callToServer() is called
    var tempIFrame=document.createElement('iframe');
    tempIFrame.setAttribute('id','RSIFrame');
    tempIFrame.style.border='0px';
    tempIFrame.style.width='0px';
    tempIFrame.style.height='0px';
    IFrameObj = document.body.appendChild(tempIFrame);
  
    if (document.frames && navigator.userAgent.indexOf('Opera') < 0) {
      // this is for IE5 Mac, because it will only
      // allow access to the document object
      // of the IFrame if we access it through
      // the document.frames array
      IFrameObj = document.frames['RSIFrame'];
    }
  }
  
  if ( /*(*/navigator.userAgent.indexOf('Gecko') !=-1 /* || navigator.userAgent.indexOf('Opera') != -1)*/
    && !IFrameObj.contentDocument) {
    // we have to give NS6 a fraction of a second
    // to recognize the new IFrame
    setTimeout('callToServer()',10);
    return false;
  }

	
  if (IFrameObj.contentDocument) {
    // For NS6
    IFrameDoc = IFrameObj.contentDocument; 
	//window.alert("Chargement news !" + IFrameObj.contentDocument);
  } else if (IFrameObj.contentWindow) {
    // For IE5.5 and IE6
    IFrameDoc = IFrameObj.contentWindow.document;
  } else if (IFrameObj.document) {
    // For IE5
    IFrameDoc = IFrameObj.document;
  } else {
  	//  --- -pbs sous opera...
	 if (navigator.userAgent.indexOf('Opera') >= 0 && !IFrameObj.contentDocument) {
  		setTimeout("callToServer(URL)",10);
		//return false;
	 	window.alert("Chargement!");
		if (IFrameObj.contentDocument) {
	    // For NS6
    		IFrameDoc = IFrameObj.contentDocument; 
		}
	// -----
	} else {
		return true;
	}
    //return true;
  }
	if (document.getElementById('infodiv') != null) {
		document.getElementById('infodiv').innerHTML = "<img src=\"../img/jauge.gif\" width=\"50\" height=\"10\" align=\"absmiddle\">";
	}

	//
  IFrameDoc.location.replace(URL);

  return false;
}

<!-- Scripts gratuits des Trucsweb.com
function twNeowin(nUrl,nNom,w,h,nScroll){
  var winl = (screen.width) ? (screen.width-w)/2 : 0;
  var wint = (screen.height) ? (screen.height-h)/2 : 0;
  var options =	'width='+w+',height='+h+',top='+wint+',left='+winl+',scrollbars='+nScroll+',resizable=no';
  var neo = window.open(nUrl,nNom,options);
  if(neo.window.focus){neo.window.focus();}
}
// -->

/** Permet de visualiser l'apercu d une news*/
function ouvreNews(id) {
	var windowURL = 'apercunews.php?idnews='+id;
	twNeowin(windowURL, 'ApercuNews', 520, 400, 'yes');
}

/** Permet de voir le javascript d une news*/
function ouvreNewsOnWeb(idnews) {
	var windowURL = 'newsonweb.php?idnews='+idnews;
	twNeowin(windowURL, 'NewsOnWeb', 620, 540, 'yes');
}	

/** Ouvre le programme télé du soir
 */
function ouvreProgrammeTV() {
	var windowURL = 'm_programmetv.htm';
	twNeowin(windowURL,'ProgrammeTV',530,500,'no');
}


// -------------------------------------------------------------------
// GESTION DES FAVORIS
// -------------------------------------------------------------------


/** Handle appele lors de la recherche d un favori
 */
function handleFindFavoris(doc) {
	// on remplit le resulset avec le document généré
	var div = document.getElementById('listeFavorisDIV');
	var img = document.getElementById('listeFavorisDIVIMG');
	if (div != null) {
		div.innerHTML = doc.innerHTML;
		div.style.display = 'block';
		img.src = "./img/cancel.gif";
	}
	// document.getElementById("listeFavorisDIV").innerHTML = doc.innerHTML;
	// on efface la jaude recherche
	if (document.getElementById('infodiv') != null) document.getElementById('infodiv').innerHTML = "";
}

/** Ouvrir le panneau d import des favoris
 *
 */
function ouvreImportFavoris() {
	var windowURL = 'zonem/importchoix.php';
	//window.open(windowURL, 'ImportFavoris', 'width=420,height=480,top=220,left=220,scrollbars=yes');
	twNeowin(windowURL, 'ImportFavoris', 430, 500, 'yes');
}

/** Ouvrir le panneau d export des favoris
 *
 */
function ouvreExportFavoris() {
	var windowURL = 'zonem/exportchoix.php';
	twNeowin(windowURL, 'ExportFavoris', 430, 500, 'yes');
}

/** Fonction permettant de montrer/cacher 
 * le bloc de resultat de recherche 
 * d un favori
 */
function CacherMontrerRechercheFav() {
	var div = document.getElementById('listeFavorisDIV');
	var img = document.getElementById('listeFavorisDIVIMG');
	if (div != null) {
		if (div.style.display == 'none') {
			div.style.display = 'block';
			img.src = "./img/cancel.gif";
		} else {
			div.style.display = 'none';
			img.src = "./img/oeil.png";
		}
	}
}

/** Fonction de recherche d un favori
 */
function rechercherFavori() {
	// url de la page de recherche
	var windowURL = 'm_findfavori.php?';
	// paramètre de la recherche
	// le login, le nom, et/ou le prenom
	windowURL += 'favoriNom=';
	windowURL += document.getElementById('favoriNom').value;
	return callToServer(windowURL);
}

/** Permet de visualiser son horoscope
 * pour un signe doné
 */
function ouvreSigne(signe) {
	var windowURL = 'm_horoscope.php?signe='+signe;
	twNeowin(windowURL,'Horoscope',400,300,'no');
}

/** Fonction pour promouvoir le site
 * via le parrainage
 */
function promoteSite() {
	//
	var windowURL = 'promouvoir.php?mNom='
				+	document.getElementById('mNom').value
				+	'&mEmail='
				+	document.getElementById('mEmail').value
				+	'&mMessage='
				+	document.getElementById('mMessage').value;
	//
	twNeowin(windowURL,'Promouvoir',300,150,'no');	
}

/** Permet de cacher / montrer une rubrique
 * dans le gestionnaire de favoris
 */
function cacherMontrerRub(idrub) {
	if (document.getElementById('ruburl'+idrub).style.display == 'none') {
		document.getElementById('ruburl'+idrub).style.display = 'block';
	} else {
		document.getElementById('ruburl'+idrub).style.display = 'none';
	}
}

/** Permet de cacher / montrer une rubrique
 * dans le menu de gauche
 */
function cacherMontrerMainRub(idrub) {
	if (document.getElementById('mainrub'+idrub).style.display == 'none') {
		document.getElementById('mainrub'+idrub).style.display = 'block';
		document.getElementById('imgrub'+idrub).src = './img/close.png';
	} else {
		document.getElementById('mainrub'+idrub).style.display = 'none';
		document.getElementById('imgrub'+idrub).src = './img/open.png';
	}
}

/** Handle de chargement des favoris
 */
function handleLoadFavoris(doc) {
	// on rempplit le resulset avec le document généré
	document.getElementById("favorisDIV").innerHTML = doc.innerHTML;
	// on efface la jaude recherche
	if (document.getElementById('infodiv') != null) document.getElementById('infodiv').innerHTML = "";
}

// -------------------------------------------------------------------
// LECTEUR RSS
// -------------------------------------------------------------------

/** Variable contenant les rubriques des news */
var rubNews = new Array();

/** Permet d'ajouter une division pour un type de news
 */
function addNews(id, doc) {
	rubNews[id] = doc;
}

/** Permet de montrer les sous-rubriques d'une rubrique princpale
 * dans le lecteur RSS
 */
function cacherMontrerNews(idrub) {
	/*document.getElementById('globalenews').innerHTML= rubNews[idrub];
	document.getElementById('globalenews').style.display = 'block';
	VoirObj('globalenews');*/
	document.getElementById('globalenews').innerHTML = document.getElementById('sousrub'+idrub).innerHTML;
	document.getElementById('globalenews').style.display = 'block';
	VoirObj('globalenews');
}

/** Permet de cacher simplement le bloc de news d'une rubrique
 */
function CacherNews() {
	document.getElementById('globalenews').innerHTML = '';
	//CacherObj('globalenews');
	if (document.getElementById('infodiv') != null) document.getElementById('infodiv').innerHTML = "";
	document.getElementById('globalenews').style.display='none';
}

/** Permet d'afficher ou de masquer une sous-rubriques contenant des fils infos
 */
function afficherRubriqueNews(numero)
{
     if (document.getElementById('rubnews'+numero).style.display == 'none') {
         document.getElementById('rubnews'+numero).style.display='block';
     } else {
         document.getElementById('rubnews'+numero).style.display='none';
	}
}

/** Handle appelé lorsque l'on clique sur une news
 * @param rubid L'identifiant de la news
 * @param doc Le contenu de la news
 */
function handleNews(rubid, doc) {
	// on construit le nom de la division
	//var div = 'news' + rubid;
	var div = 'shownews';
	document.getElementById(div).innerHTML = doc.innerHTML;
	if (document.getElementById('infodiv') != null) document.getElementById('infodiv').innerHTML = "";
}

/** Permet d'afficher la description d'un article
 */
function afficherArticle(numero)
{
     if (document.getElementById('art'+numero).style.display == 'none') {
         document.getElementById('art'+numero).style.display='block';
		 document.getElementById('btnart'+numero).title = 'Cacher la description de l\'article';
		 document.getElementById('btnart'+numero).src = 'http://www.lamoooche.fr/img/close.png';
     } else {
         document.getElementById('art'+numero).style.display='none';
		 document.getElementById('btnart'+numero).title = 'Voir la description de l\'article';
		 document.getElementById('btnart'+numero).src = 'http://www.lamoooche.fr/img/open.png';		 
	}
}

/** Fonction permettant de bookmarker un article
 */
function addArticle(idm, titre, url, idr) {
	//escape
	var windowURL = 'm_siteRSS_Ajouter.php?idm='+idm+'&titre='+escape(titre)+'&url='+escape(url);
	if (idr != null && idr != '') {
		 windowURL += '&idr='+idr;
	}
	twNeowin(windowURL,'AjouterArticle',700,400,'yes');
}	

/** Permet d'envoyer un article à un ami
 */
function ouvreEnvoyerNews(titre, url) {
	var windowURL = 'envoyer_rss.frm.php?titre='+escape(titre)+'&url='+escape(url);
	twNeowin(windowURL, 'EnvoyerNews', 700,400,'yes');
}

// --------------------

/** Ouvre la la liste de tous les membres
 * classes par points
 */
function ouvreListeMembres() {
		var windowURL = 'm_membresall.php';
		twNeowin(windowURL, 'ListeMembre', 270,480,'no');
	}
	

// --------------------
// GESTION DES FAVORIS
// --------------------

	/** Ouvrir la fenetre pour ajouter une rubrique
	 * @param	idr		Identifiant de la rubrique dans laquelle on veut ajouter la nouvelle rubrique (vaut 0 si non spécifiée)
	 *
	 */
	function addRubrique(idparent) {
		//var windowURL = 'rubrique_Ajouter.php';
		if (idparent == null) {
			idparent = 0;
		}
		var windowURL = 'rubrique_Deplacer.php?idparent='+idparent;
		twNeowin(windowURL, 'AjouterRubrique', 550,340,'no');
	}

	/** Ouvre la fenetre d actions sur une rubrique
	 * @param	idr		L'identifiant de la rubrique sur laquelle on veut réaliser une action
	 * @param	perso	Indique s'il s'agit d'une rubrique personnelle ou générique
	 *
	 */	
	function ouvreActionsRubrique(idr, perso) {
		//var windowURL = 'm_actionsRubrique.php?nomr='+nomr+'&idr='+idr+'&rubPerso='+perso;
		var windowURL = 'rubrique_Deplacer.php?&idr='+idr+'&rubPerso='+perso;
		twNeowin(windowURL,'ActionsFavoris',550,340,'no');
	}
	
	/** Ouvrir la fenetre d actions pour un site
	 * @param	ids		Identifiant du site sur lequel on veut réaliser une action
	 *
	 */
	function ouvreActionsSite(ids) {
		//var windowURL = 'm_actionsSite.php?idr='+idr+'&ids='+ids+'&noms='+escape(noms)+'&urls='+escape(urls);
		var windowURL = 'site_Deplacer.php?ids='+ids;
		twNeowin(windowURL, 'ActionsFavoris', 550,340,'no');
	}
	
	/** Ouvrir la fenetre d actions pour un site
	 * @param	idr		Identifiant de la rubrique dans laquelle on veut ajouter le site (vaut 0 si non spécifiée)
	 *
	 */
	function ouvreAjouterSite(idr) {
		if (idr == null) {
			idr = 0;
		}
		//var windowURL = 'm_actionsSite.php?idr='+idr+'&ids='+ids+'&noms='+escape(noms)+'&urls='+escape(urls);
		var windowURL = 'site_Deplacer.php?idr='+idr;
		twNeowin(windowURL, 'ActionsFavoris', 550,340,'no');
	}

