function temps(date)
{
var d = new Date(date[2], date[1] - 1, date[0]);
return d.getTime();
}


function trim(string) 
{ 
return string.replace(/(^\s*)|(\s*$)/g,''); 
}
function DecocheDestinations()
{
for (i= 0; i < 15; i++) {

document.Form1.destination[i].checked=false;

}	
}
function verifmoteur()
{
//alert("mmm");

var debut = temps(document.getElementById('TextBox_ArrivalDate').value.split("/"));
var fin = temps(document.getElementById('TextBox_DepartureDate').value.split("/"));
var ts = (fin - debut) / (1000 * 60 * 60 * 24); // + " jours";

 

                  var strUrl                = "http://booking.cyberesa.net/darcherait/cr.resa/ui/aba/Hotel_Selection.aspx?id=742"



                        + "&fromdate=" + document.getElementById('TextBox_ArrivalDate').value

                        + "&todate=" + document.getElementById('TextBox_DepartureDate').value

						+ "&doubleroom=&singleroom=&tripleroom=&quadrupleroom=&user=707&curr=1&ilng=1";
                       

 
//alert(strUrl); 

opennewwindow(strUrl,'',560,776);

//GB_showCenter('', strUrl, 560, 776)
//document.location.href=strUrl;
return false;               

}
//-->
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function redirect()
{
location.href=document.rapide.acces.value;
}

function agrandir() {
  false;
}
function opennewwindow(page, nom, hauteur, largeur) {
options='height='+hauteur+',width='+largeur+',left=2, top=2,toolbar=no,scrollbars=yes';
newWindow=window.open(page, nom,options); 
}

function afficheMaxi(chemin)
	{
	Imageslim = new Image;
	Imageslim.src = chemin;
	titre='Jetsetmagazine.net';
	popupImage = window.open('','grande','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0,height=10,width=10,left=0, top=0');
	html = '<HTML><HEAD><TITLE>'+titre+'</TITLE><link href="../../styles/styles.css" rel="stylesheet" type="text/css"></HEAD><BODY LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0 onLoad="self.focus();">';
	html =html+'<table width="100%" height="100%"  border="0" cellpadding="0" cellspacing="0"><tr>';
    html =html+'<td valign="middle"><table border="0" align="center" cellpadding="0" cellspacing="0"><tr>';
	html =html+'<td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"><tr>';
	html =html+'<td align="left"><strong><img src="../../images/logo_min.gif" width="97" height="40" hspace="10" vspace="3"></strong></td>';
    html =html+'<td align="right" valign="bottom"><img src="../../images/url.gif" width="136" height="10" hspace="3" vspace="2"></td>';
    html =html+'</tr></table></td></tr><tr>';
    html =html+'<td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"><tr>';
	html =html+'<td width="10" valign="top" background="../../images/bg_v.gif"><img src="../../images/coinv.gif" width="13" height="17" border="0"></td>';
   	html =html+'<td rowspan="2" bgcolor="#FFFFFF" class="photolarge"><IMG SRC="'+chemin+'" BORDER=0 NAME=imageTest onLoad="window.resizeTo(document.imageTest.width+50,document.imageTest.height+110);window.moveTo(100,100);self.focus();"></td>';
    html =html+'</tr><tr><td valign="bottom" background="../../images/bg_v.gif"><img src="../../images/coinfooter.gif" width="13" height="28" border="0" style="background-color:#292C33"></td></tr>';
    html =html+'</table></td></tr></table></td></tr></table></body></HTML>';      
      
		
	popupImage.document.open();
	popupImage.document.write(html);
	popupImage.document.close();
	}
function VerificationEmail(elm)
{
if (elm.value.indexOf("@") != "-1" &&
    elm.value.indexOf(".") != "-1" &&
    elm.value != "")
    return true;

return false;
}

function Verifmail(formulaire)
{
	//alert(formulaire.email_newsletter.value);
	if(VerificationEmail(formulaire.email_newsletter) == false)

		{
		alert('Adresse e-mail invalide!!');
        formulaire.email_newsletter.focus();
		return false;		
		}
		else return true;
}


window.onload=montre;
function montre(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
	
if (d) {d.style.display='block';}

}

function chouf(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=15; i++) {
		if (document.getElementById('annee'+i)) {document.getElementById('annee'+i).style.display='none';}
	}
	
if (d) {d.style.display='block';}

}



function positionne(id) {
	
	var d = document.getElementById(id);
marge=(screen.width-953)/2+'px';
if (d) 
	{
	d.style.right=marge;
	d.style.display='block';
	}

}





function SwapOut(im)
{
	showCode(im);
	hideCode(im+'_on');
}
function SwapOver(im)
{
	hideCode(im);
	showCode(im+'_on');
}








///Envoi ami


function file(fichier)
     {
     if(window.XMLHttpRequest) // FIREFOX
          xhr_object = new XMLHttpRequest(); 
     else if(window.ActiveXObject) // IE
          xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
     else 
          return(false); 
     xhr_object.open("GET", fichier, false); 
     xhr_object.send(null); 
     if(xhr_object.readyState == 4) return(xhr_object.responseText);
     else return(false);
     }

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

return false;
}


function hideCode(id)
{
	var d = document.getElementById(id);
	d.style.display='none';
}

function showCode(id)
{
	var d = document.getElementById(id);
	d.style.display='block';
}


function verifForm()
{

if(document.contact.nom.value == "")
 {
alert(' Entrez votre nom svp !!');
document.contact.nom.focus();
return false; 
 }
/////////PRENOM
if(document.contact.prenom.value == "")
 {
alert(' Entrez votre prénom svp !!');
document.contact.prenom.focus();
return false; 
 }

    /////////tel
if(document.contact.tel.value == "")
 {
alert(' Entrez votre téléphone svp !!');
document.contact.tel.focus();
return false; 
 }
/////////////MAIL
if(VerificationEmail(document.contact.mail) == false)
{
		alert('Adresse email invalide!!');
       document.contact.mail.focus();
		return(false); 	
}
/////////SUJET
if(document.contact.sujet.value == "")
 {
alert(' Saisissez le sujet de votre message !!');
document.contact.sujet.focus();
return false; 
 }
 /////////message
if(document.contact.message.value == "")
 {
alert(' Saisissez votre message !!');
document.contact.message.focus();
return false; 
 }
if(document.contact.code.value == "")
 {
alert(' Recopiez le code svp  !!');
document.contact.code.focus();
return false; 
 }

else 
{
	showCode('loading_contact');
	if(retour = file('send.php?nom='+escape(document.contact.nom.value)+'&prenom='+escape(document.contact.prenom.value)+'&adresse='+escape(document.contact.adresse.value)+'&tel='+escape(document.contact.tel.value)+'&mail='+escape(document.contact.mail.value)+'&sujet='+escape(document.contact.sujet.value)+'&code='+escape(document.contact.code.value)+'&message='+escape(document.contact.message.value)))
	{
		
		if(retour == 1) 
		{
			hideCode('fail_contact');
			hideCode('loading_contact');
			showCode('succes_contact');
			hideCode('form_candidat');
			//alert(retour);
			return(false); 
			
		}
		
		else 
		{
			hideCode('loading_contact');
			showCode('fail_contact');
			
			//alert(retour);
			return(false); 
			
		}
		
	}
	else return(false); 
	
}

}








