/*****************************************************************************
Start main pour sit
******************************************************************************/

var bShowInscription = false;

function startmainsite(Langue) {
	var wf = "";

	wf = wf + "width=" + 800;
	wf = wf + ",height=" + 692;

	if (screen.width <= 800) {
		wf = wf + ",left=" + 0;
	} else {
		wf = wf + ",left=" + (screen.width - 800)/2;
	}
	if (screen.top <= 692) {
		wf = wf + ",top=" + 0;
	} else {
		wf = wf + ",top=" + (screen.height - 692)/2; 
	}

	wf = wf + ",resizable=" + "yes";
	wf = wf + ",scrollbars=" + "yes";
	wf = wf + ",menubar=" + "no";
	wf = wf + ",toolbar=" + "no";
	wf = wf + ",directories=" + "no";
	wf = wf + ",location=" + "no";
	wf = wf + ",status=" + "no";	

	// diriger vers un site de version flash 8
	window.open("http://residencelesoleil.telemedic.ca/intranet/main.asp?Langue=" + Langue, "_blank", wf, false)

	<!-- Lorsque l'intranet peut être appeler de Plusieurs IP -->
	<!-- window.open("http://255.255.255.255/intranet/main.asp?IPExt=255.255.255.255&Langue=" + Langue, "", wf) -->
}

function startaccount(Langue) {
	// diriger vers un site de version flash 8
	window.open("asp/accpatientid.asp?Status=New&Langue=" + Langue, "_self");
}

function SetCookie(langue) {
	SetCookieParam("langue", langue, 28);
}

function SetCookieParam(name, value, duration) {
	cookiestring=name + "=" + escape(value) + ";EXPIRES=" + getexpirydate(duration);
	document.cookie = cookiestring;
}

function getexpirydate(nodays){
	var UTCstring;
	Today	= new Date();
	nomilli = Date.parse(Today);
	Today.setTime(nomilli + nodays * 24 * 60 * 60 * 1000);
	UTCstring = Today.toUTCString();
	return UTCstring;
}

function GetCookie() {
	var Langue = getCookieParam("Langue");
	if (Langue != "") {
		startmainsite(Langue)
	}
}

// Obtient la string du cookie
function getCookieParam(name) {
	name = name + "=";
	var i = 0;
	while (i < document.cookie.length) {
		var offset = i + name.length;
		if (document.cookie.substring(i, offset) == name) { 
			var endstr = document.cookie.indexOf(";", offset); 
			if (endstr == -1) {
				endstr = document.cookie.length;
			}
			return unescape(document.cookie.substring(offset, endstr));
		}
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) {// Est-ce que l'on a terminé
			break; 
		}
	}
	return "";	// Cookie non trouvé
}


