var rubrique = ["", "gastronomie", "hebergement", "patrimoine", "sport", "detente", "divertissement", "territoire"];

function zoom_moins(){
	//alert("diminuer la taille du texte ! A FAIRE !!!!");
	var reg = new RegExp("px", "g");
	var tailleActuelle = document.body.style.fontSize;
	tailleActuelle = Number(tailleActuelle.replace(reg, ""));
			
	if(tailleActuelle>9){
		var newTaille = tailleActuelle-1;
		document.body.style.fontSize = newTaille + 'px';
	}else{
		var newTaille = tailleActuelle;
	}
	cookieTaille(newTaille);
}

function zoom_plus(){
	//alert("agrandir la taille du texte ! A FAIRE !!!!");
	var reg = new RegExp("px", "g");
	var tailleActuelle = document.body.style.fontSize;
	tailleActuelle = Number(tailleActuelle.replace(reg, ""));
			
	if(tailleActuelle<16){
		var newTaille = tailleActuelle+1;
		document.body.style.fontSize = newTaille + 'px';
	}else{
		var newTaille = tailleActuelle;
	}	cookieTaille(newTaille);
}


function cookieTaille(newTaille){	
	$.post('http://www.suisse-alsace.fr/cookieTaille.php',
		{
			taille:newTaille
		}
	);
}


function ajout_favori(){
  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
 	window.external.AddFavorite("http://www.suisse-alsace.fr","La Suisse d'Alsace"); 
  } else if (navigator.appName == "Netscape") {
    window.sidebar.addPanel("La Suisse d'Alsace","http://www.suisse-alsace.fr","");
  } else {
    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
  }

}

function imprimer(){
	window.print();
}	

function changeLangue(langue){
	var hr = window.location.href;
	if(hr.indexOf("?") != -1)
		hr += "&user_lang="+langue;
	else hr += "?user_lang="+langue;
	
	window.location.href = hr;
}

function allerCateg(num){
	window.location.href = 'http://www.suisse-alsace.fr/liste.php?type='+rubrique[num];
}

function allerAccueil(){
	window.location.href = 'http://www.suisse-alsace.fr/index.php';
}

function allerCarte(){
	window.location.href = 'http://www.suisse-alsace.fr/plan.php';
}

function allerMeteo(){
	window.location.href = 'http://www.suisse-alsace.fr/meteo.php';
}

function allerTelechargement(){
	window.location.href = 'http://www.suisse-alsace.fr/documents.php';
}

function ajouterFavoris(){
	
	$.post('http://www.suisse-alsace.fr/ajout_favoris.php',
		{
			name:cur_page_name,
			url:cur_page_url
		},
		function(data){
				 var ls = data.split(";;");
				if(ls[0] == "1") {
					appelFlash("flashTop").incrementerFavoris();
				}
				$("#contenuFenetreFavoris").html(ls[1]);
				$("#fenetreFavoris").slideDown("slow");	
				window.setInterval('$("#fenetreFavoris").slideUp("slow")', 5000);
		}
	);
}

function afficherPartage(){
	if ($("#fenetrePartage").is(":hidden")) {
		$("#fenetrePartage").slideDown("slow");	
	}
	else {
		$("#fenetrePartage").slideUp("slow");		
	}
}


function appelFlash(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
    }
    else {
	    return document[movieName];
    }
} 

function lancerRecherche(searchText){
	window.location.href = 'http://www.suisse-alsace.fr/search.php?recherche='+searchText;

}

function allerFavoris(){
	window.location.href = 'http://www.suisse-alsace.fr/favoris.php';
}

function partagePage(lien_1,page_1){
	
	var mon_nom_1 = $('#mon_nom').val();
	var mon_email_1 = $('#mon_email').val();
	var ami_1 = $('#ami').val();
	var ami_email_1 = $('#ami_email').val();
	
	var send = 1;
	/*var message_erreur = 'Le (ou les) suivants ne sont pas renseigné :';
	if(mon_nom_1 =='') 
	{
		send = 0;
		message += '';
	}
	*/
	if (send != 0)
	{
		$.post('http://www.suisse-alsace.fr/form/form_partage.php',
			{
				lien:lien_1,
				page:page_1,
				mon_nom:mon_nom_1,
				mon_email:mon_email_1,
				ami:ami_1,
				ami_email:ami_email_1
			},
			fermerPartage()
		);
	}
}

function fermerPartage(){
	$("#fenetrePartage").slideUp("slow");	
	$("#fenetreMerciPartage").slideDown("slow");	
	window.setInterval('$("#fenetreMerciPartage").slideUp("slow")', 5000);
}

function fermerErreur(){
	$("#fenetreErreur").slideUp("slow");
}

function ouvrirMarker(){
	marker.openInfoWindowHtml(contenus);
}