// <![CDATA[

$(document).ready(function(){
	/*-----------------------MAIN FRAME----------------*/
	jQuery("#contentarea").load("./pages/accueil.html");
	jQuery("#accueil").css({
                           "background-color": "#f4f4f4"
                        });

    /*----------------- DELICIOUS-----------------------*/
   /* jQuery.ajax({
        url: "getDelicious.php",
        cache: false, // pour que les navigateur ne stockent pas la page !
        dataType: "xml",
        success: function(_xml){
       var v_html = "<ul class='list_forma'>";
            jQuery(_xml).find('item').each(function(){
            
                v_html += '<li><a href="' + jQuery(this).find('link').text() + '" onclick="window.open(this.href); return false;"> ' + jQuery(this).find('title').text() + ' </a></li>';
                
            });
			v_html += "</ul>";
            jQuery("#delicious").html(v_html);
            
        }
    });*/
	
	
});

function _tagcloud(){
jQuery('#tagcloud').slideToggle(300);
}

function _navig(_page){
jQuery("#hfeed").load("./pages/"+_page+".html");
						jQuery("#who").css({
                           "color": "#E4265A", "border-bottom" : 0						 
                        });
						jQuery("#competences").css({
						"color": "#E4265A"
						});
							jQuery("#projets").css({
						"color": "#E4265A"
						});
						jQuery("#contact").css({
						"color": "#E4265A"
						});
						jQuery("#contact").css({
                          "color": "#E4265A"					 
                        });
						
	jQuery("#"+_page).css({
                           "color": "#444",
						   "border-bottom" : "1px dotted #ccc"						 
                        });
						
}

/*#########################################################FORMULAIRE###################################"*/
function f_test(x){
    //si on clique sur envoyer !
	for(var _ij=0; _ij<5; _ij++){
				jQuery("#asterix_"+_ij).html(" ");
			}
  
        var tab = new Array;
        if (document.getElementById("input_nom").value == "") {
		tab.push("Le champ message n'est pas valide");
	                    document.getElementById("asterix_0").innerHTML = " *";
        }
        if (document.getElementById("input_prenom").value == "") {
		tab.push("Le champ message n'est pas valide");
                        document.getElementById("asterix_1").innerHTML = " *";
        }
        
        
        
        var v_mail = document.getElementById("input_email").value;
        //ou v_mail.indexOf("@") renvoi la place du caractere ds la chaine ou -1 s'il n'y en a pas
        if (v_mail == "" || v_mail.match(/^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,3}$/) == null) {
		tab.push("Le champ message n'est pas valide");
                 document.getElementById("asterix_2").innerHTML = " *";
        }
        
        if (document.getElementById("input_obj").value == "") {
		tab.push("Le champ message n'est pas valide");
                document.getElementById("asterix_3").innerHTML = " *";
        }
        
        if (document.getElementById("input_message").value == "") {
            tab.push("Le champ message n'est pas valide");
            document.getElementById("asterix_4").innerHTML = " *";
        }
        
        if (tab.length == 0) {
			jQuery("#missfield").html(" ");
			for(var _ij=0; _ij<5; _ij++){
				jQuery("#asterix"+_ij).html(" ");
			}
            var _prenom = document.getElementById("input_prenom").value;
            var _nom = document.getElementById('input_nom').value;
            var _message = document.getElementById('input_message').value;
            var _mail = document.getElementById('input_email').value;
            var _obj = document.getElementById('input_obj').value;
            jQuery.ajax({
                type: "POST",
                url: "./envoi.php",
                data: "input_nom=" + _nom + "&input_prenom=" + _prenom + "&input_email=" + _mail + "&input_obj=" + _obj + "&input_message=" + _message,
                success: function(_msg){
                    jQuery('#form_contact').html(_msg);
                }
            });
        }
        else {
        
            tab = tab.join("\n");
            jQuery("#missfield").html("* Veuillez remplir tous les champs.");
            return false;
        }
    
     
}

/*################# FIN FORMULAIRE ##################### */

/*###################### PROJET ######################### */

function switchProjet(_ref){
    jQuery(".titre_projet").css({
        "display": "inline",
        "margin": "0 10px 10px 10px",
        "font-size": "1.1em",
        "text-decoration": "underline"
    });
    jQuery("#" + _ref.id).css({
        "text-decoration": "none"
    });
    jQuery("#contenu").load("./pages/" + _ref.id + ".html");
    
}

/*------------ POP UP CSS-------------------*/
function hideDiv(_x){
    if (document.getElementById) { // DOM3 = IE5, NS6 
        document.getElementById('hideshow' + _x).style.visibility = 'hidden';
    }
    else {
        if (document.layers) { // Netscape 4 
            document.hideshow.visibility = 'hidden';
        }
        else { // IE 4 
            document.all.hideshow.style.visibility = 'hidden';
        }
    }
}

function showDiv(_x){
    if (document.getElementById) { // DOM3 = IE5, NS6 
        document.getElementById('hideshow' + _x).style.visibility = 'visible';
    }
    else {
        if (document.layers) { // Netscape 4 
            document.hideshow.visibility = 'visible';
        }
        else { // IE 4 
            document.all.hideshow.style.visibility = 'visible';
        }
    }
}

// ]]>

