/*
	By Martin Rancourt
	v 1.0 > 2006.05.05
	v 1.1 > 2007.07.30 -> Enlever Yahoo
*/
var FromIndent;
function getPartenaires() {
	var arrPartenaires = new Array(
		new partenaireClass('ms', 39), 
		new partenaireClass('telusad', 180), 
		new partenaireClass('telus', 30)
	);
	if (partenaireRequest("prov") != "") {
		for (var i = 0; i < arrPartenaires.length; i++) {
			if (arrPartenaires[i].strQS == partenaireRequest("prov")) {
				FromIndent = arrPartenaires[i].height;
				if (typeof(offsetTotal) === 'undefined') offsetTotal = 0;
				offsetTotal += FromIndent;
				arrPartenaires[i].writeHtml();
			}
		}
	}
}
function getPartenairesBas() {
	var arrPartenaires = new Array(
		new partenaireClass('ms', 44)
	);
	if (partenaireRequest("prov") != "") {
		for (var i = 0; i < arrPartenaires.length; i++) {
			if (arrPartenaires[i].strQS == partenaireRequest("prov")) {
				arrPartenaires[i].writeHtmlBas();
			}
		}
	}
}
function partenaireClass(strQs, height) {
	this.strQS = strQs;
	this.height = height;
	
	this.writeHtml = function() {
		this.updateQs();
		var noCache = Math.round(new Date());
		d.write('<iframe style="width:100%;height:'+this.height+'px;background-color:#FFF" frameborder="0" scrolling="no" src="/lib/v1/partenaires/'+this.strQS+'/top.html?noCache='+noCache+'"></iframe>');
	}
	this.writeHtmlBas = function() {
		this.updateQs();
		var noCache = Math.round(new Date());
		d.write('<iframe style="width:100%;height:'+this.height+'px;background-color:#FFF" frameborder="0" scrolling="no" src="/lib/v1/partenaires/'+this.strQS+'/bottom.html?noCache='+noCache+'"></iframe>');
	}
	this.updateQs = function() {
		if (this.strQS == "telus") {
			if (document.location.toString().toLowerCase().indexOf("/sports/") != -1) this.strQS = "telusSports";
			else if (document.location.toString().toLowerCase().indexOf("/regions/") != -1) this.strQS = "telusRegions";
			else this.strQS = "telusNouvelles";
		}
	}
}


function partenaireRequest(param) {
	/*	CC Martin Rancourt */
	/*	v 1.0	*/
	var strParam = param.toString().toLowerCase();
	var strQS = document.location.search.toString().toLowerCase().slice(1);//enlève le ?
	if (strQS.indexOf(strParam) != -1) {
		var arrQS = strQS.split("&");
		for(var i = 0; i < arrQS.length; i++) {
			if (arrQS[i].slice(0, arrQS[i].indexOf("=")) == strParam) return arrQS[i].slice(arrQS[i].indexOf("=")+1);
		}
	}
	return "";
}