ankor=window.location.hash.split('/');
page=ankor[0].replace('#','');
	
day=new Array('Dimanche');
day[1]='Lundi';
day[2]='Mardi';
day[3]='Mercredi';
day[4]='Jeudi';
day[5]='Vendredi';
day[6]='Samedi';
month=new Array('');
month[1]='Janvier';
month[2]='Février';
month[3]='Mars';
month[4]='Avril';
month[5]='Mai';
month[6]='Juin';
month[7]='Juillet';
month[8]='Aoùt';
month[9]='Septembre';
month[10]='Octobre';
month[11]='Novembre';
month[12]='Décembre';

function log() {
	if (top.document.getElementById('login').value=='identifiant') { top.document.getElementById('login').value='';top.document.getElementById('password').value=''; }
}

function letter(n) {
	n+="";
	a=n.substring(0,1);
	b=n.substring(1,2);
	return '<img src=/0.gif class=h'+a+'><img src=/0.gif class=h'+b+'>';
}

function horloge() {
	today=new Date();
	top.document.getElementById('jour').innerHTML=day[today.getDay()].toLowerCase()+" "+today.getDate()+" "+month[today.getMonth()+1].toLowerCase()+" "+today.getFullYear();
	top.document.getElementById('horloge').innerHTML=letter(dbl(today.getHours()))+"<img src=/0.gif class=hp>"+letter(dbl(today.getMinutes()));
}
function dbl(num){if(num*1<10)return'0'+num*1;else return num}

function dec2hex(i) {
	a2='';
	ihex=hexQuot(i);
	idiff=i-(ihex*16);
	a2 = itohex(idiff) + a2;
	while( ihex >= 16) {
		itmp = hexQuot(ihex);
		idiff = ihex-(itmp*16);
		a2 = itohex(idiff) + a2;
		ihex = itmp;
	}
	a1 = itohex(ihex);
	res = a1 + a2+'';
	while(res.length%2!=0) res = '0'+res;
	return res;
}
function hexQuot(i) {return Math.floor(i/16)}
function itohex(m) {hexChars = '0123456789ABCDEF';return hexChars.charAt(m)}

function mouse_out(v) {
	mout(document.getElementById('menu0').parentNode.parentNode,document.getElementById('menu0_value').value);
	mout(document.getElementById('menu1').parentNode.parentNode,document.getElementById('menu1_value').value);
	if (document.getElementById('menu2_value').value.length>0) mout(document.getElementById('menu2').parentNode.parentNode,document.getElementById('menu2_value').value);
	if (document.getElementById('menu3_value').value.length>0) mout(document.getElementById('menu3').parentNode.parentNode,document.getElementById('menu3_value').value);
	if (document.getElementById('menu4_value').value.length>0) mout(document.getElementById('menu4').parentNode.parentNode,document.getElementById('menu4_value').value);
	if (document.getElementById('menu5_value').value.length>0) mout(document.getElementById('menu5').parentNode.parentNode,document.getElementById('menu5_value').value);
	if (v==0) {
		if (top.document.getElementById('selected')!=undefined) {
			top.document.getElementById('selected').id="selected_old";
			top.document.getElementById('main').innerHTML+="<input id=selected type=hidden class=main>";
		}
	}
}

function open(obj){
	mouse_out();
	lis=document.getElementsByTagName('li');
	for(i=0;i<lis.length;i++) {
		if(lis[i].className=='open') lis[i].className='close';
		if(lis[i].className=='open2') lis[i].className='close2';
	}
	if ((obj.className=='close2') || (obj.className=='hover2')) obj.className='open2';
	if ((obj.className=='close') || (obj.className=='hover')) obj.className='open';
}

function nav_list(obj){
	uls=obj.parentNode.getElementsByTagName('ul');
	if (uls[0].className=='nav_list'){
		uls[0].className='nav_list_open';
		uls[0].parentNode.className='nav_open';
	}else if (uls[0].className=='nav_list_open'){
		uls[0].className='nav_list';
		uls[0].parentNode.className='';
	}
}

function menu_over(obj,flag){
	divs=obj.getElementsByTagName('div');
	if (flag>0) {
		for(i=0;i<divs.length;i++) if (divs[i].className.substring(divs[i].className.length-4,divs[i].className.length)=='null') divs[i].className=divs[i].className.substring(0,divs[i].className.length-5);
	} else {
		for(i=0;i<divs.length;i++) if (divs[i].className.substring(divs[i].className.length-4,divs[i].className.length)!='null') divs[i].className=divs[i].className+'_null';
	}
}

function stats_analytics(page) {
	ankor=window.location.hash.split('/');
	if (ankor[1]=="essentiel") page="essentiel";
	session('stats_analytics.php?page='+page,'content_load');
}

function home(obj){
	if (typeof(obj)!="undefined") open(obj.parentNode);
	session('content_home.php','content_load');
}
function menu_actualites(obj){
	if (obj==undefined) obj=document.getElementById('news_reload');
	news_reload_start();
	if (top.document.getElementById('sl_essentiel').className=='news_on') essentiel(1);
	else {
		if (top.document.getElementById('sl_essentiel').className=='news_on') slide(top.document.getElementById('sl_essentiel'));
		top.document.getElementById('calendar_watch').style.display="block";
		top.document.getElementById('watch').style.display="block";
		if (typeof(obj)!="undefined") open(obj.parentNode);
		session('/content_news.php?date_news='+document.getElementById("calendar_hour").value.substring(0,10)+'&hour_news='+document.getElementById("calendar_hour").value.substring(11,13),'content_load');
	}
}
function menu_petites_annonces(obj){
	if (typeof(obj)!="undefined") open(obj.parentNode);
	session('content_sads.php','content_load');
}
function menu_journal(obj){
	if (typeof(obj)!="undefined") open(obj.parentNode);
	session('content_journal.php','content_load');
}
function menu_logiciels(obj){
	if (typeof(obj)!="undefined") open(obj.parentNode);
	session('content_software.php','content_load');
}
function menu_drivers(obj){
	if (typeof(obj)!="undefined") open(obj.parentNode);
	session('content_driver.php','content_load');
}

function session(url,trg){
	if (typeof(trg)!="undefined") top.document.getElementById(trg).src=url;
	else return(url);
}

function load_page(){
	ifs=document.getElementsByTagName('iframe');
	ext=".php";
	page=window.location.hash.substring(1,8);
	if ((page=="accueil") || (page=="")) ext="_home.php";
	for(i=0;i<ifs.length;i++) if (ifs[i].id.substring(0,2)=='m4') ifs[i].src=session('/m4/'+ifs[i].id+ext);
}

function scrolling(){
	if (top.document.body.clientWidth>1250) {
		if ((top.document.body.scrollTop>140) && (top.document.getElementById('scroll_top').style.display=='none')) {
			changeOpac(0,'scroll_top');
			top.document.getElementById('scroll_top').style.display='';
			opacity('scroll_top',0,100,300);
		}
		if (top.document.body.scrollTop<=140) top.document.getElementById('scroll_top').style.display='none';
		if (navigator.userAgent.indexOf('MSIE')>0)	{
			if ((top.document.body.scrollTop<top.document.getElementById('content').offsetHeight-top.document.documentElement.offsetHeight+145) && (top.document.getElementById('scroll_bottom').style.display=='none')) {
				// changeOpac(0,'scroll_bottom');
				top.document.getElementById('scroll_bottom').style.display='';
				// opacity('scroll_bottom',0,100,300);
			}
			if (top.document.body.scrollTop>=top.document.getElementById('content').offsetHeight-top.document.documentElement.offsetHeight+145) top.document.getElementById('scroll_bottom').style.display='none';
		} else {
			top.document.getElementById('scroll_bottom').style.top=(top.document.body.clientHeight-144);
			if ((top.document.body.scrollTop+top.document.body.clientHeight+90<top.document.body.offsetHeight) && (top.document.getElementById('scroll_bottom').style.display=='none')) {
				changeOpac(0,'scroll_bottom');
				top.document.getElementById('scroll_bottom').style.display='';
				opacity('scroll_bottom',0,100,300);
			}
			if (top.document.body.scrollTop+top.document.body.clientHeight+90>=top.document.body.offsetHeight) top.document.getElementById('scroll_bottom').style.display='none';
		}
	} else {
		top.document.getElementById('scroll_top').style.display='none';
		top.document.getElementById('scroll_bottom').style.display='none';
	}	
}

function sizing_content() {
	w=Math.max(Math.max(top.document.body.scrollWidth, top.document.documentElement.scrollWidth),Math.max(top.document.body.offsetWidth, top.document.documentElement.offsetWidth),Math.max(top.document.body.clientWidth, top.document.documentElement.clientWidth));
	if (navigator.userAgent.indexOf('MSIE')>0) limit=1024; else limit=1009;
	if (w<=limit) width_add=0;
	else if (w<1280) width_add=0;
	else width_add=Math.round((w-limit)/2-128);
	if (top.document.body.className=='hab') width_add=0;
	document.write('<img src=/0.gif id=content_width style=width:'+(680+width_add)+'px>');
}

function sizing(){
	w=Math.max(Math.max(top.document.body.scrollWidth, top.document.documentElement.scrollWidth),Math.max(top.document.body.offsetWidth, top.document.documentElement.offsetWidth),Math.max(top.document.body.clientWidth, top.document.documentElement.clientWidth));
	if (navigator.userAgent.indexOf('MSIE')>0) { correct=32; limit=1024; decal=9; wid=16; } else { limit=1009; decal=0; wid=9; correct=5;}
	if (top.document.body.className=='hab') {
		width_add=0;
		hab=120;
		td=top.document.getElementById('headbody').getElementsByTagName('td');
		td[0].style.paddingTop=hab;
		top.document.getElementById('cdi_logo').style.width=250;
		top.document.getElementById('cdi_logo').style.marginLeft=0;
		top.document.getElementById('cdi_logo').style.marginTop=0;
		top.document.getElementById('cdi_logo').style.backgroundPosition='-213px 0px';
		top.document.getElementById('m4_lb').style.top=9;
		top.document.getElementById('m4_lb').style.left=270;
		top.document.getElementById('message').style.display="none";
		top.document.getElementById('header').style.width=1000;
		top.document.getElementById('header').style.marginTop=hab;
		top.document.getElementById('header').style.marginLeft=Math.floor((w-1000)/2)-decal;
		top.document.getElementById('header_right1').style.display="none";
		top.document.getElementById('header_right2').style.display="none";
		top.document.getElementById('header_right3').style.display="none";
		top.document.getElementById('border').style.display="none";
		top.document.getElementById('hab_top').style.height=hab;
		top.document.getElementById('hab_right').style.width=Math.floor((w-1000)/2)-decal;
		top.document.getElementById('hab_left').style.width=Math.floor((w-1000)/2)-decal;
		top.document.getElementById('hab_right').style.left=Math.floor((w-1000)/2)-decal+1000;
	} else {
	hab=0;
	if (w<=limit) {
		top.document.getElementById('cdi_logo').style.width=250;
		top.document.getElementById('cdi_logo').style.marginLeft=0;
		top.document.getElementById('cdi_logo').style.backgroundPosition='-213px 0px';
		top.document.getElementById('m4_lb').style.left=274;
		top.document.getElementById('header').style.width=1007;
		width_add=0;
	} else {
		if (w<1280) width_add=0; else width_add=Math.round((w-limit)/2-128);
		top.document.getElementById('cdi_logo').style.width=464;
		top.document.getElementById('cdi_logo').style.marginLeft=Math.floor((w-1000-width_add)/2)-218-decal;
		top.document.getElementById('m4_lb').style.left=Math.floor((w-1000+width_add)/2)+271-decal;
		top.document.getElementById('cdi_logo').style.backgroundPosition='0px 0px';
		top.document.getElementById('header').style.width='100%';
	}}
	top.document.getElementById('content_width').style.width=(680+width_add);
	if (top.document.getElementById('content').innerHTML.indexOf('tag_trend')>0) {
		top.document.getElementById('tag_trend').style.width=(260+width_add);
		top.document.getElementById('tag_trend').src=top.document.getElementById('tag_trend').src;
		if (document.getElementById('menu4_value').value.length>0) if (w<1350) top.document.getElementById('home_driver_input_2').style.display='none'; else top.document.getElementById('home_driver_input_2').style.display='';
	}
	top.document.getElementById('main_width').style.width=(680+width_add);
	top.document.getElementById('header_bar').style.width=(401+width_add);
	top.document.getElementById('message').style.width=(399+width_add+top.document.getElementById('header_right2').clientWidth);
	top.document.getElementById('message').style.left=605+top.document.getElementById('header_right2').clientWidth;
	top.document.getElementById('scroll_top').style.left=(top.document.body.clientWidth-116);
	top.document.getElementById('scroll_bottom').style.left=(top.document.body.clientWidth-116);
	top.document.getElementById('alert').style.width=top.document.body.clientWidth;
	scrolling();
	top.document.getElementById('chat').style.height=0;
	top.document.getElementById('chat').style.height=Math.max(0,Math.max(top.document.body.scrollHeight,top.document.body.clientHeight)+correct-top.document.getElementById('main').offsetHeight-top.document.getElementById('nav').offsetHeight-90)-hab;
}

function replace_all(text,src,trg,casse){
	i=0;
	while (i!=-1){
		if (casse) i=text.indexOf(src,i);
		else i=text.toLowerCase().indexOf(src.toLowerCase(),i);
		if (i>=0){
			text=text.substring(0,i)+trg+text.substring(i+src.length);
			i+=trg.length;
	}}
	return text;
}

function get_value(text,start,end,casse){
	i=0;
	if (start.length>0) {
		if (casse) i=text.indexOf(start);
		else i=text.toLowerCase().indexOf(start.toLowerCase());
		text=text.substring(i+start.length,text.length);
	}
	if (end.length>0){
		i=0;
		if (casse) i=text.indexOf(end);
		else i=text.toLowerCase().indexOf(end.toLowerCase());
		text=text.substring(0,i);
	}
	return text;
}

function addEvent(obj,type,fn){if (obj.addEventListener){obj.addEventListener(type,fn,false);}else{obj['e'+type+fn]=fn;obj[type+fn]=function(){obj['e'+type+fn](window.event)};obj.attachEvent('on'+type,obj[type+fn]);}}

function pagination(total,page,action,type) {
	page_html="";
	num=Math.floor(total/100)+1;
	prec=Math.max(1,page-1);
	next=Math.min(num+1,page+1);
	page_html="<table width=98%><tr><td>Résultats : <b>"+total+"</b>   <td align=right><table><tr><td>Page : <td><ul id=pagination-digg>";
	if (page>1) page_html+="<li id=page_prec class=next><a href=javascript:"+action+"("+String.fromCharCode(34)+type+String.fromCharCode(34)+","+prec+");>«</a></li>";
	for(p=1;p<=num;p++) {
		hide=0;
		if (Math.abs(page-p)>9) hide=1;
		if ((p==1) || (p==num)) hide=0;
		if (((hide==1) && (p==2)) || ((hide==1) && (p==num-1))) page_html+="<li> ... </li>";
		if (hide==0) {
			if (page==p) clas="active"; else clas="";
			if (p<100) clas+="min";
			page_html+="<li title="+String.fromCharCode(34)+"Résultats "+(p*100-99)+" à "+Math.min(total,p*100)+String.fromCharCode(34)+" class="+clas+" id=page_"+p+"><a href=javascript:"+action+"("+String.fromCharCode(34)+type+String.fromCharCode(34)+","+p+");>"+p+"</a></li>";
	}}
	if (page<num) page_html+="<li id=page_next class=next><a href=javascript:"+action+"("+String.fromCharCode(34)+type+String.fromCharCode(34)+","+next+");>»</a></li>";
	page_html+="</ul></td></table></td></table>";
	return(page_html);
}

function global_switch(id,reload,type) {
	obj=top.document.getElementById('sl_'+type+'_'+id).className;
	if (reload>0) {
		if (obj.substring(obj.length-3,obj.length)=='off') on=0; else on=1;
		if (top.document.getElementById('sl_essentiel').className=='news_on') ess=1; else ess=0;
		session("/feed.php?action=syndicate&essentiel="+ess+"&type="+type+"&on="+on+"&id="+id+"&day="+document.getElementById('calendar_hour').value,'content_load');
		if (top.document.getElementById('sl_essentiel').className=='news_off') { load_page(); listing(type,top.document.getElementById("calendar_hour").value.substring(11,13)); }
	} else if (obj.substring(obj.length-2,obj.length)=='on') slide_pos('sl_'+type+'_'+id,0,0);
}

function tl(obj) {
	div=top.document.getElementById('content').getElementsByTagName('div');
	for(s=0;s<div.length-1;s++) if (div[s].id=='selected') div[s].id='';
	obj.parentNode.id='selected';
	obj.className='tover';
	if (obj.innerHTML.length<10) {
		type=get_value(get_value(document.getElementById('selected').innerHTML.replace("http://www.comptoir-info.com",""),'href=',' ',true),'/','/');
		id=get_value(document.getElementById('selected').innerHTML,'/'+type+'/','"',true);
		switch (type) {
			case "actualites": type2="cette news"; break;
			case "petites_annonces": type2="cette petite annonce"; break;
			case "drivers": type2="ce driver"; break;
			case "logiciels": type2="ce logiciel"; break;
		}
		obj.innerHTML='<input onmouseout=this.className=""; onmouseover=this.className="plus"; title="Recommander '+type2+'" type=button onclick=listing_plus('+id+',"'+type+'");><input onmouseout=this.className=""; onmouseover=this.className="moins"; title="Déconseiller '+type2+'" type=button onclick=listing_minus('+id+',"'+type+'");><input onmouseout=this.className=""; onmouseover=this.className="mail"; title="Envoyer '+type2+' par email à un ami \nou à vous même pour vous en souvenir..." type=button onclick=listing_mail('+id+',"'+type+'");><input onmouseout=this.className=""; onmouseover=this.className="star"; title="Marquer '+type2+', de manière à pouvoir la retrouver plus tard" type=button onclick=listing_save('+id+',"'+type+'");><input onmouseout=this.className=""; onmouseover=this.className="fb"; title="Partager '+type2+' sur Facebook" type=button onclick=listing_fb('+id+',"'+type+'");><input onmouseout=this.className=""; onmouseover=this.className="tw"; title="Partager '+type+' sur Twitter" type=button onclick=listing_tw('+id+',"'+type+'");>';
		}
	addEvent(obj,'mouseout',function(){this.className='t';this.parentNode.id='selected';});
}

function listing(objID,h,last){
	off=new Array();
	oldhour=new Number(0);
	newhour=new Number(0);
	hour=new Number(0);
	addhour=new Boolean(false);
	start=new Number();
	end=new Number();
	inps=new Object(top.document.getElementById('nav').getElementsByTagName('input'));
	inps_off=new Object(top.document.getElementById('nav').getElementsByTagName('div'));
	pref=new String('sl_'+objID+'_');
	if (top.document.getElementById('calendar_watch').style.display=='none') hidden=false; else hidden=true;
	if (objID=='news') {
		news_hitech=new String(top.document.getElementById('slider_0').className);
		news_actu=new String(top.document.getElementById('slider_100').className);
		news_eco=new String(top.document.getElementById('slider_200').className);
		news_sport=new String(top.document.getElementById('slider_300').className);
		news_apple=new String(top.document.getElementById('slider_400').className);
		news_jv=new String(top.document.getElementById('slider_500').className);
		news_mob=new String(top.document.getElementById('slider_600').className);
		if (h<0) { start=0; end=24; }
		else if (h<11) { start=0; end=11; }
		else if (h<14) { start=11; end=14; }
		else if (h<18) { start=14; end=18; }
		else { start=18; end=24; }}
	if (objID=='sads') {
		tags_color=new Array('FF3C3F','85E842','9EAFFF','AF47FF','FFC023');
		tags=new Array('&nbsp;VDS&nbsp;','&nbsp;ACH&nbsp;','&nbsp;ECH&nbsp;','&nbsp;EST&nbsp;','&nbsp;DON&nbsp;');
	} else {
		tags_color=new Array();
		tags=new Array();
	}
	if ((objID=='home') || (objID=='news')) read_news=new Object(top.document.getElementById('news_readed').value.split('|')); else read_news=new Array();
	if ((objID=='home') || (objID=='driver')) read_driver=new Object(top.document.getElementById('driver_readed').value.split('|')); else read_driver=new Array();
	if ((objID=='home') || (objID=='software')) read_software=new Object(top.document.getElementById('software_readed').value.split('|')); else read_software=new Array();
	if (objID=='sads') read_sads=new Object(top.document.getElementById('sads_readed').value.split('|')); else read_sads=new Array();
	if (objID!='home') {
		for(i=0;i<inps_off.length;i++) {
			ii=new Object(inps_off[i]);
			if (ii.id.substring(0,pref.length)==pref) {
				inps_off_id=new Number(parseInt(ii.id.replace(pref,'')));
				if (hidden==true) {
					if (objID=='news') {
						if (news_hitech=='news_off') { if (inps_off_id<1000) off[off.length]=new Number(inps_off_id); }
						if (news_actu=='news_off') { if ((inps_off_id<2000) && (inps_off_id>999)) off[off.length]=new Number(inps_off_id); }
						if (news_eco=='news_off') { if ((inps_off_id<3000) && (inps_off_id>1999)) off[off.length]=new Number(inps_off_id); }
						if (news_sport=='news_off') { if ((inps_off_id<4000) && (inps_off_id>2999)) off[off.length]=new Number(inps_off_id); }
						if (news_apple=='news_off') { if ((inps_off_id<5000) && (inps_off_id>3999)) off[off.length]=new Number(inps_off_id); }
						if (news_jv=='news_off') { if ((inps_off_id<6000) && (inps_off_id>4999)) off[off.length]=new Number(inps_off_id); }
						if (news_mob=='news_off') { if ((inps_off_id<7000) && (inps_off_id>5999)) off[off.length]=new Number(inps_off_id); }
					}
					if (ii.className.substring(ii.className.length-3,ii.className.length)=='off') {
						for (z=0;z<off.length;z++) {
							if (off[z]-inps_off_id==0) { inps_off_id=0; break; }
						}
						if (inps_off_id>0) off[off.length]=new Number(inps_off_id);
					}
				}
			}
		}		
		for(i=0;i<inps.length;i++) {
			ii=new Object(inps[i]);
			if ((ii.className==objID+'_tag_color') || (ii.className==objID+'_tag_mail')) {
				if (ii.style.backgroundColor.length==7) tags_color[tags.length]=ii.style.backgroundColor;
				else {
					c=ii.style.backgroundColor.substring(4,ii.style.backgroundColor.length-1).split(',');
					tags_color[tags.length]='#'+dec2hex(c[0])+dec2hex(c[1])+dec2hex(c[2]);
				}
				tags[tags.length]=ii.id;
			} else if (ii.className==objID+'_tag_block') {
				tags_color[tags.length]='';
				tags[tags.length]=ii.id;
			}
		}
	}
	divs=new Object(top.document.getElementById(objID).getElementsByTagName('div'));
	for(d=0;d<divs.length-1;d++){
		dd=new Object(divs[d]);
		if (dd.className=='listing'){
			line=new Object(dd.getElementsByTagName('div'));
			if (line.length>1) {
				type=new String(get_value(get_value(line[0].innerHTML.replace("http://www.comptoir-info.com",""),'href=',' ',true),'/','/'));
				if (type!="") {
					for(l=0;l<line.length;l++){
						ll=new Object(line[l]);
						if (ll.innerHTML.substring(2,4)=='4>') {
							ll.innerHTML=ll.innerHTML.substring(9);
							ll.style.height='18px';
						}
						ll.style.display='block';
						if (objID=='news') {
							spans=new Object(ll.getElementsByTagName('span'));
							if (spans[1].innerHTML.substring(0,2)*3600+spans[1].innerHTML.substring(3,5)*60+spans[1].innerHTML.substring(11,13)*1>last) spans[1].className='hnew';
							if (spans[0].className=="read") hour=parseInt(spans[2].innerHTML.substring(0,2));
							else hour=parseInt(spans[1].innerHTML.substring(0,2));
							if (h>=0 && ((hour<start) || (hour>=end))) ll.style.display='none'; else ll.style.display='block';
						}
						if (off.length>0) {
							if (ll.innerHTML.indexOf('/user/')<0) {
								src=new Number(parseInt(get_value(ll.innerHTML,'i_','>',false).replace('"','')));
								for(o=0;o<off.length;o++) { if (src-off[o]==0) { ll.style.display='none'; break; } }
							}
						}
						if (ll.style.display!='none') {
							text=new String(get_value(ll.innerHTML,'i_','<'));
							text=get_value(text,'>','');
							newtext=new String(text);
							for(t=0;t<tags.length;t++) {
								tt=new String(tags[t]);
								if (text.toLowerCase().indexOf(tt.toLowerCase())>=0) {
									if (tags_color[t].length>0) newtext=replace_all(newtext,tt,'<font style=background-color:'+tags_color[t]+'>'+tt+'</font>',false);
									else ll.style.display='none';
								}
							}
							if (text!=newtext) ll.innerHTML=ll.innerHTML.replace(text,newtext);

							switch (type.substring(0,1)) {
								case "a": listing_read(read_news,"actualites",ll); break;
								case "d": listing_read(read_driver,"drivers",ll); break;
								case "l": listing_read(read_software,"logiciels",ll); break;
								case "p": listing_read(read_sads,"petites_annonces",ll); break;
							}

							if ((objID=='news') && (hidden==true)) {
								newhour=hour;
								if (newhour!=oldhour) {
									if (addhour==true) {
										if (ll.innerHTML.indexOf('</h4>')<0) ll.innerHTML='<h4></h4>'+ll.innerHTML;
										else if (ll.innerHTML.indexOf('</H4>')<0) ll.innerHTML='<h4></h4>'+ll.innerHTML;
										ll.style.height='36px';
									}
									addhour=true;
								}
								oldhour=hour;
							}
						}
						addEvent(ll,'mouseup',function(){stats_analytics(objID);this.id='read';setTimeout("news_read('"+objID+"')",100);load_page()});
						addEvent(ll,'mouseover',function(){top.document.getElementById('selected').id='selected_old';this.id='selected';});
					}
				}
			}
		}
	}
	setTimeout("news_reload_stop()",500);
	count_launch(0);
}

function listing_read(read,type,line) {
	for(r=0;r<read.length;r++) {
		id=new String(get_value(line.innerHTML,'/'+type+'/','>',true).replace('"',''));
		if (id.indexOf(' ')>0) id=id.substring(0,id.indexOf(' '));
		if ((id==read[r]) && (replace_all(line.innerHTML.toLowerCase(),'"','',false).indexOf('class=read>')<=0)) {
			if (line.innerHTML.indexOf('<h5>')>0) line.innerHTML=line.innerHTML.replace('</h5>','</h5><span class=read></span>').replace(" target="," class=read target=");
			else if (line.innerHTML.indexOf('<H5>')>0) line.innerHTML=line.innerHTML.replace('</H5>','</h5><span class=read></span>').replace(" target="," class=read target=");
			else line.innerHTML='<span class=read></span>'+line.innerHTML.replace(" target="," class=read target=");

		}
	}
}

function news_reload_stop() {
	rout(top.document.getElementById('news_reload'));
	top.document.getElementById('news_reload').className='stop';
}

function news_reload_start() { 
	top.document.getElementById('news_reload').className='loading';
	top.document.getElementById('news_reload').style.backgroundPosition='0px 0px';
}

function news_read(objID) {
	divs=top.document.getElementById(objID).getElementsByTagName('div');
	for(d=0;d<divs.length-1;d++){
		dd=new Object(divs[d]);
		if (dd.className=='listing'){
			line=dd.getElementsByTagName('div');
			for(l=0;l<line.length;l++){
				ll=new Object(line[l]);
				if (ll.id=='read') {
					ll.id='selected';
					if (ll.innerHTML.indexOf('read')<0) {
						if (ll.innerHTML.indexOf('<h5>')>0) ll.innerHTML=ll.innerHTML.replace('</h5>','</h5><span class=read></span>').replace(" target="," class=read target=");
						else if (ll.innerHTML.indexOf('<H5>')>0) ll.innerHTML=ll.innerHTML.replace('</H5>','</h5><span class=read></span>').replace(" target="," class=read target=");
						else ll.innerHTML='<span class=read></span>'+ll.innerHTML.replace(" target="," class=read target=");
					}
				}
			}
		}
	}
}

function listing_plus(id,type) { session('/share.php?site=plus&type='+type+'&id='+id,'content_load'); }
function listing_minus(id,type) { session('/share.php?site=minus&type='+type+'&id='+id,'content_load'); }
function listing_mail(id,type) { session('/share.php?site=mail&type='+type+'&id='+id,'content_load'); }
function listing_save(id,type) { session('/share.php?site=save&type='+type+'&id='+id,'content_load'); }
function listing_fb(id,type) { session('/share.php?site=facebook&type='+type+'&id='+id,'content_load'); }
function listing_tw(id,type) { session('/share.php?site=twitter&type='+type+'&id='+id,'content_load'); }

function home_tab(os,nbr,tab,big){
	for(d=1;d<=nbr;d++){
		if (d==os){
			document.getElementById('home_'+tab+'_'+d).style.display='block';
			document.getElementById('home_'+tab+'_input_'+d).className=big+'on';
		}else{
			document.getElementById('home_'+tab+'_'+d).style.display='none';
			document.getElementById('home_'+tab+'_input_'+d).className=big+'';
		}
	}
}

function tag_rgb(r,g,b) {
	return '<input type=button class=tag_color onclick=tag_select('+r+','+g+','+b+') style=background:#'+dec2hex(r)+dec2hex(g)+dec2hex(b)+'>';
}

function tag_select(r,g,b) {
	document.getElementById('tag_txt').style.backgroundColor='#'+dec2hex(r)+dec2hex(g)+dec2hex(b);
	document.getElementById('tag_color').style.backgroundColor='#'+dec2hex(r)+dec2hex(g)+dec2hex(b);
	document.getElementById('tag_color').value=dec2hex(r)+dec2hex(g)+dec2hex(b);
}

function tag_add(obj,type) {
	obj.parentNode.style.display='none';
	html='<div class=feed_add_form><input type=text class=text id=tag_txt value=""><br><input id=tag_color value="FFFFFF" maxlength=6>Choisissez une couleur de fond :<div style=margin-top:11px;margin-bottom:5px;>';
	for(x=255;x>=80;x=x-10) html+=tag_rgb(x,x,x);
	b=0;r=255;	for(g=0;g<256;g=g+15) html+=tag_rgb(r,g,b);
	g=255;	for(r=255;r>=0;r=r-15) html+=tag_rgb(r,g,b);
	r=0;	for(b=0;b<256;b=b+15) html+=tag_rgb(r,g,b);
	b=255;	for(g=255;g>=0;g=g-15) html+=tag_rgb(r,g,b);
	g=0;	for(r=0;r<256;r=r+15) html+=tag_rgb(r,g,b);
	html+='</div><input type=radio name=notif onclick=tag_set(-1); class=check>Aucune action<br><input type=radio name=notif onclick=tag_set(0); checked class=check>Notification  par email<br><input type=radio name=notif onclick=tag_set(18); class=check>Notification quotidienne à 18h<br><input type=radio name=notif onclick=tag_set(24); class=check>Notification quotidienne à minuit<br><input type=radio onclick=tag_set(-2); name=notif class=check>Masquer toutes les news contenant ce tag<table width=100%><tr><td><input type=button class=submit onmouseover=classover(this,1) onmouseout=classover(this,0) value="Ajouter le tag" id=tag_button onclick=tag_form("'+type+'");><td align=right><input type=hidden id=tag_notif value=0><input type=button class=cancel onmouseover=classover(this,1) onmouseout=classover(this,0) value="Annuler" id=tag_cancel onclick=feed_cancel(this.parentNode.parentNode.parentNode.parentNode);></table></div>';
	obj.parentNode.parentNode.innerHTML+=html;
	stats_analytics('tag');load_page();
}

function tag_edit(obj,tag,color,notif,type) {
	tag=replace_all(tag,' ',' ',false);
	obj.parentNode.parentNode.style.display='none';
	html='<div class=feed_add_form><input type=text class=text id=tag_txt value="'+tag+'"><br><input id=tag_color value="'+color+'" maxlength=6>Choisissez une couleur de fond :<div style=margin-top:11px;margin-bottom:5px;>';
	for(x=255;x>=80;x=x-10) html+=tag_rgb(x,x,x);
	b=0;r=255;	for(g=0;g<256;g=g+15) html+=tag_rgb(r,g,b);
	g=255;	for(r=255;r>=0;r=r-15) html+=tag_rgb(r,g,b);
	r=0;	for(b=0;b<256;b=b+15) html+=tag_rgb(r,g,b);
	b=255;	for(g=255;g>=0;g=g-15) html+=tag_rgb(r,g,b);
	g=0;	for(r=0;r<256;r=r+15) html+=tag_rgb(r,g,b);
	html+='</div><input type=radio ';
	if (notif=="") { html+='checked '; notif="-1"; }
	html+='name=notif onclick=tag_set(-3); class=check>Aucune action<br><input type=radio ';
	if (notif=="0") html+='checked ';
	html+='name=notif onclick=tag_set(0); class=check>Notification  par email<br><input type=radio ';
	if (notif=="1") html+='checked ';
	html+='name=notif onclick=tag_set(18); class=check>Notification quotidienne à 18h<br><input type=radio ';
	if (notif=="2") html+='checked ';
	html+='name=notif onclick=tag_set(24); class=check>Notification quotidienne à minuit<br><input type=radio ';
	if (color.length==0) html+='checked ';
	html+='onclick=tag_set(-2); name=notif class=check>Masquer toutes les news contenant ce tag<table width=100%><tr><td><input type=button class=submit onmouseover=classover(this,1) onmouseout=classover(this,0) value="Modifier le tag" id=tag_button onclick=tag_form("'+type+'","'+replace_all(tag,' ',' ',false)+'");><td align=right><input type=hidden id=tag_notif value='+notif+'><input type=button class=cancel onmouseover=classover(this,1) onmouseout=classover(this,0) value="Annuler" id=tag_cancel onclick=feed_cancel(this.parentNode.parentNode.parentNode.parentNode);></table></div>';
	obj.parentNode.parentNode.parentNode.innerHTML+=html;
	document.getElementById('tag_txt').style.backgroundColor='#'+color;
	document.getElementById('tag_color').style.backgroundColor='#'+color;
	stats_analytics('tag');load_page();
}

function tag_find(tag,type) {
	document.getElementById('search_'+type).value=tag;
	global_find(type,document.getElementById('search_'+type));
	find_form(type,1);
}

function tag_set(v) {
	document.getElementById('tag_notif').value=v;
}

function tag_form(type,old) {
	if (typeof(old)=="undefined") link=""; else link="&old_tag="+replace_all(old,' ',' ',false);
	session("/tag.php?action=save&type="+type+"&tag="+replace_all(document.getElementById('tag_txt').value,' ',' ',false)+"&color="+document.getElementById('tag_color').value+"&notif="+document.getElementById('tag_notif').value+link,'content_load');
}

function tag_delete(tag,type) {
	session("/tag.php?action=delete&type="+type+"&tag="+tag,'content_load');
}

function feed_add(obj) {
	obj.parentNode.style.display='none';
	obj.parentNode.parentNode.innerHTML+='<div class=feed_add_form><input type=text class=text id=feed_url onKeyUp=feed_url(this); value="http://"><br><select id=feed_universe><option value=0>Hi-Tech</option><option value=4>Apple</option><option value=5>Jeux-Vidéos</option><option value=6>Mobilité</option><option value=1>Monde</option><option value=2>Economie</option><option value=3>Sport</option></select><br>Categorie : <input type=text class=text_min id=feed_cat value="FLUX PERSOS"><br><input type=text class=text style=display:none; id=feed_name value=""><div style=display:none; id=feed_ico style>Chargement des icônes en cours...</div><input type=hidden id=feed_site value=""><table width=100%><tr><td><input type=button class=submit onmouseover=classover(this,1) onmouseout=classover(this,0) value="Ajouter le flux" id=feed_button onclick=feed_form(); style=display:none;><td align=right><input type=button class=cancel onmouseover=classover(this,1) onmouseout=classover(this,0) value="Annuler" id=feed_cancel onclick=feed_cancel(this.parentNode.parentNode.parentNode.parentNode);></table></div>';
	stats_analytics('feed');load_page();
}

function feed_url(obj) {
	if (obj.value.indexOf('//http://')>0) obj.value=obj.value.replace('http://http://','http://');
	session('/feed.php?action=url&url='+escape(obj.value),'content_load');
}

function feed_url_form(webname,website) {
	if (webname.length>0) {
		if (document.getElementById('feed_name').value.length==0) document.getElementById('feed_name').value=webname;
		document.getElementById('feed_name').style.display='block';
	}
	if (website.length>0) {
		if (document.getElementById('feed_site').value.length==0) document.getElementById('feed_site').value=website;
		session("/feed.php?action=ico&url="+escape(website),'content_load');
		document.getElementById('feed_ico').style.display='block';
	}
}

function feed_ico_form(html) {
	document.getElementById('feed_ico').innerHTML=html;
}

function feed_ico_save(ico,id) {
	if (id==0) document.getElementById('feed_name').style.backgroundImage='url(/user/ico_default/'+ico+')';
	else document.getElementById('feed_name').style.backgroundImage='url(/user/ico_temp/'+ico+')';
	document.getElementById('feed_name').style.padding='1px 0px 0px 20px';
	document.getElementById('feed_button').style.display='block';
}

function feed_form() {
	session("/feed.php?action=save&url="+escape(document.getElementById('feed_url').value)+"&www="+escape(document.getElementById('feed_site').value)+"&name="+document.getElementById('feed_name').value+"&cat="+document.getElementById('feed_cat').value+"&universe="+document.getElementById('feed_universe').value+"&ico="+document.getElementById('feed_name').style.backgroundImage,'content_load');
}

function feed_edit(obj,id) {
	obj.parentNode.parentNode.style.display='none';
	obj.parentNode.parentNode.parentNode.innerHTML+='<div class=feed_add_form><input type=text class=text id=feed_url onKeyUp=feed_url(this); value="http://"><br><select id=feed_universe><option value=0>Hi-Tech</option><option value=4>Apple</option><option value=5>Jeux-Vidéos</option><option value=6>Mobilité</option><option value=1>Monde</option><option value=2>Economie</option><option value=3>Sport</option></select><br>Categorie : <input type=text class=text_min id=feed_cat value=""><br><input type=text class=text id=feed_name value=""><div id=feed_ico style>Chargement des icônes en cours...</div><input type=hidden id=feed_site value=""><input type=button class=cancel onmouseover=classover(this,1) onmouseout=classover(this,0) value="Annuler" id=feed_cancel onclick=feed_cancel(this); style=float:right;><input type=button class=submit onmouseover=classover(this,1) onmouseout=classover(this,0) value="Modifier le flux" id=feed_button onclick=feed_form()></div>';
	session("/feed.php?action=edit&id="+id,'content_load');
}

function feed_cancel(obj) {
	html=obj.parentNode.parentNode.innerHTML;
	if (html.indexOf('class="feed_add_form')>0) html=get_value(html,'','<div class="feed_add_form',false);
	else html=get_value(html,'','<div class=feed_add_form',false);
	html=replace_all(html,'tag_delete_null_over','tag_delete_null',false);
	html=replace_all(html,'tag_edit_null_over','tag_edit_null',false);
	html=replace_all(html,'tag_delete','tag_delete_null',false);
	html=replace_all(html,'tag_edit','tag_edit_null',false);
	html=replace_all(html,'_null_null','_null',false);
	html=replace_all(html,'_null(','(',false);
	obj.parentNode.parentNode.innerHTML=html.replace('none','block');
	stats_analytics('feed');load_page();
}

function feed_delete(id) {
	session("/feed.php?action=delete&id="+id,'content_load');
}

function SortIt(tab,col){
  tab.sort(Sortmulti);
 function Sortmulti(a,b){
  swap=0;
    if(isNaN(a[col]-b[col])){
      if((isNaN(a[col]))&&(isNaN(b[col]))){swap=(b[col]<a[col])-(a[col]<b[col]);}
      else{swap=(isNaN(a[col])?1:-1);}
    }
    else{swap=(a[col]-b[col]);}
    return swap;
} }

function global_find(type,obj,key) {
	stats_analytics('search');
	if (obj.value.indexOf("instantanée...")>0) obj.value=obj.value.replace('Recherche instantanée...','');
	if (typeof(key)!="undefined") if (key==13) find_form(type,1);
	html='Source :<select onchange=find_form("'+type+'",1); id='+type+'_search_src><option value=0>Tous les sites</option>';
	switch (type) {
		case "news": pref="li_actualites"; break;
		case "sads": pref="li_petites_annonces"; break;
		case "software": pref="li_logiciels"; break;
		case "driver": pref="li_drivers"; break;
	}
	inps=document.getElementById(pref).getElementsByTagName('img');
	src=new Array();
	switch (type) {
		case "news": pref="i_"; break;
		case "sads": pref="i_"; break;
		case "software": pref="si_"; break;
		case "driver": pref="di_"; break;
	}
	for(s=0;s<inps.length-1;s++) {
		ii=new Object(inps[s]);
		if (ii.className.substring(0,pref.length)==pref) {
			site=get_value(ii.parentNode.innerHTML,'>','',false);
			src[src.length]=new Array(ii.className.replace(pref,''),site,site.toLowerCase());
		}
	}
	SortIt(src,2);
	for(i=0;i<src.length-1;i++) html+='<option value='+src[i][0]+'>'+src[i][1]+'</option>';
	switch (type) {
		case "sads": label="Petites annonces"; fem="e"; break;
		case "software": label="Logiciels"; fem=""; break;
		default: if (type=="news") fem=""; else fem=""; label=type.substring(0,1).toUpperCase()+type.substring(1,type.length); break;
	}
	html+='</select><br>Depuis :<select onchange=find_form("'+type+'",1); id='+type+'_search_since><option value=1>1 mois</option><option value=3>3 mois</option><option value=6>6 mois</option><option value=12>1 an</option><option value=-1>le début</option></select><div style=margin-top:5px;width:100%;height:40px; align=right><div style=float:left;text-align:left;><input onchange=find_form("'+type+'",1); class=check type=checkbox name=filter id='+type+'_search_filter_1 value=1> '+label+' marqué'+fem+'s<br><input onchange=find_form("'+type+'",1); class=check type=checkbox name=filter id='+type+'_search_filter_2 value=1> '+label+' déjà vu'+fem+'s</div><input type=button class=cancel style=margin:0px; onmouseover=classover(this,1) onmouseout=classover(this,0) value="Annuler" id=tag_cancel onclick=global_find_cancel("'+type+'");></div>';
	obj.className='nav_find_open';
	if (document.getElementById(type+'_find_options').innerHTML.length==0) document.getElementById(type+'_find_options').innerHTML=html;
	document.getElementById(type+'_find_options').style.display='block';
	load_page();
}

function find_form(action,page) {
	if (action=="news") {
		top.document.getElementById('calendar_watch').style.display='none';
		news_reload_start();
	}
	if (action=="essentiel") essentiel(page);
	else {
		document.getElementById(action+'_find_options').style.display='block';
		session("/search.php?action="+action+"&search="+document.getElementById('search_'+action).value+"&src="+document.getElementById(action+'_search_src').value+"&since="+document.getElementById(action+'_search_since').value+"&filter1="+document.getElementById(action+'_search_filter_1').checked+"&filter2="+document.getElementById(action+'_search_filter_2').checked+"&page="+page,'content_load');
	}
}

function nav_page(action,page) {
	session("/page.php?action="+action+"&page="+page,'content_load');
}

function global_find_cancel(type) {
	if (type=='news') top.document.getElementById('calendar_watch').style.display='block';
	document.getElementById(type+'_find_options').style.display='none';
	document.getElementById('search_'+type).className='nav_find';
	document.getElementById('search_'+type).value='Recherche instantanée...';
	switch (type) {
		case "news": menu_actualites(); break;
		case "sads": menu_petites_annonces(); break;
		case "software": menu_logiciels(); break;
		case "driver": menu_drivers(); break;
	}
	stats_analytics('search');load_page();
	news_reload_stop();
}

function calendar_go(y,m,d,h) {
	news_reload_start();
	document.getElementById('calendar_watch').innerHTML=calendar_month(y,m,d);
	if (!(h>0)) h=-1;
	document.getElementById('calendar_hour').value=y+','+dbl(m)+','+dbl(d)+','+h;
	session('/content_news.php?date_news='+y+','+dbl(m)+','+dbl(d)+'&hour_news='+h,'content_load');
}

function calendar_day(d,classname) {
	if (d.getDate()>0) {
		html='<div class='+classname;
		if (classname.substring(0,3)!="fut") html+=' onclick=calendar_go('+d.getFullYear()+','+(1+d.getMonth())+','+d.getDate()+'); onmouseover=this.className='+String.fromCharCode(39)+'highlight'+String.fromCharCode(39)+'; onmouseout=this.className='+String.fromCharCode(39)+classname+String.fromCharCode(39)+';><a href="/#actualites/'+d.getFullYear()+'-'+dbl(1+d.getMonth())+'-'+dbl(d.getDate())+'">'; else html+='>';
		html+=d.getDate();
		if (classname.substring(0,3)!="fut") html+='</a>';
		html+='</div>';
		return(html);
	}
}
function calendar_day_letter(d) {
	return '<div class=letter>'+d.substring(0,1)+'<span>'+d.substring(1,3)+'</span></div>';
}
function calendar_month(y,m,s) {
	html='';
	d=new Date(y,m-1,1);
	sd=new Date(y,m-1,s);
	today=new Date();
	num=d.getDay()-1;
	html+=calendar_day_letter("LUN")+calendar_day_letter("MAR")+calendar_day_letter("MER")+calendar_day_letter("JEU")+calendar_day_letter("VEN")+calendar_day_letter("SAM")+calendar_day_letter("DIM");
	monday=0;
	height=0;
	if (num<0) num=6;
	if (num>0) {
	for(i=0;i<num;i++) {
		d=new Date(y,m-1,1-num+i);
		html+=calendar_day(d,"gray");
	}}
	for(i=num;i<7;i++) {
		d=new Date(y,m-1,1-num+i);
		if (d.getTime()>today.getTime()) html+=calendar_day(d,"futur");
		else if (d.getDate()==s) html+=calendar_day(d,"selection");
		else if ((d.getDate()==today.getDate()) && (d.getMonth()==today.getMonth()) && (d.getFullYear()==today.getFullYear())) html+=calendar_day(d,"today");
		else if (d.getDay()%6==0) html+=calendar_day(d,"weekend");
		else html+=calendar_day(d,"week");
	}
	f=new Date(y,m,0);
	for(i=1+d.getDate();i<=f.getDate();i++) {
		d=new Date(y,m-1,i);
		if (d.getDay()==1) { html+='<br>'; monday++; }
		if (d.getTime()>today.getTime()) html+=calendar_day(d,"futur");
		else if (d.getDate()==s) html+=calendar_day(d,"selection");
		else if ((d.getDate()==today.getDate()) && (d.getMonth()==today.getMonth()) && (d.getFullYear()==today.getFullYear())) html+=calendar_day(d,"today");
		else if (d.getDay()%6==0) html+=calendar_day(d,"weekend");
		else html+=calendar_day(d,"week");
	}
	d=new Date(y,m-1,i);
	if (d.getDay()==0) html+=calendar_day(d,"gray");
	k=1;
	if (d.getDay()>1) for(i=d.getDay();i<8;i++) {
		d=new Date(y,m,k++);
		if (d.getTime()>today.getTime()) html+=calendar_day(d,"futurgray");
		else html+=calendar_day(d,"gray");
	}
	next=new Date(y,m,1);
	prev=new Date(y,m-1,0);
	if (navigator.userAgent.indexOf('MSIE')>0) height=147; else height=145;
	if (monday<5) height=height-18;
	html='<div id=calendar_height style=height:'+height+'px><div id=calendar><input class=calendar_prev onmouseover=classover(this,1); onmouseout=classover(this,0); onclick=calendar_go('+prev.getFullYear()+','+(1+prev.getMonth())+','+prev.getDate()+');><div id=calendar_now>'+month[m*1]+' '+y+'</div><input class=calendar_next onmouseover=classover(this,1); onmouseout=classover(this,0); onclick=calendar_go('+next.getFullYear()+','+(1+next.getMonth())+','+next.getDate()+');>'+html+'</div><div id=watch';
	if (monday==5) {
		if (navigator.userAgent.indexOf('MSIE')>0) html+=' style=margin-top:17px'; else html+=' style=margin-top:16px';
	}
	html+='><div id=watch_type class=watch_day><div id=watch_type_over><div id=watch_now>'+day[sd.getDay()].substring(0,1)+'<b>'+day[sd.getDay()].substring(1,day[sd.getDay()].length)+'</b> '+sd.getDate()+'/'+dbl(1+sd.getMonth());
	html+='</div><div class=l><div onmouseover=news_over("mor"); onmouseout=news_over(""); onclick=news_filter(0);news_last(11); id=news_mor> </div></div>';
	html+='<div class=l><div onmouseover=news_over("mid"); onmouseout=news_over(""); onclick=news_filter(11);news_last(14); id=news_mid> </div></div>';
	html+='<div class=l><div onmouseover=news_over("aft"); onmouseout=news_over(""); onclick=news_filter(14);news_last(18); id=news_aft> </div></div>';
	html+='<div class=l><div onmouseover=news_over("eve"); onmouseout=news_over(""); onclick=news_filter(18);news_last(24); id=news_eve> </div></div>';
	html+='<div class=l><div onmouseover=news_over("day"); onmouseout=news_over(""); onclick=news_filter(-1);news_last(24); id=news_day> </div></div></div></div></div></div>';
	return html;
}

function news_over(obj) {
	if (obj.length>0) {
		date=document.getElementById('calendar_hour').value;
		if (date.length>0) {
		d=new Date(date.substring(0,4),Math.round(date.substring(5,7))-1,date.substring(8,10));
		w=day[d.getDay()].substring(0,1)+'<b>'+day[d.getDay()].substring(1,day[d.getDay()].length)+'</b> '+d.getDate()+'/'+dbl(1+d.getMonth());
		document.getElementById('watch_type_over').className='watch_over_'+obj;
		document.getElementById('news_'+obj).className+='over';
		switch (obj) {
			case 'mor': document.getElementById('watch_now').innerHTML='M<b>atin avant 11H</b>'; break;
			case 'mid': document.getElementById('watch_now').innerHTML='M<b>idi 11H à 14H</b>'; break;
			case 'aft': document.getElementById('watch_now').innerHTML='A<b>prem 14 à 18H</b>'; break;
			case 'eve': document.getElementById('watch_now').innerHTML='S<b>oir après 18H</b>'; break;
			default: document.getElementById('watch_now').innerHTML=w; break;
		}
	}} else {
		switch (document.getElementById('watch_type').className) {
			case 'watch_mor': document.getElementById('watch_now').innerHTML='M<b>atin avant 11H</b>'; break;
			case 'watch_mid': document.getElementById('watch_now').innerHTML='M<b>idi 11H à 14H</b>'; break;
			case 'watch_aft': document.getElementById('watch_now').innerHTML='A<b>prem 14 à 18H</b>'; break;
			case 'watch_eve': document.getElementById('watch_now').innerHTML='S<b>oir après 18H</b>'; break;
			default: document.getElementById('watch_now').innerHTML=w; break;
		}
		document.getElementById('watch_type_over').className='';
		document.getElementById('news_day').className=document.getElementById('news_day').className.replace('over','');
		document.getElementById('news_mor').className=document.getElementById('news_mor').className.replace('over','');
		document.getElementById('news_mid').className=document.getElementById('news_mid').className.replace('over','');
		document.getElementById('news_aft').className=document.getElementById('news_aft').className.replace('over','');
		document.getElementById('news_eve').className=document.getElementById('news_eve').className.replace('over','');
	}
}

function news_filter(hr,last) {
	date=document.getElementById('calendar_hour').value;
	d=new Date(date.substring(0,4),Math.round(date.substring(5,7))-1,date.substring(8,10));
	document.getElementById('calendar_hour').value=document.getElementById("calendar_hour").value.substring(0,11)+hr;
	if (hr<0) {
		document.getElementById('watch_now').innerHTML=day[d.getDay()].substring(0,1)+'<b>'+day[d.getDay()].substring(1,day[d.getDay()].length)+'</b> '+d.getDate()+'/'+dbl(1+d.getMonth());
		document.getElementById('watch_type').className='watch_day';
		document.getElementById('news_day').className='selected'+document.getElementById('news_day').className;
		document.getElementById('news_mor').className='';
		document.getElementById('news_mid').className='';
		document.getElementById('news_aft').className='';
		document.getElementById('news_eve').className='';
		top.document.location.href="/#actualites/"+replace_all(document.getElementById("calendar_hour").value.substring(0,10),",","-");
	} else if (hr<11) {
		document.getElementById('watch_now').innerHTML='M<b>atin avant 11H</b>';
		document.getElementById('watch_type').className='watch_mor';
		document.getElementById('news_mor').className='selected'+document.getElementById('news_mor').className;
		document.getElementById('news_day').className='';
		document.getElementById('news_mid').className='';
		document.getElementById('news_aft').className='';
		document.getElementById('news_eve').className='';
		top.document.location.href="/#actualites/"+replace_all(document.getElementById("calendar_hour").value.substring(0,10),",","-")+"/matin";
	} else if (hr<14) {
		document.getElementById('watch_now').innerHTML='M<b>idi 11H à 14H</b>';
		document.getElementById('watch_type').className='watch_mid';
		document.getElementById('news_mid').className='selected'+document.getElementById('news_mid').className;
		document.getElementById('news_mor').className='';
		document.getElementById('news_day').className='';
		document.getElementById('news_aft').className='';
		document.getElementById('news_eve').className='';
		top.document.location.href="/#actualites/"+replace_all(document.getElementById("calendar_hour").value.substring(0,10),",","-")+"/midi";
	} else if (hr<18) {
		document.getElementById('watch_now').innerHTML='A<b>prem 14 à 18H</b>';
		document.getElementById('watch_type').className='watch_aft';
		document.getElementById('news_aft').className='selected'+document.getElementById('news_aft').className;
		document.getElementById('news_mor').className='';
		document.getElementById('news_mid').className='';
		document.getElementById('news_day').className='';
		document.getElementById('news_eve').className='';
		top.document.location.href="/#actualites/"+replace_all(document.getElementById("calendar_hour").value.substring(0,10),",","-")+"/aprem";
	} else {
		document.getElementById('watch_now').innerHTML='S<b>oir après 18H</b>';
		document.getElementById('watch_type').className='watch_eve';
		document.getElementById('news_eve').className='selected'+document.getElementById('news_eve').className;
		document.getElementById('news_mor').className='';
		document.getElementById('news_mid').className='';
		document.getElementById('news_aft').className='';
		document.getElementById('news_day').className='';
		top.document.location.href="/#actualites/"+replace_all(document.getElementById("calendar_hour").value.substring(0,10),",","-")+"/soir";
	}
	load_page();
	listing('news',hr,last);
	sizing();
}

function news_last(last) {
	session("/last.php?date="+document.getElementById("calendar_hour").value+"&last="+last,'content_load');
}

function slide_pos(obj,pos,sens) {
	inp=top.document.getElementById(obj).getElementsByTagName('input');
	inp[0].style.backgroundPosition=pos+'px 0px';
	if (sens==0) top.document.getElementById(obj).className='news_off';
	if ((sens<0) && (pos>0)) {
		setTimeout("slide_pos("+String.fromCharCode(34)+obj+String.fromCharCode(34)+","+(pos-2)+",-1)",2);
		if (pos==16) top.document.getElementById(obj).className='news_off';
		if (pos==2) {
			if (obj.substring(0,8)=='sl_news_') global_switch(obj.replace('sl_news_',''),1,"news");
			else if (obj.substring(0,8)=='sl_sads_') global_switch(obj.replace('sl_sads_',''),1,"sads");
			else if (obj.substring(0,10)=='sl_driver_') global_switch(obj.replace('sl_driver_',''),1,"driver");
			else if (obj.substring(0,12)=='sl_software_') global_switch(obj.replace('sl_software_',''),1,"software");
			else if (obj.substring(0,12)=='sl_essentiel') menu_actualites();
			else { if (top.document.getElementById('sl_essentiel').className=='news_on') ess=1; else ess=0;
			session("/feed.php?action=syndicate&essentiel="+ess+"&alert=0&type=news_category&on=0&id="+obj.replace('slider_','')+"&day="+document.getElementById('calendar_hour').value,'content_load');
			top.document.getElementById('nav_hide_'+obj.replace('slider_','')).className='nav_off';
			if (ess==0) {load_page();listing('news',top.document.getElementById("calendar_hour").value.substring(11,13));}
			}
		}
	}
	if ((sens>0) && (pos<32)) {
		setTimeout("slide_pos("+String.fromCharCode(34)+obj+String.fromCharCode(34)+","+(pos+2)+",1)",2);
		if (pos==16) top.document.getElementById(obj).className='news_on';
		if (pos==30) {
			if (obj.substring(0,8)=='sl_news_') global_switch(obj.replace('sl_news_',''),1,"news");
			else if (obj.substring(0,8)=='sl_sads_') global_switch(obj.replace('sl_sads_',''),1,"sads");
			else if (obj.substring(0,10)=='sl_driver_') global_switch(obj.replace('sl_driver_',''),1,"driver");
			else if (obj.substring(0,12)=='sl_software_') global_switch(obj.replace('sl_software_',''),1,"software");
			else if (obj.substring(0,12)=='sl_essentiel') essentiel(1);
			else { if (top.document.getElementById('sl_essentiel').className=='news_on') ess=1; else ess=0;
			session("/feed.php?action=syndicate&essentiel="+ess+"&alert=0&type=news_category&on=1&id="+obj.replace('slider_','')+"&day="+document.getElementById('calendar_hour').value,'content_load');
			top.document.getElementById('nav_hide_'+obj.replace('slider_','')).className='';
			load_page();
			if (ess==0) {listing('news',top.document.getElementById("calendar_hour").value.substring(11,13));}
			}
		}
	}
}

function slide(obj) {
	if (obj.className=='news_on') slide_pos(obj.id,32,-1); else slide_pos(obj.id,0,1);
}

function changeOpac(opacity,id) {
	if (navigator.userAgent.indexOf('MSIE')<0) {
		object=document.getElementById(id).style;
		object.opacity=(opacity/100);
		object.MozOpacity=(opacity/100);
		object.KhtmlOpacity=(opacity/100);
		if (navigator.appVersion.indexOf('NT 5')<=0) object.filter="alpha(opacity="+opacity+")";
	}
}

function opacity(id, opacStart, opacEnd, millisec) {
	if (navigator.userAgent.indexOf('MSIE')<0) {
	speed=Math.round(millisec/100);
	timer=0;
	if (navigator.appVersion.indexOf('NT 5')<=0) {
	if(opacStart>opacEnd){
		for(i=opacStart;i>=opacEnd;i--){
			setTimeout("changeOpac("+i+",'"+id+"')",(timer*speed));
			timer++;
		}
	}else if(opacStart<opacEnd){
		for(i=opacStart;i<=opacEnd;i++){
			setTimeout("changeOpac("+i+",'"+id+"')",(timer*speed));
			timer++;
		}
	}}}
}

function count_launch(m) {
	session('/count.php?m='+m,'content_count');
}

function mover(obj,txt) {
	if ((obj.className=='close') || (obj.className=='close2')) {
		if (obj.className=='close') obj.className='hover';
		if (obj.className=='close2') obj.className='hover2';
		if ((obj.className=='hover') || (obj.className=='hover2')) {
			h1=obj.getElementsByTagName("h1");
			h1[0].innerHTML=txt;
			opacity(h1[0].id,0,100,250);
			if (h1[0].id!="menu0") mout(document.getElementById('menu0').parentNode.parentNode,document.getElementById('menu0_value').value);
			if (h1[0].id!="menu1") mout(document.getElementById('menu1').parentNode.parentNode,document.getElementById('menu1_value').value);
			if (document.getElementById('menu2_value').value.length>0) if (h1[0].id!="menu2") mout(document.getElementById('menu2').parentNode.parentNode,document.getElementById('menu2_value').value);
			if (document.getElementById('menu3_value').value.length>0) if (h1[0].id!="menu3") mout(document.getElementById('menu3').parentNode.parentNode,document.getElementById('menu3_value').value);
			if (document.getElementById('menu4_value').value.length>0) if (h1[0].id!="menu4") mout(document.getElementById('menu4').parentNode.parentNode,document.getElementById('menu4_value').value);
			if (document.getElementById('menu5_value').value.length>0) if (h1[0].id!="menu5") mout(document.getElementById('menu5').parentNode.parentNode,document.getElementById('menu5_value').value);
		}
	}
}

function mout(obj,txt) {
	if ((obj.className=='hover') || (obj.className=='hover2')) {
	if (obj.className=='hover') obj.className='close'; if (obj.className=='hover2') obj.className='close2';
	if ((obj.className=='close') || (obj.className=='close2')) {
		h1=obj.getElementsByTagName("h1");
		h1[0].innerHTML=txt;
}}}

function rover(obj) { obj.style.backgroundPosition='-227px -230px'; }
function rout(obj) { obj.style.backgroundPosition='-227px -212px'; }
function imover(obj) { if (obj.className=='home_off') obj.className='home_force'; }
function imout(obj) { if (obj.className=='home_force') obj.className='home_off'; }

function message_defil(m) {
	msg=top.document.getElementById('messages').value.split('|');
	top.document.getElementById('message').value=msg[m];
	setTimeout("message_defil("+((m+1)%4)+")",15000);
}

function back(obj,v) {
	if (v>0) obj.className+='_over';
	else obj.className=obj.className.replace('_over','');
}

function nav(obj,v) {
	if (v>0) obj.id='over';
	else obj.id='';
}

function classover(obj,v) {
	if (v>0) obj.className+='_over';
	else obj.className=obj.className.replace('_over','');
}

function userdetail() {
	top.location.href="http://www.comptoir-hardware.com/component/comprofiler/userdetails.html";
	load_page();
}

function logout() {
	top.location.href="/logout.php";
}

function register() {load_page();alert_msg("Vous allez être redirigé vers le Comptoir du Hardware pour vous inscrire sur l'ensemble des sites du Comptoir<br>Votre identifiant et mot de passe seront alors valides sur le Comptoir de l'Info et les Forums du Comptoir.","http://www.comptoir-hardware.com/component/comprofiler/registers.html","top");}

function alert_msg(val,url,trg) {
	top.document.getElementById('alert').style.width=top.document.body.clientWidth;
	if ((val.length>1) && (top.document.getElementById('alert').innerHTML.length==0)) {
		html="<table class=all><tr><td width=100% align=right>"+val+"<td>&nbsp;";
		if (typeof(url)!="undefined") {
			html+="<input type=button onclick=";
			if (trg=="top") html+="top.location.href";
			else html+="top.document.getElementById('content_load').src";
			html+="='"+url+"'; onmouseover=classover(this,1) onmouseout=classover(this,0) class=submit onmouseover=classover(this,1) onmouseout=classover(this,0) value='OK'>&nbsp;&nbsp;&nbsp;<input type=button onmouseover=classover(this,1) onmouseout=classover(this,0) onclick=alert_timer(0) class=cancel onmouseover=classover(this,1) onmouseout=classover(this,0) value='Annuler'>";
		} else html+="<input id=alert_time type=button onmouseover=classover(this,1) onmouseout=classover(this,0) onclick=alert_timer(0) class=cancel onmouseover=classover(this,1) onmouseout=classover(this,0) value='OK (5sec...)'>";
		html+="</table>";
		top.document.getElementById('alert').innerHTML=html;
		alert_show(-50);
		if (typeof(url)=="undefined") alert_timer(5);
	}
}

function alert_show(val) {
	if (val<0) {
		if (navigator.userAgent.indexOf('MSIE')>0) {
			top.document.getElementById('alert').style.top=top.document.body.scrollTop+val;
		} else {
			top.document.getElementById('alert').style.position="fixed";
			top.document.getElementById('alert').style.top=val;
		}
		setTimeout("alert_show("+(val+3)+")",1);
	} else {
		if (navigator.userAgent.indexOf('MSIE')>0) {
			top.document.getElementById('alert').style.top='';
			top.document.getElementById('alert').className="ie";
		}
	}
}

function alert_hide(val) {
	if (val>-50) {
		if (navigator.userAgent.indexOf('MSIE')>0) {
			top.document.getElementById('alert').style.top=top.document.body.scrollTop+val;
		} else {
			top.document.getElementById('alert').style.position="fixed";
			top.document.getElementById('alert').style.top=val;
		}
		setTimeout("alert_hide("+(val-3)+")",1);
	} else {
		top.document.getElementById('alert').style.position="absolute";
		top.document.getElementById('alert').style.top=-10000;
		top.document.getElementById('alert').innerHTML="";
		top.document.getElementById('content_load').src="about:blank";
		top.document.getElementById('alert').className="";
	}
}


function alert_timer(sec) {
	if (sec<1) {
		alert_hide(0);
	} else {
		top.document.getElementById('alert_time').value='OK ('+sec+'sec...)';
		setTimeout("alert_timer("+(sec-1)+")",1000);
	}
}

function visitor() {load_page();alert_msg("Vous devez être inscrit ou identifié pour profiter de cette fonctionnalité.<br>Souhaitez-vous être redirigé vers la page d'inscription du Comptoir ?","http://www.comptoir-hardware.com/component/comprofiler/registers.html","top");}

function count_draw(type,value) {
	if (value>0) {
		top.document.getElementById(type).parentNode.className=top.document.getElementById(type).parentNode.className.replace("2","")+"2";
		top.document.getElementById(type).innerHTML="+"+value;
	} else top.document.getElementById(type).innerHTML="";
}

function essentiel(p) {
	top.document.getElementById('calendar_watch').style.display="none";
	top.document.location.href='/#actualites/essentiel';
	if (p==0) {
		open(top.document.getElementById('news_reload').parentNode);
		slide(top.document.getElementById('sl_essentiel'));
	} else session("/search.php?action=essentiel&page="+p,'content_load');
}

setInterval("horloge()",60000);
setTimeout("sizing()",2000);

function nolink() { window.status=''; }

function nav_li(text,first,clas,page,href) {
	if ((typeof(page)!="undefined") && (page!="")) {
		if (page!=href) clas='close';
		if (page==href) clas='open';
	}
	html="<li id=li_"+href+" onmouseover=\"mover(this,'"+text+"')\" ";
	if (first) html+="id=first ";
	html+="class="+clas+">";
	document.write(html);
}

function cdi_start(script,page) {
	if (page=="actualites") {
		document.getElementById("content").innerHTML="";
		switch (ankor[2]) {
			case "matin": ankor[2]="0"; break;
			case "midi": ankor[2]="11"; break;
			case "aprem": ankor[2]="14"; break;
			case "soir": ankor[2]="18"; break;
			default: ankor[2]="-1"; break;
		}
		top.document.getElementById('action').value="horloge();";
		if (ankor[1]=="essentiel") slide(top.document.getElementById("sl_essentiel"));
		else {
			if ((ankor[1]!=undefined) && (ankor[1]!="")) {
				d=ankor[1].split("-");
				top.document.getElementById('calendar_hour').value=d[0]+','+d[1]+','+d[2]+','+ankor[2];
				h=ankor[2];
			} else {
				d=top.document.getElementById('calendar_hour').value.split(',');
				h=-1;
			}
			if (d[0]>0) calendar_go(d[0],d[1],d[2],h);
			menu_actualites();
	}}
	else if ((page=="accueil") || (page=="wrong_password") || (page=="")) {
		top.document.getElementById('action').value="horloge();"+script+"count_launch();";
		if (page=="wrong_password") top.document.getElementById('action').value="home(document.getElementById('menu0').parentNode);alert_msg('Si vous avez oublié votre mot de passe, vous pouvez demander à le recevoir par email','http://www.comptoir-hardware.com/component/comprofiler/lostpassword.html','top');";
	} else top.document.getElementById('action').value="horloge();menu_"+page+"();";
	document.getElementById('action').click();
}
