function Popup(url, width, height, left, top){
	
	if (left == 0){
		left = (screen.width - width) / 2;
	}
	if (top == 0){
		top = (screen.height - height) / 2;
	}
	
	window.open(url,'_blank','toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, copyhistory=0, menuBar=0, width='+width+', height='+height+', left='+left+', top='+top+'');

}

function changeImg(src){
   var x = document.getElementById('img_theme') ;
   x.style.background = "url(" + src + ")" ;
}



/* CHANGEMENT DE TAILLE DE POLICE DANS UN BLOC */
var taille_texte=11;
function diminue(z){
	var elem = document.getElementById(z);
	if(taille_texte>8 && elem){
		taille_texte=taille_texte-1;
		pixel=taille_texte+"px";
		elem.style.fontSize = pixel;
	}
}
function augmente(z){
	var elem = document.getElementById(z);
	if(taille_texte<36 && elem){
		taille_texte++;
		pixel=taille_texte+"px";
		elem.style.fontSize = pixel;
	}
}

function OpenWindowPopup(str){
	win=window.open(str,'OpenWindowPopup','scrollbars=yes,resizable=yes,width=650,height=600,status=no,location=no,toolbar=yes');
}

function GoogleMapPopup(lat, lng, adresse, titre){

	var width = 660;
	var height = 450;
	var left = (screen.width - width) / 2;
	var top = (screen.height - height) / 2;

	var href = '/scripts/php/map.php?lat='+lat+'&lng='+lng+'&add='+adresse+'&title='+titre;
	window.open(href,'_blank','toolbar=0, location=0, directories=0, status=1, scrollbars=0, resizable=0, copyhistory=0, menuBar=0, width='+width+', height='+height+', left='+left+', top='+top+'');
}

// contrôle de validité d'une adresse email
function isEmail(string) {
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i

	if (filter.test(string))
		return true;
	else
		return false;
}

// Lit le contenu de la page courante avec Dixerit
function Vocalise(langue){
	var page = document.location;
	page = escape(document.location);
	window.open('http://voice.dixerit.com/nyon_chdix?lang='+langue+'&url='+escape(document.location),'dixerit','width=300, height=120, top=80, left=800');
}

