function handleHttpResponse() { 
    if (http.readyState == 4) { 
       if (http.status == 200) { 
          if (http.responseText.indexOf('invalid') == -1) {
             // Armamos un array, usando la coma para separar elementos
             results = http.responseText.split(","); 
			 texto=results[0];
			 if (texto=='XX')
			 {
				//document.getElementById("divprincipal").innerHTML = 'No existen impuestos para ese dia';
			 }
			 else
			 {
	             document.getElementById("divprincipal").innerHTML = results[0];
			 }
			 enProceso = false;
          }
       }
    }
}

function muestroDia(opcion,fecha)
{
	
		var url = "buscar.asp?op="+opcion+"&diaevento="+ fecha;
		//alert (url);
		http.open("GET", url, true);
		http.onreadystatechange = handleHttpResponse;
		enProceso = true;
		http.send(null);

}
function getHTTPObject() {
    var xmlhttp;
    /*@cc_on
    @if (@_jscript_version >= 5)
       try {
          xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
       } catch (e) {
          try {
             xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
          } catch (E) { xmlhttp = false; }
       }
    @else
    xmlhttp = false;
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
       try {
          xmlhttp = new XMLHttpRequest();
       } catch (e) { xmlhttp = false; }
    }
    return xmlhttp;
}

var enProceso = false; // lo usamos para ver si hay un proceso activo
var http = getHTTPObject(); // Creamos el objeto XMLHttpRequest

function reloj() {
  //obtiene fecha y hora
  var fecha = new Date();
  var Anio = fecha.getFullYear();
  var Mes = fecha.getMonth();
  var DiaActual = fecha.getDate();
  var Dia = fecha.getDay();
  var horas = fecha.getHours();
  var minutos = fecha.getMinutes();
  var segundos = fecha.getSeconds();

  //asigna p.m. o a.m. segun el caso
  var cir = "";
  var i = 12;
  if(horas < i) {
    cir = "a.m.";
  } else if(horas >= i) {
    cir = "p.m.";
  }

  //array nombres meses
  var mes = new Array();
  mes[0] = "Enero";
  mes[1] = "Febrero";
  mes[2] = "Marzo";
  mes[3] = "Abril";
  mes[4] = "Mayo";
  mes[5] = "Junio";
  mes[6] = "Julio";
  mes[7] = "Agosto";
  mes[8] = "Septiembre";
  mes[9] = "Octubre";
  mes[10] = "Noviembre";
  mes[11] = "Diciembre";
  
  //array nombres dias
  var dia = new Array();
  dia[0] = "Domingo";
  dia[1] = "Lunes";
  dia[2] = "Martes";
  dia[3] = "Miércoles";
  dia[4] = "Jueves";
  dia[5] = "Viernes";
  dia[6] = "Sábado";
  
  //array horas
  var hr = new Array();
  hr[0] = "12";
  hr[1] = "01";
  hr[2] = "02";
  hr[3] = "03";
  hr[4] = "04";
  hr[5] = "05";
  hr[6] = "06";
  hr[7] = "07";
  hr[8] = "08";
  hr[9] = "09";
  hr[10] = "10";
  hr[11] = "11";
  hr[12] = "12";
  hr[13] = "01";
  hr[14] = "02";
  hr[15] = "03";
  hr[16] = "04";
  hr[17] = "05";
  hr[18] = "06";
  hr[19] = "07";
  hr[20] = "08";
  hr[21] = "09";
  hr[22] = "10";
  hr[23] = "11";
  
  //obtiene nombre mes
  //mas faci: Mes = mes[Mes];
  if(Mes==0){Mes = mes[0];}
  if(Mes==1){Mes = mes[1];}
  if(Mes==2){Mes = mes[2];}
  if(Mes==3){Mes = mes[3];}
  if(Mes==4){Mes = mes[4];}
  if(Mes==5){Mes = mes[5];}
  if(Mes==6){Mes = mes[6];}
  if(Mes==7){Mes = mes[7];}
  if(Mes==8){Mes = mes[8];}
  if(Mes==9){Mes = mes[9];}
  if(Mes==10){Mes = mes[10];}
  if(Mes==11){Mes = mes[11];}

  //obtiene nombre dia
  //mas facil: Dia = dia[Dia];
  if(Dia==0){Dia = dia[0];}
  if(Dia==1){Dia = dia[1];}
  if(Dia==2){Dia = dia[2];}
  if(Dia==3){Dia = dia[3];}
  if(Dia==4){Dia = dia[4];}
  if(Dia==5){Dia = dia[5];}
  if(Dia==6){Dia = dia[6];}
  
  //ajusta formato horas
  //mas facil: horas = hr[horas];
  if(horas==0){horas = hr[0];}
  if(horas==1){horas = hr[1];}
  if(horas==2){horas = hr[2];}
  if(horas==3){horas = hr[3];}
  if(horas==4){horas = hr[4];}
  if(horas==5){horas = hr[5];}
  if(horas==6){horas = hr[6];}
  if(horas==7){horas = hr[7];}
  if(horas==8){horas = hr[8];}
  if(horas==9){horas = hr[9];}
  if(horas==10){horas = hr[10];}
  if(horas==11){horas = hr[11];}
  if(horas==12){horas = hr[12];}
  if(horas==13){horas = hr[13];}
  if(horas==14){horas = hr[14];}
  if(horas==15){horas = hr[15];}
  if(horas==16){horas = hr[16];}
  if(horas==17){horas = hr[17];}
  if(horas==18){horas = hr[18];}
  if(horas==19){horas = hr[19];}
  if(horas==20){horas = hr[20];}
  if(horas==21){horas = hr[21];}
  if(horas==22){horas = hr[22];}
  if(horas==23){horas = hr[23];}
  
  //ajusta segundos
  var m = 10;
  if(minutos < m) {
    minutos="0"+minutos;
  }
  if(segundos < m) {
    segundos="0"+segundos;
  }
 
  //cadena final
  textoFinal = (Dia+", "+DiaActual+" de "+Mes+" de "+Anio+"       ...::: www.torremolinos.es :::...");

  //muestra en barra de estado
  window.status = textoFinal;
  //si quieres poner algo en el titulo
//  document.title = " |-[ Prockto ]-| ";

  //repite cada 1 segundo
  setTimeout("reloj()",1);
}
//reloj();
function selnoticia(x)
{
x.style.textDecoration="underline";
}
function deselnoticia(x)
{
x.style.textDecoration="";
}
function seltelefono(x)
{
x.bgColor="#ffffcc";
}
function deseltelefono(x)
{
x.bgColor="#ffffff";
}
function txtfocus(x)
{
x.style.backgroundColor="#FFFFCC";
}
function txtblur(x)
{
x.style.backgroundColor="#ffffff";
}

function vermastlf(x)
{
	newwindow=window.open("telefonos/vermastlf.asp?idtelefono="+x,"sub","top=240,left=210,menubar=no,status=0,height=170,width=370");
	newwindow.focus();
}
function silleno(nform,ncampo,actionform)
{
	var x=ncampo.value;
	if (x=="")
		{
			alert("Debe escribir algo en el campo de busqueda");
			ncampo.focus();
			return false;
			
		}
	else 
		{
			nform.action=actionform;
			return true;
			
		}

}
function mostrar(contenido) { 
divactual=contenido
document.getElementById(contenido).style.display='block';

}
function cambiarcolor(objeto)
{
	colortd=objeto.style.backgroundColor; 
	objeto.style.backgroundColor='#f5e78b';
}

function devolvercolor(objeto)
{
	objeto.style.backgroundColor=colortd;
}

function sumomes(contenido)
{if (contenido>=0 && contenido<=3 - contenido+3)
	{
	divactual=contenido
	document.getElementById(contenido).style.display='block';
	}
else
	{
	document.getElementById(divactual).style.display='block';
	}
	

}
function verCalendarioFiscal(contenido)
{
	var mesactual,mesfinal;
	mesactual=document.getElementById("mesactual").value;
	mesfinal=12-mesactual;
	if (contenido>=0 && contenido<=mesfinal - contenido+mesfinal)
	{
	divactual=contenido
	document.getElementById(contenido).style.display='block';
	}
else
	{
	document.getElementById(divactual).style.display='block';
	}
	

}
function restomes(contenido)
{
divactual=contenido
document.getElementById(contenido-2).style.display='block';

}
function ocultar() { 
document.getElementById(divactual).style.display='none';
} 
function verevento(link)
{
	location.href = "agenda.asp?idevento="+link;
}
function filtroturismo(estrellas,tipo)
{
	location.href = "turismo.asp?ta="+tipo+"&es="+estrellas;
}
function change_image() {document.images["masinfo"].src = "baile/masinfoover.gif";}  
function normal_image() {document.images["masinfo"].src = "baile/masinfo.gif";}  
function mouseOver(elemento)
{
	elemento.style.backgroundColor='#F7B707';
	elemento.style.color='#ffffff';
}
function mouseOut(elemento)
{
	elemento.style.backgroundColor='#ffffff';
	elemento.style.color='#333333';
}
function resEstilo(elemento)
{
	elemento.style.backgroundColor='';
	elemento.style.color='';
}

