
function toggleDetailVisibility(action,indice_element){
		if(action=='hide'){ 
					document.getElementById('btn_show_'+indice_element).style.display='none';
					document.getElementById('btn_hide_'+indice_element).style.display='block';
					document.getElementById('block_detail_'+indice_element).style.display='none';
		}else if(action=='show'){
					document.getElementById('btn_show_'+indice_element).style.display='block';
					document.getElementById('btn_hide_'+indice_element).style.display='none';
					document.getElementById('block_detail_'+indice_element).style.display='block';
					
		}
	}	

function afficheActualiteSportive(val,i){

		if(val=="lire"){
			document.getElementById("contenu_complet_"+i).style.display="";
			document.getElementById("contenu_tronque_"+i).style.display="none";
			document.getElementById("image_lire_"+i).style.display="none";
			document.getElementById("image_fermer_"+i).style.display="";
		}
		else{
			document.getElementById("contenu_complet_"+i).style.display="none";
			document.getElementById("contenu_tronque_"+i).style.display="";
			document.getElementById("image_fermer_"+i).style.display="none";
			document.getElementById("image_lire_"+i).style.display="";
		}	
}
function startFlashPlayer(titre,img,namevideo,diffusion,in_maghribia,flash) {			

			var video="videos/"+namevideo;
			
			if(in_maghribia == 1){			
				     image="http://www.alaoula.ma/images/"+img;			
			}else{
					 image="images/"+img;
			}			
			if(flash=="flash_ar"){ 
				getMovieName("playerSnrt").startVideoPlayer('ar','almaghribia','707b8a',video,image,titre,diffusion); 
			}else{				
				getMovieName("playerSnrt").startVideoPlayer('fr','almaghribia','707b8a',video,image,titre,diffusion); 
			}
}
			
function getMovieName(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName]
   }
   else {
	   return document[movieName]
   }
}


function openChaineInter(){
	window.open('http://www.chaineinter.ma/player.php','player','height=240, width=504,toolbar=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=no');
}

function openWatanya(){
	window.open('http://www.alidaa-alwatania.ma/player.php','player','height=240, width=504,toolbar=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=no');
}

function openAmazigh(){
	window.open('http://www.alidaa-alamazighia.ma/player.php','player','height=240, width=504,toolbar=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=no');
}

function openAssadissa(){
	window.open('http://www.idaatmohammedassadiss.ma/player.php','player','height=240, width=504,toolbar=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=no');
}
function enforce_fields()
{
	var nom = document.all['nom'].value;
	var email = document.all['email'].value;
	var message = document.all['message'].value;
	
	var mail = /^[\w\-]+(\.[\w\-]+)*@[\w\-]+(\.[\w\-]+)*\.[\w\-]{2,3}$/;
		
	if (nom == '') {
		alert('Veuillez entrer votre nom et prénom');
		return false;
	}
	else if(!mail.test(email)) {
	       alert('Veuillez entrer un email valide');
		   return false;
	   }  
	else if (message == '') {
		alert('Veuillez entrer votre message');
		return false;
	}
	
	return true;
}

function send_contact()
{
	var tel = document.getElementById('tel').value;
	var nom = document.getElementById('nom').value;
	var email = document.getElementById('email').value;
	var message = document.getElementById('message').value;
	 if (xmlHttp1)
		{
		 try
			    		 {
						   var cache = new Array();
                           cache.push("nom="+nom+"&email="+email+"&tel="+tel+"&message="+message);
      				       if ((xmlHttp1.readyState == 4 || xmlHttp1.readyState == 0))
						       {
									var cacheEntry = cache.shift();
					                xmlHttp1.open("POST","contacter_nous_validation.php", true);
							        xmlHttp1.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
							        xmlHttp1.onreadystatechange = waitForResponse2;
					        		xmlHttp1.send(cacheEntry);
									/*var browserName=navigator.appName;
									if (browserName=="Microsoft Internet Explorer")
									{ 										
										 document.getElementById('flash_div').innerHTML="<table cellpadding='0' cellspacing='0' border='0' width='626' bgcolor='#ffffff' height='48'><tr><td width='479' align='center' valign='middle'><img src='images/clear_pix.gif' height='1' width='1' border='0'/></td><td width='1' bgcolor='#2d3e4b'></td><td width='139' bgcolor='#384854' valign='top'><img src='images/clear_pix.gif' width='139' height='1'><br></td><td width='1' bgcolor='#2d3e4b'><img src='images/clear_pix.gif' width='1' height='1'><br></td></tr></table>";
									}
									else 
									{ 
										 document.getElementById('flash_div').innerHTML="<table cellpadding='0' cellspacing='0' border='0' width='626' bgcolor='#ffffff' height='53'><tr><td width='482' align='center' valign='middle'><img src='images/clear_pix.gif' height='1' width='1' border='0'/></td><td width='1' bgcolor='#2d3e4b'></td><td width='139' bgcolor='#384854' valign='top'><img src='images/clear_pix.gif' width='139' height='1'><br></td><td width='1' bgcolor='#2d3e4b'><img src='images/clear_pix.gif' width='1' height='1'><br></td></tr></table>";
									}*/
		       					}
					     }
					     catch (e)
					     {
					      displayError(e.toString());
					     }	
		}
}
function waitForResponse1()
{
 if (xmlHttp1.readyState == 4) 
  {
    if (xmlHttp1.status == 200) 
    {
      try
      {
        var response = xmlHttp1.responseText;
		document.getElementById('envoyer_div').innerHTML=response;
      }
      catch(e)
      {
        displayError(e.toString());
      }
    }
    else
    {
      displayError(xmlHttp1.statusText);
    }
  }		
}
function waitForResponse2()
{
 if (xmlHttp1.readyState == 4) 
  {
    if (xmlHttp1.status == 200) 
    {
      try
      {
        var response = xmlHttp1.responseText;
		document.getElementById('contacter_div').innerHTML=response;
      }
      catch(e)
      {
        displayError(e.toString());
      }
    }
    else
    {
      displayError(xmlHttp1.statusText);
    }
  }		
}
