function show_about(){
	$("#about").slideToggle(1200);
}

function show_image(image, width, height){
	var ratio = width/height;
	if (width > screen.width){
		width = screen.width;
		height = width/ratio;
	}
	if (height > screen.height){
		height = screen.height;
		width = height*ratio;
	}
	window.open('galerie_image.php?image='+image+'&width='+width+'&height='.height,'_blank','toolbar=0, location=0, directories=0, status=0, scrollbars=auto, resizable=yes, copyhistory=0, menuBar=0, width='+width+', height='+height+', left=20, top=20');
}

function openPopup(page, width, height){
	window.open(page,'_blank','toolbar=0, location=0, directories=0, status=0, scrollbars=1, resizable=0, copyhistory=0, menuBar=0, width='+width+', height='+height+', left=200, top=80');
}

function showpage(id){
	if (id == 0){
		document.location.href = '/index.php';
		return;
	}
	document.location.href = 'page.php?id='+id;
}

function checksearch(formulaire){
	if (formulaire.search_string.value.length < 4){
		alert('Les critères de recherche doivent contenir au minimum 4 caractères.');
		formulaire.search_string.select();
		return false;
	}
	if (formulaire.search_string.value=='Recherche sur le site...'){
		alert('Veuillez saisir un ou plusieurs mots-clés dans le champ de recherche.');
		formulaire.search_string.select();
		return false;
	}
	return true;
}

// 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;
}

function printPage(titre)
{
	var startPrintMark = "<!-- STARTPAGEPRINT -->" ;
	var endPrintMark = "<!-- ENDPAGEPRINT -->" ;
	var startButtonMark = "<!-- STARTBUTTONPRINT -->" ;
	var endButtonMark = "<!-- ENDBUTTONPRINT -->" ;
	var ladate=new Date()

	var source = document.body.innerHTML ;
	source = source.substr(source.indexOf(startPrintMark) + startPrintMark.length) ;
	source = source.substr(0, source.indexOf(endPrintMark)) ;

	//source = source.substr(0, source.indexOf(startButtonMark)) + source.substr(source.indexOf(endButtonMark)+endButtonMark.length);

	var win = window.open("",null,"height=600,width=850,status=0, scrollbars=1,toolbar=0,menubar=1,location=0, resizable=1;");

	win.document.open();
	win.document.write('<html><head><link rel="stylesheet" href="style/style_print.php" type="text/css" />');

	win.document.write('<script type="text/javascript" src="tooltip/ajax-dynamic-content.js"></script><script type="text/javascript" src="tooltip/ajax.js"></script><script type="text/javascript" src="tooltip/ajax-tooltip.js"></script><link rel="stylesheet" href="tooltip/ajax-tooltip.css" media="screen" type="text/css">') ;

	//titre = 'Titre de la page';
	win.document.write('</head>') ;
	win.document.write('<body onload="window.print();">') ;
	if (titre){
		win.document.write('<div class="titre_paragraphe" style="border-bottom: 1px solid #2A6CBD;">') ;
		win.document.write(titre) ;
		win.document.write('</div><br />') ;
	}
	win.document.write(source) ;
	win.document.write('<div align="center" style="color: #2A6CBD;"><hr style="height: 1px; margin-top: 30px; color: #2A6CBD;">&copy; '+ladate.getFullYear()+' Commune de Veysonnaz</div>');
	win.document.write('</body></html>') ;
	win.document.close();
}

function show_image(image, width, height){
	var ratio = width/height;
	if (width > screen.width){
		width = screen.width;
		height = width/ratio;
	}
	if (height > screen.height){
		height = screen.height;
		width = height*ratio;
	}
	window.open('galerie_image.php?image='+image+'&width='+width+'&height='.height,'_blank','toolbar=0, location=0, directories=0, status=0, scrollbars=auto, resizable=yes, copyhistory=0, menuBar=0, width='+width+', height='+height+', left=20, top=20');
}

function panier(){
	$.ajax({
	  type: "POST",
	  url: "session_basket.php",
	  data: "basket=true",
	  success: function(msg){
	    //alert( "Data Saved: " + msg );
	  }
	});
}