/* gestion images png avec ie 6 */

var MStourisme = {};

MStourisme.display = {
  "alphaBackgrounds" : function (e) {
    var bg = e.currentStyle.backgroundImage;
    if (bg.match(/\.png/i) != null && e.hasClassName("trans")) { 
      var mypng = bg.substring(5,bg.length-2);
      e.setStyle({  
        filter : "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + mypng + "', sizingMethod='" + (e.currentStyle.backgroundRepeat == "no-repeat" ? "crop" : "scale") + "')",
        backgroundImage : "none"}); 
    }
  },

  "fnLoadPngs" : function (img){
    if (img.src.match(/\.png$/i) != null) {
      var src = img.src;
      var div = document.createElement("DIV");    
      div.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizing='scale')";
      div.style.width = img.width + "px";
      div.style.height = img.height + "px";
      img.replaceNode(div); 
    }
  },

  "swapBg" : function (el) {
    var position = "top";
    if (!el.style.backgroundPosition.match(/bottom/gi)) position = "bottom";
    el.setStyle({ backgroundPosition: "left " + position });
  }

};

document.observe("dom:loaded", function() {
  if (Prototype.Browser.IE) {
    var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, "");
    if (rslt != null && Number(rslt[1]) >= 5.5 && Number(rslt[1]) < 7) {
      $$("*").each(MStourisme.display.alphaBackgrounds);
      $$("img.trans").each(MStourisme.display.fnLoadPngs);
    }
  }
});


MStourisme.candidaturespontanee = {
  'button':null,
 
  'onSubmit' : function(args){
    var msg ="";
    if($F('fieldsnom').empty()){
     msg+="Champ Requis : Nom \n"; 
    }  
    if($F('fieldsprenom').empty()){
      msg+="Champ Requis : Prenom \n";
    }
    if($F('fieldsville').empty()){
      msg+="Champ Requis : Ville \n";
    }
    if($F('fieldsemail').empty()){
      msg+="Champ Requis : Email \n";
    }
    if($F('fieldsphone').empty()){
      msg+="Champ Requis : Telephone \n";
    }
    if($F('fieldsdispo').empty()){
      msg+="Champ Requis : Disponibilite \n";
    }
    if($F('fieldsrenum').empty()){
      msg+="Champ Requis : Derniere renumeration \n";
    }
    if(!($('fields_postulate_oui').checked || $('fields_postulate_non').checked)){
      msg+="Champ Requis : Avez-vous déjà postulé ? \n";
    }
    if((!$('fields_postulate_oui').checked) && ($F('fieldsdatepostulate').empty() || $('fieldsdatepostulate').value=="mm/aaaa")){
      msg+="Champ Requis : Date \n";
    }
    
    if($F('fieldssource').empty()){
      msg+="Champ Requis : Source \n";
    }
    if($F('fieldscv').empty()){
      msg+="Champ Requis : CV \n";
    }
    


    if(msg!=""){
      alert(msg);   
    return false;
    }
    return true;
  }
}


MStourisme.commande = {
  'button' : null,
  'onSubmit' : function(args) {
    //alert(args);
    if(MStourisme.commande.verifform()){
      MStourisme.commande.button = $(args).select("input[type=submit]")[0];
      MStourisme.commande.button.disable();
      Kwo.exec('/mstourisme/place.order.mail',args,{"callback":MStourisme.commande.onCallBack});
    }
  },
  'onCallBack' : function(h) {
      MStourisme.commande.button.enable();
      if(h["error"]>0){
        Kwo.error(h["result"]["msg"]);
      }else{
        //Kwo.warn(h["result"]["alert"]);
        $('kwo-mstourisme-boxdroit').update(h["result"]["alert"]);
      }
  },
  'verifform' : function(){
    var msg="";
    if($F('fieldssociete').empty()){
      msg+="Champ Requis : Societe \n";
    }
    if($F('fieldsnom').empty()){
      msg+="Champ Requis : Nom \n";
    }
    if($F('fieldsphone').empty()){
      msg+="Champ Requis : Telephone \n";
    }
    if($F('fieldsemail').empty()){
      msg+="Champ Requis : Email \n";
    }
    if($F('fieldsposte').empty()){
      msg+="Champ Requis : Poste \n";
    }
    if(msg!=""){
      alert(msg);
      return false;
    }
    return true;
  }
}
/* fin gestion images png avec ie 6 */




	
	
	
	

Event.observe(window, 'dom:loaded', function () {
	if(!Prototype.Browser.IE) return false; 
	else {
	  $$('ul.niveau1 > li.sousmenu, ul.niveau2 > li.soussousmenu').each(function (node) {
		  node.observe('mouseover', showUl);
			node.observe('mouseout', hideUl);
	    });
	}
});


function showUl () {
	this.select('ul')[0].show();
}

function hideUl () {
	this.select('ul')[0].hide();
}










