// JavaScript Document


function change_image(r){
	var ShowItem = document.getElementById("carte");

	ShowItem.style.backgroundImage = 'url(images/carte/'+ r +'.png)';
}

function hide_image(r) {

	var ShowItem = document.getElementById("carte");

	ShowItem.style.backgroundImage = 'url(images/carte/none.png)';
}
function preload_image(_image) {

	var image = new Image;

	image.src = _image;
}

            $(function(){
                $("#mail_form").corner("dog").corner("round 20px");
                $("#submitt").corner("dog").corner("round 10px");
                $("#form").corner("dog").corner("round 10px");
                $("#recherche").corner("dog").corner("wicked 15px");
                $("#departement-label").hide();
                $("#departement").hide();
                $('#region').prepend($("<option></option>").attr("selected", "selected").text("Choisir votre Région"));
                $('#categories_animaux').prepend($("<option></option>").attr("selected", "selected").text("Choisir une Catégorie"));

        $("#region").change(function(){
                $value = $("#region option:selected").val();
                $.post("/Async/getregion", {'id':$value}, function(data){
                $("#departement-label").show();
                $("#departement").show().empty();

                $.each(data, function(i, val) {
                      $('#departement').append($("<option></option>").attr("value",val).text(val));
                    });


                }, 'json');
              });

                $("#races_animaux-label").hide();
                $("#races_animaux").hide();
        $("#categories_animaux").change(function(){
                $value = $("#categories_animaux option:selected").val();
                $.post("/Async/getcat", {'id':$value}, function(data){
                $("#races_animaux-label").show();
                $("#races_animaux").show().empty();

                $.each(data, function(i, val) {
                $('#races_animaux').append($("<option></option>").attr("value",i).text(val));
                });
            }
                , 'json');
              });

                $("#departementr-label").hide();
                $("#departementr").hide();
                $('#regionr').prepend($("<option></option>").attr("selected", "selected").text("Choisir une Région"));
                $('#animauxr').prepend($("<option></option>").attr("selected", "selected").text("Choisir une Catégorie"));
$("#regionr").change(function(){
                $value = $("#regionr option:selected").val();
                $.post("/Async/getregion", {'id':$value}, function(data){
                $("#departementr-label").show();
                $("#departementr").show().empty();

                $.each(data, function(i, val) {
                      $('#departementr').append($("<option></option>").attr("value",val).text(val));
                    });


                }, 'json');
              });

                $("#races_animauxr-label").hide();
                $("#races_animauxr").hide();
        $("#animauxr").change(function(){
                $value = $("#animauxr option:selected").val();
                $.post("/Async/getcat", {'id':$value}, function(data){
                $("#races_animauxr-label").show();
                $("#races_animauxr").show().empty();

                $.each(data, function(i, val) {
                $('#races_animauxr').append($("<option></option>").attr("value",i).text(val));
                });
            }
                , 'json');
              });
	$("area").mouseover(function() {

		var chaine = $(this).attr("alt");




		document.getElementById("regannonce").innerHTML = chaine;


                });
	$("area").mouseout(function() {
		document.getElementById("regannonce").innerHTML = 'Cliquez sur une région <span style="text-decoration: blink;">></span>';


                });


              });



