var ie = /MSIE/.test(navigator.userAgent);

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';
       // var timer = setTimeout("bidon()", 500);
      }else{
//        sousMenu.display = 'none';
      }
    }
  }
}
function bidon(){//alert('aaa');
return;
}

function out(obj){
   if(document.all){
    UL = obj.getElementsByTagName('ul');
    if(UL.length > 0){
      sousMenu = UL[0].style;
      sousMenu.display = 'none';
    }
  }
}

function setHover(){
 
  TabUL = document.getElementsByName('Menu');
  for(i=0; i < TabUL.length; i++){
    LI = TabUL[i].getElementsByTagName('li');
    for(j=0; j < LI.length; j++){  
        LI[j].onmouseover = function(){hover(this);};
        LI[j].onmouseout = function(){out(this);};
        }
    }
  
}

function setHover2(){
  
  LI = document.getElementById('Menu').getElementsByTagName('li');
  for(i=0; i < LI.length; i++){
    LI[i].onmouseover = function(){hover(this);};
    LI[i].onmouseout = function(){hover(this);};
    }
  
}

function AjaxGetClasse(car)
{
	HtmlControlUpdate('DetailCompteListeScolaire.AjaxGetClasse', 'ListeClasse', car);
}

function AjaxAjoutListe(param1, param2, idwebficheenfant, idficheenfant)
{
    val = document.getElementById(param2).value;
    if(val>0)
    {
	    HtmlControlUpdate('DetailCompteListeScolaire.AjaxAjoutListe', param1, val);
	    HtmlControlUpdate('DetailCompteListeScolaire.AjaxAffichePanierListeScolaire', 'DetailPanierListeScolaire', val + '|' + idwebficheenfant +'|' + idficheenfant);
	}
}

function AjaxSuppressionArticleListeScolaire(param1, param2)
{
    HtmlControlUpdate('DetailCompteListeScolaire.AjaxSuppressionArticleListeScolaire', param1, param2);
}

function AjaxAjoutArticleListeScolaire(param1, param2)
{
    HtmlControlUpdate('DetailCompteListeScolaire.AjaxAjoutArticleListeScolaire', param1, param2);
}

function AjaxUpdateSessionE_IDFicheClasse(car)
{
	DetailCompteListeScolaire.AjaxUpdateSessionE_IDFicheClasse(car);
	HtmlControlUpdate('DetailCompteListeScolaire.AjaxGetListeScolaire', 'ChoixListeScolaire', car);
	
}
function AjaxUpdateSessionIDArticleListeScolaire(car)
{
	DetailCompteListeScolaire.AjaxUpdateSessionIDArticleListeScolaire(car);
}
function AjaxSuppressionEnfant(car)
{
	DetailCompteListeScolaire.AjaxSuppressionEnfant(car);
	location.reload();
}

function AjaxContactSendMail()
{
    var mExpediteurMail = document.getElementById('ContactExpediteurMail').value;
    var mExpediteurNom =  document.getElementById('ContactExpediteurNom').value;
    var mMessageObjet =   document.getElementById('ContactMessageObjet').value;
    var mMessageBody =    document.getElementById('ContactMessageBody').value;
    
    MainPage.AjaxContactSendMail(mExpediteurMail, mExpediteurNom, mMessageObjet, mMessageBody);
    AfficheBulleContactSendMail();
    setTimeout(function(){location.reload('Default.aspx?Action=AfficheAccueil')}, 1500);
    //location.reload('Default.aspx?Action=AfficheAccueil');
}

function AfficheBulleContactSendMail()
{
    bulle = document.getElementById("BulleContactEnvoiMail");
	if(ie){
	bulle.style.visibility = "visible";
	bulle.style.display = "block";
	bulle.innerHTML = '<br><b><center>Votre message a ete transmis...<center></b><br>'; 
	setTimeout(function(){cacheBubbleContactSendMail(bulle)}, 1500);
    }
}

function cacheBubbleContactSendMail(bulle){
    bulle.style.visibility = "hidden";
	bulle.style.display = "none";
}


function AjaxAjoutEnfant()
{
	DetailCompteListeScolaire.AjaxAjoutEnfant(document.getElementById('TextBoxNomFamilleEnfant').value, document.getElementById('TextBoxPrenomEnfant').value);
	location.reload();
}

function PaiementCheque()
{
    alert('Imprimez cette page, \n joignez y votre reglement\n et envoyez le nous par voie postale');
    window.print();
}

function AjaxAjoutPanier(vIDArticle)
{
	HtmlControlUpdate('MainPage.AjaxAjoutPanier', 'PanelContenuPanier', vIDArticle);
	AfficheBulleAjoutPanier();
}

function AfficheBulleAjoutPanier()
{
    bulle = document.getElementById("BulleAjoutPanier");
	if(ie){
	bulle.style.visibility = "visible";
	bulle.style.display = "block";
	//bulle.style.background = '#FFFFFF';
//	var posx = 0;
//    var posy = 0;
//    if (!e) var e = window.event;
//    if (e.pageX || e.pageY) 	{
//        posx = e.pageX;
//        posy = e.pageY;
//    }
//    else if (e.clientX || e.clientY) 	{
//        posx = e.clientX + document.body.scrollLeft
//            + document.documentElement.scrollLeft;
//        posy = e.clientY + document.body.scrollTop
//            + document.documentElement.scrollTop;
//    }
//    
//	bulle.style.left = posx +'px';
//	bulle.style.top =posy +'px';
	
	bulle.innerHTML = '<br><b><center>Article ajoute au panier.<center></b><br>'; 
	setTimeout(function(){cacheBubbleAjoutPanier(bulle)}, 1500);
    }
}

function cacheBubbleAjoutPanier(bulle){
    bulle.style.visibility = "hidden";
	bulle.style.display = "none";
}





function AjaxAjoutPanierDilicom(vCodeBarre)
{
	HtmlControlUpdate('MainPage.AjaxAjoutPanierDilicom', 'ModulePanier', vCodeBarre);
	AfficheBulleAjoutPanier();
}

function AjaxDeleteArticlePanier(vIDArticle)
{
	HtmlControlUpdate('MainPage.AjaxDeleteArticlePanier', 'ModulePanier', vIDArticle);
	location.reload();
}