/* 
responsable: Carlos Cortes
Creacion: Diciembre 2008
*/
var peticion = false;
 try {
  peticion = new XMLHttpRequest();
  } catch (trymicrosoft) {
  try {
		peticion = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (othermicrosoft) {
  try {
		peticion = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (failed) {
		peticion = false;
} 
}
}
if (!peticion)
 alert("ERROR AL INICIALIZAR!");


function AddUrlSin(strUrl, strWiken)
{
	var strTemp = escape(strWiken);
	strUrl = strUrl.replace("*u*",strTemp)
	location.href = strUrl;
}

function wiken_rating() /* realiza votacion */
{
	var new_valor2;
	
	
		var valor=rating2.getValue();
		//alert(valor);
		var idItemNum=document.getElementById('idItem').value
		var strnum_modulo=document.getElementById('num_modulo').value
		var estadoninos=document.getElementById('estninos').value

		var strUrl='/estadisticas/rating.asp?voto='+valor+'&idItem='+eval(idItemNum)+'&num_modulo='+strnum_modulo+'&estninos='+ estadoninos +'&ran='+ Math.random();
		//alert(strUrl);
		
		peticion.open("GET", strUrl); 
		peticion.onreadystatechange = function() { 
		
			if (peticion.readyState == 4)
			{ 
				new_valor2=peticion.responseText;
				//alert(new_valor2);
				rating2.setValue(new_valor2); /* seteo valor */
				validar_cookie(idItemNum,strnum_modulo,'1');
			} 
		}
		peticion.send(null); 
	
}


function validar_cookie(Id,IdMod,estado) /* valida cookie de votacion */
{
	var cookie_valor;
	var strUrl='/estadisticas/cookie.asp?idItem='+eval(Id)+'&idmod='+IdMod+'&estado='+estado+'&ran='+ Math.random();
	peticion.open("GET", strUrl); 
	peticion.onreadystatechange = function() { 
	if (peticion.readyState == 4) { 
		cookie_valor=peticion.responseText;
		if (cookie_valor==1)
			rating2.setState('readonly');
	} 
	} 
	peticion.send(null); 
}

function est_div(str_obj)
{
	var obj_div=document.getElementById(str_obj);
	(obj_div.style.display !='block')?showclose_div(1,str_obj):showclose_div(0,str_obj);
	constr_form();
}




function showclose_div(estado,str_obj)
{
	if (estado == 0)
	{
		document.getElementById(str_obj).style.display='none';
	}
	else
	{
		document.getElementById(str_obj).style.display='block';
		document.getElementById(str_obj).style.top=posy+250;
		document.getElementById(str_obj).style.left=posx+250;
	

	}
}


/*swf*/

function load_swf(path)
{
	//alert(path);
	var flashvars = {
				PathX:path			
				};
		var params = {allowFullScreen:'true',wmode:'opaque'};
		var attributes = {};

	swfobject.embedSWF("../swf/trans.swf", "flash_calendar","669", "275", "9.0.0","../swf/expressInstall.swf", flashvars, params, attributes);
	
	/*deteccion de player para MOZ*/
/*	if (!swfobject.hasFlashPlayerVersion("9.0.0")) 
	{	if (document.getElementById("version_flash"))
			document.getElementById("version_flash").style.display="block";
	}
*/

}
var posx = 0;
var posy = 0;


/*** Mail ***/


function enviarFormulario(url,formid,element_id)
{
	var Formulario = document.getElementById(formid);
	var longitudFormulario = Formulario.elements.length;
	var cadenaFormulario = ""
	var sepCampos
	sepCampos = ""
	for (var i=0; i <= Formulario.elements.length-1;i++)
	{
	cadenaFormulario += sepCampos+Formulario.elements[i].name+'='+encodeURI(Formulario.elements[i].value);
	sepCampos="&";
	}
	//alert(cadenaFormulario);
	var element = document.getElementById(element_id);
	//element.innerHTML = 'cargando'; 
	peticion.open("POST", url, true);
	peticion.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=ISO-8859-1');
	peticion.onreadystatechange = function () {
	if (peticion.readyState == 4) {
	element.innerHTML = peticion.responseText
			
	}
	}
	peticion.send(cadenaFormulario);
	
}

function constr_form()
{

var str_form='<input id="str_permalink" name="scorreo"  type="hidden" value="">';
    
	str_form=str_form+'<div id="div_caja_form_env_b">'
		str_form=str_form+'<div id="div_caja_form_env_c">E-mail destinatario</div>'
        str_form=str_form+'<div id="div_caja_form_env_d"><input name="text_mail_destino" type="text" id="text_mail_destino" class="imput_form_0"></div>'
    str_form=str_form+'</div>'

	str_form=str_form+'<div id="div_caja_form_env_b">'
        str_form=str_form+'<div id="div_caja_form_env_c">Su E-mail</div>'
        str_form=str_form+'<div id="div_caja_form_env_d"><input name="text_mail_origen" type="text" id="text_mail_origen" class="imput_form_0"></div>'
    str_form=str_form+'</div>'

	str_form=str_form+'<div id="div_caja_form_env_b">'
        str_form=str_form+'<div id="div_caja_form_env_c">Comentario</div>'
        str_form=str_form+'<textarea name="text_comentario1" rows="2" id="text_comentario1" cols="25" class="imput_form_1"></textarea>'
    str_form=str_form+'</div>'

	str_form=str_form+'<div id="botonEnviar"><img border="0" src="/img/btn_enviar_form_0.gif" onClick="validar_mail()";></div>'


	document.getElementById('send_mail').innerHTML=str_form;
		document.getElementById("div_caja_form_env").style.top=(posy-20)+"px";
	document.getElementById("div_caja_form_env").style.left=(posx+20)+"px";




}

function validar_mail()
			{
				var dest=document.getElementById('text_mail_destino');
				var orig=document.getElementById('text_mail_origen');

				if (dest.value.length == 0){
					alert("Completar E-mail destinatario");
					dest.focus();
					return false;
				}
				else if (orig.value.length == 0){
					alert("Completar Su E-mail");
					orig.focus();
					return false;
				}
				
				else if ((dest.value.length != 0) && (! isEmail(dest.value))) {
					alert("Email Incorrecto");
					dest.focus();
					return false;
				}
				else if ((orig.value.length != 0) && (! isEmail(orig.value))) {
					alert("Email Incorrecto");
					orig.focus();
					return false;
				}
				else
				{
					enviarFormulario('../mail/EnviarsinID.asp','form_enviar','send_mail');
				}
		
				return true;
			}



function isEmail (s)
			{
				var i = 1;
				var sLength = s.length;
				while ((i < sLength) && (s.charAt(i) != "@"))
				{ i++
				}

				if ((i >= sLength) || (s.charAt(i) != "@")) return false;
				else i += 2;

				while ((i < sLength) && (s.charAt(i) != "."))
				{ i++
				}

				if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
				else return true;
			}
	
		
		function Favoritos(url,tit_fav) {
		if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)){
			window.external.AddFavorite(url, tit_fav) ;
		}
	
}

/* funcion que obtiene el alto y ancho del browser
(para getViewportSize().x):

*/
function getViewportSize() {
    var x, y;
    if (self.innerHeight) { // MOS
        y = self.innerHeight;
        x = self.innerWidth;
    } else if (document.documentElement && document.documentElement.clientWidth) { // IE6 Strict
        x = document.documentElement.clientWidth;
        y = document.documentElement.clientHeight;
    } else if (document.body.clientHeight) { // IE quirks
        y = document.body.clientHeight;
        x = document.body.clientWidth;
    }
    return {x: x, y: y};
}



//popup terminos y registro
function popupTERMINOS(URL)
{
window.open(URL,'popTERMINOS','width=787,height=490');
}

function LoadLogin()
{
//*********************
var posx=0;
var str_form=''; 
/*
str_form = str_form + '<p>Autentificación</p>';
str_form = str_form + '<form name="frmRegistro" id=frmRegistro method="post" action="/registro/chkRegistro.asp">';
str_form = str_form + 'Usuario: <input type="text" name="txUser" id="txUser" size=30> <br><br>';
str_form = str_form + 'Password: <input type="password" name="txPasswd" id="txPasswd" size=30> <br><br>';
str_form = str_form + '<input type="submit" name="boSubmit" id="boSubmit" size=10 value="Ingresar">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
str_form = str_form + '<input type="reset" name="boReset" id="boReset" size=10 value="Cancelar" onclick="document.getElementById(\'ContenedorRegistro\').style.display=\'none\';"> ';
str_form = str_form + '<input type="hidden" name="txURL" id="txURL" value="'+ location.href +'"> <br><br>';
str_form = str_form + '</form>';
*/

str_form = str_form + '<div id="box_FORM"><div id="top_FORM"></div>';
str_form = str_form + '<div id="contenedorFORM">';
str_form = str_form + '<form name="frmRegistro" id=frmRegistro method="post" action="/registro/chkRegistro.asp">';
str_form = str_form +'<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">';
str_form = str_form +'<tr><td align="right" width="150"><p>Usuario: </p></td>';
str_form = str_form +'<td colspan="2"> <input type="text" name="txUser" id="txUser" size=30> <br><br></td>';
str_form = str_form +'</tr><tr><td align="right" width="150"><p>Password: </p></td>';
str_form = str_form +'<td colspan="2"><input type="password" name="txPasswd" id="txPasswd" size=30><br><br></td></tr>'
str_form = str_form +'<tr>';
str_form = str_form +'<td colspan=2><input type="submit" name="boSubmit" id="boSubmit" size=10 value="Ingresar"></td><td width="39%">';
str_form = str_form + '<input type="reset" name="boReset" id="boReset" size=10 value="Cancelar" onclick="document.getElementById(\'ContenedorRegistro\').style.display=\'none\';"></td>';
str_form = str_form + '<input type="hidden" name="txURL" id="txURL" value="'+ location.href +'">';
str_form = str_form + '</tr>';
str_form = str_form + '</table></form>';
str_form = str_form + '</div><div id="inf_FORM"></div></div>';



document.getElementById('ContenedorRegistro').style.display='block';
document.getElementById('ContenedorRegistro2').innerHTML=str_form;


document.getElementById("ContenedorRegistro2").style.left=(getViewportSize().x/2)-250+"px";

}


function handleHttpResponsePostComment() { 
// alert(http.readyState);
    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(","); 
			 // alert(http.status);
             document.getElementById("tl_blogComments").innerHTML = http.responseText; //results[0];
			 enProceso = false;			
             
          }
       }
		else{
		if (http.status == 500) { 
          if (http.responseText.indexOf('invalid') == -1) {

			 document.getElementById("tl_blogComments").innerHTML = http.responseText; //results[0];
             enProceso = false;
		 }
		}
		}
    }
}

function CheckCantPalabras(strTexto)
{

 strTexto = strTexto.replace(/(^\s*)|(\s*$)/g, "");

 var ArrPalabras =  new Array();
 ArrPalabras  = strTexto.split(' ');

  return ArrPalabras.length;
}
function Comentar() {
	//alert('RefreshNodos');

    if (!enProceso && http) {
       var strParamPages="";
		if (document.getElementById("txComentario").value.length==0)
		{
			alert('Debe ingresar un comentario');
			return false;
		}
		var iCantIngre = CheckCantPalabras(document.getElementById("txComentario").value)
		if (iCantIngre > 500)
		{
			alert('El texto ingresado (' +iCantIngre +' palabras.) excede de las 500 palabras permitidas.');
			return false;
		}


		strParamPages=strParamPages + "mod=" + escape(document.getElementById("mod").value);
		strParamPages=strParamPages + "&idf=" + escape(document.getElementById("idf").value);
		strParamPages=strParamPages + "&txComentario=" + escape(document.getElementById("txComentario").value);

	   
       var url = "/include/mt-comments.asp";
    
       http.open("POST", url, true);	  
       http.onreadystatechange = handleHttpResponsePostComment;
	   http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=ISO-8859-1');
	   //http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
		

       enProceso = true;
      http.send(strParamPages)
    }
}


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


/* se utiliza en cajas laterales*/

function openPopup(url,wdth,hght)
{
	var opciones = 'width=' + wdth + ',heigth=' + hght + ',scrollbars=no,menubar=no,resizable=no';
	window.open(url,"",opciones);
}


/* fade caja */
function MM_effectAppearFade(targetElement,duration, from, to, toggle)
{


	Spry.Effect.DoFade(targetElement, {duration: duration, from: from, to: to, toggle: toggle});
	
	

}


// * Dependencies * 
// this function requires the following snippets:
// JavaScript/readable_MM_functions/findObj
// JavaScript/readable_MM_functions/showHideLayers
// JavaScript/events/getMouseLoc
function moveLayerToMouseLoc(theLayer, offsetH, offsetV)
{
  var obj;
  if ((findObj(theLayer))!=null)
  {
    if (document.layers)  //NS
    {
      document.onMouseMove = getMouseLoc;
      obj = document.layers[theLayer];
      obj.left = mLoc.x +offsetH;
      obj.top  = mLoc.y +offsetV;
    }
    else if (document.all)//IE
    {
      getMouseLoc();
      obj = document.all[theLayer].style;
      obj.pixelLeft = mLoc.x +offsetH;
      obj.pixelTop  = mLoc.y +offsetV;
    }
   // showHideLayers(theLayer,'','show');
  }
}
// get mouse location
function Point(x,y) {  this.x = x; this.y = y; }
mLoc = new Point(-500,-500);
function getMouseLoc(e)
{
  if(!document.all)  //NS
  {
    mLoc.x = e.pageX;
    mLoc.y = e.pageY;
  }
  else               //IE
  {
    mLoc.x = event.x + document.body.scrollLeft;
    mLoc.y = event.y + document.body.scrollTop;
  }
  return true;
}
//NS init:
if(document.layers){ document.captureEvents(Event.MOUSEMOVE); document.onMouseMove = getMouseLoc; }


function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}


function showHideLayers()
{ 
  var i, visStr, obj, args = showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3)
  {
    if ((obj = findObj(args[i])) != null)
    {
      visStr = args[i+2];
      if (obj.style)
      {
        obj = obj.style;
        if(visStr == 'show') visStr = 'visible';
        else if(visStr == 'hide') visStr = 'hidden';
      }
      obj.visibility = visStr;
    }
  }
}


function changeInfoCine(id_busc,idCine)
{

var contentDiv;
var info_cine;
//contentDiv='<div class="info_x-cerrar"><a href="javascript:void(0)" onclick="MM_effectAppearFade(\'info-cine1\', 500, 100, 0, false)">X</a></div>';
contentDiv='<div class="info_x-cerrar"><img src="/img/boton_alt_cerrar.gif" title="Cerrar" href="javascript:void(0)" onclick="MM_effectAppearFade(\'info-cine1\', 500, 100, 0, false);cerrarInfoCine();"></div>';

	var strUrl='../fichas/cine/dondeverla.asp?id='+eval(id_busc)+'&idCine='+eval(idCine)+'&ran='+ Math.random();
		//alert(strUrl);
	peticion.open("GET", strUrl); 
	peticion.onreadystatechange = function() { 
	if (peticion.readyState == 4)
		{ 
			info_cine =peticion.responseText;
			contentDiv=contentDiv + info_cine;
			//alert(contentDiv);
			document.getElementById('info_despliegue-cine').innerHTML=contentDiv;
			controlefecto=1;			
		} 
		}
	document.getElementById("info-cine1").style.top=(posy-20)+"px";
	document.getElementById("info-cine1").style.left=(posx+20)+"px";
	MM_effectAppearFade('info-cine1', 500, 0, 100, false);
peticion.send(null); 
}

function cerrarInfoCine()
{
	document.getElementById("info-cine1").style.top="-1000px";
	document.getElementById("info-cine1").style.left="-1000px";
}

function changeInfoTV(i,strTexto)
{

var contentDiv;
	contentDiv='<div class="info_x-cerrar"><img src="/img/boton_alt_cerrar.gif" title="Cerrar" href="javascript:void(0)" onclick="MM_effectAppearFade(\'info-tv1\', 500, 100, 0, false);cerrarInfoTV();"></div>';
		
	document.getElementById('info_despliegue-tv').innerHTML=contentDiv+strTexto;
		
	document.getElementById("info-tv1").style.top=(posy-20)+"px";
	document.getElementById("info-tv1").style.left=(posx+20)+"px";

	MM_effectAppearFade('info-tv1', 500, 0, 100, false);
 
}

function cerrarInfoTV()
{
	document.getElementById("info-tv1").style.top="-1000px";
	document.getElementById("info-tv1").style.left="-1000px";
}


function InfoCiclo(strnombreCiclo,strcicDire,strcicfono,strciccomuna,strcicweb,strprecioscic)
{

var contentDiv;
var info_cine;
var strhtmlciclo;
//contentDiv='<div class="info_x-cerrar"><a href="javascript:void(0)" onclick="MM_effectAppearFade(\'info-cine1\', 500, 100, 0, false)">X</a></div>';
contentDiv='<div class="info_x-cerrar"><img src="/img/boton_alt_cerrar.gif" title="Cerrar" href="javascript:void(0)" onclick="MM_effectAppearFade(\'info-cine1\', 500, 100, 0, false);cerrarInfoCine();"></div>';
	
strhtmlciclo=contentDiv+'<p class="linea_separador"><strong>' + strnombreCiclo + '</strong></p>';
strhtmlciclo=strhtmlciclo+'<p><strong>Dirección</strong>: ' + strcicDire +'</p>';
strhtmlciclo=strhtmlciclo+'<p><strong>Fono</strong>: ' + strcicfono + '</p>';
strhtmlciclo=strhtmlciclo+'<p><strong>Comuna</strong>: ' + strciccomuna + '</p>';
strhtmlciclo=strhtmlciclo+'<p><strong>Precios</strong>: ' + strprecioscic + '</p>';
if ( strcicweb != "")
{
	strhtmlciclo=strhtmlciclo+'<p><strong><a href="' + strcicweb + '" target="_blank" style="color:#fff;">Sitio Web</a></strong></p>';
}


document.getElementById('info_despliegue-cine').innerHTML=strhtmlciclo;
controlefecto=1;
	document.getElementById("info-cine1").style.top=(posy-20)+"px";
	document.getElementById("info-cine1").style.left=(posx+20)+"px";
MM_effectAppearFade('info-cine1', 500, 0, 100, false);

}

function load_sind(idficha,idmod)
{
	var contentDiv='';
	var info_cine;
	//contentDiv+='<div><img src="/img/boton_alt_cerrar.gif" title="Cerrar" onclick="MM_effectAppearFade(\'infoSindica\', 500, 100, 0, false);"></div>'
	contentDiv+='<div id="div_caja_sindicacion">'
    	contentDiv+='<div id="div_caja_sindicacion_a">'
			contentDiv+='<div id="div_caja_sindicacion_bc">'
				contentDiv+='<div id="div_caja_sindicacion_e"><b>Sindicación</b></div>'
				contentDiv+='<div><img src="/img/boton_alt_cerrar.gif" title="Cerrar" onclick="cerrarSind();"></div>'
			contentDiv+='</div>'
		

var strUrl='../fichas/sindicacion.asp?id='+eval(idficha)+'&idmodulo='+eval(idmod)+'&ran='+ Math.random();
		//alert(strUrl);
	peticion.open("GET", strUrl); 
	peticion.onreadystatechange = function() { 
	if (peticion.readyState == 4)
		{ 
			info_cine =peticion.responseText;
			contentDiv=contentDiv + info_cine;
			contentDiv+='</div>'
			contentDiv+='</div>'
			document.getElementById('infoSindica').innerHTML=contentDiv;
			controlefecto=1;			
		} 
	}

					document.getElementById("infoSindica").style.top=(posy-20)+"px";
	document.getElementById("infoSindica").style.left=(posx+20)+"px";
			document.getElementById('infoSindica').style.display = "block";
			MM_effectAppearFade('infoSindica', 0, 0, 100, false);

			
			

peticion.send(null); 




}

function cerrarSind()
{	
	document.getElementById('infoSindica').style.display = "none";
}


var posx=0,posy=0;
function Locate(e){




if(e==null) e=window.event;
if(e.pageX || e.pageY){
    posx=e.pageX; posy=e.pageY;
    }
else if(e.clientX || e.clientY){
    if(document.documentElement.scrollTop){
        posx=e.clientX+document.documentElement.scrollLeft;
        posy=e.clientY+document.documentElement.scrollTop;
        }
    else{
        posx=e.clientX+document.body.scrollLeft;
        posy=e.clientY+document.body.scrollTop;
        }
    }

}


	//document.onmousemove = Locate;






/***GRILLA **/

function FormularioTV(formid,element_id,strhorafecha)
{
	
	var url="loadGrid.asp"
	var Formulario = document.getElementById(formid);
	var longitudFormulario = Formulario.elements.length;
	var cadenaFormulario = "";
	var filtrosSeccion="";
	var sepCampos;
	sepCampos = "";
	for (var i=0; i <= Formulario.elements.length-1;i++)
	{
		
		if (Formulario.elements[i].type == "checkbox")
		{
			if (Formulario.elements[i].checked)
			{
			//alert(Formulario.elements[i].value);							
			filtrosSeccion+= sepCampos+Formulario.elements[i].name+'='+encodeURI(Formulario.elements[i].value);
			sepCampos="&";
			}
		
		}
		else
		{

			cadenaFormulario += sepCampos+Formulario.elements[i].name+'='+encodeURI(Formulario.elements[i].value);
			sepCampos="&";
	
		}
		
	}
	cadenaFormulario=cadenaFormulario+ filtrosSeccion+strhorafecha;
	//alert(document.getElementById('ddlDay').value);
	//alert(cadenaFormulario);
	
	var element = document.getElementById(element_id);
	//element.innerHTML = 'cargando'; 
	peticion.open("POST", url, true);
	peticion.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=ISO-8859-1');
	peticion.onreadystatechange = function () {
	if (peticion.readyState == 4) {
	element.innerHTML = peticion.responseText

	{
	}		

	}
	}
	peticion.send(cadenaFormulario);
	
}


function prevnextTV(formid,element_id,strhorafecha)
{
	
	var url="loadGrid.asp"
	var Formulario = document.getElementById(formid);
	var longitudFormulario = Formulario.elements.length;
	var cadenaFormulario = "";
	var filtrosSeccion="";
	var sepCampos;
	sepCampos = "";
	for (var i=0; i <= Formulario.elements.length-1;i++)
	{		
		if (Formulario.elements[i].type == "checkbox")
		{
			if (Formulario.elements[i].checked)
			{
			//alert(Formulario.elements[i].value);							
			filtrosSeccion+= sepCampos+Formulario.elements[i].name+'='+encodeURI(Formulario.elements[i].value);
			sepCampos="&";
			}
		
		}

		
	}
	if (filtrosSeccion !="")
	{
		cadenaFormulario=filtrosSeccion+'&'
	}
	cadenaFormulario=cadenaFormulario+strhorafecha
	//alert(cadenaFormulario);
	
	var element = document.getElementById(element_id);
	//element.innerHTML = 'cargando'; 
	peticion.open("POST", url, true);
	peticion.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=ISO-8859-1');
	peticion.onreadystatechange = function () {
	if (peticion.readyState == 4) {
	element.innerHTML = peticion.responseText
			
	}
	}
	peticion.send(cadenaFormulario);
	
}

function limpiaGrillaTv(formid)
{
	
	var Formulario = document.getElementById(formid);
	for (var i=0; i <= Formulario.elements.length-1;i++)
	{
		if (Formulario.elements[i].name!="strAll" && Formulario.elements[i].type == "checkbox")
		{
			
			Formulario.elements[i].checked='';
		}
	}
}

function changegrillaTV(i,strTexto,strHraRegI,strHraRegF, strcanal,strcategoria)
{

var contentDiv;
	contentDiv='<div class="info_x-cerrar"><img src="/img/boton_alt_cerrar.gif" title="Cerrar" href="javascript:void(0)" onclick="MM_effectAppearFade(\'info-tv1\', 500, 100, 0, false);cerrarInfoTV();"></div>';

	var strTextoCont=contentDiv + "<div class='tbGrilla'><table width='220'>";
		strTextoCont+="<tr><td><span><b>Canal: </b>"+strcanal+"</span></td></tr>";
		strTextoCont+="<tr><td><span><b>Tipo: </b>" + strcategoria + "</span></td></tr>";
		strTextoCont+="<tr><td><span><b>Resumen:<br>&nbsp;</b>"+strTexto+"</span></td></tr>";
		strTextoCont+="<tr><td><span><b>Horario:&nbsp;</b>"+strHraRegI.substr(10,15)+" - "+ strHraRegF.substr(10,15) +" hrs.</span></td></tr></table></div>";
		//alert(strTextoCont);
	//document.getElementById('info_Grilla-tv').innerHTML=contentDiv+'<p>'+strTexto+'</p><p>Fuente:</p><p><img src="/img/directv.gif" ></p>';
	document.getElementById('info_Grilla-tv').innerHTML=strTextoCont;

		
	document.getElementById("info-tv1").style.top=(posy-20)+"px";
	document.getElementById("info-tv1").style.left=(posx+20)+"px";

	MM_effectAppearFade('info-tv1', 500, 0, 100, false);
 
}


function limpiacheck()
{
	document.getElementById('strAll').checked='';
}




function canales_tv()
{
	var info_cine;
	var strUrl='canales.asp'+'?ran='+ Math.random();
		//alert(strUrl);
	peticion.open("GET", strUrl); 
	peticion.onreadystatechange = function() { 
	if (peticion.readyState == 4)
		{ 
			info_cine =peticion.responseText;
			document.getElementById('content_grillaTV').innerHTML=info_cine;

		} 
	}

	

peticion.send(null); 




}


/*generacion captcha*/

function RefreshImage(valImageId) {
	var objImage = document.images[valImageId];
	if (objImage == undefined) {
		return;
	}
	var now = new Date();
	objImage.src = objImage.src.split('?')[0] + '?x=' + now.toUTCString();

	
	//alert(leeCookie('wikensec'));
}


      function leeCookie(nombre)

      {

          var cookies=document.cookie; if(!cookies) return false;
          var comienzo=cookies.indexOf(nombre);
		  if(comienzo==-1) return false;
		  comienzo=comienzo+nombre.length+1;
		  cantidad=cookies.indexOf("; ", comienzo)-comienzo; if(cantidad<=0) cantidad=cookies.length;
		  return cookies.substr(comienzo, cantidad);
		 
      }

function isEmail (s)
			{
				var i = 1;
				var sLength = s.length;
				while ((i < sLength) && (s.charAt(i) != "@"))
				{ i++
				}

				if ((i >= sLength) || (s.charAt(i) != "@")) return false;
				else i += 2;

				while ((i < sLength) && (s.charAt(i) != "."))
				{ i++
				}

				if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
				else return true;
			}

function valida_avisoUsuario()
{
	
	if (document.getElementById('ddlDay').value=='x')
	{
		alert('Seleccionar el tipo de evento');
		document.getElementById('ddlDay').focus();
		return false;

	}
	else if (document.getElementById('horainput').value.length  == 0)
	{
		alert('Completar hora ');
		document.getElementById('horainput').focus();
		return false;
	
	}
	else if (document.getElementById('strfecha').value.length  == 0)
	{
		alert('Completar fecha ');
		document.getElementById('strfecha').focus();
		return false;
	
	}
	else if (document.getElementById('Direinput').value.length  == 0)
	{
		alert('Completar Direccion ');
		document.getElementById('Direinput').focus();
		return false;
	
	}
	else if (document.getElementById('nominput').value.length  == 0)
	{
		alert('Completar Nombre de Contacto');
		document.getElementById('nominput').focus();
		return false;
	
	}
	else if (document.getElementById('mailinput').value.length  == 0)
	{
		alert('Completar Mail de Contacto');
		document.getElementById('mailinput').focus();
		return false;
	
	}
	else if ((document.getElementById('mailinput').value.length != 0) && (! isEmail(document.getElementById('mailinput').value)))
	{
					alert("Mail Incorrecto");
					document.getElementById('mailinput').focus();
					return false;
	}
	else if (document.getElementById('telinput').value.length  == 0 || isNaN(document.getElementById('telinput').value))
	{
		alert('Completar Telefono de Contacto');
		document.getElementById('telinput').focus();
		return false;
	
	}

	else if (leeCookie('wikensec') != document.getElementById('codeinput').value.toUpperCase())
	{
		alert('Código Seguridad no es valido');
		document.getElementById('telinput').focus();
		RefreshImage('imgCaptcha');
		return false;
	
	}
	else 
	{
		enviarFormulario('maileventosend.asp','form_enviar','contenedor_middle_669px_grilla');	
	}
	
return false
}
