// JavaScript Document

function promo_viewer(id_ong){

init_all_ong();
document.getElementById("ong_"+id_ong).className="btn_ong_a";

document.getElementById("produits_p1").innerHTML="<div style='text-align:center; padding-top:60px'>Loading....</div>";
var xmlHttp=getxmlhttpr();

  
  
  
  xmlHttp.open("POST","marrakech_promo.php",true);
  xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
      html=xmlHttp.responseText;
	  
		document.getElementById("produits_p1").innerHTML=html;
      }
    }
  
  xmlHttp.send(null);


}

function init_all_ong(){
document.getElementById("ong_1").className="btn_ong_i";
document.getElementById("ong_2").className="btn_ong_i";
document.getElementById("ong_3").className="btn_ong_i";
document.getElementById("ong_4").className="btn_ong_i";
document.getElementById("ong_5").className="btn_ong_i";

}

var gal_ph_c="";
var gal_vid_c="";

var c_ph="";
var f_dwn=0;

function video(id){
var vid=document.getElementById("videos_s");
var ph=document.getElementById("photos_s");
vid.className="";
ph.className="btn_i";
var gal_c=document.getElementById("galleryContainer");
if(f_dwn==0){
gal_ph_c=gal_c.innerHTML;
c_ph=document.getElementById("previewPane").innerHTML;
f_dwn=10;
}

gal_vid_c="dddddd";
gal_c.innerHTML="";
var xmlHttp=getxmlhttpr();

  
  document.getElementById("previewPane").innerHTML='<div style="border:solid 1px #FFFFFF; width:452px; height:302px"><iframe name="iframe_video" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" style="border:none; display:block; width:450px; height:300px; overflow:hidden; margin:0; padding:0" src="showvideo.php"></iframe></div>';
  
  xmlHttp.open("GET","gal_videos.php?id="+id,true);
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
      html=xmlHttp.responseText;
		gal_c.innerHTML=html;
		
		
      }
    }
  
  xmlHttp.send(null);

}

function videoa(id){
var vid=document.getElementById("videos_s");
var ph=document.getElementById("photos_s");
vid.className="";
ph.className="btn_i";
var gal_c=document.getElementById("galleryContainer");
if(f_dwn==0){
gal_ph_c=gal_c.innerHTML;
c_ph=document.getElementById("previewPane").innerHTML;
f_dwn=10;
}

gal_vid_c="dddddd";
gal_c.innerHTML="";
var xmlHttp=getxmlhttpr();

  
  document.getElementById("previewPane").innerHTML='<div style="border:solid 1px #FFFFFF; width:452px; height:302px"><iframe name="iframe_video" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" style="border:none; display:block; width:450px; height:300px; overflow:hidden; margin:0; padding:0" src="../showvideo.php"></iframe></div>';
  
  xmlHttp.open("GET","../gal_videosa.php?id="+id,true);
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
      html=xmlHttp.responseText;
		gal_c.innerHTML=html;
		
		
      }
    }
  
  xmlHttp.send(null);

}
function photo(){
var vid=document.getElementById("videos_s");
var ph=document.getElementById("photos_s");
vid.className="btn_i";
ph.className="";
var gal_c=document.getElementById("galleryContainer");
	document.getElementById("previewPane").innerHTML=c_ph;
	gal_c.innerHTML=gal_ph_c;
	initSlideShow();
}

function showVideo(id_vid){
	document.forms[0].id.value=id_vid;
	document.forms[0].submit();
}



function photos_et_details(id_ch,id_c){
	var details_ch=document.getElementById("details_ch"+id_ch);
	
	var pop_d_ch=document.getElementById("pop_d_ch");
	pop_d_ch.innerHTML=details_ch.innerHTML;
		 
	pop_d_ch.style.display="block";
	
	 
	this.y=id_c ;
	pop_d_ch.style.top=this.y+'px';}


function fermer_details(id_srv){
document.getElementById('pop_d_ch').style.display='none';
}




function photos_et_detailss(id_ch){
	var details_ch=document.getElementById("details_ch"+id_ch);
	details_ch.style.display="block";
	
}
 
 

function fermer_detailss(id_srv){
document.getElementById('details_ch'+id_srv).style.display='none';
}
function d_down(id_dv){
	if(id_dv=="devis"){
	document.getElementById(id_dv).style.display="block";
	document.getElementById("langue").style.display="none";
	}
	if(id_dv=="langue"){
	document.getElementById(id_dv).style.display="block";
	document.getElementById("devis").style.display="none";
	}
}

function hide_down(id_dv){
	document.getElementById(id_dv).style.display="none";
}


function getxmlhttpr(){
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  return xmlHttp;
}

function verif_mail(mail){
var xmlHttp=getxmlhttpr();
  xmlHttp.open("GET","get_newsletter.php?email_i="+mail,true);
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
      	html=xmlHttp.responseText;
		if(html.indexOf("1")==-1){
		alert(html);
		}
      }
    }
  
  xmlHttp.send(null);
	
}

function newsletter(fmail){
var xmlHttp=getxmlhttpr();
  xmlHttp.open("GET","get_newsletter.php?email="+fmail.email.value,true);
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
      	html=xmlHttp.responseText;
	  	
		document.getElementById("news_resp").innerHTML=html;
		
      }
    }
  
  xmlHttp.send(null);
	
}