function objetoAjax(){
	var xmlhttp=false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
		   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
  		}
	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;

}


function pedirDatos(idVideo){
	//donde se mostrarn los datos
	divFormulario = document.getElementById('formulario');
	cargando = document.getElementById('formulario');
	//instanciamos el objetoAjax
	ajax=objetoAjax();
	//uso del medotod GET
	ajax.open("POST", "include/consulta_por_id.php");
	
	cargando.innerHTML= '<img src="images/loader.gif">';

	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divFormulario.innerHTML = ajax.responseText
			//mostrar el formulario
			divFormulario.style.display="block";
		}
	}
	//como hacemos uso del metodo GET
	//colocamos null
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	//enviando los valores
	ajax.send("idVideo="+idVideo)
}


function pedirDatos_ini(idVideo){

	//0-domingo
	var ahora = new Date();
	var dia = ahora.getDay();
	var hora = ahora.getHours();
	if(dia=='6' || dia=='0' || (dia=='1' && hora<15))
	{
		estas_viendo();
		clima_ciudad(clima_ini);
	}
	else
	{
		//donde se mostrarn los datos
		divFormulario = document.getElementById('formulario');
		cargando = document.getElementById('formulario');
		//instanciamos el objetoAjax
		ajax=objetoAjax();
		//uso del medotod GET
		ajax.open("POST", "include/consulta_por_id.php");
		
		cargando.innerHTML= '<img src="images/loader.gif">';
	
		ajax.onreadystatechange=function() {
			if (ajax.readyState==4) {
				//mostrar resultados en esta capa
				divFormulario.innerHTML = ajax.responseText
				//mostrar el formulario
				divFormulario.style.display="block";
				estas_viendo();
				clima_ciudad(clima_ini);
			}
		}
		//como hacemos uso del metodo GET
		//colocamos null
		ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		//enviando los valores
		ajax.send("idVideo="+idVideo)
	}
}

function ver_programacion(dia)
{
		//donde se mostrarn los datos
	divFormulario = document.getElementById('columna_izquierda');
	cargando = document.getElementById('columna_izquierda');
	//instanciamos el objetoAjax
	ajax=objetoAjax();
	//uso del medotod GET
	ajax.open("POST", "include/programacion_total.php");
	
	cargando.innerHTML= '<img src="images/loader.gif">';

	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divFormulario.innerHTML = ajax.responseText
			//mostrar el formulario
			divFormulario.style.display="block";
		}
	}
	//como hacemos uso del metodo GET
	//colocamos null
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	//enviando los valores
	ajax.send("dia="+dia)
}

function ver_programacion_ini(dia)
{
		//donde se mostrarn los datos
	divFormulario = document.getElementById('columna_izquierda');
	cargando = document.getElementById('columna_izquierda');
	//instanciamos el objetoAjax
	ajax=objetoAjax();
	//uso del medotod GET
	ajax.open("POST", "include/programacion_total.php");
	
	cargando.innerHTML= '<img src="images/loader.gif">';

	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//mostrar resultados en esta capa
			divFormulario.innerHTML = ajax.responseText
			//mostrar el formulario
			divFormulario.style.display="block";
			estas_viendo();
			clima_ciudad(clima_ini);
		}
	}
	//como hacemos uso del metodo GET
	//colocamos null
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	//enviando los valores
	ajax.send("dia="+dia)
}
function clima_ciudad(ciudad)
{
	divClima = document.getElementById('div_clima');
	divClima.innerHTML= '<iframe id="iframe_clima" allowtransparency="true" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" src="clima/clima.php?id='+ciudad+'" height="250px" width="490px"></iframe>';
	
	ocultar_lista_ciudades();
}

function ver_lista_ciudades()
{
	div = document.getElementById('clima_sel');
	div.style.display = '';
	
	div = document.getElementById('otras_localidades');
	div.style.display = 'none';
}

function ocultar_lista_ciudades()
{
	div = document.getElementById('clima_sel');
	div.style.display = 'none';
	
	div = document.getElementById('otras_localidades');
	div.style.display = '';
}

