
function openWiz(url, redirect)
{
	var oLink = {href: "",name: "",title: null,target: null,className: null,style: null};
	width = 700;
	height = 575;
	//alert("wbservice");
	if (url.indexOf("http:") == -1)
	{
		url = "http://" + url;
	}

	if (redirect == "true")
	{
		location.href = url;	
	} else {
		str = window.showModalDialog(url + "&WebbyzzLoggedIn=6144","", "status:no; center:yes; help:no; minimize:no; maximize:no; scroll:no; border:thin; statusbar:no; dialogWidth:" + width + "px; dialogHeight:" + height + "px");
//	alert(oLink.href)
		if (str != "" && str != undefined)
			{
			location.href = str;
			}
		}
	
}

function WBPrint() {
	window.focus();
	if(window.print)
		window.print();

}

function WBLogUrlRequest(strUrl) {
	window.open('/_system/services/logUrlRequest.asp?page='+strUrl,'','toolbar=no,status=no,titlebar=no,menubar=no,resizable=yes,scrollbars=yes,width=1,height=1,left=0,top=0')	
}

function golien(intNoLien) {
	window.open("/lien/lien-redirect.asp?xnolien="+intNoLien);
}

function gotoshow(){
	window.open('http://www.cld-joliette.qc.ca/_system/baniere/adclick2.asp?adresse='+slidelinks[whichlink],'stat')
}

function WBGoLien(intNoLien, intNoType, strUrl) {
//********************************************************
// Modifie le lien selon son type
//********************************************************	

// Variable du no de site pour les statistiques
//page interne
	if((intNoType==11) && (intNoLien==0)){
		if (!(strUrl.indexOf("ttp://") > 0))
		{
				strUrl = "http://" + strUrl;
		}
		location.href = strUrl
		//parent.location.href = "http://director.marigny.com/d-click.php?aid="+strIDSite+"&url="+strUrl;

	
	}else{
//page externe
		if ((intNoType==13) || (intNoType==12)){
			//WBLogUrlRequest(strUrl)
			if (!  (    (strUrl.indexOf("ttp://") > 0) || (strUrl.indexOf("ttps://") > 0) || (strUrl.indexOf("ww.") > 0)   ))
				{
					strUrl = "http://www.beaconsfield.ca" + strUrl;
		}
			if (intNoType==13) 
			{
				window.open(strUrl);
			}
			else
			{
				location.href = strUrl;
			}
			//window.open("http://director.marigny.com/d-click.php?aid="+strIDSite+"&url="+strUrl);
		}else{
//image						
			if ((intNoType==10) && (strUrl.indexOf(".htm") > 0))
			{
				strUrl = "http://www.beaconsfield.ca" + strUrl
				//window.open("http://director.marigny.com/d-click.php?aid="+strIDSite+"&url="+strUrl);
				location.href = strUrl
			}else{
				window.open(strUrl);
			}
		}
	}
}

function WBSendPage() {
	window.open('/_system/services/sendpage.asp?page='+location.pathname,'','toolbar=no,status=no,titlebar=no,menubar=no,resizable=yes,scrollbars=yes,width=650,height=440,left=0,top=0')	
}


function WBPrintPage() {
	window.open('/_system/services/printpage.asp?page='+location.pathname,'','toolbar=no,status=no,titlebar=no,menubar=no,resizable=yes,scrollbars=yes,width=637,height=740,left=0,top=0')
}

function WBPrintPageTheme() {
	window.open('/_system/services/printpage.asp?theme='+document.all.xthemecourant.value,'','toolbar=no,status=no,titlebar=no,menubar=no,resizable=yes,scrollbars=yes,width=630,height=740,left=0,top=0')
}


function textCounter(field, countfield, maxlimit) {
	if (maxlimit - field.value.length < 0) 
		field.value = field.value.substring(0, maxlimit);
	else 
		countfield.value = maxlimit - field.value.length;
	}

function NextPage(pstrNoPage, totalLiens, pageDecalage, pageQty, pageFin, pageGabarit, paramPagination, rechLangue)
	{
		//alert(pstrNoPage);

		var strUrl;
		var strMessage;
		var oMsg;
		
		oMsg = false;

		try {
			oMsg = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				oMsg = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (E) {
				oMsg = false;
			}
		}

		if (!oMsg && typeof XMLHttpRequest!='undefined') {
			oMsg = new XMLHttpRequest();
		}

		strUrl = location.href.substring(location.href.lastIndexOf('?') + 1, location.href.length);

		strUrl = strUrl + "&pagination=1&pageCourante=" + pstrNoPage + "&totalLiens=" + totalLiens + "&pageDecalage=" + pageDecalage + "&pageQty=" + pageQty + "&pageFin=" + pageFin + "&pageGabarit=" + pageGabarit + "&paramPagination=" + paramPagination + "&rechLangue=" + rechLangue 

		if (strUrl != 0){	
		
			//alert(strUrl);
			oMsg.open("GET", "/_system/BEACONSFIELD/recherche/recherche.asp?" + strUrl, false)
			oMsg.setRequestHeader("MethodName", "enterOrder")
			oMsg.setRequestHeader("MessageType", "Call")
			oMsg.setRequestHeader("Content-Type", "text/xml-SOAP")

			oMsg.send(null)

			strMessage = oMsg.responseText
			//alert('StrMEssage:' + strMessage)
			if (strMessage.length > 10)
			{
				document.getElementById("wb_contenu_in").innerHTML = strMessage
			}

			document.getElementById("SEARCH").value = document.getElementById("C_SEARCH").value
		}
		delete oMsg;
	}


	function init(pNoLangue)
	{
		var strUrl;
		var strMessage;
		var intPosPI;
		var oMsg = new ActiveXObject("Microsoft.XMLHTTP");
		strUrl = location.href.substring(location.href.lastIndexOf('?') + 1, location.href.length);
		strUrl = strUrl + "&xnolangue=" + pNoLangue;
				//alert(strUrl);
		if (strUrl != 0){		
			oMsg.open("GET", "/_system/beaconsfield/recherche/recherche.asp?" + strUrl, false)
			oMsg.setRequestHeader("MethodName", "enterOrder")
			oMsg.setRequestHeader("MessageType", "Call")
			oMsg.setRequestHeader("Content-Type", "text/xml-SOAP")

			oMsg.send()

			strMessage = oMsg.responseText
			if (strMessage.length > 10)
			{
				wb_contenu_in.innerHTML = strMessage
			}

			document.all.SEARCH.value = document.all.C_SEARCH.value
		}
		delete oMsg;
	}

function rnd() {
	rnd.seed = (rnd.seed*9301+49297) % 233280;
	return rnd.seed/(233280.0);
}

function rand(number) {
		return Math.ceil(rnd()*number);
}

function refreshTimer()	{
	document.getElementById("img_wait").src = "/_SITE/BEACONSFIELD/TEMPLATE/IMAGES/timer60_1sc.gif";
}

function boiteMessage(pstrNomDiv) {
	var intOffsetTop = 0;
	var intOffsetWidth = 0;

	intOffsetTop = document.body.scrollTop;
	intOffsetWidth = document.body.scrollLeft;
	
	try	{
		document.getElementById(pstrNomDiv).style.top = window.event.y + intOffsetTop;
		document.getElementById(pstrNomDiv).style.left = window.event.x + intOffsetWidth;
	} catch (e)	{
		document.getElementById(pstrNomDiv).style.top = 200+ intOffsetTop;
		document.getElementById(pstrNomDiv).style.left = 200+ intOffsetWidth;
	}
		
		
	if(document.getElementById(pstrNomDiv).style.display == "none") {
		document.getElementById(pstrNomDiv).style.display = "inline";
		setTimeout("refreshTimer()",100)
		return;
	}

	if(document.getElementById(pstrNomDiv).style.display == "inline") {
		document.getElementById(pstrNomDiv).style.display = "none";
		return;
	}
		
}

function isEmail(opt) {
	if (opt == "" || opt.length < 6)	//' Check if empty or invalid length 
		return false

	temp = /\s+/g;										//' Check for spaces (illegal characters)
	if (temp.test(opt))
		return false;
	

	temp = /^(\w|[^_]\.|[\-])+((\@){1}([^_]))(([a-z]|[\d]|[\-]|\.)+|([^_]\.[^_])*)+\.[a-z]{2,6}$/i;
	if (!temp.test(opt))
		return false;
			
	temp =/\.(a[c-gil-oq-uwz]|b[a-bd-jm-or-tvwyz]|c[acdf-ik-orsuvx-z]|d[ejkmoz]|e[ceghr-u]|f[i-kmorx]|g[abd-ilmnp-uwy]|h[kmnrtu]|i[delm-oq-t]|j[emop]|k[eg-imnprwyz]|l[a-cikr-vy]|m[acdghk-z]|n[ace-giloprtuz]|om|p[ae-hk-nrtwy]|qa|r[eouw]|s[a-eg-ort-vyz]|t[cdf-hjkm-prtvwz]|u[agkmsyz]|v[aceginu]|w[fs]|y[etu]|z[admrw]|com|edu|net|org|mil|gov|biz|pro|aero|coop|info|name|museum)$/i;
	
	if (!temp.test(opt))								//' Validate domains part of the email
		return false;
	
	temp = /\.\./										//' Validate ././ problem
	if (temp.test(opt))
		return false;
	
														//'  Validate @@ problem
	temp = /\@\@/
	if(temp.test(opt))
		return false;

	return true;
}

function ChangerLangue() {
	var sUrl = new String("");
	sUrl = document.location.href;
	sUrl = sUrl.toLowerCase();

	if (sUrl.indexOf("/anglais/") == -1) {
		sUrl = sUrl.replace('/francais/','/anglais/');
	} else {
		sUrl = sUrl.replace('/anglais/','/francais/');
	}
	document.location.href = sUrl;
	
}

function cleantextbox(pObj) {
	pObj.value = "";
}