

	
function targetLinks() {
	var site = location.hostname; 
	var str;
	var where;
	where="_blank";
	for(var i=0;i<=(document.links.length-1);i++) {
		str=document.links[i].href;
		if((str.search(site)==-1)
		   &&((str.search('http://')!=-1)
			||(str.search('https://')!=-1)
			||(str.search('ftp://')!=-1)
			)){
				document.links[i].target=where;
		}
	}
}

function editer(strURL,strType){

//	location.href='#URL_SITE_SPIP/ecrire/?exec=articles_edit&id_article=#ID_ARTICLE'
	var strOptions="";
	var strType="fixed";
	var strHeight=",height=700";
	var strWidth=",width=1000";
	
	if (strType=="console") strOptions="resizable"+strHeight+strWidth;
	if (strType=="fixed") strOptions="scrollbars,resizable,status"+strHeight+strWidth;
	if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location"+strHeight+strWidth;
	x = window.open(strURL, '_blank', strOptions);
	x.focus();
}

function montrerReload(){
	d=ut_objet("boutonReload");
	montrer(d);
}

function recalculer(){
	location.href = ut_ajouterAParam(location.href,"var_mode=recalcul");
}

function apercu(){
	location.href = ut_ajouterAParam(location.href,"var_mode=preview");
}

function ut_ajouterAParam(url,str){
	var re = RegExp(str);
	if (!re.test(url)){
		(url.indexOf('?') == -1) ? locationQuery = '?' : locationQuery = '&';
		url = url + locationQuery + str;
	}
	return url;
}

function creerArticle(rubrique){
	var url=location.href.substring(0, location.href.lastIndexOf('/'));
	var expression=/(ecrire)/;
	var ecrire=''; 
	if (expression.test(url)==false){
		ecrire='/ecrire';
	};
	editer(url + ecrire + '/?exec=articles_edit&id_rubrique='+rubrique+'&new=oui');
}

function creerRubrique(rubrique){
	var url=location.href.substring(0, location.href.lastIndexOf('/'));
	var expression=/(ecrire)/;
	var ecrire=''; 
	if (expression.test(url)==false){
		ecrire='/ecrire';
	};
	editer(url + ecrire + '/?exec=rubriques_edit&id_parent='+rubrique+'&new=oui&retour=nav');
}

function viderCache(){
	var fin=location.href.substring(0, location.href.lastIndexOf('/'));
	fin=fin.replace(/\/ecrire/,'');
	editer(fin+'/ecrire/?exec=admin_vider&amp;action=purger');
}

function basculer(obj){
	d=document;
	if(d.getElementById){d=d.getElementById(obj)}
	else {d=d.all[obj]}
	if(d.style){d=d.style}
	if(d.display=="none"){d.display="block"}
	else{d.display="none"}
}
	
function montrer(obj){
	d=document;
	if(d.getElementById){d=d.getElementById(obj)}
	else {d=d.all[obj]}
	if(d.style){d=d.style}
	if(d.display){d.display="block"}
}
	
function popUp(strURL,strType,strHeight,strWidth) {
	var strOptions="";
	if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth;
	if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
	if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
	window.open(strURL, 'newWin', strOptions);
}


function ut_selectionner(liste, valeur){
	// fonctionne avec un select (jamais test้ avec plusieurs valeurs)
	var i = 0 ;
	var nb = 0;
	if(liste){
		if (typeof(liste) == "object"){
			(isNaN(liste.length)) ?	nb = 0 : nb = liste.length ;
			while ( i < nb ){
				if (liste[i].value==valeur){ 
					liste.selectedIndex = i;
					break
				}// if
				i++;
			}// while
		}
	}
}// function

function ut_marquer(bRadio,valeur){
	// fonctionne avec un bouton radio et un checkbox (plusieurs valeurs)
	if(bRadio){
		if (isNaN(bRadio.length)){
			bRadio.checked=(bRadio.value==valeur) ;
		}
		else{
			for (var i = 0 ; i<bRadio.length ; i++){
				bRadio[i].checked=(bRadio[i].value==valeur) ;
			}
		}
	}
}


function ut_objet(objid){
	d=document
	if(d.all){d=d.all[objid]}
	else{d=d.getElementById(objid)}
	return d;
}

function ut_style(objid){
	d=ut_objet(objid)
	if(d){if(d.style){d=d.style}}
	return d;
}




// Fonction pour effacer le contenu par d&eacute;faut dans le champs de recherche
	function clearText(thefield){
		if (thefield.defaultValue==thefield.value)
		thefield.value = ""
		} 


