//window.onunload = clean();
//var urldoc = String(document.location); if(urldoc.substring(0,31)!='http://www.archiwwweb.com'){document.location='http://www.archiwwweb.com/'}
if (parent.frames.length > 0){window.top.location.href = location.href;}
function overlayHide(){opacity('overlayContent', 100, 0, 1000);obj1=document.getElementById('overlay');obj1.className='';obj2=document.getElementById('overlayContent');obj2.className='';document.getElementById('overlayContent').innerHTML='';}
function overlayShow(){obj1=document.getElementById('overlay');obj1.className='overlay';obj2=document.getElementById('overlayContent');obj2.className='overlayContent';}
function voteplus(x){var xhr=null;if(window.XMLHttpRequest){xhr=new XMLHttpRequest();}
else if(window.ActiveXObject){xhr=new ActiveXObject("Microsoft.XMLHTTP");}
xhr.open("GET","http://www.archiwwweb.com/util/ajax/annu-hit-plus.php?url="+x,false);xhr.send(null);document.getElementById('div_vote').innerHTML='Votre vote a ete pris en compte.<br/>Merci de votre participation.<br/>'+xhr.responseText+' votes pour ce site.';}
function votemoins(x){var xhr=null;if(window.XMLHttpRequest){xhr=new XMLHttpRequest();}
else if(window.ActiveXObject){xhr=new ActiveXObject("Microsoft.XMLHTTP");}
xhr.open("GET","http://www.archiwwweb.com/util/ajax/annu-hit-moins.php?url="+x,false);xhr.send(null);document.getElementById('div_vote').innerHTML='Votre vote a ete pris en compte.<br/>Merci de votre participation.<br/>'+xhr.responseText+' votes pour ce site.';}
function msgedit(x,y){var xhr=null;if(window.XMLHttpRequest){xhr=new XMLHttpRequest();}
else if(window.ActiveXObject){xhr=new ActiveXObject("Microsoft.XMLHTTP");}
xhr.open("GET","http://www.archiwwweb.com/util/ajax/getMsgForum.php?id="+x+"&idp="+y,false);xhr.send(null);obj=document.getElementById("edito");document.getElementById("block_form").innerHTML='';obj.innerHTML=xhr.responseText;tinyMCE.init({mode:"textareas",theme:"advanced",plugins:"safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount",theme_advanced_buttons1:"save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",theme_advanced_buttons2:"cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,|,insertdate,inserttime,preview,|,forecolor,backcolor",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",theme_advanced_statusbar_location:"bottom",theme_advanced_resizing:true,content_css:"css/content.css",template_external_list_url:"lists/template_list.js",external_link_list_url:"lists/link_list.js",external_image_list_url:"lists/image_list.js",media_external_list_url:"lists/media_list.js",template_replace_values:{username:"archiwwweb",staffid:"06011966"}});}
function affichoutil(x,y){obj=document.getElementById("editbox"+x);obj.innerHTML="<input type='button' value='editer' id='feditbutton' onclick='msgedit(\""+x+"\","+y+");'><input type='button' value='citer' id='fquotebutton' onclick='msgquote(\""+x+"\","+y+");'><input type='button' value='delete' id='fdelbutton' onclick='msgdelete(\""+x+"\","+y+");'>";}
function msgdelete(x,y){if(confirm("Vous etes sur le point de detruire ce message.")){var xhr=null;if(window.XMLHttpRequest){xhr=new XMLHttpRequest();}
else if(window.ActiveXObject){xhr=new ActiveXObject("Microsoft.XMLHTTP");}
xhr.open("GET","http://www.archiwwweb.com/util/ajax/delMsgForum.php?id="+x+"&idp="+y,false);xhr.send(null);obj=document.getElementById("editbox"+x);obj.innerHTML=xhr.responseText;setTimeout(document.location.replace(document.location.href),3000);}}
function msgquote(x,y){var xhr=null;if(window.XMLHttpRequest){xhr=new XMLHttpRequest();}
else if(window.ActiveXObject){xhr=new ActiveXObject("Microsoft.XMLHTTP");}
xhr.open("GET","http://www.archiwwweb.com/util/ajax/getMsgQuoteForum.php?id="+x+"&idp="+y,false);xhr.send(null);obj=document.getElementById("message_forum");ed=window.tinyMCE.get("message_forum");ed.setContent(ed.getContent()+"\n<div class=\"quote\">"+xhr.responseText+"</div><br/>\n");}
function confirmeUrl(){var urlRE=/^(http|https)\:\/\/[a-zA-Z0-9\-\.]*\/$/;if(!urlRE.test(document.getElementById("site").value)){alert(document.getElementById("site").value+' non valable.'+'\n'+'Votre adresse de site doit commencer par http ou https et comprendre le caractere / e la fin.'+'\n'+'Vous ne pouvez pas donner d\'Url interne ou de sous dossiers.');return false;}
return true;}
function confirmeAvatar(){var urlRE=/^(http|https)\:\/\/[a-zA-Z0-9\-\.\/\_]*(\.gif|\.jpg|\.jpeg|\.png|\.GIF|\.JPG|\.JPEG|\.PNG)$/;if(!urlRE.test(document.getElementById("url_avatar").value)){alert(document.getElementById("url_avatar").value+' non valable.');return false;}
return true;}
function confirmeMail(){var urlRE=/^[a-zA-Z0-9\-\.\_]+@[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}||museum||travel)$/;if(!urlRE.test(document.getElementById("mail").value)){alert(document.getElementById("mail").value+' non valable.'+'\n'+'Votre mail peut contenir "-", "_" et "." Les autres caracteres ne sont pas admis.');return false;}
return true;}
var clientPC=navigator.userAgent.toLowerCase();var clientVer=parseInt(navigator.appVersion);var is_ie=((clientPC.indexOf("msie")!=-1)&&(clientPC.indexOf("opera")==-1));var is_nav=((clientPC.indexOf('mozilla')!=-1)&&(clientPC.indexOf('spoofer')==-1)&&(clientPC.indexOf('compatible')==-1)&&(clientPC.indexOf('opera')==-1)&&(clientPC.indexOf('webtv')==-1)&&(clientPC.indexOf('hotjava')==-1));var is_moz=0;var is_win=((clientPC.indexOf("win")!=-1)||(clientPC.indexOf("16bit")!=-1));var is_mac=(clientPC.indexOf("mac")!=-1);function confirme(Message){if(Message==""){alert('Vous devez completer votre page !!');return false;}else{document.FEDITO.submit();return true;}}
function insert(icon){document.FEDITO.message.value=document.FEDITO.message.value+icon;document.FEDITO.message.focus();}
function bbfontstyle(bbopen,bbclose,txtzone){var txtarea=txtzone;if((clientVer>=4)&&is_ie&&is_win){theSelection=document.selection.createRange().text;if(!theSelection){txtarea.value+=bbopen+bbclose;txtarea.focus();return;}
document.selection.createRange().text=bbopen+theSelection+bbclose;txtarea.focus();return;}else if(txtarea.selectionEnd&&(txtarea.selectionEnd-txtarea.selectionStart>0)){mozWrap(txtarea,bbopen,bbclose);return;}else{txtarea.value+=bbopen+bbclose;txtarea.focus();}
storeCaret(txtarea);}
function mozWrap(txtarea,open,close){var selLength=txtarea.textLength;var selStart=txtarea.selectionStart;var selEnd=txtarea.selectionEnd;if(selEnd==1||selEnd==2)
selEnd=selLength;var s1=(txtarea.value).substring(0,selStart);var s2=(txtarea.value).substring(selStart,selEnd)
var s3=(txtarea.value).substring(selEnd,selLength);txtarea.value=s1+open+s2+close+s3;return;}
function suprimepage(x){var answer=confirm("Supprimer la page "+x+" ?")
if(answer){alert("Votre derniere chance de concerver cette page est de ne pas cliquer sur OK et de fermer votre navigateur (Ctrl alt Sup sous windows ou Kill sous Nux) passe cette etape, la page en cour sera definitivement supprimee.");var xhr=null;if(window.XMLHttpRequest){xhr=new XMLHttpRequest();}
else if(window.ActiveXObject){xhr=new ActiveXObject("Microsoft.XMLHTTP");}
xhr.open("GET","http://www.archiwwweb.com/util/ajax/deletePage.php?id="+x+"&file=",false);xhr.send(null);obj=document.getElementById("delete");obj.value=xhr.responseText;}else{alert("Fausse manipe pas de panique");}}
function preview(x,type){obj=document.getElementById("edito");text=formate_text(x);if(type==2){obj.innerHTML=obj.innerHTML+text;}else{obj.innerHTML=text;}}
function assigner(x,y){var xhr=null;if(window.XMLHttpRequest){xhr=new XMLHttpRequest();}
else if(window.ActiveXObject){xhr=new ActiveXObject("Microsoft.XMLHTTP");}
xhr.open("GET","http://www.archiwwweb.com/util/ajax/assigne-bloc.php?bloc="+document.getElementById('bloc'+y).value+"&page="+x+"&ordre="+y,false);xhr.send(null);obj=document.getElementById("BA"+y);obj.innerHTML=xhr.responseText;}
window.onload=montre;function montre(id){var d=document.getElementById(id);for(var i=0;i<=100;i++){if(document.getElementById('smenu'+i)){document.getElementById('smenu'+i).style.display='none';}}
if(d){d.style.display='block';}}
function masque(id){document.getElementById(id).style.display='none';}
function masquemod(id){if(document.getElementById('bloc_'+id).style.display=='none'){document.getElementById('bloc_'+id).style.display='block';document.getElementById('img_'+id).src='http://www.archiwwweb.com/images/folder-collapse.gif';}else{document.getElementById('bloc_'+id).style.display='none';document.getElementById('img_'+id).src='http://www.archiwwweb.com/images/folder-expand.gif';}}
function saveMiniature(x){
	var xhr=null;
	if(window.XMLHttpRequest){xhr=new XMLHttpRequest();}
	else if(window.ActiveXObject){xhr=new ActiveXObject("Microsoft.XMLHTTP");}
	xhr.open("GET","http://www.archiwwweb.com/util/ajax/getMiniature.php?url="+x,false);
	xhr.send(null);
	obj=document.getElementById(x);
	obj.innerHTML =xhr.responseText;
}
function SetDescCommune(x){
    document.getElementById('ApportDescCommune').src = 'http://www.archiwwweb.com/form/complement-commune.php?insee='+x;
    document.getElementById('ApportDescCommune').className = 'ApportDescCommune';
    document.getElementById('ApportDescCommune').style.width='590px';
	document.getElementById('ApportDescCommune').style.height='600px';
    document.getElementById('closeLink').style.display='block';
}
function HideFrom(){
    document.getElementById('ApportDescCommune').src = '';
    document.getElementById('ApportDescCommune').className = 'FrameDateWait';
    document.getElementById('ApportDescCommune').style.width='0px';
	document.getElementById('ApportDescCommune').style.height='0px';
    document.getElementById('closeLink').style.display='none';
}
function doSocialFrame(x,y){
	document.getElementById('SocialFrame').src='http://www.archiwwweb.com/util/social.php?page=http://www.archiwwweb.com' + x + '&titre=' + y;
	document.getElementById('SocialFrame').style.width='300px';
	document.getElementById('SocialFrame').style.height='150px';
}
function testPub(){
	var block = true;
	for(i=0;i<10;i++){
		if(document.getElementById('ads_header').childNodes[i]){
			if(document.getElementById('ads_header').childNodes[i].nodeName == 'INS'){block = false;}
		}
	}
	if(block){alert('pub bloquée');}
}
function epinglepage(x){var answer=confirm("Epingler le sujet "+x+" ?")
	if(answer){var xhr=null;if(window.XMLHttpRequest){xhr=new XMLHttpRequest();}
	else if(window.ActiveXObject){xhr=new ActiveXObject("Microsoft.XMLHTTP");}
	xhr.open("GET","http://www.archiwwweb.com/util/ajax/epinglePage.php?id="+x,false);xhr.send(null);obj=document.getElementById("post_it"+x);obj.value=xhr.responseText;}else{alert("Fausse manipe pas de panique");}}
function panierAjouter(x){
	overlayShow();
	var xhr=null;
	if(window.XMLHttpRequest){xhr=new XMLHttpRequest();}
	else if(window.ActiveXObject){xhr=new ActiveXObject("Microsoft.XMLHTTP");}
	xhr.open("GET","http://www.archiwwweb.com/util/ajax/addPanier.php?item="+x,false);
	xhr.send(null);
	obj=document.getElementById('overlayContent');
	obj.innerHTML =xhr.responseText;
	opacity('overlayContent', 0, 100, 1000);
}
function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 10;
	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 changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}
function addPanier(x,y){
	overlayHide();
	var xhr=null;
	if(window.XMLHttpRequest){xhr=new XMLHttpRequest();}
	else if(window.ActiveXObject){xhr=new ActiveXObject("Microsoft.XMLHTTP");}
	xhr.open("GET","http://www.archiwwweb.com/util/ajax/addPanierSession.php?item="+x+"&count="+y,false);
	xhr.send(null);
}
function clean(){
	opacity('globale', 0, 100, 1000);
}


