window.onload = function() {
	for(var i = 0, l = document.getElementsByTagName('input').length; i < l; i++) {
		if(document.getElementsByTagName('input').item(i).type == 'text') {
			document.getElementsByTagName('input').item(i).setAttribute('autocomplete', 'off');
		};
	};
};

var map=null;

function changer_diapo(my_url,diapositive_id)
{
	document.getElementById('texte_pub').innerHTML ='';
	document.getElementById('accueil_pub').style.background= "url("+my_url+"/images/pub"+diapositive_id+".jpg)";
	document.getElementById('titre_pub').innerText = document.getElementById('titre_hidden'+diapositive_id).innerText;
	document.getElementById('texte_pub').innerText = document.getElementById('texte_hidden'+diapositive_id).innerText;
	document.getElementById('texte_pub').innerHTML +=' <a href="#">En savoir +</a>';	
}

function lookup(inputString,my_url) {
	if(inputString.length == 0) {
		// Hide the suggestion box.
		$('#suggestions').hide();
	} else {
		$.post("?p=-1&url="+my_url+".php", {queryString: ""+inputString+""}, function(data){
			if(data.length >0) {
				$('#suggestions').show();
				$('#autoSuggestionsList').html(data);
			}
		});
	}
} // lookup


function fill(valeur) {
	document.form.nom.value=valeur;
	//setTimeout("$('#suggestions').hide();", 200);
	document.form.submit();
	}
	
function fill2(valeur, my_pays, my_editeur) {
	document.form.nom.value=valeur;
	i=0;
	while(document.forms.form.pays.options[i].value!=my_pays){
		i++;
	}
	j=0;
	while(document.forms.form.editeur.options[j].value!=my_editeur){
		j++;
	}
	document.getElementById('pays').selectedIndex=i;
	document.getElementById('editeur').selectedIndex=j;
	}
	
function cacher(){
	setTimeout("$('#suggestions').hide();", 200);
}

function supprimer(url){
	if (confirm ('Voulez vous vraiment supprimer cette ligne ?')){
		document.location.href=url;
	}
}

function raz(){
	document.form.nom.value = '';
	document.form.reseau.value = '';
	document.form.den.value = '';
	document.form.dev.value = '';
	document.form.region.value = '';
	document.form.jonction.value = 0;
	document.form.pays.value = 0;
	document.form.departement.value = 0;

	document.form.faire.value = '';
	document.form.cave_id.value = '';
	
	document.form.nom.focus();
}

function valider_cavite(){
	if(document.form.cave_id.value != ''){
		document.form.faire.value='edit';
	} else {
		document.form.faire.value='add';
	}
	document.form.submit();
}

//Changer la transparence de l'echo des vulcains quand on passe dessus
function set_opacity(id, opacity)
{
	el = document.getElementById("image"+id);
	el.style["filter"] = "alpha(opacity="+opacity+")";
	el.style["-moz-opacity"] = opacity/100;
	el.style["-khtml-opacity"] = opacity/100;
	el.style["opacity"] = opacity/100;
	
	Obj = document.getElementById("description"+id);
	if(opacity==100){
		Obj.style.background="#1c1204";
	} else {
		Obj.style.background="#0b0701";
	}
	
	Obj = document.getElementById("download"+id);
	if(opacity==100){
		Obj.style.background="#1c1204";
	} else {
		Obj.style.background="#0b0701";
	}

	return true;
}

function checkForm(){
	var Obj = $('.produit');
	var prix_total = 0;
	
	if(Obj){
		for(var i=0;i<Obj.length;i++){
			if(Obj[i].value > 0){
				var temp = Obj[i].id;
				var qte = parseInt(Obj[i].value);
				temp = parseInt(temp.replace("eur_",""));
				prix_total += (temp * qte);
			}
		}
	}
	
	var totalCommande = document.getElementById("total_commande");
	totalCommande.value = prix_total / 100;
	$('#frm_commande').submit();
}

  function initialize() {
    geocoder = new google.maps.Geocoder();
    var latlng1 = new google.maps.LatLng(45.7710579, 4.8008353);
    var latlng2 = new google.maps.LatLng(45.7720579, 4.7958353);
    var myOptions = {
      zoom: 15,
      center: latlng1,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById("map_canvas"),
        myOptions);
        
    var marker = new google.maps.Marker({
            map: map, 
            position: latlng2
        });
  }
  
$(document).ready(function() {
  alert("toto");
});
