function go(id,obj) {
	var news_id = top.newshq.list.document.getElementById("news_id").value.split('¶');
	var news_read = top.newshq.list.document.getElementById("news_read").value.split('¶');
	var today=new Date();
	for (i=0;i<news_id.length;i++) { if (news_id[i]==id) { news_read[i]=today.getHours()+"h"+today.getMinutes(); break;}}
	top.newshq.list.document.getElementById("news_read").value=news_read.join("¶");
	top.newshq.list.document.getElementById("read"+id).style.display="";
	obj.style.color="#416590";
	obj.style.fontWeight="bold"; }

function save(id,go_type) {
	url="news_last.php?news_save="+id;
	if (go_type.length>0) url+="&news_save_type=1";
	top.newshq.list.framebalise.location.href=session(url);
}

function save_log(id,type) { top.newshq.list.framebalise.location.href=session("news_last.php?news_save_log="+id+"&news_save_type="+type); }

function delsave(id) {
	url="news_last.php?news_save_del="+id;
	top.newshq.list.framebalise.location.href=session(url);
}
	
function smft_on(id) {
	if (document.getElementById('smft'+id).innerHTML=="") {
		document.getElementById('smft'+id).style.backgroundImage='url(/css/all/smft.png)';
		var news_id=document.getElementById("news_id").value.split('¶');
		var news_title=document.getElementById("news_title").value.split('¶');
		var news_source=document.getElementById("news_source").value.split('¶');
		for (i=0;i<news_id.length;i++) {
			if (news_id[i]==id) {
				if (news_source[i]>0) go_type=""; else go_type="user/";
				url='http://www.comptoir-info.com/news/'+go_type+id;
				title=news_title[i];
				document.getElementById('smft'+id).style.backgroundImage='url(/css/all/smft.png)';
				document.getElementById('smft'+id).innerHTML='<img src=0.gif style=border:1px; title="Marquer cette news pour pouvoir facilement la retrouver plus tard" onclick=save('+id+',"'+go_type+'");><a onclick=save_log('+id+',"mail"); href="mailto:adresse@email.com?subject='+title+'&body='+url+'"><img src=0.gif title="Envoyer cette news à un ami"></a><a onclick=save_log('+id+',"facebook"); target=_blank title="Partager avec vos amis sur Facebook" href="http://www.facebook.com/share.php?u='+url+'"><img src=0.gif></a><a onclick=save_log('+id+',"twitter"); target=_blank title="Partager avec vos amis sur Twitter" href="http://www.twitter.com/home?status=Comptoir de l\'Info+'+title+'+-+'+url+'"><img src=0.gif></a>';
				break;
			}
		}
	}
}

function listsave() {
	top.newshq.nav.document.getElementById("day").style.display="none";
	top.newshq.nav.document.getElementById("day5").style.display="none";
	top.newshq.nav.document.getElementById("search").style.display="";
	top.newshq.list.document.getElementById("news").style.display="none";
	top.newshq.list.document.getElementById("search").style.display="";
	var SAV = new search();
	SAV.appendData("foo", top.newshq.nav.document.getElementById('foo').value);
	SAV.appendData("since", top.newshq.nav.document.getElementById('since').value);
	SAV.sendAndLoad("news_listsave.php", "POST", afficherSave);
}

function afficherSave(obj) {
	var tabResult = obj.responseXML.getElementsByTagName('resultat');
	var HTML=new Array();
	top.newshq.nav.document.getElementById("title_search").innerHTML="<b>News marquées</b>";
	if (tabResult.length > 0) {
		HTML.push("<table id=day class=list>");
		modulo=0;
		oldmonth=""; oldday="";
		for (var i = 0; i < tabResult.length; i++) {
			resultat = tabResult.item(i); 
			get_id=resultat.getAttribute('newsid');
			get_title=resultat.getAttribute('title');
			get_date=resultat.getAttribute('date');
			get_source=resultat.getAttribute('source');
			get_category=resultat.getAttribute('category');
			newmonth=get_date.substring(3,10);
			newday=get_date.substring(0,2);
			if (newmonth!=oldmonth) {
				if (oldmonth.length>0) HTML.push('<tr class=oddh><td colspan=5><tr><td><br>');
				HTML.push('<tr class=oddh><td colspan=5><tr class=oddh><td colspan=5>&nbsp;<b>',month[Math.floor(newmonth.substring(0,2))],' ',newmonth.substring(3,7));
				HTML.push('<tr class=oddh><td colspan=5>');
			} else {
				if (newday!=oldday) HTML.push('<tr class=oddh><td colspan=5> ');
			}
			HTML.push('<tr style=display:block id=n',get_id,' class=n');
			HTML.push('p');
			HTML.push((modulo++%2+1));
			HTML.push(' onmouseout=out_off',((modulo-1)%2+1),'(this,',get_id,'); onmouseover=over_smft_off(this,',get_id,')>');
			HTML.push('<td class=hours>',get_date.substring(0,5),' à ',get_date.substring(11,16),' ');
			HTML.push('<td><a target=_blank title="',source_name(get_source),'" href=',source_url(get_source),'><img src=img/icon/',get_source,'.gif></a><td class=news>');
			if (get_source>0) go_type=""; else go_type="user/";
			HTML.push('<a onclick=go(',get_id,',this) target=_blank href=../news/',go_type,get_id,'>',get_title,'</a><td nowrap>',get_category,'  ');
			HTML.push('<td nowrap onmouseover=smft_off(',get_id,',"',replace_all(get_title," "," "),'",',get_source,');><div class=smft id=smft_off',get_id,'></div></td>');
			oldmonth=newmonth; oldday=newday;
			}
		HTML.push("</table>");
		top.newshq.list.document.getElementById("search").innerHTML=HTML.join("");
		top.newshq.list.document.getElementById("search").style.display="";
		top.newshq.nav.document.getElementById("searchnumber").innerHTML="<b>Résultat</b> : "+tabResult.length+" news marquée";
		if (tabResult.length>1) top.newshq.nav.document.getElementById("searchnumber").innerHTML+="s";
		}
	else {
		top.newshq.list.document.getElementById("search").innerHTML="<table width=100% height=100%><tr><td><center><table class=text><tr><td>    <br>    Aucune news marquée...    <br>    </td></tr></table></td></tr></table>";
		top.newshq.nav.document.getElementById("searchnumber").innerHTML="<b>Résultat</b> : aucun";
	}
}

function smft_search(id,title,source) {
	if (document.getElementById('smft'+id).innerHTML=="") {
		document.getElementById('smft'+id).style.backgroundImage='url(/css/all/smft.png)';
		if (source>0) go_type=""; else go_type="user/";
		url='http://www.comptoir-info.com/news/'+go_type+id;
		document.getElementById('smft'+id).style.backgroundImage='url(/css/all/smft.png)';
		document.getElementById('smft'+id).innerHTML='<img src=0.gif style=border:1px; title="Marquer cette news pour pouvoir la retrouver facilement plus tard" onclick=save('+id+',"'+go_type+'");><a href="mailto:adresse@email.com?subject='+title+'&body='+url+'"><img src=0.gif title="Envoyer cette news à un ami"></a><a target=_blank title="Partager avec vos amis sur Facebook" href="http://www.facebook.com/share.php?u='+url+'"><img src=0.gif></a><a target=_blank title="Partager avec vos amis sur Twitter" href="http://www.twitter.com/home?status=Comptoir de l\'Info+'+title+'+-+'+url+'"><img src=0.gif></a>';
	}
}

function smft_off(id,title,source) {
	if (document.getElementById('smft_off'+id).innerHTML=="") {
		document.getElementById('smft_off'+id).style.backgroundImage='url(/css/all/smft_off.png)';
		if (source>0) go_type=""; else go_type="user/";
		url='http://www.comptoir-info.com/news/'+go_type+id;
		document.getElementById('smft_off'+id).style.backgroundImage='url(/css/all/smft_off.png)';
		document.getElementById('smft_off'+id).innerHTML='<img src=0.gif style=border:1px; title="Supprimer le marquage de cette news" onclick=delsave('+id+');><a href="mailto:adresse@email.com?subject='+title+'&body='+url+'"><img src=0.gif title="Envoyer cette news à un ami"></a><a target=_blank title="Partager avec vos amis sur Facebook" href="http://www.facebook.com/share.php?u='+url+'"><img src=0.gif></a><a target=_blank title="Partager avec vos amis sur Twitter" href="http://www.twitter.com/home?status=Comptoir de l\'Info+'+title+'+-+'+url+'"><img src=0.gif></a>';
	}
}

function out_smft(id) {	document.getElementById('smft'+id).style.backgroundImage='url(0.gif)'; }
function out_smft_off(id) {	document.getElementById('smft_off'+id).style.backgroundImage='url(0.gif)'; }
function over(obj,id) { obj.style.backgroundColor='#C8FAC8'; gotobalise(1); document.getElementById('smft'+id).style.backgroundImage='url(/css/all/smft.png)'; }
function over_smft_off(obj,id) { obj.style.backgroundColor='#C8FAC8'; gotobalise(1); document.getElementById('smft_off'+id).style.backgroundImage='url(/css/all/smft_off.png)'; }
function over_home(obj) { obj.style.backgroundColor='#F0FAF0'; }
function out0(obj,id) { obj.style.backgroundColor="transparent"; }
function out1(obj,id) { obj.style.backgroundColor="#F0F3F5"; out_smft(id); }
function out2(obj,id) { obj.style.backgroundColor="#FFFFFF"; out_smft(id); }
function out_off1(obj,id) { obj.style.backgroundColor="#F0F3F5"; out_smft_off(id); }
function out_off2(obj,id) { obj.style.backgroundColor="#FFFFFF"; out_smft_off(id); }

function addtag(tag) {
	tag=top.newshq.content.document.getElementById("addtag").value;
	if (top.newshq.list.document.getElementById("tags_text").value.length>0) {
		top.newshq.list.document.getElementById("tags_text").value+='¶';
		top.newshq.list.document.getElementById("tags_color").value+='¶';
		top.newshq.list.document.getElementById("tags_valid").value+='¶';
		top.newshq.list.document.getElementById("tags_alert").value+='¶';
	}
	top.newshq.list.document.getElementById("tags_text").value+=tag;
	top.newshq.list.document.getElementById("tags_color").value+="CCCCCC";
	top.newshq.list.document.getElementById("tags_valid").value+="1";
	top.newshq.list.document.getElementById("tags_alert").value+="0";
	update();
	update_tags("1");
	top.newshq.content.location.href="news_filter.php";
}

function overaddtag() {
	if (top.newshq.content.document.getElementById("colorpicker").style.display=='none') {
		top.newshq.content.document.getElementById("colorpicker").height=75;
		top.newshq.content.document.getElementById("colorpicker").style.display='';
		colorpicker.location.href=session("news_filter_add.php");
	}
	if (document.getElementById('addtag').value=='Ajouter un tag...') document.getElementById('addtag').value='';
}

function reset_message() { if (top.newshq.content.document.getElementById('message').value=='Ajouter un message...') top.newshq.content.document.getElementById('message').value=''; }

function update() {
	var type_detail=top.newshq.list.document.getElementById("type_detail").value;
	if (top.newshq.list.document.getElementById("type_tri").value>0) if (type_detail==0) update_category(0); else update_category(1);
	if (top.newshq.list.document.getElementById("type_tri").value==0) if (type_detail==0) update_time(0,1); else update_time(1,1);
	if (top.newshq.list.document.getElementById("type_tri").value<0) if (type_detail==0) update_time(0,-1); else update_time(1,-1);
}

function super_tag(text) {
	var add=new Array(); var k=0;
	add[k++]="<td class=supertag>";
	if (text.search(new RegExp("amd","gi"))+text.search(new RegExp("radeon","gi"))+text.search(new RegExp("catalyst","gi"))>=0) add[k++]="<img src=img/icon/amd.png>&nbsp;";
	if (text.search(new RegExp("apple","gi"))+text.search(new RegExp("iphone","gi"))+text.search(new RegExp("ipod","gi"))+text.search(new RegExp("mac ","gi"))>=0) add[k++]="<img src=img/icon/apple.png>&nbsp;";
	if (text.search(new RegExp("intel","gi"))>=0) add[k++]="<img src=img/icon/intel.png>&nbsp;";
	if (text.search(new RegExp("nvidia","gi"))+text.search(new RegExp("geforce","gi"))+text.search(new RegExp("forceware","gi"))>=0) add[k++]="<img src=img/icon/nvidia.png>&nbsp;";
	if (text.search(new RegExp("vista","gi"))>=0) add[k++]="<img src=img/icon/vista.png>&nbsp;"; else if (text.search(new RegExp("windows","gi"))+text.search(new RegExp("microsoft","gi"))>=0) add[k++]="<img src=img/icon/windows.png>&nbsp;";
	return add.join("");
}

function super_text(text) {
	if (text.search(new RegExp("amd","gi"))+text.search(new RegExp("radeon","gi"))+text.search(new RegExp("catalyst","gi"))>=0) return("AMD");
	if (text.search(new RegExp("apple","gi"))+text.search(new RegExp("iphone","gi"))+text.search(new RegExp("ipod","gi"))+text.search(new RegExp("mac ","gi"))>=0) return("Apple");
	if (text.search(new RegExp("intel","gi"))>=0) return("Intel");
	if (text.search(new RegExp("nvidia","gi"))+text.search(new RegExp("geforce","gi"))+text.search(new RegExp("forceware","gi"))>=0) return("Nvidia");
	if (text.search(new RegExp("vista","gi"))>=0) return("Vista"); else if (text.search(new RegExp("windows","gi"))+text.search(new RegExp("microsoft","gi"))>=0) return("Microsoft");
	return "";
}

function update_time(type_detail,order) {
	top.newshq.list.document.getElementById("news").style.display="";
	top.newshq.list.document.getElementById("search").style.display="none";
	var last=top.newshq.list.document.getElementById("last").value;
	var tags_text=top.newshq.list.document.getElementById("tags_text").value.split('¶');
	var tags_color=top.newshq.list.document.getElementById("tags_color").value.split('¶');
	var tags_valid=top.newshq.list.document.getElementById("tags_valid").value.split('¶');
	var news_id=top.newshq.list.document.getElementById("news_id").value.split('¶');
	var news_title=top.newshq.list.document.getElementById("news_title").value.split('¶');
	var news_date=top.newshq.list.document.getElementById("news_date").value.split('¶');
	var news_source=top.newshq.list.document.getElementById("news_source").value.split('¶');
	var news_category=top.newshq.list.document.getElementById("news_category").value.split('¶');
	var news_read=top.newshq.list.document.getElementById("news_read").value.split('¶');
	var news_hit=top.newshq.list.document.getElementById("news_hit").value.split('¶');
	var hide_type=top.newshq.list.document.getElementById("hide_type").value;
	var type_source=top.newshq.list.document.getElementById("type_source").value;
	var type_category=top.newshq.list.document.getElementById("type_category").value;;
	var type_star=top.newshq.list.document.getElementById("type_star").value;
	var news_highlight=top.newshq.list.document.getElementById("news_highlight").value;
	if (type_detail>0) detail=top.newshq.list.document.getElementById("news_detail").value.split('¶');
	var HTML=new Array();
	var min_hit=min_array(news_hit);
	var max_hit=max_array(news_hit);
	var oldhour=-1;
	var oldnews=0;
	var barread=0;
	var reloaded=0;
	var table_end="";
	if (news_id[0]>0) {
	HTML.push("<div class=top_list><table><tr><td width=2><img src=0.gif width=2 height=2></td><td align=left><img src=0.gif class=list_top_left><td align=right><img src=0.gif class=list_top_right><td width=2><img src=0.gif width=2 height=2></td></table></div><div class=div_list id=div_list><table><tr><td width=2><img src=0.gif width=2 height=0></td><td><table class=list>");
	modulo=0;
	if (order>0) { for_start=0; for_end=news_id.length; }
	else { for_start=news_id.length-1; for_end=-1; }
	for (i=for_start;i!=for_end;i=i+order) {
		if (news_id[i]!=oldnews) hide=0; else hide=1;
		if (((hide_type==1) && (news_read[i].length==0)) || ((hide_type==2) && (news_read[i].length>0)) || ((hide_type==4) && (news_hit[i].length==0))) hide=1;
		if (hide_type==3) { show=0; for (t=0;t<tags_valid.length;t++) if (tags_valid[t]>0) {
				if (tags_text[t]==tags_text[t].toLowerCase()) maReg = new RegExp(tags_text[t],"gi"); else maReg = new RegExp(tags_text[t],"g");
				if (news_title[i].search(maReg)>=0) { show=1; break; }} if (show==0) hide=1; }

		for (t=0;t<tags_color.length;t++) if ((tags_color[t]=="") && (tags_valid[t]>0)) {
			if (tags_text[t]==tags_text[t].toLowerCase()) maReg = new RegExp(tags_text[t],"gi"); else maReg = new RegExp(tags_text[t],"g");
			if (news_title[i].search(maReg)>=0) { hide=1; break; }}

		if (hide==0) {
			if (news_highlight==news_id[i]) HTML.push('<tr><td><a name=balise></a></td></tr>');
			if (oldhour<0) oldhour=news_date[i].substring(11,13);
			newhour=news_date[i].substring(11,13);
			if (newhour!=oldhour) HTML.push('<tr class=oddh><td colspan=7> ');
			if ((last>=news_date[i]) && (barread>0)) {
				reloaded=1;
				HTML.push('<tr><td><a name=lastnews></a></td></tr>');
				if (newhour==oldhour) HTML.push('<tr id=oddr class=oddr><td colspan=7> ');
				else HTML.push('<tr id=oddr style=display:none; class=oddr><td colspan=7> ');
				barread=-1; }
			
			if (news_highlight==news_id[i]) {
				HTML.push('<tr id=n',news_id[i],' class=odds');
				modulo++;
			} else {
				HTML.push('<tr id=n',news_id[i],' class=n');
				if (news_read[i].length>0) clas='r'; else clas='p';
				if ((news_hit[i].length>0) && (type_star==2)) clas+='s';
				HTML.push(clas,(modulo++%2+1),' onmouseout=out',((modulo-1)%2+1),'(this,',news_id[i],') onmouseover=over(this,',news_id[i],')');
			}
			HTML.push('><td class=hours');
			if (last<news_date[i]) { HTML.push('new'); if (barread==0) barread=1; }
			HTML.push('>',news_date[i].substring(11,13),"h",news_date[i].substring(14,16),' ');

			if (news_source[i]>0) { src_name=source_name(news_source[i]); src_url=source_url(news_source[i]); src_icon=source_icon(news_source[i]); }
			else { src_name=sourceuser_name(Math.abs(news_source[i])); src_url=sourceuser_url(Math.abs(news_source[i])); src_icon=sourceuser_icon(Math.abs(news_source[i])); }

			if ((type_source==0) || (type_source==2)) HTML.push('<td><a target=_blank title="',src_name,'" href=',src_url,'><img src=img/',src_icon,'></a>');
			if (type_source>=1) HTML.push('<td nowrap> <a target=_blank href=',src_url,'><b>',src_name,'</a>');
			HTML.push('<td class=news>');
			
			for (t=0;t<tags_valid.length;t++) if (tags_valid[t]>0) {
				if (tags_text[t]==tags_text[t].toLowerCase()) maReg = new RegExp("("+tags_text[t]+")","gi"); else maReg = new RegExp("("+tags_text[t]+")","g");
				news_title[i]=news_title[i].replace(maReg,"›"+tags_color[t]+");'>$1‹"+tags_color[t]+"¤"); }
			do { news_title[i]=news_title[i].replace("›","<span class=tag style='background:url(tag.php?color="); } while (news_title[i].indexOf("›")>0);
			do { news_title[i]=news_title[i].replace("‹","</span><img height=16 width=1 style='position:absolute;background:url(tag.php?color="); } while (news_title[i].indexOf("‹")>0);
			do { news_title[i]=news_title[i].replace("¤",");' src=0.gif>"); } while (news_title[i].indexOf("¤")>0);

			if (news_source[i]>0) go_type=""; else go_type="user/";
			HTML.push('<a onclick=go(',news_id[i],',this) target=_blank href=../news/',go_type,news_id[i],'>',news_title[i],'</a>');

			if ((type_star>0) && (news_hit[i].length>0)) {
					HTML.push(' ');
					nbr_star=Math.round((news_hit[i]-min_hit)/Math.max(1,((max_hit-min_hit)/4))+1);
					for (s=0;s<nbr_star;s++) HTML.push('<img title="',news_hit[i],' bams / jour" src=0.gif class=news_star>'); }

			 if ((type_detail==0) && (type_category>=0)) {
				if (type_category>0) HTML.push(super_tag(" "+news_title[i]));
				if (news_category[i].length>0) HTML.push('<td nowrap>',news_category[i],'  ');
				else HTML.push('<td>',super_text(" "+news_title[i]));
				}
			if (news_source[i]>0) HTML.push('<td nowrap onmouseover=smft_on(',news_id[i],');><div class=smft id=smft',news_id[i],'></div>');
			else HTML.push('<td></td>');
			if (news_read[i].length>0) HTML.push('<td class=valid><img src=0.gif alt="News lue ',news_read[i],'">'); else HTML.push('<td class=valid><img src=0.gif style=display:none; id=read',news_id[i],'>');
			oldhour=newhour;
			
			if (type_detail>0) {
				if (detail[i].length>0) {
					HTML.push('<tr class=n',clas,((modulo-1)%2+1),'><td><td colspan=6 class=detail>');
					if (news_category[i].length>0) HTML.push('<u>',news_category[i],'</u> : ');
					HTML.push(detail[i]);
				} else {
					if (news_category[i].length>0) {
					HTML.push('<tr class=n',clas,((modulo-1)%2+1),'><td><td colspan=6 class=detail>');
					HTML.push('Catégorie : <u>',news_category[i],'</u>');
				}}
			}
		}
		oldnews=news_id[i];
	}
	if (barread>=0) HTML.push('<tr id=oddr style=display:none; class=oddr><td colspan=7> ');	
	HTML.push("</table><td width=2><img src=0.gif width=2 height=0></td></table></div><div class=bot_list><table><tr><td width=2><img src=0.gif width=2 height=2></td><td class=list_bot_left><img src=0.gif class=list_bot_left><td align=right><img src=0.gif class=list_bot_right><td width=2><img src=0.gif width=2 height=2></td></table></div>");
	} else HTML[0]="<table width=100% height=100%><tr><td><center><table class=text><tr><td>    <br>    Aucune news...    <br>    </td></tr></table></td></tr></table>";
	top.newshq.list.document.getElementById("news").innerHTML=HTML.join("");
	if (news_highlight>0) setTimeout("gotobalise(0)",100);
	if (reloaded>0) setTimeout("gotolastnews()",100);
}

function gotobalise(hide) {
	if (top.newshq.list.document.getElementById("news_highlight").value>0) {
		top.newshq.list.location.href="#balise";
		if (hide>0) top.newshq.list.document.getElementById("news_highlight").value=0; else setTimeout("gotobalise(0)",100);
	}
}

function gotolastnews() {
	top.newshq.list.location.href="#lastnews";
	if (top.newshq.list.document.getElementById("type_tri").value==0) h=0-top.newshq.list.document.body.clientHeight;
	else h=top.newshq.list.document.body.clientHeight;
	top.newshq.list.scrollBy(0,h);
	
}

function scrolloff() {
	top.newshq.list.document.getElementById("news_highlight").value=0;
}


function update_category(type_detail) {
	top.newshq.list.document.getElementById("news").style.display="";
	top.newshq.list.document.getElementById("search").style.display="none";
	var last=top.newshq.list.document.getElementById("last").value;
	var tags_text=top.newshq.list.document.getElementById("tags_text").value.split('¶');
	var tags_color=top.newshq.list.document.getElementById("tags_color").value.split('¶');
	var tags_valid=top.newshq.list.document.getElementById("tags_valid").value.split('¶');
	var news_id=top.newshq.list.document.getElementById("news_id").value.split('¶');
	var news_title=top.newshq.list.document.getElementById("news_title").value.split('¶');
	var news_date=top.newshq.list.document.getElementById("news_date").value.split('¶');
	var news_source=top.newshq.list.document.getElementById("news_source").value.split('¶');
	var news_category=top.newshq.list.document.getElementById("news_category").value.split('¶');
	var news_read=top.newshq.list.document.getElementById("news_read").value.split('¶');
	var news_hit=top.newshq.list.document.getElementById("news_hit").value.split('¶');
	var hide_type=top.newshq.list.document.getElementById("hide_type").value;
	var type_category=top.newshq.list.document.getElementById("type_category").value;;
	var type_star=top.newshq.list.document.getElementById("type_star").value;
	var HTML=new Array();
	var min_hit=min_array(news_hit);
	var max_hit=max_array(news_hit);
	var oldhour=0;
	var oldnews=0;
	if (type_detail>0) detail=top.newshq.list.document.getElementById("news_detail").value.split('¶');
	var src_namei="";
	var src_namej="";

	if (news_id[0]>0) {
	HTML.push("<table class=list>");
	cat=new Array();
	cat_url=new Array();
	cat_icon=new Array();
	for (i=0;i<news_id.length;i++) {
		modulo=0;
		if (news_source[i]>0) {
			src_name=source_name(news_source[i]);
			src_url=source_url(news_source[i]);
			src_icon=source_icon(news_source[i]);
		} else {
			src_name=sourceuser_name(Math.abs(news_source[i]));
			src_url=sourceuser_url(Math.abs(news_source[i]));
			src_icon=sourceuser_icon(Math.abs(news_source[i]));
		}
		for (c=0;c<cat.length;c++) if (src_name==cat[c]) { modulo=1; break; }
		if (modulo==0) {
			if (((hide_type==1) && (news_read[i].length==0)) || ((hide_type==2) && (news_read[i].length>0)) || ((hide_type==4) && (news_hit[i].length==0))) modulo++;
			if (hide_type==3) { show=0; for (t=0;t<tags_valid.length;t++) if (tags_valid[t]>0) {
				if (tags_text[t]==tags_text[t].toLowerCase()) maReg = new RegExp(tags_text[t],"gi"); else maReg = new RegExp(tags_text[t],"g");
				if (news_title[i].search(maReg)>=0) { show=1; break; }} if (show==0) modulo++; }
			for (c=0;c<cat.length;c++) if (src_name==cat[c]) modulo--;
			if (modulo==0) {
				cat[cat.length]=src_name;
				cat_url[src_name]=src_url;
				cat_icon[src_name]=src_icon;
			}
		}
	}
	cat.sort();
	HTML.push('<tr class=oddh><td colspan=6><tr class=oddh><td colspan=6>&nbsp;<a id=home><b>Sommaire<tr><td colspan=6><table>');
	
	for (l=0;l<Math.ceil(cat.length/5);l++) {
		HTML.push('<tr class=np',(modulo++%2+1),'><td>&nbsp;&nbsp;');
		for (c=l;c<cat.length;c=c+Math.ceil(cat.length/5)) {
			src_url=cat_url[cat[c]];
			src_icon=cat_icon[cat[c]];
			HTML.push('<td><a target=_blank title="',src_name,'" href=',src_url,'><img src=img/',src_icon,'></a><td width=20%>&nbsp;<b><a href=#site',c,'>',cat[c],'</a>');
			num=c;
		}
		if (num+Math.ceil(cat.length/5)>=cat.length) HTML.push('<td> <td> ');
		
	}
	HTML.push('</table><tr><td>&nbsp;');
	for (c=0;c<cat.length;c++) {
		if (c>0) HTML.push('<tr class=oddh><td colspan=6><tr><td><br>');
		HTML.push('<tr class=oddh><td colspan=6><tr class=oddh><td nowrap colspan=3>&nbsp;<a id=site',c,'><b>',cat[c],'<td colspan=3 align=right><a href=#home><b>Sommaire&nbsp;');
		HTML.push('<tr class=oddh><td colspan=6>');
		for (i=0;i<news_id.length;i++) {
			if (news_source[i]>0) src_name=source_name(news_source[i]); else src_name=sourceuser_name(Math.abs(news_source[i]));
			if (cat[c]==src_name) {
				hide=0;
				if (news_id[i]!=oldnews) hide=0; else hide=1;
				if (((hide_type==1) && (news_read[i].length==0)) || ((hide_type==2) && (news_read[i].length>0)) || ((hide_type==4) && (news_hit[i].length==0))) hide=1;
				if (hide_type==3) { show=0; for (t=0;t<tags_valid.length;t++) if (tags_valid[t]>0) {
						if (tags_text[t]==tags_text[t].toLowerCase()) maReg = new RegExp(tags_text[t],"gi"); else maReg = new RegExp(tags_text[t],"g");
						if (news_title[i].search(maReg)>=0) { show=1; break; }} if (show==0) hide=1; }
						
				if (hide==0) {
					if (oldhour==0) oldhour=news_date[i].substring(11,13);
					newhour=news_date[i].substring(11,13);
					if (newhour!=oldhour) HTML.push('<tr class=oddh><td colspan=6> ');
					HTML.push('<tr id=n',news_id[i],' class=n');
					
					if (news_read[i].length>0) clas='r'; else clas='p';
					if ((news_hit[i].length>0) && (type_star==2)) clas+='s';
					HTML.push(clas,(modulo++%2+1),' onmouseout=out',((modulo-1)%2+1),'(this,',news_id[i],') onmouseover=over(this,',news_id[i],')><td class=hours');

					if (last<news_date[i]) HTML.push('new');
					HTML.push('>',news_date[i].substring(11,13),"h",news_date[i].substring(14,16),' ');
					if (news_source[i]>0) {
						src_name=source_name(news_source[i]);
						src_url=source_url(news_source[i]);
						src_icon=source_icon(news_source[i]);
					} else {
						src_name=sourceuser_name(Math.abs(news_source[i]));
						src_url=sourceuser_url(Math.abs(news_source[i]));
						src_icon=sourceuser_icon(Math.abs(news_source[i]));
					}
					HTML.push('<td><a target=_blank title="',src_name,'" href=',src_url,'><img src=img/',src_icon,'></a><td class=news>');
					for (t=0;t<tags_valid.length;t++) if (tags_valid[t]>0) {
						if (tags_text[t]==tags_text[t].toLowerCase()) maReg = new RegExp("("+tags_text[t]+")","gi"); else maReg = new RegExp("("+tags_text[t]+")","g");
						news_title[i]=news_title[i].replace(maReg,"<span style='padding:0 2 0 3;height:16px;background:url(tag.php?color="+tags_color[t]+");padding-top:0px;background-repeat:repeat-x;'><b>$1</b></span><img height=16 width=1 style='position:absolute;background:url(tag.php?color="+tags_color[t]+");' src=0.gif>");
					}
					if (news_source[i]>0) go_type=""; else go_type="user/";
					HTML.push('<a onclick=go(',news_id[i],',this) target=_blank href=../news/',go_type,news_id[i],'>',news_title[i],'</a>');

					if (type_star>0) { HTML.push(' ');
						if (news_hit[i].length>0) {
							nbr_star=Math.round((news_hit[i]-min_hit)/Math.max(1,((max_hit-min_hit)/4))+1);
							for (s=0;s<nbr_star;s++) HTML.push('<img title="',news_hit[i],' bams / jour" src=0.gif class=news_star>'); } }

					if ((type_detail==0) && (type_category>=0)) {
						if (type_category>0) HTML.push(super_tag(" "+news_title[i]));
						if (news_category[i].length>0) HTML.push('<td nowrap>',news_category[i],'  ');
						else HTML.push('<td>',super_text(" "+news_title[i]));
						} else HTML.push('<td> ');
					oldhour=newhour;
					if (news_source[i]>0) HTML.push('<td nowrap onmouseover=smft_on(',news_id[i],');><div class=smft id=smft',news_id[i],'></div>');
					else HTML.push('<td></td>');
					if (news_read[i].length>0) HTML.push('<td class=valid><img src=0.gif alt="News lue ',news_read[i],'">'); else HTML.push('<td class=valid><img src=0.gif style=display:none; id=read',news_id[i],'>');

					if (type_detail>0) {
						if (detail[i].length>0) {
							HTML.push('<tr class=n',clas,((modulo-1)%2+1),'><td><td colspan=5 class=detail>');
							if (news_category[i].length>0) HTML.push('<u>',news_category[i],'</u> : ');
							HTML.push(detail[i]);
						} else {
							if (news_category[i].length>0) {
							HTML.push('<tr class=n',clas,((modulo-1)%2+1),'><td><td colspan=5 class=detail>');
							HTML.push('Catégorie : <u>',news_category[i],'</u>');
						}}
					}
				}
				oldnews=news_id[i];
			}
		}
	}
	HTML.push("</table>");
	} else HTML[0]="<table width=100% height=100%><tr><td><center><table class=text><tr><td>    <br>    Aucune news...    <br>    </td></tr></table></td></tr></table>";
	top.newshq.list.document.getElementById("news").style.display="none";
	top.newshq.list.document.getElementById("news").innerHTML=HTML.join("");
	top.newshq.list.document.getElementById("news").style.display="";
}

function changetri(value) {
	top.newshq.list.document.getElementById("type_tri").value=value;
	top.newshq.nav.frameload.location.href=session("news_last.php?news_datcat="+value);
	top.newshq.reload.location.href=session("news_select.php?detail="+top.newshq.list.document.getElementById("type_detail").value+"&tri="+value);
}

function changefilter(id) {
	top.newshq.content.frameform.location.href=session("news_save.php?filter="+id);
}

function calcnumber() {
	var news_id=top.newshq.list.document.getElementById("news_id").value.split('¶');
	var news_title=top.newshq.list.document.getElementById("news_title").value.split('¶');
	var news_hit=top.newshq.list.document.getElementById("news_hit").value.split('¶');
	var last=top.newshq.list.document.getElementById("last").value;
	var news_date=top.newshq.list.document.getElementById("news_date").value.split('¶');
	var news_read=top.newshq.list.document.getElementById("news_read").value.split('¶');
	var hide_type=top.newshq.list.document.getElementById("hide_type").value;
	var tags_valid=top.newshq.list.document.getElementById("tags_valid").value.split('¶');
	var tags_text=top.newshq.list.document.getElementById("tags_text").value.split('¶');
	var new_news=0;
	var num_news=0;
	for (i=0;i<news_id.length;i++) {
		hide=0;
		if (((hide_type==1) && (news_read[i].length==0)) || ((hide_type==2) && (news_read[i].length>0)) || ((hide_type==4) && (news_hit[i].length==0))) hide=1;
		if (hide_type==3) { show=0; for (t=0;t<tags_valid.length;t++) if (tags_valid[t]>0) {
			if (tags_text[t]==tags_text[t].toLowerCase()) maReg = new RegExp(tags_text[t],"gi"); else maReg = new RegExp(tags_text[t],"g");
			if (news_title[i].search(maReg)>=0) { show=1; break; }} if (show==0) hide=1; }
		if (hide==0) {
			if (last<news_date[i]) new_news++;
			num_news++;
		}
		}
	top.newshq.nav.document.getElementById("divnew").innerHTML="(+<strong>"+new_news+"</strong>)";
	if (new_news>0) top.newshq.nav.document.getElementById("divnew").style.display="";
	else top.newshq.nav.document.getElementById("divnew").style.display="none";
	top.newshq.nav.document.getElementById("divnumber").innerHTML=num_news+" news";
}

function afficherResultats(obj) {
	var tabResult = obj.responseXML.getElementsByTagName('resultat');
	var HTML=new Array();
	top.newshq.nav.document.getElementById("title_search").innerHTML="<b>Recherche</b>";
	if (tabResult.length > 0) {
		HTML.push("<table id=day class=list>");
		modulo=0;
		oldmonth=""; oldday="";
		for (var i = 0; i < tabResult.length; i++) {
			resultat = tabResult.item(i); 
			get_id=resultat.getAttribute('newsid');
			get_title=resultat.getAttribute('title');
			get_date=resultat.getAttribute('date');
			get_source=resultat.getAttribute('source');
			get_category=resultat.getAttribute('category');
			newmonth=get_date.substring(3,10);
			newday=get_date.substring(0,2);
			if (newmonth!=oldmonth) {
				if (oldmonth.length>0) HTML.push('<tr class=oddh><td colspan=5><tr><td><br>');
				HTML.push('<tr class=oddh><td colspan=5><tr class=oddh><td colspan=5>&nbsp;<b>',month[Math.floor(newmonth.substring(0,2))],' ',newmonth.substring(3,7));
				HTML.push('<tr class=oddh><td colspan=5>');
			} else {
				if (newday!=oldday) HTML.push('<tr class=oddh><td colspan=5> ');
			}
			HTML.push('<tr style=display:block id=n',get_id,' class=n');
			HTML.push('p');
			HTML.push((modulo++%2+1));
			HTML.push(' onmouseout=out',((modulo-1)%2+1),'(this,',get_id,') onmouseover=over(this,',get_id,')>');
			HTML.push('<td class=hours>',get_date.substring(0,5),' à ',get_date.substring(11,16),' ');
			HTML.push('<td><a target=_blank title="',source_name(get_source),'" href=',source_url(get_source),'><img src=img/icon/',get_source,'.gif></a><td class=news>');
			if (get_source>0) go_type=""; else go_type="user/";
			HTML.push('<a onclick=go(',get_id,',this) target=_blank href=../news/',go_type,get_id,'>',get_title,'</a><td nowrap>',get_category,'  ');
			HTML.push('<td nowrap onmouseover=smft_search(',get_id,',"',replace_all(get_title," "," "),'",',get_source,');><div class=smft id=smft',get_id,'></div>');
			oldmonth=newmonth; oldday=newday;
			}
		HTML.push("</table>");
		top.newshq.list.document.getElementById("search").innerHTML=HTML.join("");
		top.newshq.list.document.getElementById("search").style.display="";
		top.newshq.nav.document.getElementById("searchnumber").innerHTML="<b>Résultat</b> : "+tabResult.length+" news";
		}
	else {
		top.newshq.list.document.getElementById("search").innerHTML="<table width=100% height=100%><tr><td><center><table class=text><tr><td>    <br>    Aucune news...    <br>    </td></tr></table></td></tr></table>";
		top.newshq.nav.document.getElementById("searchnumber").innerHTML="<b>Résultat</b> : aucun";
	}
}

function replace_all(text,search,replace) {
	loop=0;
	while (text.indexOf(search,0)>=0) { loop++; text=text.replace(search,replace); if (loop>10) break; }
	return(text);
}

function loadData(force) {
	search_len=top.newshq.nav.document.getElementById('foo').value.length;
	if (force) search_len=3;
	if ((search_len<3) || (top.newshq.nav.document.getElementById('foo').value=="Recherche instantanée...")) {
		top.newshq.nav.document.getElementById("search").style.display="none";
		top.newshq.list.document.getElementById("search").style.display="none";
		top.newshq.nav.document.getElementById("day").style.display="";
		top.newshq.nav.document.getElementById("day5").style.display="";
		top.newshq.list.document.getElementById("news").style.display="";
	} else {
		top.newshq.nav.document.getElementById("day").style.display="none";
		top.newshq.nav.document.getElementById("day5").style.display="none";
		top.newshq.nav.document.getElementById("search").style.display="";
		top.newshq.nav.frameload.location.href=session("news_last.php?time_news="+top.newshq.nav.document.getElementById('since').value);
		top.newshq.list.document.getElementById("news").style.display="none";
		top.newshq.list.document.getElementById("search").style.display="";
		var XHR = new search();
		XHR.appendData("foo", top.newshq.nav.document.getElementById('foo').value);
		XHR.appendData("since", top.newshq.nav.document.getElementById('since').value);
		XHR.sendAndLoad("news_search.php", "POST", afficherResultats);
	}
}

function max_array(array) {
	var Max = Math.round(array[0]);
	for (i=1;i<array.length; i++) if (Math.round(array[i])>Max) Max = Math.round(array[i]);
	return Max;
}

function min_array(array) {
	var Min = Math.round(array[0]);
	for (i=1;i<array.length; i++) if (Math.round(array[i])<Min) Min = Math.round(array[i]);
	return Min;
}

function sum_array(array) {
	var Total = Math.round(array[0]);
	for (i=1;i<array.length; i++) Total += Math.round(array[i]);
	return Total;
}

function check(id) {
	obj="c"+id;
	if (document.getElementById(obj).checked) {
		frameform.location.href=session("news_save.php?news="+id+"&add=0");
	} else {
		frameform.location.href=session("news_save.php?news="+id+"&add=1");
	}
}

function checkuser(id) {
	obj="cuser"+id;
	if (document.getElementById(obj).checked) {
		frameform.location.href=session("news_save.php?newsuser="+id+"&add=0");
	} else {
		frameform.location.href=session("news_save.php?newsuser="+id+"&add=1");
	}
}

function clu(id) {
	obj="clu"+id;
	if (document.getElementById(obj).checked) {
		frameform.location.href=session("news_save.php?newslu="+id+"&add=0");
	} else {
		frameform.location.href=session("news_save.php?newslu="+id+"&add=1");
	}
}

function settag(id,go) {
	var tags_text=top.newshq.list.document.getElementById("tags_text").value.split('¶');
	top.newshq.content.document.getElementById("tagtext").value=tags_text[id];
	for (i=0;i<tags_text.length;i++) {
		if (tags_text[i].length>0) {
			if (i==id) top.newshq.content.document.getElementById("rss"+i).style.display="";
			else top.newshq.content.document.getElementById("rss"+i).style.display="none";
		}
	}
	top.newshq.content.document.getElementById("rssno").style.display="none";
	top.newshq.content.document.getElementById("colorpicker").height=0;
	if (go) {
		top.newshq.content.document.getElementById("tagradio"+id).click();
		searchtag();
	}
}

function searchtag() {
	if (top.newshq.content.document.getElementById("tagtext").value.length==0) alert("Veuillez choisir un tag !");
	else {
		top.newshq.nav.document.getElementById('foo').value=top.newshq.content.document.getElementById("tagtext").value;
		loadData(true)
	}
}

function colorchange() {
	if (top.newshq.content.document.getElementById("tagtext").value.length==0) alert("Veuillez choisir un tag !");
	else {
		var tags_text=top.newshq.list.document.getElementById("tags_text").value.split('¶');
		var tags_color=top.newshq.list.document.getElementById("tags_color").value.split('¶');
		for (i=0;i<tags_text.length;i++) {
			if (tags_text[i]==top.newshq.content.document.getElementById("tagtext").value) { id=i; break; }
		}
		colorpicker.location.href=session("news_filter_color.php?id="+id+"&tag="+tags_text[id]+"&color="+tags_color[id]);
		top.newshq.content.document.getElementById("colorpicker").height=199;
		top.newshq.content.document.getElementById("colorpicker").style.display='';
	}
}

function deltag() {
	if (top.newshq.content.document.getElementById("tagtext").value.length==0) alert("Veuillez choisir un tag !");
	else {
		var tags_text=top.newshq.list.document.getElementById("tags_text").value.split('¶');
		var tags_color=top.newshq.list.document.getElementById("tags_color").value.split('¶');
		var tags_valid=top.newshq.list.document.getElementById("tags_valid").value.split('¶');
		var tags_alert=top.newshq.list.document.getElementById("tags_alert").value.split('¶');
		for (i=0;i<tags_text.length;i++) {
			if (tags_text[i]==top.newshq.content.document.getElementById("tagtext").value) { num=i; break; }
		}
		tagtodel=tags_text[num];
		tags_text[num]="";
		top.newshq.list.document.getElementById("tags_text").value="";
		top.newshq.list.document.getElementById("tags_color").value="";
		top.newshq.list.document.getElementById("tags_valid").value="";
		top.newshq.list.document.getElementById("tags_alert").value="";
		for (i=0;i<tags_valid.length;i++) {
			if (tags_text[i].length>0) {
				if (top.newshq.list.document.getElementById("tags_text").value.length>0) {
					top.newshq.list.document.getElementById("tags_text").value+='¶';
					top.newshq.list.document.getElementById("tags_color").value+='¶';
					top.newshq.list.document.getElementById("tags_valid").value+='¶';
					top.newshq.list.document.getElementById("tags_alert").value+='¶';
				}
				top.newshq.list.document.getElementById("tags_text").value+=tags_text[i];
				top.newshq.list.document.getElementById("tags_color").value+=tags_color[i];
				top.newshq.list.document.getElementById("tags_valid").value+=tags_valid[i];
				top.newshq.list.document.getElementById("tags_alert").value+=tags_alert[i];
			}
		}
		update();
		update_tags("1");
		top.newshq.content.frameform.location.href=session("news_last.php?tag_del="+tagtodel);
	}
}

function update_tags(add) {
	var tags_text=top.newshq.list.document.getElementById("tags_text").value.split('¶');
	var tags_color=top.newshq.list.document.getElementById("tags_color").value.split('¶');
	var tags_alert=top.newshq.list.document.getElementById("tags_alert").value.split('¶');
	var HTML=new Array();
	HTML.push('<form name=addform target=frameform method="post" action="news_last.php?addtag=1"><table width=100% class=framebig><tr><td colspan=3 height=30><table width=100%><tr><td class=module>Tags</td></tr></table></td><input id=tagtext type=hidden></tr>');
	for (i=0;i<tags_text.length;i++) {
		if (tags_text[i].length>0) {
		HTML.push('<tr><td class=checkbox><input class=checkbox type=radio name=tagid id=tagradio',i,' value=',i,' onclick=settag(',i,',false);></td>');
		HTML.push('<td onclick=settag(',i,',true); id=tag_',i,' style="cursor:pointer;padding:0px 3px 2px 3px;');
		if (tags_color[i]=="") HTML.push('color:white;');
		HTML.push('background:url(tag.php?color=',tags_color[i],');background-repeat:repeat-x;"><b>',tags_text[i],'</b></td>');
		HTML.push('<td id=tagend_',i,' style="background:url(tag.php?color=',tags_color[i],');background-repeat:repeat-x;"><img src=0.gif width=1 height=1></td><td nowrap>');
		if (tags_alert[i]>0) HTML.push(' <img title="Supprimer l\'alerte par email" onclick=\'top.newshq.content.document.getElementById("tagtext").value="',tags_text[i],'";news_alert();\' class=mail src=0.gif>'); else if (tags_color[i]=="") HTML.push(' <img title="Supprimer le filtre" onclick=\'top.newshq.content.document.getElementById("tagtext").value="',tags_text[i],'";forbidden();\' class=forbidden src=0.gif>'); else HTML.push('<img width=5 src=0.gif>');
		HTML.push('</td><td width=20> </td><tr><td height=2>'); } }
	HTML.push('<tr><td height=5> <tr><td><center><img title="Lancer une recherche instantannée sur ce mot clé" onclick=');
	if (add=="1") HTML.push('searchtag'); else HTML.push('visitor');
	HTML.push('(); src=0.gif class=zoom></td><td style=padding-left:3px>Lancer une recherche</td></tr>');
	HTML.push('<tr><td height=3> <tr><td><center><img title="Masquer toutes les news qui contiennent ce tag" onclick=');
	if (add=="1") HTML.push('forbidden'); else HTML.push('visitor');
	HTML.push('(); src=0.gif class=forbidden></td><td style=padding-left:3px>Masquer les news avec ce tag</td></tr>');
	HTML.push('<tr><td height=3> <tr><td><center><img title="Recevoir un email dés qu\'une news est publiée ave ce tag" onclick=');
	if (add=="1") HTML.push('news_alert'); else HTML.push('visitor');
	HTML.push('(); src=0.gif class=mail></td><td style=padding-left:3px>Etre alerté par email</td></tr>');
	HTML.push('<tr><td height=3> <tr><td><center>');
	for (i=0;i<tags_text.length;i++) {
		if (tags_text[i].length>0) {
		HTML.push('<a title="Voir le flux RSS dédié à ce ce sujet" ');
	if (add=="1") HTML.push('target=_blank href="../rss.xml?tag=',tags_text[i],'"'); else HTML.push('onclick=visitor();');
	HTML.push('><img src=0.gif id=rss',i,' style=display:none; class=rss></a>'); } }
	HTML.push('<img title="Génèrer un flux RSS de toutes les news qui contiennent ce tag" src=0.gif id=rssno onclick=');
	if (add=="1") HTML.push('searchtag'); else HTML.push('visitor');
	HTML.push('(); class=rss></td><td style=padding-left:3px>Générer un flux RSS</td></tr>');
	HTML.push('<tr><td height=3> <tr><td><center><img title="Changer la couleur de fond des tags" onclick=');
	if (add=="1") HTML.push('colorchange'); else HTML.push('visitor');
	HTML.push('(); src=0.gif class=color></td><td style=padding-left:3px>Changer de couleur</td></tr>');
	HTML.push('<tr><td height=3> <tr><td><center><img title="Supprimer ce tag" onclick=');
	if (add=="1") HTML.push('deltag'); else HTML.push('visitor');
	HTML.push('(); src=0.gif class=x></td><td style=padding-left:3px>Supprimer ce tag</td></tr>');
	HTML.push('<tr><td height=3> <tr><td><center><img style=cursor:pointer title="Ajouter un tag" onclick=document.forms.addform.submit(); src=../images/tick.png></td><td style=padding-left:3px><table><tr><td><img src=0.gif class=tag_input_left></td><td><input type=text onclick=');
	if (add=="1") HTML.push('overaddtag'); else HTML.push('visitor');
	HTML.push('() id=addtag name=addtag class=tag value="Ajouter un tag..."></td><td><img src=0.gif class=tag_input_right></td></tr></table></form></td></tr>');
	HTML.push('<tr><td height=3> <tr><td colspan=5><center><iframe id=colorpicker name=colorpicker style=display:none; src="about:blank" width=210 height=199 frameborder=0 scrolling=no></iframe></td></tr>');
	HTML.push('<tr><td colspan=5 class=framebottom><img class=framebottom src=0.gif></td></tr></table><br>');
	top.newshq.content.document.getElementById("divtag").innerHTML=HTML.join("");
}

function hide() {
	top.newshq.head.document.getElementById('d0').style.display="none";
	top.newshq.head.document.getElementById('e0').style.display="none";
	top.newshq.head.document.getElementById('o0').className="onglet";
	top.newshq.head.document.getElementById('d1').style.display="none";
	top.newshq.head.document.getElementById('e1').style.display="none";
	top.newshq.head.document.getElementById('o1').className="onglet";
	top.newshq.head.document.getElementById('d2').style.display="none";
	top.newshq.head.document.getElementById('e2').style.display="none";
	top.newshq.head.document.getElementById('o2').className="onglet";
	top.newshq.head.document.getElementById('d3').style.display="none";
	top.newshq.head.document.getElementById('e3').style.display="none";
	top.newshq.head.document.getElementById('o3').className="onglet";
	top.newshq.head.document.getElementById('d6').style.display="none";
	top.newshq.head.document.getElementById('e6').style.display="none";
	top.newshq.head.document.getElementById('o6').className="onglet";
	top.newshq.head.document.getElementById('d7').style.display="none";
	top.newshq.head.document.getElementById('e7').style.display="none";
	top.newshq.head.document.getElementById('o7').className="onglet";
	top.newshq.head.document.getElementById('d8').style.display="none";
	top.newshq.head.document.getElementById('e8').style.display="none";
	top.newshq.head.document.getElementById('o8').className="onglet";
}

function news_rss() { top.newshq.full.location.href=session("news_rss.php"); }
function news_alert() { 
	if (top.newshq.content.document.getElementById("tagtext").value.length==0) alert("Veuillez choisir un tag !");
	else { top.newshq.full.location.href=session("news_alert.php?action=add&tag="+top.newshq.content.document.getElementById("tagtext").value); }
}
function forbidden() { 
	if (top.newshq.content.document.getElementById("tagtext").value.length==0) alert("Veuillez choisir un tag !");
	else {
		var tags_color=top.newshq.list.document.getElementById("tags_color").value.split('¶');
		var tags_text=top.newshq.list.document.getElementById("tags_text").value.split('¶');
		for (i=0;i<tags_text.length;i++) {
			if (tags_text[i]==top.newshq.content.document.getElementById("tagtext").value) { id=i; break; }
		}
		if (tags_color[id]=="") tags_color[id]="CCCCCC"; else tags_color[id]="";
		top.newshq.list.document.getElementById("tags_color").value="";
		for (i=0;i<tags_color.length;i++) {
			if (i>0) top.newshq.list.document.getElementById("tags_color").value+='¶';
			top.newshq.list.document.getElementById("tags_color").value+=tags_color[i];
		}
		top.newshq.content.frameform.location.href=session("news_last.php?tag_forbidden="+top.newshq.content.document.getElementById("tagtext").value);
		top.newshq.list.document.getElementById('update').click();
	}
}
function del_rss(id) { if(confirm("Voulez-vous supprimer ce flux RSS ?")) { self.location.href=session("news_rss.php?del="+id); } }
function edit_rss(id) { self.location.href=session("news_rss.php?edit="+id); }

function member() { alert("Rubrique reservée aux membres. Inscrivez-vous ! :)"); }
function menu(id) {
	var tabs=top.newshq.head.document.getElementById("tabs").value.split('¶');
	var content=top.newshq.head.document.getElementById("content").value.split('¶');
	var list=top.newshq.head.document.getElementById("list").value.split('¶');
	top.newshq.head.document.getElementById("menuid").value=id;
	top.newshq.content.location.href="about:blank";
	top.newshq.list.location.href="about:blank";
	top.newshq.nav.location.href="about:blank";
	top.newshq.frames.document.getElementById('main').cols="0,0,0,*";
	for (i=0;i<tabs.length;i++) {
		document.getElementById('pipe_no_on_'+i).style.display="none";
		document.getElementById('pipe_no_off_'+i).style.display="none";
		document.getElementById('pipe_on_off_'+i).style.display="none";
		document.getElementById('pipe_off_on_'+i).style.display="none";
		document.getElementById('pipe_off_off_'+i).style.display="none";
		if (i==id) {
			if (i>0) document.getElementById('pipe_off_on_'+i).style.display="";
			else document.getElementById('pipe_no_on_'+i).style.display="";
			document.getElementById('onglet_on_'+i).style.display="";
			document.getElementById('onglet_off_'+i).style.display="none";
		} else {
			if (i==id+1) document.getElementById('pipe_on_off_'+i).style.display="";
			else if (i>0) document.getElementById('pipe_off_off_'+i).style.display="";
			else document.getElementById('pipe_no_off_'+i).style.display="";
			document.getElementById('onglet_off_'+i).style.display="";
			document.getElementById('onglet_on_'+i).style.display="none";
		}
	}
	if (id==tabs.length-1) {
		document.getElementById('end_on_no').style.display="";
		document.getElementById('end_off_no').style.display="none";
	} else {
		document.getElementById('end_off_no').style.display="";
		document.getElementById('end_on_no').style.display="none";
	}
	if (content[id].length>0) top.newshq.content.location.href=session(content[id]);
	if (list[id].length>0) {
		top.newshq.list.location.href=session(list[id]);
	}
}

function session(url) {
	s=""+Math.random();
	if (url.indexOf("?")>0) return(url+"&s="+s.substring(2,12));
	else return(url+"?s="+s.substring(2,12));
}

function visitor() { alert("Vous devez vous identifier pour profiter de cette fonction !"); }

function yesterday() {
	day=top.newshq.list.document.getElementById("period").value;
	day=Math.floor(day*1)-82800; day_date=new Date(day*1000); day_date.setHours(0); day=day_date.getTime()/1000;
	document.getElementById("tomorrow").style.display="";
	top.newshq.reload.location.href=session("news_select.php?detail="+top.newshq.list.document.getElementById("type_detail").value+"&tri="+top.newshq.list.document.getElementById("type_tri").value+"&day="+day); }

function gotomorrow() {
	day=top.newshq.list.document.getElementById("period").value;
	now=new Date();
	day=Math.floor(day*1)+90000; day_date=new Date(day*1000); day_date.setHours(0); day=day_date.getTime()/1000;
	test=now.getTime()/1000;
	next=Math.floor(day*1)+90000; next_date=new Date(next*1000); next_date.setHours(0); next=next_date.getTime()/1000;
	if (test<next) document.getElementById("tomorrow").style.display="none";
	top.newshq.reload.location.href=session("news_select.php?detail="+top.newshq.list.document.getElementById("type_detail").value+"&tri="+top.newshq.list.document.getElementById("type_tri").value+"&day="+day); }