
// correctly handle PNG transparency in Win IE 5.5 or higher.
// ce script relativement commun sur internet a en l'occurence été récupéré depuis ce site : http://homepage.ntlworld.com/bobosola/
 var W3CDOM = (document.createElement && document.getElementsByTagName);	
if (!W3CDOM) { alert ('Your Browser doesn\'t support the W3C standarts.If this page doesn\'t display properly, please disable Javascript to access all the page functionnalities'); }
var popcount= 0; //will help to know how many time one has clicked on a popupform

//******START AT WINDOW ONLOAD*************************************************************************************************
function init() {hidejava();
	
	if(navigator.userAgent.indexOf('MSIE 6.0') != -1){correctPNG();} 
	
	var isform=document.getElementById('fondvdf');
  if(isform){	remplirprix();    }
	
    var iscarriere=document.getElementById('carriere');
	if(iscarriere){ choixcarriere();}
	
	}
 
 function correctPNG()
 {
   for(var i=0; i<document.images.length; i++)
      {
	  var img = document.images[i]
	  var imgName = img.src.toUpperCase()
	  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
	     {
		 var imgID = (img.id) ? "id='" + img.id + "' " : ""
		 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
		 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
		 var imgStyle = "display:inline-block;" + img.style.cssText
		 if (img.align == "left") imgStyle = "float:left;" + imgStyle
		 if (img.align == "right") imgStyle = "float:right;" + imgStyle
		 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
		 var strNewHTML = "<span " + imgID + imgClass + imgTitle
		 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	     + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
		 img.outerHTML = strNewHTML
		 i = i-1
	     }
      }
  
 
  
  }
   
    window.onload = init;
	
	//VERY IMPORTANT FONCTION //Extracted from nifty.js THANK YOU!
function getElementsByClassName(className, tag, elm){
	var testClass = new RegExp("(^|\\\\s)" + className + "(\\\\s|$)");
	var tag = tag || "*";
	var elm = elm || document;
	var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag);
	var returnElements = [];
	var current;
	var length = elements.length;
	for(var i=0; i<length; i++){
		current = elements[i];
		if(testClass.test(current.className)){
			returnElements.push(current);
		}
	}
	return returnElements;
}	
	
	
	
	
	function calcquantite()
	{
	var q=document.getElementById('quantite');
 	var quantite=q[q.selectedIndex].value; 
	return parseInt(quantite); 
	}
	
	function calcfrais() 
	{ quantite=calcquantite();
    if(quantite % 2==0){var frais=(quantite*1.25);}
	else var frais=((quantite+1)*1.25);
	return frais;
	}
	
	function remplirprix()
	{ var quantite=calcquantite(); 
	  var frais=calcfrais();
	  var total=quantite*10+frais;
      getfrais=document.getElementById('frais');
	  getfrais.innerHTML=frais+" &euro;";
	  
	  document.getElementById('avertbase').innerHTML=quantite*10+" &euro;";
	  
      document.getElementById('total').innerHTML=total+" &euro;";
	  document.getElementById('averttotal').innerHTML=total+" &euro;";
	}
	
	function surlignervert(numero) 
	{   var cmd='cmd'+numero;
		var td=document.getElementById(cmd);
		td.style.backgroundColor='#96FB6A';		
	}
	
	function surlignertri(champ)
	{ var chps=getElementsByClassName(champ);
	  for (x=0;x<chps.length;x++)
	  { chps[x].style.fontSize="#13px;";
	    chps[x].style.fontWeight="bold";
		chps[x].style.backgroundColor="#F7ACB8";}
	}
	
	function desactiverSaisie() {
	
	if (document.getElementsByTagName) {

    var inputElements = document.getElementsByTagName("input");

    for (i=0; inputElements[i]; i++) {

      if (inputElements[i].className && (inputElements[i].className.indexOf("autoNon") != -1)) {

        inputElements[i].setAttribute("autocomplete","off");

      }//if current input element has the disableAutoComplete class set.

    }//loop thru input elements

  }//basic DOM-happiness-check
	
	}
	

   function choixcarriere () { 
   var cat=new Array('theatre','cinema','television','voix','radio');
   for (x=0;x<cat.length;x++)
   {      obj=cat[x];
	      temp=document.getElementById(obj);
          temp.onmouseover=catOn;
		  temp.onmouseout=catOff;
		  temp.onclick=catsOn;
	
  }                          }
  
  
  function catOn() {if (this.style.border!='1px solid green')
	this.style.border='1px solid red';   
  }
  
   function catOff() {if (this.style.border!='1px solid green')
	this.style.border='1px dashed black';   
  }
  
  
  
  
  function catsOn() {var divid=this.id; 
	var liste=document.getElementById('liste');	
	var divs=liste.getElementsByTagName('div');
	 for (x=0;x<divs.length;x++)
   {
   curdiv= divs[x];
   if (curdiv.className==divid){curdiv.style.backgroundColor='#DBF4B9';curdiv.style.border='1px solid #666';}
   else  curdiv.style.backgroundColor='transparent';curdiv.style.border='none';
   }
	 
    
	
	
	
	
	
	this.style.border='1px solid green';
	
	
	var cat=new Array('theatre','cinema','television','voix','radio');
   for (x=0;x<cat.length;x++)
   { c=cat[x];
     if (divid!=c){t=document.getElementById(c);t.style.border='1px dashed black';}
   }
	 
	   
   }
   
   //pour cacher les elements qui seront visible sans javascript activé
	function hidejava() 
   {
	   var javas=getElementsByClassName('javahide');
	 for(r=0;r<javas.length;r++){
		javas[r].style.display='none'; 
	 }
   }
   
   function showjava() 
   {
	   var javas=getElementsByClassName('javashow');
	 for(r=0;r<javas.length;r++){
		javas[r].style.display='block'; 
	 }
   }
   
   