var TOMnuClose="";
var blnTOMnuClose=false;
var BackToGo = -1;

function aller(url) {
	if (request("prov") != "") {
		if (url.indexOf("?") != -1) {
			document.location = url + "&prov=" + request("prov");
		} else {
			document.location = url + "?prov=" + request("prov");
		}
	} else {
		document.location = url;
	}
}

function add1Back() {
	if (BackToGo < -2) {
		BackToGo = BackToGo - 1;
	}
}

function closeAllSMnu() {
	if (smnuMM_findObj('SMnuMeteo')) {
		if (blnTOMnuClose==true) {
			closeLay('SMnuRegion');
			closeLay('SMnuRDI');
			closeLay('SMnuTele');
			closeLay('SMnuRadio');
			closeLay('SMnuCBC');
			closeLay('SMnuMeteo');
			closeLay('SMnuRCI');
		}
		blnTOMnuClose=false;
	}
}

function openLay(lay) {
	if (smnuMM_findObj(lay)) {
		layer = smnuMM_findObj(lay);
		Cache = smnuMM_findObj('SMnucache');
		if (document.layers) {
			layer.visibility="show";
			Cache.visibility="show";
		} else {
			layer.style.visibility="visible";
			Cache.style.visibility="visible";
		}
	}
}

function MnuMouseOver() {
	blnTOMnuClose=true;
	closeAllSMnu();
	openLay('SMnuRegion');
}

function closeLay(lay) {
	layer = smnuMM_findObj(lay);
	Cache = smnuMM_findObj('SMnucache');
	if (document.layers) {
		layer.visibility ="hide";
		Cache.visibility ="hide";
	} else {
		layer.style.visibility="hidden";
		Cache.style.visibility="hidden";
	}
}

function versionImprimable() {
	var UrlPagePrint = "/nouvelles/print.asp?nv=";
	var UrlToPrint = document.location.pathname;
	UrlToPrint = UrlToPrint.substring(1,UrlToPrint.length);
	//alert(UrlToPrint);
	
	if (UrlToPrint.indexOf('/nouvelles/20') != -1 || UrlToPrint.indexOf('/saddam/20') != -1) { //		<-- pour s'assurer que c'est une page de nouvelles
		UrlToPrint = UrlToPrint.replace('.asp', '.xml');
		UrlToPrint = UrlToPrint.replace('.shtml', '.xml');
		UrlToPrint = UrlToPrint.replace('.html', '.xml');
		window.open(UrlPagePrint+UrlToPrint,'Imprimer','toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes,width=760,height=500');
	} else {
		alert("Il n'y a pas de version imprimable pour cette page.");
	}
}
function Suggerer ()
{
	jsURL='http://radio-canada.ca/util/postier/suggerer.asp?sTitre='+escape(document.title)+'&sURL='+escape(document.location);
	jsNom='suggerer';
	jsParam='toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,history=no,resizable=yes,width=405,height=450,left=1,top=1';
	window.open(jsURL, jsNom, jsParam)
}

function GoTo (sURL) {
	if ( location.search.indexOf("prov=msn2") != -1 || location.search.indexOf("prov=microcell") != -1 || location.search.indexOf("prov=telus") != -1)
		top.location.href = "http://www.radio-canada.ca/url.asp?" + sURL;
	else
		location.href = sURL;
}

function goToHyperlien(Lien, Titre, Texte) {
	var cont = '';

	cont += '<p class="Hyper">';
	cont += '<a';
	if (Lien.indexOf('radio-canada.ca/nouvelles') != -1) cont += '';
	else if (Lien.indexOf('radio-canada.ca') != -1) cont += ' target="_top"';
	else cont += ' target="_blank"';
	
	cont += ' class="HyperTitre" href="' + Lien + '">';
	cont += Titre;
	cont += '</a>';
	if (Texte != "") cont += '<br />' + Texte;
	cont += '</p>';

	document.write(cont);
}

// Fonction JavaScript simulant l'objet ASP Request
// Par Carlos Tremblay
function request(leChamp) {
	var leQueryString = (location.search ? location.search.toLowerCase().substring(1) : '');
	var lesPairesNomVal = leQueryString.split("%26"); // %26 est le code pour le symbole &
	for(var i = 0; i < lesPairesNomVal.length; i++) {
		unePaireNomVal = lesPairesNomVal[i].split("=");
		if (unePaireNomVal[0]==leChamp) return unePaireNomVal[1];
	}
	return ""; // retourner une chaine vide pour que les comparaisons ne plantent pas même si le champ n'a pas été trouvé
}

//	Fonction de Dreamweaver
function smnuMM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

