function dtNow() {
	var now = new Date() ;
	var d = now.getDate() ; d = (d<10)? "0"+d : d ;
	var m = now.getMonth() + 1 ; m = (m<10)? "0"+m : m ;
	var y = now.getFullYear() ;
	var h = now.getHours() ; h = (h<10)? "0"+h : h ;
	var n = now.getMinutes() ; n = (n<10)? "0"+n : n ;
	var s = now.getSeconds() ; s = (s<10)? "0"+s : s ;
	this.y = y ;
	this.m = m ;
	this.d = d ;
	this.h = h ;
	this.n = n ;
	this.s = s ;
}

// fixe cookie partner si param src !="":
if (getParamValue("src")!=="") {
	ecrireCookie("partner", getParamValue("src"), "/") ;
}
// ecrireCookie ( nom, valeur [, path [, expire [, domain [, secure]]]] )
function ecrireCookie(nom, valeur) {
	var argv = ecrireCookie.arguments;
	var argc = ecrireCookie.arguments.length;
	var path = (argc > 2) ? argv[2] : null;
	var expires = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = nom+"="+escape(valeur)+
		((path===null) ? "" : ("; path="+path))+
		((expires===null) ? "" : ("; expires="+expires.toGMTString()))+
		((domain===null) ? "" : ("; domain="+domain))+
		((secure===true) ? "; secure" : "");
}
function getCookie(sName) {
	var aCookies ;
	var aCookie ;
	if (document.cookie!=="") {
		aCookies = document.cookie.split('; ') ;
		for (i=0; i<aCookies.length; i+=1) {
			aCookie = aCookies[i].split('=') ;
			if (aCookie[0]==sName) {
				return unescape(aCookie[1]) ;
			}
		}
	}
	return "" ;
}
function getParamValue(fieldName) {
	var strUrl = window.location + "" ;
	var posField = strUrl.indexOf(fieldName + "=") ;
	var strVal = (posField>-1)? strUrl.substr((posField + fieldName.length + 1), 2) :  "" ;
	return strVal ;
}
function setImgNumTel(sElId, sSrc) {
	// sElId : target img
	// sSrc : /patch/imgName##.ext
	var sCookie = getCookie("partner") ;
	sCookie = (sCookie)? sCookie.substr(0, 1) : "" ;
	if (sCookie!=="") {
		if (parseInt(sCookie)<10) { sCookie = "0" + sCookie ; }
	}
	document.getElementById(sElId).src = sSrc.strReplace("##", sCookie) ;
	document.getElementById(sElId).alt = "num tel " + sCookie ;
}
function strReplace(sSearch, sReplace) {
	var i = 0 ;
	var result = this ;
	var sRepl =(sReplace!=null)? String(sReplace) : "" ;
	while(i!=-1) {
		i = result.indexOf(sSearch, i) ;
		if (i>=0) {
			result = result.substring(0,i) + sRepl + result.substring(i+sSearch.length) ;
			i += sRepl.length ;
		}
	}
	return result ;
}
String.prototype.strReplace = strReplace ;

function popForPrint(sUrl) {
	var oArgs = popForPrint.arguments ;
	var iArgCount = popForPrint.arguments.length ;
	var wTitle = (iArgCount > 1) ? oArgs[1] : "wprint" ;
	var wOpt = (iArgCount > 2) ? oArgs[2] : "" ;

	w = window.open(sUrl, wTitle, wOpt) ;
}

function removeAccent(Str) {
	Str = Str.replace(/é/gi, 'e' );
    Str = Str.replace(/è/gi, 'e' );
    Str = Str.replace(/ù/gi, 'u' );
    Str = Str.replace(/à/gi, 'a' );
    Str = Str.replace(/ê/gi, 'e' );
    Str = Str.replace(/ô/gi, 'o' );
    Str = Str.replace(/î/gi, 'i' );
    Str = Str.replace(/û/gi, 'u' );
    Str = Str.replace(/â/gi, 'a' );
    Str = Str.replace(/ë/gi, 'e' );
    Str = Str.replace(/ö/gi, 'o' );
    Str = Str.replace(/ï/gi, 'i' );
    Str = Str.replace(/ü/gi, 'u' );
    Str = Str.replace(/ä/gi, 'a' );
    Str = Str.replace(/ç/gi, 'c'); 

    return Str;
}

function replaceBadChar(Str) {
	Str = Str.replace(/'/g , '-');
	Str = Str.replace("/./g" , '-');
	Str = Str.replace(/ /g , '-');
	
	return Str;
}


function str2Url(Str) {
	return replaceBadChar(removeAccent(Str)).toLowerCase();
}