/**
 * @author Eric Hébert
 */
function open_comment() {
	//if (navigator.appName=="Netscape" && navigator.userAgent.indexOf("Netscape6") != -1)
	//	return;

	window.document.write("<body bgcolor=white>");
	window.document.write("<font color=white>");
	window.document.write("<PLAINTEXT>");
	window.document.write("<!--");
}

function close_comment() {
	//if (navigator.appName=="Netscape" && navigator.userAgent.indexOf("Netscape6") != -1)
	//	return;

	window.document.write("-->");
	window.document.write("</PLAINTEXT>");
	window.document.write("</font>");
	window.document.write("</body>");
}

//retourne un cookie
function getCookie(name) {
	var key = name + "=";
	var cookies = document.cookie;
	var keyPosition = cookies.indexOf(key);

	if (keyPosition == -1)
		return null;

	var valuePosition = keyPosition + key.length;
	var valuePositionEnd = cookies.indexOf(";", valuePosition);

	if (valuePositionEnd == -1)
		valuePositionEnd = cookies.length;

	return unescape(cookies.substring(valuePosition, valuePositionEnd));
}

//efface un cookie
function deleteCookie(name, path) {
	var exp = new Date();

	exp.setTime(exp.getTime() - 1);
	var cookieVal = getCookie(name);
	if (cookieVal != null) {
		var cookie = name + "=" + cookieVal + "; expires=" + exp.toGMTString();
		if (path != null)
			cookie = cookie + "; path=" + path;
		document.cookie = cookie;
	}
}

//création d'un cookie
function setCookie(name, value, path, session) {
    var cookie = name + "=" + value;

    if (session != true) {
	    var date = new Date();
		date.setTime(date.getTime()+(365*86400000));
	    cookie = cookie + "; expires=" + date.toGMTString();
	}

    if (path != null)
        cookie = cookie + "; path=" + path;

    //assignation du cookie
    document.cookie = cookie;
}

if(document.domain=="www.snapvertise.com" && top.location.href.indexOf("contactid")=="-1") {
  var expireDate = new Date(); expireDate.setDate(expireDate.getDate()+parseInt(1));
  document.cookie = 'X3URL=' + top.location.href + '; path=/; expires=' + expireDate.toGMTString();
}

