function popUp(url,vwidth,vheight,scroll,name) {	
	
var w = vwidth;
var h = vheight;
var x = (screen.width - w)/2;
var y = (screen.height - h)/2;			
var s = scroll;
var n = name;

if (!name) {
	n = "remote";
}

	
if ((s == 0) || (s == "") || (s == null)) {
	s = "no"
}
else {
	s = "yes"
}
	
popupWin = window.open(url, n,  'menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars='+s+',resizable=no,width='+w+',height='+h+',left='+x+',top='+y+'')
}


/* FONCTIONS POUR FORMULAIRE DE RÉSERVATIONS DES ENTÊTES DES PAGES */

// Pour faire popper une fenêtre
function PopWin(theURL,winName,features){
	window.open(theURL,winName,features);
}

// Bug de Netscape pour le BR des années
function br(){
	if(document.layers){
		document.write("<BR>")
	}
}

function modifon(bouton){
	bouton.style.background='#C0C0C0';
	bouton.style.color='#333333';
	//this.style.background='#333333';this.style.color='#FFCC00';
}

function modifoff(bouton){
	//this.style.background='#C0C0C0';this.style.color='#333333';
	bouton.style.background='#000000';
	bouton.style.color='#FFCC00';
}


//mouseover script
<!--
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_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_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];}
}



// Pour soumettre le formulaire avec des Hovers sur les images

/* Pour sélectionner la date d'aujourd'hui dans le bon menu */
function selectDate() {
	var sel_aujo = new Date() ;
	var sel_demain = new Date() ;
	sel_demain.setTime(sel_aujo.getTime() + 86400000) ;
  if (document.f) {
  	document.f.departureDay.selectedIndex = (sel_demain.getDate() - 1) ;
	  document.f.departureMonth.selectedIndex = sel_demain.getMonth() + 1 ;
  }
}


/* Pour calculer l'annee de depart selon le mois choisi */
function makeArray() {
	this[0] = makeArray.arguments.length ;
	for (i = 0; i<makeArray.arguments.length; i++)
	this[i+1] = makeArray.arguments[i] ;
}

var accumulate    = new makeArray( 0,31,59,90,120,151,181,212,243,273,304,334) ;
var accumulateLY  = new makeArray( 0,31,60,91,121,152,182,213,244,274,305,335) ;

/* Pour calculer annees bissextiles */ 
function LeapYear(year) {
	if ((year/4)   != Math.floor(year/4))   return false;
	if ((year/100) != Math.floor(year/100)) return true;
	if ((year/400) != Math.floor(year/400)) return false;
	return true;
}

/* Pour obtenir le nombre de jours écoulés depuis le 1er janvier */
function getJulian(day,month,year) {
	if (LeapYear(year))
		return (day + accumulateLY[month]);
	else
		return (day + accumulate[month]);
}

/* Calcul des dates et années pour envoyer la bonne année */
function calculerEnvoyer(f) {
	var today = new Date() ;
	var ddjour = parseInt(f.departureDay.value) ;
	var ddmois = parseInt(f.departureMonth.value) ;
	var ddannee = today.getYear() ;
	var dd = getJulian(ddjour,ddmois,ddannee) ;
	var aujourdhui = getJulian(today.getDate(), today.getMonth() + 1, today.getYear() ) ;
	if ((dd > 0) && (dd < aujourdhui)) {
		var zeDate =  (ddannee + 1) ;
		var zeDateString =  zeDate + "" ;
		var dateCroppee = zeDateString.substring(2,4) ;
//		f.dda.value = dateCroppee ;
	}
	else
	{
		var zeDate = today.getYear() ;
		var zeDateString =  zeDate + "" ;
		var dateCroppee =  zeDateString.substring(2,4) ;
//		f.dda.value = dateCroppee ;
	}
	return(false) ;
}

function verifNombre(choix) {
	var totalPass = parseInt(document.f.cat_1.options[document.f.cat_1.options.selectedIndex].value) +
					parseInt(document.f.cat_2.options[document.f.cat_2.options.selectedIndex].value) +
					parseInt(document.f.cat_4.options[document.f.cat_4.options.selectedIndex].value) +
					parseInt(document.f.cat_5.options[document.f.cat_5.options.selectedIndex].value) +
					parseInt(document.f.cat_0.options[document.f.cat_0.options.selectedIndex].value) ;
	if ((choix==3) && (totalPass < 2)) {
		alert("El número total de billetes es de " + totalPass + " pero en cada una de las literas dobles deben ir 2 personas.\n");
	}
	else
	if ((choix==4) && (totalPass < 3)) {
		alert("El número total de billetes es de " + totalPass + " pero en cada una de las literas triples  deben ir 3 personas.\n");
	}
}

	function Validate (f){
	
	with (f){

		if (departureMonth.selectedIndex == 0){
		alert ('Le rogamos elegir una fecha de salida (mes)')
		departureMonth.focus();
		return(false);
		}

		if (departureDay.selectedIndex == 0){
		alert ('Le rogamos elegir una fecha de llegada (día)')
		departureDay.focus();
		return(false);
		}
	
		if ((departureStnCd.selectedIndex==0) || (destinationStnCd.selectedIndex==0)){
			alert('Le rogamos que elija una estación de salida y una de destino ...');
			departureStnCd.focus();
			return(false);
			}	
			
		if ((numAdults.selectedIndex + numSeniors.selectedIndex + numStudents.selectedIndex + numChildren.selectedIndex) > 6) {
			alert('Se ha excedido del máximo de seis pasajeros.');
			return(false);
			}
			
		if ((numAdults.selectedIndex + numSeniors.selectedIndex + numStudents.selectedIndex + numChildren.selectedIndex) == 0) {
			alert('Le rogamos que elija por lo menos un pasajero.');
			numAdults.focus();
			return(false);		
			}			
			
		if ((numAdults.selectedIndex + numSeniors.selectedIndex + numStudents.selectedIndex) == 0) {
			if (numChildren.selectedIndex > 0) {
				alert('Los niños deben ir acompañados al menos por un adulto.');
				return(false);				
				}				
			}
		}
	}
