/**
 * Envoie le topHits 
 * @param domain
 * @return
 */
function tophits(domain) 
{
	
	// Le topHit ne s'applique qu'aux pages en prod
	if ( location.host == 'tva.canoe.ca' && location.pathname != '/emissions/je/tests/13547.html' ) {
		//S'il s'agit de TSC on recupere le numero de l'article
		if ( domain == "tsc") {
			// Si aucun article on retourne rien
			if (getVar('article') == null ) {
				return;
			}
			path    = location.href.substring(0,location.href.indexOf("?")+1)+'article='+getVar('article');
		} else {
			path    = document.URL;
		}
		document.write('<img src=\"' + 
				'http://www.canoe.com/cgi-bin/tophits/tophits.cgi' + 
				'?path=' + path + '&bid='+ domain +
				'\" width=\"1\" height=\"1\" alt=\"\" title=\"\">');
	}
}

/**
 * Fonction qui recupere la valeur d'un parametre
 * @param nomVariable
 * @return
 */
 function getVar (nomVariable)
 {
	 var infos = location.href.substring(location.href.indexOf("?")+1, location.href.length)+"&";
	 if (infos.indexOf("#")!=-1) {
		 infos = infos.substring(0,infos.indexOf("#"))+"&";
	 }
	 var variable=0;
	 {
		 nomVariable = nomVariable + "=";
		 var taille = nomVariable.length;
		 if (infos.indexOf(nomVariable)!=-1) {
			 variable = infos.substring(infos.indexOf(nomVariable)+taille,infos.length).substring(0,infos.substring(infos.indexOf(nomVariable)+taille,infos.length).indexOf("&"));
		 }
		 return variable;
	 }
 } 