// JavaScript Documentfunction
function writeCookie(nom, valeur)
	{
	//alert('cookie '+nom+' '+valeur);
	var argv=writeCookie.arguments;
	var argc=writeCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=nom+"="+escape(valeur)+
	((expires==null || expires==0) ? "" : ("; expires="+expires.toGMTString()))+
	((path==null) ? ("; path=/") : ("; path="+path))+
	((domain==null) ? "" : ("; domain="+domain))+
	((secure==true) ? "; secure" : "" );
	}
function getCookieVal(offset)
	{
	var endstr=document.cookie.indexOf (";", offset);
	if (endstr==-1) endstr=document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
	}
function readCookie(nom)
	{
	var arg=nom+"=";
	var alen=arg.length;
	var clen=document.cookie.length;
	var i=0;
	while (i<clen)
		{
		var j=i+alen;
		if (document.cookie.substring(i, j)==arg) return getCookieVal(j);
		i=document.cookie.indexOf(" ",i)+1;
		if (i==0) break;
		}
	return null;
	}

function submit_parent(element)
	{
	if(element.className)
		{
		classnames = element.className.split(' ');
		for(var i = 0; i < classnames.length; i++)
			{
			if(classnames[i] == 'disabled')
				{
				return false;
				}
			}
		}
	submit_name = element.name;
	if(element.nodeName == "A")
		{
		var hidden_input = null;
		if(submit_name != "")
			{
			hidden_input = document.createElement("input");
			hidden_input.type = "hidden";
			hidden_input.name = submit_name;
			hidden_input.value = "1";
			}
		}
	form = null;
	while(element)
		{
		if(typeof(element) != "object") return false;
		if(element.nodeName == 'FORM')
			{
			form = element;
			break;
			}
		element = element.parentNode;
		}
	if(form)
		{
		if(hidden_input)
			{
			form.appendChild(hidden_input);
			}
		if(typeof form.onsubmit == 'function')
			{
			form.onsubmit();
			}
		else
			{
			form.submit();
			}
		}
	}
function WindowSizeWidth()
	{
	return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
	}
function WindowSizeHeight()
	{
	return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;
	}
function WindowPosLeft()
	{
	return (document.all)?window.screenLeft:window.screenX;
	//return typeof window.pageXOffset != 'undefined' ? window.pageXOffset :document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;
	}
function WindowPosTop()
	{
	return (document.all)?window.screenTop:window.screenY;
	//return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;
	}
function WindowPosRight()
	{
	return WindowPosLeft()+WindowSizeWidth();
	}
function WindowPosBottom()
	{
	return WindowPosTop()+WindowSizeHeight();
	}
function StopEvent(e)
	{
    if (!e) var e = window.event;
	e.cancelBubble = true;
    if (e.stopPropagation) e.stopPropagation();
	}
