var dir_http = "http://capinfo5.ecritel.net/batiactu.com/";

function Remplacer_dans_chaine(chaine,car_from, car_to){
	var reg=new RegExp(car_from, "g");
	tmp = chaine;
	tmp = tmp.replace(reg,car_to);

 	return tmp;
} 
function open_last_news(){
	url=dir_http+"newsletter/derniere-newsletter.html";
	var pop= window.open(url, "newsletter", "height=600,width=800,resizable=yes,scrollbars=yes,menubar=yes,location=yes");
	pop.focus();
	
}
function show_zoom(url,id_photo,id_edito){
	url_zoom = dir_http+"zoom.php?photo="+url;
	if(id_photo!=null){
		url_zoom+="&id_photo="+id_photo+"&id_edito="+id_edito;
	}
	openpopup(url_zoom, 'zoom_photo',800,600,'yes','yes');
}
function openpopup(url,windowname,sizex,sizey,sizable,scrollable)
{
	var pop= window.open(url, windowname, "height="+sizey+",width="+sizex+",resizable="+sizable+",scrollbars="+scrollable+",menubar=no");
	pop.focus();
}
function imprime_article(url){

	openpopup(dir_http+"imprimer.php?url="+url,'imprime',800,600,'yes','yes');

}
function transmet_article(e,url){
	
	openpopup(dir_http+"transmettre.php?e="+e+"&url="+url,'imprime',800,600,'yes','yes');
	
}
function imprime_dossier(url){

	openpopup(dir_http+"imprimer.php?url="+url,'imprime',800,600,'yes','yes');

}
function transmet_dossier(d,url){
	
	openpopup(dir_http+"transmettre.php?d="+d+"&url="+url,'imprime',800,600,'yes','yes');
	
}
function checkStringLen (string, min, max, msg) {
  var sValue = true;
  if ((min > 0) && (string.length < min)) sValue = false;
  if ((max > 0) && (string.length > max)) sValue = false;
  if (!sValue) alert(msg);
  return sValue;
}
function checkFilter (string, filter) {
  if (filter.test(string)) sValue = true;
  else {
    sValue = false;
  }
  return sValue;
}
function checkMail(string){
	if (!checkFilter(string, /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z]){2,6}$/)){
		return false	
	}
	else {
		return true;
	}
}
function write_div(msg,div){
	document.getElementById(div).innerHTML = msg;
}
