var requete = new Array();
var lib = new Array();
function ajxOptLst(nameid,params) {

if (window.XMLHttpRequest) { // Mozilla, Safari, ...
    requete[nameid] = new XMLHttpRequest();
}
else if (window.ActiveXObject) { // IE
    requete[nameid] = new ActiveXObject("Microsoft.XMLHTTP");
}
 var IE6 = false, IE7 = false, IE8 = false,
 FIREFOX2 = false, FIREFOX = false,
 NETSCAPE7 = false, NETSCAPE = false,
 OPERA9 = false, OPERA = false,
 AUTRE = false;
 var intSplitStart = navigator.userAgent.indexOf("(",0);
 var intSplitEnd = navigator.userAgent.indexOf(")",0);
 var strChStart = navigator.userAgent.substring(0,intSplitStart);
 var strChMid = navigator.userAgent.substring(intSplitStart, intSplitEnd);
 var strChEnd = navigator.userAgent.substring(strChEnd);

 if(strChMid.indexOf("MSIE 8") != -1)
 IE8 = true;
 else if(strChMid.indexOf("MSIE 7") != -1)
 IE7 = true;
 else if(strChMid.indexOf("MSIE 6") != -1)
 IE6 = true;
 else if(strChEnd.indexOf("Firefox/2") != -1)
 FIREFOX2 = true;
 else if(strChEnd.indexOf("Firefox") != -1)
 FIREFOX = true;
 else if(strChEnd.indexOf("Netscape/7") != -1)
 NETSCAPE7 = true;
 else if(strChEnd.indexOf("Netscape") != -1)
 NETSCAPE = true;
 else if(strChStart.indexOf("Opera/9") != -1)
 OPERA9 = true;
 else if(strChStart.indexOf("Opera") != -1)
 OPERA = true;
 else
 AUTRE = true;


	var url = '/ajxOptLst.php?'+params;
	
	requete[nameid].open('GET', url, true);
	
	requete[nameid].onreadystatechange = function() {
		if(requete[nameid].readyState == 4) {
			if(requete[nameid].status == 200) {
			  if (!IE7 && !IE6 && !IE8){
			        lib[nameid] = requete[nameid].responseText;
				//alert(lib[nameid]);
				lib[nameid] = lib[nameid].replace(/<(.*)select(.*)>/ig,'coucou');
				document.getElementById(nameid).innerHTML = lib[nameid];
			}
			  else {
				document.getElementById(nameid).outerHTML = requete[nameid].responseText;
			}
			}
		}
	};
	
	requete[nameid].send(null);
}



function zm(page){
page=page.replace(/!/g,'/');
page=page.replace(/]/g,'.html');
window.location=page;
}

function zmr(page){
page=page.replace(/!/g,'/redir.php?URLID=');
page=page.replace(/]/g,'');
window.open(page);
}

function isArray(obj){return(typeof(obj.length)=="undefined")?false:true;}

function rewriteTyp() {
var t=document.getElementsByName("TYP_ID");
var p=document.getElementsByName("PAY_ID");
var v=document.getElementsByName("VIL_ID");
var x=document.getElementsByName("PRI_ID");
var d=document.getElementsByName("DEP_ID");
var a=document.getElementsByName("DAT_ID");
var e=document.getElementsByName("EMAIL");
var c=0;

if(isArray(d) && d[0]){
  dval=d[0].value;
}
else{
  dval=0;
}
if(isArray(a) && a[0])
  aval=a[0].value;
else
  aval=0;



if(p[0].value>0) {
  c=p[0].value;
  var libu=p[0].options[p[0].selectedIndex].text.toLowerCase();
}
if(v[0].value>0) {
  c=v[0].value;
  var libu=v[0].options[v[0].selectedIndex].text.toLowerCase();
}

if(p[0].value>0 || v[0].value>0){
  libu=libu.replace(/\./g,"");
  libu=libu.replace(/'/g,"-");
  libu=libu.replace(/\(/g,"");
  libu=libu.replace(/\)/g,"");
  libu=libu.replace(/[0-9]/g,"");
  libu=libu.replace(/ $/g,"");
  libu=libu.replace(/ /g,"-");
}

//if(!e[0]) e=document.getElementsByName("PRI_ID");
if(t[0].value>0 && c==0 && x[0].value==0 && dval==0 && aval==0 && (!e[0] ||  e[0].value=='')){
switch (t[0].value) {
 case '1':
 window.location = '/sejour/';
 break;
 case '2':
 window.location = '/hotel/';
 break;
 case '3':
 window.location = '/croisiere/';
 break;
 case '4':
 window.location = '/week-end/';
 break;
 case '5':
 window.location = '/circuit/';
 break;
 case '6':
 window.location = '/thalasso/';
 break;
 case '7':
 window.location = '/vol/';
 break;
 case '8':
 window.location = '/location-ski/';
 break;
 case '9':
 window.location = '/location-vacances/';
 break;
 }
 }
 else
 {
   if( t[0].value>0 && c>0 && x[0].value==0 && dval==0 && aval==0 && (!e[0] ||  e[0].value=='')){
   switch (t[0].value) {
   case '1':
   var finals=c+"-sejour-"+libu+".html";
   window.location = '/sejour/'+finals;
   break;
   case '2':
   var finals=c+"-hotel-"+libu+".html";
   window.location = '/hotel/'+finals;
   break;
   case '3':
   var finals=c+"-croisiere-"+libu+".html";
   window.location = '/croisiere/'+finals;
   break;
   case '4':
   var finals=c+"-week-end-"+libu+".html";
   window.location = '/week-end/'+finals;
   break;
   case '5':
   var finals=c+"-circuit-"+libu+".html";
   window.location = '/circuit/'+finals;
   break;
   case '6':
   var finals=c+"-thalasso-"+libu+".html";
   window.location = '/thalasso/'+finals;
   break;
   case '7':
   var finals=c+"-vol-"+libu+".html";
   window.location = '/vol/'+finals;
   break;
   case '8':
   var finals=c+"-location-ski-"+libu+".html";
   window.location = '/location-ski/'+finals;
   break;
   case '9':
   var finals=c+"-location-vacances-"+libu+".html";
   window.location = '/location-vacances/'+finals;
   break;
   }

   }
   else{
   if(x[0].value==0) {prix='0-0';} else {prix=x[0].value;}
//   alert( '/voyages/'+t[0].value+'-'+c+'/'+prix+'/'+aval+'/'+dval+'-0/discount.html');
   window.location = '/voyages/'+t[0].value+'-'+c+'/'+prix+'/'+aval+'/'+dval+'-0/discount.html';
   //  document.forms['avan'].submit();
   }
 }
 
}

function VerificationEmail(elm)
{
if (elm.value.indexOf("@") != "-1" &&
    elm.value.indexOf(".") != "-1" &&
    elm.value != "")
    return true;

return false;
}

function VerificationAlert()
{
if(document.forms['avan'].EMAIL) {
  if (VerificationEmail(document.forms['avan'].EMAIL) == false)
      {
      alert("Email non Valide.");
      document.forms['avan'].EMAIL.focus();
      return false;
      }
  else
  {
     document.forms['avan'].submit();

  return true;
  }
}
else
  return true;
}

function VerificationAlertPop()
{
if(document.forms['avan'].email) {
  if (VerificationEmail(document.forms['avan'].email) == false)
      {
      alert("Email non Valide.");
      document.forms['avan'].email.focus();
      return false;
      }
  else
  {
  if(!(document.forms['avan'].email.value==document.forms['avan'].email2.value))
    {
          alert("Votre email de confirmation n'est pas le meme.");
	  return false;
    }
  else
  {
    document.forms['avan'].submit();
    return true;
  }
  }
}
else
  return true;
}

function VerificationSendtofriend()
{
if(document.forms['avan'].email) {
  if (VerificationEmail(document.forms['avan'].email) == false)
      {
      alert("Votre email non valide.");
      document.forms['avan'].email.focus();
      return false;
      }
  else
  {
  if (VerificationEmail(document.forms['avan'].email2) == false)
      {
      alert("L'email de votre ami non valide.");
      document.forms['avan'].email2.focus();
      return false;
      }
  else
  {
    document.forms['avan'].submit();
    return true;
  }
  }
}
else
  return true;
}


  var OA_channel = 'ovaed';

var OA_p=location.protocol=='https:'?'https:':'http:';
var OA_r=Math.floor(Math.random()*99999999);
if (!document.OA_used) document.OA_used = ',';
function OA_adjs(z,n)
{
  if (z>-1) {
    var az="<"+"script language='JavaScript' type='text/javascript' ";
    az+="src='"+OA_p+"//91.121.153.226/ads/www/delivery/ajs.php?n="+n+"&zoneid="+z;
    az+="&source="+OA_channel+"&exclude="+document.OA_used+"&r="+OA_r;
    az+="&mmm_fo="+(document.mmm_fo)?'1':'0';
    if (document.context) az+= "&context=" + escape(document.context);
    if (window.location) az+="&loc="+escape(window.location);
    if (document.referrer) az+="&referer="+escape(document.referrer);
    az+="'><"+"/script>";
    document.write(az);
  }
}
function OA_adpop(z,n)
{
  if (z>-1) {
    var az="<"+"script language='JavaScript' type='text/javascript' ";
    az+="src='"+OA_p+"//91.121.153.226/ads/www/delivery/apu.php?n="+n+"&zoneid="+z;
    az+="&source="+OA_channel+"&exclude="+document.OA_used+"&r="+OA_r;
    if (window.location) az+="&loc="+escape(window.location);
    if (document.referrer) az+="&referer="+escape(document.referrer);
    az+="'><"+"/script>";
    document.write(az);
  }
}
function popupalert()
{
var t=document.getElementsByName("TYP_ID");
var p=document.getElementsByName("PAY_ID");
var v=document.getElementsByName("VIL_ID");
var x=document.getElementsByName("PRI_ID");
var d=document.getElementsByName("DEP_ID");
var a=document.getElementsByName("DAT_ID");
var e=document.getElementsByName("EMAIL");


if(isArray(d) && d[0]){
  dval=d[0].value;
}
else{
  dval=0;
}
if(isArray(a) && a[0])
  aval=a[0].value;
else
  aval=0;


window.open ('/popalert.php?email='+e[0].value+'&TYP_ID='+t[0].value+'&PAY_ID='+p[0].value+'&VIL_ID='+v[0].value+'&PRI_ID='+x[0].value+'&DEP_ID='+dval+'&DAT_ID='+aval,'', config='height=500, width=700, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no')
}

function popupreduc()
{
var e=document.getElementsByName("EMAIL");
window.open ('/popreduc.php?email='+e[0].value,'', config='height=500, width=700, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no')
}

function popupjeu()
{
var e=document.getElementsByName("EMAIL");
window.open ('/popjeu.php?email='+e[0].value,'', config='height=500, width=700, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no')
}


function popupsendtofriend()
{
var url = window.location;
window.open ('http://www.o-vacances.com/sendtofriend.php?surl='+url,'', config='height=550, width=700, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no')
}

