//==================================================================================================================
//===(  Copyright 2010 Alain CHALET  -  Author Alain Chalet <alain.chalet@free.fr>  )===============================
//==================================================================================================================


///////////////////////////////////////////////////////////////////////// }}}
// AJAX ///////////////////////////////////////////////////////////////// {{{
/////////////////////////////////////////////////////////////////////////
function GetXmlHttpRequest() 
{
	var xhttpr = null;
	if (window.XMLHttpRequest || window.ActiveXObject) {
		if (window.ActiveXObject) {
			try      { xhttpr = new ActiveXObject("Msxml2.XMLHTTP"); } 
			catch(e) { xhttpr = new ActiveXObject("Microsoft.XMLHTTP"); }
		} else { xhttpr = new XMLHttpRequest(); }
	} else { alert("Votre navigateur ne supporte pas l'objet XMLHTTPRequest..."); return null; }
	return xhttpr;
}

function getXMLHTTP()
{
    var xhttpr = null;
    if(window.XMLHttpRequest)
    { // Firefox et autres
        xhttpr = new XMLHttpRequest();
    }
    else if(window.ActiveXObject)
    { // Internet Explorer
        try      { xhttpr = new ActiveXObject("Msxml2.XMLHTTP");}
        catch(e) { try       { xhttpr = new ActiveXObject("Microsoft.XMLHTTP"); }
		   catch(e1) { xhttpr = null; }
                 }
    }
    else
    { // XMLHttpRequest non supporté par le navigateur
        alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");return null;
    }
    return xhttpr;
}

///////////////////////////////////////////////////////////////////////// }}}
// Navig Menu /////////////////////////////////////////////////////////// {{{
/////////////////////////////////////////////////////////////////////////
function galprod(lien)
{
  var xhr = getXMLHTTP();
  xhr.onreadystatechange = function() { if(xhr.readyState == 4 && xhr.status == 200)
	  { 
	  	document.getElementById('main').innerHTML = xhr.responseText;
  		
		$("a.group").fancybox({
			'speedIn'       	: 200, 
			'speedOut'      	: 200, 
			'transitionIn'		: 'elastic',
			'transitionOut'		: 'elastic',
			'titleShow'     	: false,
			'hideOnContentClick'	: true,
			'overlayShow' 		: true,
			'overlayColor' 		: '#000',
			'overlayOpacity' 	: 0.5
		});	
  	} 
  }
  var url = lien;
  xhr.open('GET',url, true); xhr.send(null);
}
///////////////////////////////////////////////////////////////////////// }}}
function tog_ibo_box()/////////////////////////////////////////////////// {{{
/////////////////////////////////////////////////////////////////////////
{  
  if (document.getElementById('ibo-box').className == 'ibo-off') { document.getElementById('ibo-box').className = 'ibo-on'; }
  else                                                           { document.getElementById('ibo-box').className = 'ibo-off'; }
}
///////////////////////////////////////////////////////////////////////// }}}
function changevideo(n,w,h,x) /////////////////////////////////////////// {{{
/////////////////////////////////////////////////////////////////////////
{  
  var FO = { movie:'img/video/mediaplayer.swf',width:""+w+"",height:""+h+"",majorversion:"7",build:"0",bgcolor:"#FFFFFF",
  flashvars:"image=img/video/"+n+".jpg&file="+n+".flv&showdigits=true&autostart=false" };
  UFO.create( FO, "player"+x );
}
///////////////////////////////////////////////////////////////////////// }}}
function changevideo2() ///////////////////////////////////////////////// {{{
/////////////////////////////////////////////////////////////////////////
{  

 var req = null;
  if(window.XMLHttpRequest)  req = new XMLHttpRequest(); // Firefox, Safari, ...
  else
    if (window.ActiveXObject)  req = new ActiveXObject(Microsoft.XMLHTTP); // Internet Explorer 

  req.onreadystatechange = function()
  {
    if(req.readyState == 4) // reçu, OK
    {
       if(req.status == 200)
           document.ajax.dyn="Received:" + req.responseText;
       else
           document.ajax.dyn="Error code " + req.status;
    };
    /*
      req.open( GET", "data.xml", true);
      req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");  
      req.send(null);
    */
  } 
}
///////////////////////////////////////////////////////////////////////// }}}
function hover(obj) ///////////////////////////////////////////////////// {{{
/////////////////////////////////////////////////////////////////////////	
{  
   if(document.all)
   {    
     UL = obj.getElementsByTagName('ul');
     if(UL.length > 0)
     {      
       sousMenu = UL[0].style;
       if (sousMenu .display == 'none' || sousMenu.display == '') { sousMenu.display = 'block'; }
       else { sousMenu.display = 'none'; }
     }
   }
}
///////////////////////////////////////////////////////////////////////// }}}
function setHover(menu) ///////////////////////////////////////////////// {{{
/////////////////////////////////////////////////////////////////////////
{  
  LI = document.getElementById(menu).getElementsByTagName('li'); 
  nLI = LI.length;  
  for (i=0; i < nLI; i++) { LI[i].onmouseover = function() { hover(this);}; LI[i].onmouseout = function() { hover(this);} }
}
///////////////////////////////////////////////////////////////////////// }}}
function select(n) ////////////////////////////////////////////////////// {{{
/////////////////////////////////////////////////////////////////////////
{
  var  d2 = document.getElementById('sct'+n);  d3 = document.getElementById('cl'+n); 
  if  (d2.className == 'nosct') {d2.className = 'sct'; eval('document.formulaire.coul'+n+'.checked = true');}
  else                          {d2.className = 'nosct'; eval('document.formulaire.coul'+n+'.checked = false');}
}
///////////////////////////////////////////////////////////////////////// }}}


