// JavaScript Document

// Funciones de menuder
horas1=Array(0,14,12,12,14,16,0,10,16,19);
horas2=Array(0,26,28,27,27,25,14,26,26,27);
hora1actual=0;
hora2actual=0;
function refrescahoras(dia){
	if (dia>0){
//		alert(horas1[dia]+" a "+horas2[dia]);
		document.recomendaciones.hora1.length=0
		document.recomendaciones.hora2.length=0
		contador=0;
		indice1=0;	
		indice2=0;	
		document.recomendaciones.hora1.options[0]=new Option('----','-');
		document.recomendaciones.hora2.options[0]=new Option('----','-');
		for (aux=horas1[dia];aux<=(horas2[dia]);aux++){
			/*if ((horas1[dia]+contador)>24){
				horaactual=(horas1[dia]+contador)-24;
			} else {*/
				horaactual=(horas1[dia]+contador);
			/*}*/
			
			if(horaactual>=24){
					horaactualtexto=horaactual-24;
			} else {
				horaactualtexto=horaactual;
			}
			if (horaactualtexto<10) {
				horaactualtexto="0"+horaactualtexto;
			}
			document.recomendaciones.hora1.options[contador+1]=new Option(horaactualtexto+':00',horaactual);
			document.recomendaciones.hora2.options[contador+1]=new Option(horaactualtexto+':00',horaactual);
			if (hora1actual==horaactual){
				indice1=(contador+1);
			}
			if (hora2actual==horaactual){
				indice2=(contador+1);
			}
			contador++;
		}
		//document.recomendaciones.hora1.selectedIndex=indice1;
		//document.recomendaciones.hora2.selectedIndex=indice2;
		//alert(indice1+","+indice2);
		if (indice1==0){hora1actual=0;}
		if (indice2==0){hora2actual=0;}
	}
}

function checkeaformulario(){
	if (recomendaciones.dia.value==0){// || recomendaciones.hora1.value=="-" || recomendaciones.hora2.value=="-"){
		OpenBrWindow('recomen_error.php','errorrecomendaciones','status=yes', 420, 270, 'true')
	} else {
		recomendaciones.submit();
	}
}

//Ventana
function OpenBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  ventana=window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
	ventana.focus();
}

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];}}
}

