function o0(a,o) {if (!o){o=document} return o.getElementById(a)}
function oRem(o1,o2) {o1.removeChild(o2)}
function node(a) {return document.createTextNode(a)}
function vo0(o) {for( var i=0; i< o.childNodes["length"];i++){o.removeChild(o.childNodes[i]);}}
function getH(o) {if (o){return o.offsetHeight}}
function getW(o) {if (o){return o.offsetWidth}}
function aff(a,o) {if (!o){o=document} if (o0(a,o)){o0(a,o).style.display=''}}
function vis(a,o) {if (!o){o=document} if (o0(a,o)){o0(a,o).style.visibility='visible'}}
function eff(a,o) {if (!o){o=document} if (o0(a,o)){o0(a,o).style.visibility='hidden'}}
function isAff(id){return (o0(id).style.display=='');}
function cl(a,o) {if (!o){o=document} if (o0(a,o)){o0(a,o).style.display='none'}}
function getCoord(obj) {return [getX(obj), getY(obj)]}
function t0(a,o)  {if (!o){o=document} return o.getElementsByTagName(a)}
function c0(a)  {return document.createElement(a)}
function oApp(o1,o2) {o1.appendChild(o2);}
function po0(a) {return o0(a,parent.document);}
function none() {return false;}
function h2d(h) {return parseInt(h,16).toString();}
function onlyNum(o){o.value=o.value.replace(/[^0-9]+/,"");}
function toupper(o){o.value=o.value.toUpperCase();}
function d2h(d) {return (d.toString(16).toString().length<2)?'0'+d.toString(16).toString().toUpperCase():d.toString(16).toString().toUpperCase();}
function AjoutMsg(o,str){oApp(o,node(str));}
function getX(MyObject){return (MyObject.offsetParent)?(MyObject.offsetLeft + getX(MyObject.offsetParent)):MyObject.offsetLeft;}
function setLyr(obj,lyr,x,y){var coord= getCoord(obj);setCoord(lyr,coord[0]+x,coord[1]+y);}
function setCoord(obj,x,y){obj.style.left=x+'px';obj.style.top=y+'px';}
function errInput(o,t){o.className=(((t=='')&&(o.value!=t))||((t!='')&&(o.value=='')))?'err':'cor';return testInput(o,t);}
function errInputV(o){o.className=(o.value=='')?'err':'cor';return testInputV(o);}
function testInput(o,t){return !((o.value!='')&&(o.value!=t));}
function testInputV(o){return (o.value!='');}
function lAr(a) {return (a.length>0)?'Array("'+TStr(a.join('","'))+'")':'Array()';}
function TStr(s){var r0 = new RegExp("'","gi");var r1 = new RegExp("\n","gi");return s.replace(r0,"\'").replace(r1,"\\n");}
function retail()
{
	maxDp1=getH(o0('P1'))+getY(o0('P1'));
	maxDp2=getH(o0('c1Contain'))+getY(o0('c1Contain'));

	var Hp1=getH(o0('P1'));
	var Hp2=getH(o0('c1Contain'));

	if (maxDp1<getWindowHeight())
	{
		Hp1=(getWindowHeight()-getY(o0('P1')));
	}
	if (maxDp2<getWindowHeight())
	{
		Hp2=(getWindowHeight()-getY(o0('c1Contain')));
	}
	if ((maxDp1>getWindowHeight())||(maxDp2>getWindowHeight()))
	{
		if (maxDp1>maxDp2)
		{
			Hp2=maxDp1-getY(o0('c1Contain'));
		}
		else
		{
			Hp1=maxDp2-getY(o0('Dp2'));
		}
	}
	o0('P1').style.height=Hp1+'px';
	o0('c1Contain').style.height=Hp2+'px';
	o0('Dp3').style.height=Hp2+getY(o0('c1Contain'))-getY(o0('Dp3'))+"px";
	if(o0('maxImgAff'))
	{
		o0('maxImgAff').style.height=getH(o0('maxImgAff').parentNode)+'px';
	}
}
function tag(a ,array) {
	o=c0(a);
	for( var key in array ) {
		if (key=='style'){
			for(var prop in array[key]){
				o.style[prop]=array[key][prop];}
			}
		else {
		o.setAttribute(key,array[key]);	
		}
	}
	return o;
}

function getY(obj)
{
	var curtop = 0;
	if (obj.offsetParent) {while (obj.offsetParent) {curtop += obj.offsetTop;obj = obj.offsetParent;}}
	else if (obj.y) curtop += obj.y;
	return curtop;
}

function formValid(o,a,b,a2,a3,a4)
{
	var v=true;
	for (var k in a) v=(a3===false)?errInputV(o[a[k]])&&v:errInput(o[a[k]],a2[k])&&v;
	if (a3!==false){for (var k in a3)v=testInput(o[a3[k]],a4[k])&&v;}
	v=(typeof addForm =="function")?addForm()&&v:v;
	o0(b).disabled=(a3===false)?!v:v;
	window.setTimeout((a3===false)?"formValid(o0('"+o.id+"'),"+lAr(a)+",'"+b+"',"+lAr(a2)+",false);":"formValid(o0('"+o.id+"'),"+lAr(a)+",'"+b+"',"+lAr(a2)+","+lAr(a3)+","+lAr(a4)+");",100);
}

function PosSouris(e) {
   if (typeof event=="object") {
   hor=event.x+document.body.scrollLeft;
   ver=event.y+document.body.scrollTop;
   }
   else {
   hor=e.pageX;
   ver=e.pageY;
   }
}

function LSupp(n)
{
	if (confirm('Attention:\n\tVous êtes sur le point de supprimer définitivement ce billet. Etes vous sur de vouloir continuer ?'))
	{
		location.href='traitements/billetSupp.php?n='+n;
	}
}

function LArch(n,b)
{
	t=(b)?' de désarchiver':' d\'archiver';
	if (confirm('Attention:\n\tVous êtes sur le point '+t+' ce billet. Etes vous sur de vouloir continuer ?'))
	{
		location.href='traitements/billetArchive.php?n='+n;
	}
}

function getWindowHeight() {
 var windowHeight = 0;
   if (typeof(window.innerHeight) == 'number') {
        windowHeight = window.innerHeight;
   }
        else {
          if (document.documentElement && document.documentElement.clientHeight) {
            windowHeight = document.documentElement.clientHeight;
          }

        else {
          if (document.body && document.body.clientHeight) {
            windowHeight = document.body.clientHeight;
        }
        }
   }
 return windowHeight;
}

var tNews;

function launchNews()
{
	var contenant=o0('newsContain');
	var contenu=o0('NewsLimit');
	var max=0-(getH(contenu));
	var reg=new RegExp("[^\-0-9]", "g");
	if (contenu.style.top.replace(reg,'')<max)
	{
		contenu.style.top=getH(contenant)+'px';
	}
	else
	{
		if(contenu.style.top=="")
		{
			contenu.style.top='0px';
		}
		else {
			contenu.style.top=(contenu.style.top.replace(reg,'')-1)+"px";
		}
	}

	tNews=window.setTimeout("launchNews();",100);
}

function stopNews()
{
	window.clearTimeout(tNews);
}

function affImgDiv(o)
{
	if (o0('imgBloc')){oRem(o0('imgBloc').parentNode,o0('imgBloc'));}
	var d2=tag('div',{"id":"imgBloc"});
	oApp(d2,tag('br'));
	oApp(d2,tag('br'));
	oApp(d2,tag('br'));
	oApp(d2,tag('br'));
	var img=tag('img');
	img.src=o[0].src;
	d2.onclick=function() {if (o0('imgBloc')){oRem(o0('imgBloc').parentNode,o0('imgBloc'));}};
	oApp(d2,img);
	oApp(t0('body').item(0),d2);
	d2.style.height=getWindowHeight()+'px';
}

function gSY(o) 
{
	var sY = 0;o1=(!o)?window:o;o2=(!o)?document:o;
	if(typeof(o1.pageYOffset)=='number'){sY = o1.pageYOffset;}
	else if(o2.documentElement&&(o2.documentElement.scrollTop)){sY = o2.documentElement.scrollTop;}
	else if(o2.body&&(o2.body.scrollTop)){sY = o2.body.scrollTop;}
	return sY;
}


	function blink_show()
	{
		blink_tags  = document.all.tags('blink');
		blink_count = blink_tags.length;
		for ( i = 0; i < blink_count; i++ )
		{
			blink_tags[i].style.visibility = 'visible';
		}
		
		window.setTimeout( 'blink_hide()', 700 );
	}
	
	function blink_hide()
	{
		blink_tags  = document.all.tags('blink');
		blink_count = blink_tags.length;
		for ( i = 0; i < blink_count; i++ )
		{
			blink_tags[i].style.visibility = 'hidden';
		}
		
		window.setTimeout( 'blink_show()', 250 );
	}

window.onload=iMain;
window.oncontextmenu=none;
window.onresize=retail;
