
/*VARIABLE QUE DETERMINA LA RUTA DEL SITIO PARA LAS FUNCIONES JAVASCRIPT*/
var url_sit='http://www.gerenciait.com/';
var is_ie = navigator.appName == 'Microsoft Internet Explorer';
var is_op = navigator.appName == 'Opera' ? true : false;
var is_fx = !is_ie && !is_op ? true : false;

function MM_popupMsg(msg) { //v1.0
  alert(msg);
}
function sobre(obj,estilo)
{
obj.className=estilo
}

function fuera(obj,estilo)
{
obj.className= estilo;

}
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_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_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

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];}
}

function expandir(item, nombreimagen,src_abierto,title_abierto,src_cerrado,title_cerrado)
{
	var d = document.getElementById(item);
	var imagen = document.getElementById(nombreimagen);
	if (d!=null)
	{
		if (d.style.display == '')
		{
			d.style.display = 'none';
			imagen.src = src_cerrado;
			imagen.title = title_abierto;
		}
		else
		{
			d.style.display = '';
			imagen.src = src_abierto;
			imagen.title = title_cerrado;
		}
	}
}

function expandir2 (item, nivel)
{
	var d = document.getElementById(item);
	if (d!=null)
	{
		if (d.style.display == '')
		{
			d.style.display = 'none';
		}
		else
		{
			HideAll(nivel); 
			d.style.display = '';
		}
	}
}

function HideAll(nivel) 
{
	var targetElement;
	var aDivs = document.body.getElementsByTagName("DIV");
	
	for (var i = 0; i < aDivs.length; i++) 
	{
		targetElement = aDivs[i];
		if (targetElement.className == nivel)
			targetElement.style.display = 'none';
	}
}
function cambiarHojaEstilos (id,estilo) {
    document.all[id].className=estilo;
  }
  
 function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_showHideLayersPos() { //v6.0
  var i,p,v,obj,args=MM_showHideLayersPos.arguments;
  for (i=0; i<(args.length-2); i+=3)
	if ((obj=MM_findObj(args[i]))!=null)
	{
		v=args[i+2];
		p=args[i+1];
		if (obj.style)
		{
			obj=obj.style;
			if(obj.display=='none')
			{
				v='';
				if(p=='1')
				{
					MM_swapImgRestore();
				}
			}
			else
			{
				v='none';
				if(p=='')
				{
					MM_swapImgRestore();
				}
			}
			//v=(obj.display=='none')?'':(obj.display=='')?'none':v;
			//v=(v=='show')?'':(v=='hide')?'none':v;
		}
		obj.display=v;
    }
}

/*Funcion que impide que se ingresen caracteres no alfanumericos en los text box*/
function validarCaracteres(e,control,boton)
{
	document.getElementById(control).value=(document.getElementById(control).value).replace(/[<>\"\']/,'');
}

/* Funcion que agrega la pagina a favoritos tanto en IE como en firefox */
function AgregarFavoritos(Titulo,URL) 
{
      /* Condición para el navegador Firefox */
      if(navigator.appName=="Netscape")
      {
            /* Agrega la página a favoritos y asigna un título al enlace */
            window.sidebar.addPanel(Titulo,URL,""); 
      }

    
      /* Condición para el navegador IE */
      if (navigator.appName=="Microsoft Internet Explorer")
      {
            /* Agrega la página a favoritos y asigna un título al enlace */
            window.external.AddFavorite(URL,Titulo);
      }
}
/*Funcion que expande o oculta divs*/
function click_div(control)
{
	var d = document.getElementById(control);
	if (d.style.display == '')
	{			
			d.style.display = 'none';
	}
	else if(d.style.display =='none')
	{
			d.style.display = '';	
	}
}

/* SECCION AJAX */

//						AUTOCOMPLETAR BUSCADOR
var Conexion=false; // Variable que manipula la conexion.
var Servidor=url_sit+"contenido/motor_ajax.aspx"; // Determina la pagina donde buscar
var Palabra=""; //Determina la ultima palabra buscada.

// funcion que realiza la conexion con el objeto XMLHTTP...
function Conectar()
{
	if(window.XMLHttpRequest)
		Conexion=new XMLHttpRequest(); //mozilla
	else if(window.ActiveXObject)
		Conexion=new ActiveXObject("Microsoft.XMLHTTP"); //microsoft
		
}

function Contenido(idContenido)
{
	/* readyState devuelve el estado de la conexion. puede valer:
	 *	0- No inicializado (Es el valor inicial de readyState)
	 *	1- Abierto (El método "open" ha tenido éxito)
	 *	2- Enviado (Se ha completado la solicitud pero ningun dato ha sido recibido todavía)
	 *	3- Recibiendo
	 *	4- Respuesta completa (Todos los datos han sido recibidos)
	 */

	// En espera del valor 4
	if(Conexion.readyState!=4) return;
	/* status: contiene un codigo enviado por el servidor
	 *	200-Completado con éxito
	 *	404-No se encontró URL
	 *	414-Los valores pasados por GET superan los 512
	 * statusText: contiene el texto del estado
	 */
	if(Conexion.status==200) // Si conexion HTTP es buena !!!
	{
		//si recibimos algun valor a mostrar...
		if(Conexion.responseText)
		{
			/* Modificamos el identificador temp con el valor recibido por la consulta
			*	Podemos recibir diferentes tipos de datos:
			*	responseText-Datos devueltos por el servidor en formato cadena
			*	responseXML-Datos devueltos por el servidor en forma de documento XML
			*/
			document.getElementById(idContenido).style.display="block";
			document.getElementById(idContenido).innerHTML=Conexion.responseText;
		}else
			document.getElementById(idContenido).style.display="none";
	}else{
		document.getElementById(idContenido).innerHTML=Conexion.status+"-"+Conexion.statusText;
	}

	// Deshabilitamos la visualización del reloj
	document.getElementById("reloj").style.visibility="hidden";

	Conexion=false;
}

function Solicitud(idContenido,Cadena)
{
	// si no recibimos cadena, no hacemos nada.
	// Cadena=la cadena a buscar en la base de datos
	/* Si cadena es igual a Palabra, no se realiza la busqueda. Puede ser que pulsen la tecla tabulador,
	 * y no interesa que vuelva a verificar...*/
	if(Cadena && Cadena!=Palabra)
	{
		// Si ya esta conectado, cancela la solicitud en espera de que termine
		if(Conexion) return; // Previene uso repetido del boton.
		
		// Realiza la conexion
		Conectar();
		
		// Si la conexion es correcta...
		if(Conexion)
		{
			// Habilitamos la visualización del reloj
			document.getElementById("reloj").style.visibility="visible";

			// Esta variable, se utiliza para igualar con la cadena a buscar.
			Palabra=Cadena;

			/* Preparamos una conexion con el servidor:
			*	POST|GET - determina como se envian los datos al servidor
			*	true - No sincronizado. Ello significa que la página WEB no es interferida en su funcionamiento
			*	por la respuesta del servidor. El usuario puede continuar usando la página mientras el servidor
			*	retorna una respuesta que la actualizará, usualmente, en forma parcial.
			*	false - Sincronizado */
			Conexion.open("POST",url_sit + "contenido/motor_ajax.aspx?comID=1&b="+Cadena,true);

			// Añade un par etiqueta/valor a la cabecera HTTP a enviar. Si no lo colocamos, no se pasan los parametros.
			Conexion.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	
			// Cada vez que el estado de la conexión (readyState) cambie se ejecutara el contenido de esta "funcion()"
			Conexion.onreadystatechange=function()
			{
			if(Conexion.readyState!=4) return;
			
			if(Conexion.status==200) // Si conexion HTTP es buena !!!
			{
				//si recibimos algun valor a mostrar...
				if(Conexion.responseText)
				{
					if(document.getElementById('tab_div')!=null)
					{	try{
						var olddiv = document.getElementById('tab_div');
						document.getElementById(idContenido).removeChild(olddiv);
						}
						catch(e){}
					}
				
					document.getElementById(idContenido).style.display="block";
					var t = document.createElement('div');
					t.setAttribute('id','tab_div');
					t.innerHTML = Conexion.responseText;
					document.getElementById(idContenido).appendChild(t);
				}else
					document.getElementById(idContenido).style.display="none";
			}

			// Deshabilitamos la visualización del reloj
			document.getElementById("reloj").style.visibility="hidden";

			Conexion=false;
				Contenido(idContenido);
			}
			
			date=new Date();
			/* Realiza la solicitud al servidor. Puede enviar una cadena de caracteres, o un objeto del tipo XML
			 * Si no deseamos enviar ningun valor, enviariamos null */
			if(is_ie)
				Conexion.send(null);
			else
				Conexion.send(1);
		}
	}
}

// Funcion que inicia la busqueda.
// Tiene que recibir el identificador donde mostrar el listado, y la cadena a buscar
function autocompletar(idContenido,Cadena)
{
	// Comprovamos que la longitud de la cadena sea superior o igual a 1 caracteres
	if(Cadena.length>=2)
	{
		if(Conexion!=false)
		{
			// Deshabilitamos la visualización del reloj
			document.getElementById("reloj").style.visibility="hidden";
			//si esta en medio de una conexion, la cancelamos
			Conexion.abort();
			Conexion=false;
		}
		Solicitud(idContenido,Cadena);
	}else
		document.getElementById(idContenido).style.display="none";
}

// Funcion que se ejecuta cuando seleccionamos un valor del desplegable
function selectItem(idContenido,value)
{
	// Cuando pulsamos sobre el desplegable, colocamos el valor en el cuadro de texto
	document.getElementById("input").value=value;
	//volvemos a indicar que actualice el listado con el nuevo valor
	autocompletar(idContenido,value);
}
function AsignarFoco(e,control)
{

var keynum

if(window.event) // IE
{
    keynum = e.keyCode
    if(keynum == 13 )
    {
        var lista = document.getElementById('lst_sugerencias');
        lista.selectedIndex++;    
              
    }
    

}
else if(e.which) // Netscape/Firefox/Opera
{
    keynum = e.which
    if(keynum == 13 )
    {     
        
        var lista = document.getElementById('lst_sugerencias');
        if(document.getElementById('sel_buscador_habitat').checked)
			location.href='../contenido/busqueda.aspx?k='+lista.options[lista.selectedIndex].value+'&opt=0'; 
		if(document.getElementById('sel_buscador_google').checked)     
			location.href='../contenido/BusquedaGoogle.aspx?q='+lista.options[lista.selectedIndex].value.replace('á','a').replace('é','e').replace('í','i').replace('ó','o').replace('ú','u')+'&opt=1'; 
    }    
    if(keynum == 9 )
    {     
        
        var lista = document.getElementById('lst_sugerencias');
         if(document.getElementById('sel_buscador_habitat').checked)
			location.href='../contenido/busqueda.aspx?k='+lista.value+'&opt=0';
		if(document.getElementById('sel_buscador_google').checked)     
			location.href='../contenido/BusquedaGoogle.aspx?q='+lista.options[lista.selectedIndex].value.replace('á','a').replace('é','e').replace('í','i').replace('ó','o').replace('ú','u')+'&opt=1';       
       
    }    
    //Flecha arriba
    if(keynum == 38 )
    {     
        
       var lista = document.getElementById('lst_sugerencias');
       if(lista.selectedIndex>0)
        lista.selectedIndex--;          
       
    }    
    //Flecha abajo
    if(keynum == 40 )
    {     
        var lista = document.getElementById('lst_sugerencias');
        lista.selectedIndex++;     
       
    }    
    
    
}
}

function enterBuscador(control)
{
	var lista = document.getElementById(control);
      location.href='../contenido/busqueda.aspx?k='+lista.options[lista.selectedIndex].value.replace('á','a').replace('é','e').replace('í','i').replace('ó','o').replace('ú','u');     

}

function enterBotonBuscador()
{
		
      //  if(document.getElementById('sel_buscador_habitat').checked)
      //  {	
			var caja = document.getElementById('input');
			if(caja.value.length>2)
			location.href='../contenido/busqueda.aspx?k='+caja.value+'&opt=0'; 
			else
			alert('Debe ingresar por lo menos tres caracteres para iniciar la busqueda');
	//	}
	//	if(document.getElementById('sel_buscador_google').checked)     
	//	{
	//		var caja2 = document.getElementById('input_google');
	//		location.href='../contenido/BusquedaGoogle.aspx?q='+caja2.value+'&opt=1';
	//	} 
		 

}

function clickBuscador(control)
{
var lista = document.getElementById(control);
      location.href='../contenido/busqueda.aspx?k='+lista.options[lista.selectedIndex].value.replace('á','a').replace('é','e').replace('í','i').replace('ó','o').replace('ú','u');     

}
function blurBuscador(control)
{
document.getElementById(control).style.display="none";     

}

var tabsId=new Array();
tabsId['tab1']='seccion1';
tabsId['tab2']='seccion2';
tabsId['tab3']='seccion3';
// Declaro el ID del DIV que actuará como contenedor de los datos recibidos
var contenedor='tabContenido';

function nuevoAjax()
{ 
	/* Crea el objeto AJAX. Esta funcion es generica para cualquier utilidad de este tipo, por
	lo que se puede copiar tal como esta aqui */
	var xmlhttp=false; 
	if(window.XMLHttpRequest)
		xmlhttp=new XMLHttpRequest(); //mozilla
	else if(window.ActiveXObject)
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); //microsoft
	return xmlhttp; 
}

function cargaContenido2(parametro)
{
	if(parametro==1)
	{
		document.getElementById('tab1').className='tabOn';
		document.getElementById('tab3').className='tabOff';
		document.getElementById('tab4').className='tabOff';
	}
	if(parametro==3)
	{
		document.getElementById('tab1').className='tabOff';
		document.getElementById('tab3').className='tabOn';
		document.getElementById('tab4').className='tabOff';
	}
	if(parametro==4)
	{
		document.getElementById('tab1').className='tabOff';
		document.getElementById('tab4').className='tabOn';
		document.getElementById('tab3').className='tabOff';
	}
	// Cambio el estado de la pestaña que se ha clickeado a activo
	this.className='tabOn';
			//document.getElementById('tabContenido').innerHTML='<img src="loading2.gif"> Cargando, por favor espere...';
			
			
				query=queryString('catID');
				if(queryString('catID')==false)
				query=1;
			var ajax=nuevoAjax();
			ajax.open("POST",url_sit+"contenido/motor_ajax.aspx?comID=5&b="+parametro+"_"+query,true);

			// Añade un par etiqueta/valor a la cabecera HTTP a enviar. Si no lo colocamos, no se pasan los parametros.
			ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	
			// Cada vez que el estado de la conexión (readyState) cambie se ejecutara el contenido de esta "funcion()"
			ajax.onreadystatechange=function()
			{
			if(ajax.readyState!=4) return;
			/* status: contiene un codigo enviado por el servidor
			*	200-Completado con éxito
			*	404-No se encontró URL
			*	414-Los valores pasados por GET superan los 512
			* statusText: contiene el texto del estado
			*/
			if(ajax.status==200) // Si conexion HTTP es buena !!!
			{
				//si recibimos algun valor a mostrar...
				if(ajax.responseText)
				{
					/* Modificamos el identificador temp con el valor recibido por la consulta
					*	Podemos recibir diferentes tipos de datos:
					*	responseText-Datos devueltos por el servidor en formato cadena
					*	responseXML-Datos devueltos por el servidor en forma de documento XML
					*/
					if(document.getElementById('tab_div')!=null)
					{
						var olddiv = document.getElementById('tab_div');
						document.getElementById('tabContenido').removeChild(olddiv);
					}
					var t = document.createElement('div');
					t.setAttribute('id','tab_div');
					t.innerHTML =ajax.responseText;
					document.getElementById('tabContenido').appendChild(t);
				}else
					document.getElementById('tabContenido').style.display="none";
			}else
				document.getElementById('tabContenido').innerHTML=ajax.status+"-"+ajax.statusText;
			}
			if(is_ie)
				ajax.send(null);
			else
				ajax.send(1);
		
}

function cargaContenido()
{
	/* Recorro las pestañas para dejar en estado "apagado" a todas menos la que se ha clickeado. Teniendo en cuenta que solo puede haber una pestaña "encendida"
	a la vez resultaría mas óptimo hacer un while hasta encontrar a esa pestaña, cambiarle el estilo y luego salir, pero, creanme, se complicaría un poco el
	ejemplo y no es mi intención complicarlos */
	for(key in tabsId)
	{
		// Obtengo el elemento
		elemento=document.getElementById(key);
		// Si es la pestaña activa
		if(elemento.className=='tabOn')
		{
			// Cambio el estado de la pestaña a inactivo 
			elemento.className='tabOff';
		}
	}
	// Cambio el estado de la pestaña que se ha clickeado a activo
	this.className='tabOn';
	
	/* De aqui hacia abajo se tratatan la petición y recepción de datos */
	
	// Obtengo el identificador vinculado con el ID del elemento HTML que referencia a la sección a cargar
	seccion=tabsId[this.id];
	
	// Coloco un mensaje mientras se reciben los datos
	//document.getElementById('tabContenido').innerHTML='<img src="loading2.gif"> Cargando, por favor espere...';
	
	// Creo el objeto AJAX y envio la petición por POST (para evitar cacheos de datos)
	var ajax=nuevoAjax();
	ajax.open("POST",url_sit+"contenido/motor_ajax.aspx?comID=5&b="+seccion,true);
	// Añade un par etiqueta/valor a la cabecera HTTP a enviar. Si no lo colocamos, no se pasan los parametros.
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.onreadystatechange=function()
	{
		if(ajax.readyState==4)
		{
		var t = document.createElement('div');
		t.innerHTML = ajax.responseText;
		
			// Al recibir la respuesta coloco directamente el HTML en la capa contenedora
			var tab = document.getElementById('tabContenido').appendChild(t);
	
		}
	}
}

function mouseSobre()
{
	// Si el evento no se produjo en la pestaña seleccionada...
	if(this.className!='tabOn')
	{
		// Cambio el color de fondo de la pestaña
		this.className='tabHover';
	}
}

function mouseFuera()
{
	// Si el evento no se produjo en la pestaña seleccionada...
	if(this.className!='tabOn')
	{
		// Cambio el color de fondo de la pestaña
		this.className='tabOff';
	}
}

/*			CALIFIQUE */

var b_califico=0;
function califique(parametro)
{
	
	var calificado = document.getElementById('_ctl1_califique1_lbl_califico');
	b_califico=calificado.innerHTML;
	if(b_califico==0)
	{
		var ajax=nuevoAjax();
		var con_id = document.getElementById('_ctl1_califique1_lbl_id').innerHTML;
		ajax.open("POST",url_sit+"contenido/motor_ajax.aspx?comID=3&b="+parametro+"_"+con_id,true);

		// Añade un par etiqueta/valor a la cabecera HTTP a enviar. Si no lo colocamos, no se pasan los parametros.
		ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

		// Cada vez que el estado de la conexión (readyState) cambie se ejecutara el contenido de esta "funcion()"
		ajax.onreadystatechange=function()
		{
		if(ajax.readyState!=4) return;
		
		if(ajax.status==200) // Si conexion HTTP es buena !!!
		{
			//si recibimos algun valor a mostrar...
			if(ajax.responseText)
			{
					var t = document.createElement('div');
					t.setAttribute('id','tab_div');
					t.innerHTML =ajax.responseText;
					document.getElementById('califique').appendChild(t);
			
				
				var response = document.getElementById('califique').innerHTML;
				document.getElementById('califique').innerHTML="";
				var responses = response.split("_-_");
				
					var s = document.createElement('div');
					s.setAttribute('id','tab_div2');
					s.innerHTML = responses[1];
					document.getElementById('califique').appendChild(s);
				
				
				
				var td_cal1 = document.getElementById('td_cal1');
				var td_cal2 = document.getElementById('td_cal2');
				var td_cal3 = document.getElementById('td_cal3');
				var td_cal4 = document.getElementById('td_cal4');
				var td_cal5 = document.getElementById('td_cal5');
				td_cal1.onclick=function(){};
				td_cal1.onmouseover=function(){};
				td_cal2.onclick=function(){};
				td_cal2.onmouseover=function(){};
				td_cal3.onclick=function(){};
				td_cal3.onmouseover=function(){};
				td_cal4.onclick=function(){};
				td_cal4.onmouseover=function(){};
				td_cal5.onclick=function(){};
				td_cal5.onmouseover=function(){};
				
				
				/*td_cal1.removeAttribute("onclick");
				td_cal1.removeAttribute("onmouseover");
				td_cal2.removeAttribute("onclick");
				td_cal2.removeAttribute("onmouseover");
				td_cal3.removeAttribute("onclick");
				td_cal3.removeAttribute("onmouseover");
				td_cal4.removeAttribute("onclick");
				td_cal4.removeAttribute("onmouseover");
				td_cal5.removeAttribute("onclick");
				td_cal5.removeAttribute("onmouseover");*/
				var estrella1 = document.getElementById('_ctl1_califique1_img_cal1');
		var estrella2 = document.getElementById('_ctl1_califique1_img_cal2');
		var estrella3 = document.getElementById('_ctl1_califique1_img_cal3');
		var estrella4 = document.getElementById('_ctl1_califique1_img_cal4');
		var estrella5 = document.getElementById('_ctl1_califique1_img_cal5');
		// Añade un par etiqueta/valor a la cabecera HTTP a enviar. Si no lo colocamos, no se pasan los parametros.
		parametro=responses[2];
		if(parametro==1)
		{
			estrella1.src="../images/estrella_roja.gif";
			estrella2.src="../images/estrella_gris.gif";		
			estrella3.src="../images/estrella_gris.gif";
			estrella4.src="../images/estrella_gris.gif";
			estrella5.src="../images/estrella_gris.gif";
		}
		if(parametro==2)
		{
			estrella1.src="../images/estrella_roja.gif";
			estrella2.src="../images/estrella_roja.gif";		
			estrella3.src="../images/estrella_gris.gif";
			estrella4.src="../images/estrella_gris.gif";
			estrella5.src="../images/estrella_gris.gif";
		}
		if(parametro==3)
		{
			estrella1.src="../images/estrella_roja.gif";
			estrella2.src="../images/estrella_roja.gif";		
			estrella3.src="../images/estrella_roja.gif";
			estrella4.src="../images/estrella_gris.gif";
			estrella5.src="../images/estrella_gris.gif";
		}
		if(parametro==4)
		{
			estrella1.src="../images/estrella_roja.gif";
			estrella2.src="../images/estrella_roja.gif";		
			estrella3.src="../images/estrella_roja.gif";
			estrella4.src="../images/estrella_roja.gif";
			estrella5.src="../images/estrella_gris.gif";
		}
		if(parametro==5)
		{
			estrella1.src="../images/estrella_roja.gif";
			estrella2.src="../images/estrella_roja.gif";		
			estrella3.src="../images/estrella_roja.gif";
			estrella4.src="../images/estrella_roja.gif";
			estrella5.src="../images/estrella_roja.gif";
		}
	
			}else
				document.getElementById('califique').style.display="none";
		}else
			document.getElementById('califique').innerHTML=ajax.status+"-"+ajax.statusText;
		}
		if(is_ie)
			ajax.send(null);
		else
			ajax.send(1);
	}
		
}

function cambiarCalificacion(parametro)
{
	var calificado = document.getElementById('Califique1_lbl_califico');
	b_califico=calificado.innerHTML;
	if(b_califico==0)
	{
		var estrella1 = document.getElementById('Califique1_img_cal1');
		var estrella2 = document.getElementById('Califique1_img_cal2');
		var estrella3 = document.getElementById('Califique1_img_cal3');
		var estrella4 = document.getElementById('Califique1_img_cal4');
		var estrella5 = document.getElementById('Califique1_img_cal5');
		// Añade un par etiqueta/valor a la cabecera HTTP a enviar. Si no lo colocamos, no se pasan los parametros.
		
		if(parametro==1)
		{
			estrella1.src="../images/estrella_roja.gif";
			estrella2.src="../images/estrella_gris.gif";		
			estrella3.src="../images/estrella_gris.gif";
			estrella4.src="../images/estrella_gris.gif";
			estrella5.src="../images/estrella_gris.gif";
		}
		if(parametro==2)
		{
			estrella1.src="../images/estrella_roja.gif";
			estrella2.src="../images/estrella_roja.gif";		
			estrella3.src="../images/estrella_gris.gif";
			estrella4.src="../images/estrella_gris.gif";
			estrella5.src="../images/estrella_gris.gif";
		}
		if(parametro==3)
		{
			estrella1.src="../images/estrella_roja.gif";
			estrella2.src="../images/estrella_roja.gif";		
			estrella3.src="../images/estrella_roja.gif";
			estrella4.src="../images/estrella_gris.gif";
			estrella5.src="../images/estrella_gris.gif";
		}
		if(parametro==4)
		{
			estrella1.src="../images/estrella_roja.gif";
			estrella2.src="../images/estrella_roja.gif";		
			estrella3.src="../images/estrella_roja.gif";
			estrella4.src="../images/estrella_roja.gif";
			estrella5.src="../images/estrella_gris.gif";
		}
		if(parametro==5)
		{
			estrella1.src="../images/estrella_roja.gif";
			estrella2.src="../images/estrella_roja.gif";		
			estrella3.src="../images/estrella_roja.gif";
			estrella4.src="../images/estrella_roja.gif";
			estrella5.src="../images/estrella_roja.gif";
		}
		
	}

}

function calificacion(parametro)
{
	var calificado = document.getElementById('_ctl1_califique1_lbl_califico');
	var texto = document.getElementById('_ctl1_califique1_lbl_valorTexto');
	b_califico=calificado.innerHTML;
	if(b_califico==0)
	{
		var estrella1 = document.getElementById('_ctl1_califique1_img_cal1');
		var estrella2 = document.getElementById('_ctl1_califique1_img_cal2');
		var estrella3 = document.getElementById('_ctl1_califique1_img_cal3');
		var estrella4 = document.getElementById('_ctl1_califique1_img_cal4');
		var estrella5 = document.getElementById('_ctl1_califique1_img_cal5');
		if(parametro==1)
		{
			estrella1.src="../images/estrella_roja.gif";
			estrella2.src="../images/estrella_gris.gif";		
			estrella3.src="../images/estrella_gris.gif";
			estrella4.src="../images/estrella_gris.gif";
			estrella5.src="../images/estrella_gris.gif";
			texto.innerHTML="Malo";
		}
		if(parametro==2)
		{
			estrella1.src="../images/estrella_roja.gif";
			estrella2.src="../images/estrella_roja.gif";		
			estrella3.src="../images/estrella_gris.gif";
			estrella4.src="../images/estrella_gris.gif";
			estrella5.src="../images/estrella_gris.gif";
			texto.innerHTML="Regular";
		}
		if(parametro==3)
		{
			estrella1.src="../images/estrella_roja.gif";
			estrella2.src="../images/estrella_roja.gif";		
			estrella3.src="../images/estrella_roja.gif";
			estrella4.src="../images/estrella_gris.gif";
			estrella5.src="../images/estrella_gris.gif";
			texto.innerHTML="Aceptable";
		}
		if(parametro==4)
		{
			estrella1.src="../images/estrella_roja.gif";
			estrella2.src="../images/estrella_roja.gif";		
			estrella3.src="../images/estrella_roja.gif";
			estrella4.src="../images/estrella_roja.gif";
			estrella5.src="../images/estrella_gris.gif";
			texto.innerHTML="Bueno";
		}
		if(parametro==5)
		{
			estrella1.src="../images/estrella_roja.gif";
			estrella2.src="../images/estrella_roja.gif";		
			estrella3.src="../images/estrella_roja.gif";
			estrella4.src="../images/estrella_roja.gif";
			estrella5.src="../images/estrella_roja.gif";
			texto.innerHTML="Excelente";
		}
	}
}



/*				Mensajes Modales  */

function sack(file) {
	this.xmlhttp = null;

	this.resetData = function() {
		this.method = "POST";
  		this.queryStringSeparator = "?";
		this.argumentSeparator = "&";
		this.URLString = "";
		this.encodeURIString = true;
  		this.execute = false;
  		this.element = null;
		this.elementObj = null;
		this.requestFile = file;
		this.vars = new Object();
		this.responseStatus = new Array(2);
  	};

	this.resetFunctions = function() {
  		this.onLoading = function() { };
  		this.onLoaded = function() { };
  		this.onInteractive = function() { };
  		this.onCompletion = function() { };
  		this.onError = function() { };
		this.onFail = function() { };
	};

	this.reset = function() {
		this.resetFunctions();
		this.resetData();
	};

	this.createAJAX = function() {
		try {
			this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e1) {
			try {
				this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e2) {
				this.xmlhttp = null;
			}
		}

		if (! this.xmlhttp) {
			if (typeof XMLHttpRequest != "undefined") {
				this.xmlhttp = new XMLHttpRequest();
			} else {
				this.failed = true;
			}
		}
	};

	this.setVar = function(name, value){
		this.vars[name] = Array(value, false);
	};

	this.encVar = function(name, value, returnvars) {
		if (true == returnvars) {
			return Array(encodeURIComponent(name), encodeURIComponent(value));
		} else {
			this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true);
		}
	}

	this.processURLString = function(string, encode) {
		encoded = encodeURIComponent(this.argumentSeparator);
		regexp = new RegExp(this.argumentSeparator + "|" + encoded);
		varArray = string.split(regexp);
		for (i = 0; i < varArray.length; i++){
			urlVars = varArray[i].split("=");
			if (true == encode){
				this.encVar(urlVars[0], urlVars[1]);
			} else {
				this.setVar(urlVars[0], urlVars[1]);
			}
		}
	}

	this.createURLString = function(urlstring) {
		if (this.encodeURIString && this.URLString.length) {
			this.processURLString(this.URLString, true);
		}

		if (urlstring) {
			if (this.URLString.length) {
				this.URLString += this.argumentSeparator + urlstring;
			} else {
				this.URLString = urlstring;
			}
		}

		// prevents caching of URLString
		this.setVar("rndval", new Date().getTime());

		urlstringtemp = new Array();
		for (key in this.vars) {
			if (false == this.vars[key][1] && true == this.encodeURIString) {
				encoded = this.encVar(key, this.vars[key][0], true);
				delete this.vars[key];
				this.vars[encoded[0]] = Array(encoded[1], true);
				key = encoded[0];
			}

			urlstringtemp[urlstringtemp.length] = key + "=" + this.vars[key][0];
		}
		if (urlstring){
			this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator);
		} else {
			this.URLString += urlstringtemp.join(this.argumentSeparator);
		}
	}

	this.runResponse = function() {
		eval(this.response);
	}

	this.runAJAX = function(urlstring) {
		if (this.failed) {
			this.onFail();
		} else {
			this.createURLString(urlstring);
			if (this.element) {
				this.elementObj = document.getElementById(this.element);
			}
			if (this.xmlhttp) {
				var self = this;
				if (this.method == "GET") {
					totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString;
					this.xmlhttp.open(this.method, totalurlstring, true);
				} else {
					this.xmlhttp.open(this.method, this.requestFile, true);
					try {
						this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
					} catch (e) { }
				}

				this.xmlhttp.onreadystatechange = function() {
					switch (self.xmlhttp.readyState) {
						case 1:
							self.onLoading();
							break;
						case 2:
							self.onLoaded();
							break;
						case 3:
							self.onInteractive();
							break;
						case 4:
							self.response = self.xmlhttp.responseText;
							self.responseXML = self.xmlhttp.responseXML;
							self.responseStatus[0] = self.xmlhttp.status;
							self.responseStatus[1] = self.xmlhttp.statusText;

							if (self.execute) {
								self.runResponse();
							}

							if (self.elementObj) {
								elemNodeName = self.elementObj.nodeName;
								elemNodeName.toLowerCase();
								if (elemNodeName == "input"
								|| elemNodeName == "select"
								|| elemNodeName == "option"
								|| elemNodeName == "textarea") {
									self.elementObj.value = self.response;
								} else {
									self.elementObj.innerHTML = self.response;
								}
							}
							if (self.responseStatus[0] == "200") {
								self.onCompletion();
							} else {
								self.onError();
							}

							self.URLString = "";
							break;
					}
				};

				this.xmlhttp.send(this.URLString);
			}
		}
	};

	this.reset();
	this.createAJAX();
}

var enableCache = true;
var jsCache = new Array();

var dynamicContent_ajaxObjects = new Array();

function ajax_showContent(divId,ajaxIndex,url)
{
	var targetObj = document.getElementById(divId);
	targetObj.innerHTML = dynamicContent_ajaxObjects[ajaxIndex].response;
	if(enableCache){
		jsCache[url] = 	dynamicContent_ajaxObjects[ajaxIndex].response;
	}
	dynamicContent_ajaxObjects[ajaxIndex] = false;
	
	ajax_parseJs(targetObj)
}

function ajax_loadContent(divId,url)
{
	if(enableCache && jsCache[url]){
		document.getElementById(divId).innerHTML = jsCache[url];
		return;
	}
	
	var ajaxIndex = dynamicContent_ajaxObjects.length;
	//document.getElementById(divId).innerHTML = 'Loading content - please wait';
	document.getElementById(divId).innerHTML='<img src="../images/loading.gif">';
	dynamicContent_ajaxObjects[ajaxIndex] = new sack();
	dynamicContent_ajaxObjects[ajaxIndex].requestFile = url;	// Specifying which file to get
	dynamicContent_ajaxObjects[ajaxIndex].onCompletion = function(){ ajax_showContent(divId,ajaxIndex,url); };	// Specify function that will be executed after file has been found
	dynamicContent_ajaxObjects[ajaxIndex].runAJAX();		// Execute AJAX function	
	
	
}

function ajax_parseJs(obj)
{
	var scriptTags = obj.getElementsByTagName('SCRIPT');
	var string = '';
	var jsCode = '';
	for(var no=0;no<scriptTags.length;no++){	
		if(scriptTags[no].src){
	        var head = document.getElementsByTagName("head")[0];
	        var scriptObj = document.createElement("script");
	
	        scriptObj.setAttribute("type", "text/javascript");
	        scriptObj.setAttribute("src", scriptTags[no].src);  	
		}else{
			if(navigator.userAgent.indexOf('Opera')>=0){
				jsCode = jsCode + scriptTags[no].text + '\n';
			}
			else
				jsCode = jsCode + scriptTags[no].innerHTML;	
		}
		
	}

	if(jsCode)ajax_installScript(jsCode);
}


function ajax_installScript(script)
{		
    if (!script)
        return;		
    if (window.execScript){        	
    	window.execScript(script)
    }else if(window.jQuery && jQuery.browser.safari){ // safari detection in jQuery
        window.setTimeout(script,0);
    }else{        	
        window.setTimeout( script, 0 );
    } 
}	


DHTML_modalMessage = function()
{
	var url;								// url of modal message
	var htmlOfModalMessage;					// html of modal message
	
	var divs_transparentDiv;				// Transparent div covering page content
	var divs_content;						// Modal message div.
	var iframe;								// Iframe used in ie
	var layoutCss;							// Name of css file;
	var width;								// Width of message box
	var height;								// Height of message box
	
	var existingBodyOverFlowStyle;			// Existing body overflow css
	var dynContentObj;						// Reference to dynamic content object
	var cssClassOfMessageBox;				// Alternative css class of message box - in case you want a different appearance on one of them
	var shadowDivVisible;					// Shadow div visible ? 
	var shadowOffset; 						// X and Y offset of shadow(pixels from content box)
	var MSIE;
		
	this.url = '';							// Default url is blank
	this.htmlOfModalMessage = '';			// Default message is blank
	this.layoutCss = 'estilos.css';	// Default CSS file
	this.height = 200;						// Default height of modal message
	this.width = 400;						// Default width of modal message
	this.cssClassOfMessageBox = false;		// Default alternative css class for the message box
	this.shadowDivVisible = true;			// Shadow div is visible by default
	this.shadowOffset = 5;					// Default shadow offset.
	this.MSIE = false;
	if(navigator.userAgent.indexOf('MSIE')>=0) this.MSIE = true;
	

}

DHTML_modalMessage.prototype = {
	// {{{ setSource(urlOfSource)
    /**
     *	Set source of the modal dialog box
     * 	
     *
     * @public	
     */		
	setSource : function(urlOfSource)
	{
		this.url = urlOfSource;
		
	}	
	// }}}	
	,
	// {{{ setHtmlContent(newHtmlContent)
    /**
     *	Setting static HTML content for the modal dialog box.
     * 	
     *	@param String newHtmlContent = Static HTML content of box
     *
     * @public	
     */		
	setHtmlContent : function(newHtmlContent)
	{
		this.htmlOfModalMessage = newHtmlContent;
		
	}
	// }}}		
	,
	// {{{ setSize(width,height)
    /**
     *	Set the size of the modal dialog box
     * 	
     *	@param int width = width of box
     *	@param int height = height of box
     *
     * @public	
     */		
	setSize : function(width,height)
	{
		if(width)this.width = width;
		if(height)this.height = height;		
	}
	// }}}		
	,		
	// {{{ setCssClassMessageBox(newCssClass)
    /**
     *	Assign the message box to a new css class.(in case you wants a different appearance on one of them)
     * 	
     *	@param String newCssClass = Name of new css class (Pass false if you want to change back to default)
     *
     * @public	
     */		
	setCssClassMessageBox : function(newCssClass)
	{
		this.cssClassOfMessageBox = newCssClass;
		if(this.divs_content){
			if(this.cssClassOfMessageBox)
				this.divs_content.className=this.cssClassOfMessageBox;
			else
				this.divs_content.className='modalDialog_contentDiv';	
		}
					
	}
	// }}}		
	,	
	// {{{ setShadowOffset(newShadowOffset)
    /**
     *	Specify the size of shadow
     * 	
     *	@param Int newShadowOffset = Offset of shadow div(in pixels from message box - x and y)
     *
     * @public	
     */		
	setShadowOffset : function(newShadowOffset)
	{
		this.shadowOffset = newShadowOffset
					
	}
	// }}}		
	,	
	// {{{ display()
    /**
     *	Display the modal dialog box
     * 	
     *
     * @public	
     */		
	display : function()
	{
		if(!this.divs_transparentDiv){
			this.__createDivs();
		}	
		
		// Redisplaying divs
		this.divs_transparentDiv.style.display='block';
		this.divs_content.style.display='block';
		this.divs_shadow.style.display='block';		
		if(this.MSIE)this.iframe.style.display='block';	
		this.__resizeDivs();
		
		/* Call the __resizeDivs method twice in case the css file has changed. The first execution of this method may not catch these changes */
		window.refToThisModalBoxObj = this;		
		setTimeout('window.refToThisModalBoxObj.__resizeDivs()',150);
		
		this.__insertContent();	// Calling method which inserts content into the message div.
	}
	// }}}		
	,
	// {{{ ()
    /**
     *	Display the modal dialog box
     * 	
     *
     * @public	
     */		
	setShadowDivVisible : function(visible)
	{
		this.shadowDivVisible = visible;
	}
	// }}}	
	,
	// {{{ close()
    /**
     *	Close the modal dialog box
     * 	
     *
     * @public	
     */		
	close : function()
	{
		//document.documentElement.style.overflow = '';	// Setting the CSS overflow attribute of the <html> tag back to default.
		
		/* Hiding divs */
		this.divs_transparentDiv.style.display='none';
		this.divs_content.style.display='none';
		this.divs_shadow.style.display='none';
		if(this.MSIE)this.iframe.style.display='none';
		
		
	}	
	// }}}	
	,
	// {{{ __addEvent()
    /**
     *	Add event
     * 	
     *
     * @private	
     */		
	addEvent : function(whichObject,eventType,functionName,suffix)
	{ 
	  if(!suffix)suffix = '';
	  if(whichObject.attachEvent){ 
	    whichObject['e'+eventType+functionName+suffix] = functionName; 
	    whichObject[eventType+functionName+suffix] = function(){whichObject['e'+eventType+functionName+suffix]( window.event );} 
	    whichObject.attachEvent( 'on'+eventType, whichObject[eventType+functionName+suffix] ); 
	  } else 
	    whichObject.addEventListener(eventType,functionName,false); 	    
	} 
	// }}}	
	,
	// {{{ __createDivs()
    /**
     *	Create the divs for the modal dialog box
     * 	
     *
     * @private	
     */		
	__createDivs : function()
	{
		// Creating transparent div
		this.divs_transparentDiv = document.createElement('DIV');
		this.divs_transparentDiv.className='modalDialog_transparentDivs';
		this.divs_transparentDiv.style.left = '0px';
		this.divs_transparentDiv.style.top = '0px';
		
		document.body.appendChild(this.divs_transparentDiv);
		// Creating content div
		this.divs_content = document.createElement('DIV');
		this.divs_content.className = 'modalDialog_contentDiv';
		this.divs_content.id = 'DHTMLSuite_modalBox_contentDiv';
		this.divs_content.style.zIndex = 100000;
		
		if(this.MSIE){
			this.iframe = document.createElement('<IFRAME src="about:blank" frameborder=0>');
			this.iframe.style.zIndex = 90000;
			this.iframe.style.position = 'absolute';
			document.body.appendChild(this.iframe);	
		}
			
		document.body.appendChild(this.divs_content);
		// Creating shadow div
		this.divs_shadow = document.createElement('DIV');
		this.divs_shadow.className = 'modalDialog_contentDiv_shadow';
		this.divs_shadow.style.zIndex = 95000;
		document.body.appendChild(this.divs_shadow);
		window.refToModMessage = this;
		this.addEvent(window,'scroll',function(e){ window.refToModMessage.__repositionTransparentDiv() });
		this.addEvent(window,'resize',function(e){ window.refToModMessage.__repositionTransparentDiv() });
		

	}
	// }}}
	,
	// {{{ __getBrowserSize()
    /**
     *	Get browser size
     * 	
     *
     * @private	
     */		
	__getBrowserSize : function()
	{
    	var bodyWidth = document.documentElement.clientWidth;
    	var bodyHeight = document.documentElement.clientHeight;
    	
		var bodyWidth, bodyHeight; 
		if (self.innerHeight){ // all except Explorer 
		 
		   bodyWidth = self.innerWidth; 
		   bodyHeight = self.innerHeight; 
		}  else if (document.documentElement && document.documentElement.clientHeight) {
		   // Explorer 6 Strict Mode 		 
		   bodyWidth = document.documentElement.clientWidth; 
		   bodyHeight = document.documentElement.clientHeight; 
		} else if (document.body) {// other Explorers 		 
		   bodyWidth = document.body.clientWidth; 
		   bodyHeight = document.body.clientHeight; 
		} 
		return [bodyWidth,bodyHeight];		
		
	}
	// }}}	
	,
	// {{{ __resizeDivs()
    /**
     *	Resize the message divs
     * 	
     *
     * @private	
     */	
    __resizeDivs : function()
    {
    	
    	var topOffset = Math.max(document.body.scrollTop,document.documentElement.scrollTop);

		if(this.cssClassOfMessageBox)
			this.divs_content.className=this.cssClassOfMessageBox;
		else
			this.divs_content.className='modalDialog_contentDiv';	
			    	
    	if(!this.divs_transparentDiv)return;
    	
    	// Preserve scroll position
    	var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
    	var sl = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
    	
    	window.scrollTo(sl,st);
    	setTimeout('window.scrollTo(' + sl + ',' + st + ');',10);

    	this.__repositionTransparentDiv();
    	

		var brSize = this.__getBrowserSize();
		var bodyWidth = brSize[0];
		var bodyHeight = brSize[1];
    	
    	// Setting width and height of content div
      	this.divs_content.style.width = this.width + 'px';
    	this.divs_content.style.height= this.height + 'px';  	
    	
    	// Creating temporary width variables since the actual width of the content div could be larger than this.width and this.height(i.e. padding and border)
    	var tmpWidth = this.divs_content.offsetWidth;	
    	var tmpHeight = this.divs_content.offsetHeight;

    	// Setting width and height of left transparent div

    	this.divs_content.style.left = Math.ceil((bodyWidth - tmpWidth) / 2) + 'px';;
    	this.divs_content.style.top = (Math.ceil((bodyHeight - tmpHeight) / 2) +  topOffset) + 'px';
    	
 		if(this.MSIE){
 			this.iframe.style.left = this.divs_content.style.left;
 			this.iframe.style.top = this.divs_content.style.top;
 			this.iframe.style.width = this.divs_content.style.width;
 			this.iframe.style.height = this.divs_content.style.height;
 		}
 		
    	this.divs_shadow.style.left = (this.divs_content.style.left.replace('px','')/1 + this.shadowOffset) + 'px';
    	this.divs_shadow.style.top = (this.divs_content.style.top.replace('px','')/1 + this.shadowOffset) + 'px';
    	this.divs_shadow.style.height = tmpHeight + 'px';
    	this.divs_shadow.style.width = tmpWidth + 'px';
    	
    	
    	
    	if(!this.shadowDivVisible)this.divs_shadow.style.display='none';	// Hiding shadow if it has been disabled
    	
    	
    }
    // }}}	
    ,
	// {{{ __insertContent()
    /**
     *	Insert content into the content div
     * 	
     *
     * @private	
     */	    
    __repositionTransparentDiv : function()
    {
    	this.divs_transparentDiv.style.top = Math.max(document.body.scrollTop,document.documentElement.scrollTop) + 'px';
    	this.divs_transparentDiv.style.left = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft) + 'px';
		var brSize = this.__getBrowserSize();
		var bodyWidth = brSize[0];
		var bodyHeight = brSize[1];
    	this.divs_transparentDiv.style.width = bodyWidth + 'px';
    	this.divs_transparentDiv.style.height = bodyHeight + 'px';		
		   	
    }
	// }}}	
	,
	// {{{ __insertContent()
    /**
     *	Insert content into the content div
     * 	
     *
     * @private	
     */	
    __insertContent : function()
    {
		if(this.url){	// url specified - load content dynamically
			ajax_loadContent('DHTMLSuite_modalBox_contentDiv',this.url);
		}else{	// no url set, put static content inside the message box
			this.divs_content.innerHTML = this.htmlOfModalMessage;	
		}
    }		
}




function displayMessage(url)
{
	messageObj = new DHTML_modalMessage();	// We only create one object of this class
    messageObj.setShadowOffset(5);	// Large shadow
	messageObj.setSource(url);
	messageObj.setCssClassMessageBox(false);
	messageObj.setSize(400,200);
	messageObj.setShadowDivVisible(true);	// Enable shadow for these boxes
	messageObj.display();
}

function displayStaticMessage(messageContent,cssClass)
{
messageObj = new DHTML_modalMessage();	// We only create one object of this class
messageObj.setShadowOffset(5);	// Large shadow
	messageObj.setHtmlContent(messageContent);
	messageObj.setSize(300,150);
	messageObj.setCssClassMessageBox(cssClass);
	messageObj.setSource(false);	// no html source since we want to use a static message here.
	messageObj.setShadowDivVisible(false);	// Disable shadow for these boxes	
	messageObj.display();
	
	
}

function closeMessage()
{
	messageObj.close();	
	delete messageObj; 
}

/*   Login Modal  */

function login()
{
	var url = 'http://funsantafe.internet.alfa.makondo.com/contenido/motor_ajax.aspx'
	alert("login ...."	);
	var ajax=nuevoAjax();
	ajax.open ('POST', url, false);
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    ajax.send("valores...");
    return false;
    
}

function validar()
{
   document.getElementById("mal").innerHTML = "";
   document.getElementById("vLogin").innerHTML = document.getElementById("vClave").innerHTML = "";
   a = true;   
   with(document.formularioIngreso)
   {
      if (esBlanco(login.value))
      {
		document.getElementById("vLogin").innerHTML = "Por favor, ingrese su nombre de usuario";
		a = false;
	  }      
      if (esBlanco(password.value))
      {
		document.getElementById("vClave").innerHTML = "Por favor, ingrese su clave";
		a = false;
	  }
	  return a;
   }
}

function validarOlvideClave()
{
   document.getElementById("vUsuario").innerHTML  = "";
   a = true;   
   
      if (esBlanco('txt_usuario.value'))
      {
		document.getElementById("vUsuario").innerHTML = "Por favor, ingrese su nombre de usuario";
		a = false;
	  }      
      
	  return a;
  
}

function esBlanco(campo)
{
   if(campo.length==0||campo==null)
      return true;
}

function esEmail(email)
{
   var unEmail=/(((\w|-)+)\@(((\w+)\.)+)(\w+))/;
   if(unEmail.test(email))
      return true;
   else 
      return false;
}

function ingreso(){
		var valido = true;
		var ajax=nuevoAjax();
 		var clave = document.getElementById('txt_clave').value;
		var usuario = document.getElementById('txt_usuario').value;
		if(usuario.length==0)
		{
			valido = false;
			document.getElementById('div_usuario').style.display="";
		}
		if(clave.length==0)
		{
			valido = false;
			document.getElementById('div_clave_actual').style.display="";
		}
		if(valido)
		{
			ajax.open("POST",url_sit+"registro/ingresar.aspx?usuario="+usuario+"&clave="+clave,true);
			// Añade un par etiqueta/valor a la cabecera HTTP a enviar. Si no lo colocamos, no se pasan los parametros.
			ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			// Cada vez que el estado de la conexión (readyState) cambie se ejecutara el contenido de esta "funcion()"
			ajax.onreadystatechange=function()
			{
			if(ajax.readyState!=4) return;
			
			if(ajax.status==200) // Si conexion HTTP es buena !!!
			{
				//si recibimos algun valor a mostrar...
				if(ajax.responseText)
				{
						var response =ajax.responseText.split('_-_');
						var exito = response[1];
						if(exito=='false')
						{
						document.getElementById('login').style.display="none";
						document.getElementById('mensaje').style.display="";
						
						}
						else
						{
							var exito_2=exito.split('||');
							if(exito_2[0]=='true')
							{
								if(exito_2[1]=='-1')
								{
									document.getElementById('registro_usuarios_estado_ingreso_nombre').innerHTML=exito_2[2];
									document.getElementById('registro_usuarios_estado_ingreso_bienvenido').innerHTML="Bienvenido:";
									document.getElementById('registro_usuarios_estado_ingreso_hlk_salir').innerHTML="Salir";
									document.getElementById('lightwindow_container').style.visibility="hidden";
									document.getElementById('registro_usuarios_div_controles').style.display="none";
									document.getElementById('div_estado_login').style.display="";
									document.getElementById('lightwindow_overlay').style.visibility="hidden";
									
									if(exito_2[3]=='true')
									{
										document.getElementById('registro_usuarios_estado_ingreso_hlk_blog').style.visibility="";
										document.getElementById('registro_usuarios_estado_ingreso_hlk_blog').innerHTML="Editar blog";
										document.getElementById('registro_usuarios_estado_ingreso_hlk_blog').href="../blogs/blog_crear.aspx?blogID="+exito_2[4];
										
									}
									else
									{
										document.getElementById('registro_usuarios_estado_ingreso_hlk_blog').style.visibility="";
										document.getElementById('registro_usuarios_estado_ingreso_hlk_blog').innerHTML="Crear blog";
										document.getElementById('registro_usuarios_estado_ingreso_hlk_blog').href="../blogs/blog_crear.aspx";
									}
									try{ document.getElementById('opine_div_opine').style.display="";}
									catch(e){};
									
								}
								else
									location.href='../contenido/contenido.aspx?catID=1&conID='+exito_2[1];
							}
							
							
						}
						
								
				}else
					document.getElementById('mensaje').style.display="none";
			}else
				document.getElementById('mensaje').innerHTML=ajax.status+"-"+ajax.statusText;
			}
			if(is_ie)
				ajax.send(null);
			else
				ajax.send(1);
		}
	
		
}



function olvide(){
		var valido = true;
		var ajax=nuevoAjax();
		var usuario = document.getElementById('txt_usuario').value;
		if(usuario.length==0)
		{
			valido = false;
			document.getElementById('div_usuario').style.display="";
		}
		if(valido)
		{
			ajax.open("POST",url_sit+"registro/olvide_clave.aspx?usuario="+usuario,true);
			// Añade un par etiqueta/valor a la cabecera HTTP a enviar. Si no lo colocamos, no se pasan los parametros.
			ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			// Cada vez que el estado de la conexión (readyState) cambie se ejecutara el contenido de esta "funcion()"
			ajax.onreadystatechange=function()
			{
			if(ajax.readyState!=4) return;
			
			if(ajax.status==200) // Si conexion HTTP es buena !!!
			{
				//si recibimos algun valor a mostrar...
				if(ajax.responseText)
				{
					var response =ajax.responseText.split('_-_');
					var exito = response[1];
					if(exito=='false')
					{
						document.getElementById('olvide').style.display="none";
						document.getElementById('mensaje2').style.display="none";
						document.getElementById('mensaje1').style.display="";
						
					}
					if(exito=='true')
					{
						document.getElementById('olvide').style.display="none";
						document.getElementById('mensaje1').style.display="none";
						document.getElementById('mensaje2').style.display="";
						
					}
						
				}
			}
			}
			if(is_ie)
				ajax.send(null);
			else
				ajax.send(1);
		}
	
		
}


function cambiar(){
		var ajax=nuevoAjax();
 		var valido = true;
		var usuario = document.getElementById('txt_usuario').value;
		var clave = document.getElementById('txt_clave_actual').value;
		var claven = document.getElementById('txt_clave_nueva').value;
		var clavec = document.getElementById('txt_confirmar').value;
		if(usuario.length==0)
		{
			valido = false;
			document.getElementById('div_usuario').style.display="";
		}
		if(clave.length==0)
		{
			valido = false;
			document.getElementById('div_clave_actual').style.display="";
		}
		if(claven.length==0)
		{
			valido = false;
			document.getElementById('div_clave_nueva').style.display="";
		}
		if(clavec.length==0)
		{
			valido = false;
			document.getElementById('div_clave_conf').style.display="";
		}
		if(valido)
		{
	
		ajax.open("POST",url_sit+"registro/cambiar_clave.aspx?usuario="+usuario+"&clave="+clave+"&claven="+claven,true);

		// Añade un par etiqueta/valor a la cabecera HTTP a enviar. Si no lo colocamos, no se pasan los parametros.
		ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

		// Cada vez que el estado de la conexión (readyState) cambie se ejecutara el contenido de esta "funcion()"
		ajax.onreadystatechange=function()
		{
		if(ajax.readyState!=4) return;
		
		if(ajax.status==200) // Si conexion HTTP es buena !!!
		{
			//si recibimos algun valor a mostrar...
			if(ajax.responseText)
			{
				var response =ajax.responseText.split('_-_');
				var exito = response[1];
				if(exito=='false')
				{
					document.getElementById('cambiar').style.display="none";
					document.getElementById('mensaje2').style.display="none";
					document.getElementById('mensaje1').style.display="";
					
				}
				if(exito=='true')
				{
					document.getElementById('cambiar').style.display="none";
					document.getElementById('mensaje1').style.display="none";
					document.getElementById('mensaje2').style.display="";
					
				}
				
			}else
				document.getElementById('mensaje1').style.display="none";
		}else
			document.getElementById('mensaje1').innerHTML=ajax.status+"-"+ajax.statusText;
		}
		if(is_ie)
				ajax.send(null);
			else
				ajax.send(1);
	}
		
}


function enviar(){
		var ajax=nuevoAjax();
 		var valido = true;
		var mail = document.getElementById('txt_email').value;
		var mail_amigo = document.getElementById('txt_email_amigo').value;
		var mensaje = document.getElementById('txt_mensaje').value;
		if(mail.length==0)
		{
			valido = false;
			document.getElementById('div_email').style.display="";
		}
		if(mail_amigo.length==0)
		{
			valido = false;
			document.getElementById('div_mail_amigo').style.display="";
		}
		if(mensaje.length==0)
		{
			valido = false;
			document.getElementById('div_mensaje').style.display="";
		}
		
		if(valido)
		{
	
		ajax.open("POST",url_sit+"registro/cambiar_clave.aspx?usuario="+usuario+"&clave="+clave+"&claven="+claven,true);

		// Añade un par etiqueta/valor a la cabecera HTTP a enviar. Si no lo colocamos, no se pasan los parametros.
		ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

		// Cada vez que el estado de la conexión (readyState) cambie se ejecutara el contenido de esta "funcion()"
		ajax.onreadystatechange=function()
		{
		if(ajax.readyState!=4) return;
		
		if(ajax.status==200) // Si conexion HTTP es buena !!!
		{
			//si recibimos algun valor a mostrar...
			if(ajax.responseText)
			{
				var response =ajax.responseText.split('_-_');
				var exito = response[1];
				if(exito=='false')
				{
					document.getElementById('cambiar').style.display="none";
					document.getElementById('mensaje2').style.display="none";
					document.getElementById('mensaje1').style.display="";
					
				}
				if(exito=='true')
				{
					document.getElementById('cambiar').style.display="none";
					document.getElementById('mensaje1').style.display="none";
					document.getElementById('mensaje2').style.display="";
					
				}
				
			}else
				document.getElementById('mensaje1').style.display="none";
		}else
			document.getElementById('mensaje1').innerHTML=ajax.status+"-"+ajax.statusText;
		}
		if(is_ie)
				ajax.send(null);
			else
				ajax.send(1);
	}
		
}



/*          MANIPULACION XML  */
function crearObjetoXML(archivoXML){
   //--- Compruebo si se trata de IE o no.
   //--- Si es IE el objeto ActiveXObject existirá.
   if(window.ActiveXObject){
      //--- Creo un nuevo objeto de la librería Microsoft.XMLDOM que es la que se encarga
      //--- en Internet Explorer de 'parsear' un archivo XML.
      xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
      //--- Defino la asincronización a false
      xmlDoc.async = false;
      xmlDoc.load(archivoXML);
     // parsearXML();
   }else if(document.implementation && document.implementation.createDocument){
      xmlDoc = document.implementation.createDocument("","",null);
      xmlDoc.load(archivoXML);
      //--- Le decimos que cuando haya terminado de cargar el XML
      //--- ejecute la función de parsear el mismo.
      //--- NOTA: Se le llama a la función sin los paréntesis. Si se le colocan no funciona
     // xmlDoc.onload = parsearXML;
   }else{
      alert ('Su navegador no puede soportar este script');
   }
}

function parsearXML(xmldoc){
   var contenido = document.getElementById("lista_google");
   var longitudXML = xmlDoc.firstChild.childNodes.length;

   for(var i=0;i<longitudXML;i++){
      contenido.innerHTML += xmlDoc.firstChild.getElementsByTagName('suggestion')[i].getAttribute('data')+' - ';
     

   }
}

function sugerenciasGoogle(cadena){

		var ajax=nuevoAjax();

		ajax.open("POST",url_sit+"contenido/motor_ajax.aspx?comID=6&b="+cadena,true);
		
		// Añade un par etiqueta/valor a la cabecera HTTP a enviar. Si no lo colocamos, no se pasan los parametros.
		ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

		// Cada vez que el estado de la conexión (readyState) cambie se ejecutara el contenido de esta "funcion()"
		ajax.onreadystatechange=function()
		{
		if(ajax.readyState!=4) return;
		
		if(ajax.status==200) // Si conexion HTTP es buena !!!
			{
				//si recibimos algun valor a mostrar...
				if(ajax.responseText)
				{
				if(document.getElementById('tab_div')!=null)
					{	try{
						var olddiv = document.getElementById('tab_div');
						
						document.getElementById('lista_google').removeChild(olddiv);
						}
						catch(e){}
					}
					document.getElementById('lista_google').style.display="block";
					var t = document.createElement('div');
					t.setAttribute('id','tab_div');
					t.innerHTML = ajax.responseText;
					document.getElementById('lista_google').appendChild(t);
				}else
					document.getElementById('lista_google').style.display="none";
			}else{
				document.getElementById('lista_google').innerHTML=ajax.status+"-"+Conexion.statusText;
			}

		}
		if(is_ie)
			ajax.send(null);
		else
			ajax.send(1);
	
		
}	
	
function seleccionBuscador(){
	

		
		if(document.getElementById('sel_buscador_habitat').checked)
		{
		document.getElementById('div_sel_buscador_habitat').style.display="";
		document.getElementById('div_sel_buscador_google').style.display="none";
		}
		if(document.getElementById('sel_buscador_google').checked)
		{
		document.getElementById('div_sel_buscador_habitat').style.display="none";
		document.getElementById('div_sel_buscador_google').style.display="";
		}

}

function verificarEmail(email)
{
	var ajax=nuevoAjax();

	ajax.open("POST",url_sit+"contenido/motor_ajax.aspx?comID=7&b="+email,true);
	
	// Añade un par etiqueta/valor a la cabecera HTTP a enviar. Si no lo colocamos, no se pasan los parametros.
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

	// Cada vez que el estado de la conexión (readyState) cambie se ejecutara el contenido de esta "funcion()"
	ajax.onreadystatechange=function()
	{
	if(ajax.readyState!=4) return;
	
	if(ajax.status==200) // Si conexion HTTP es buena !!!
		{
			//si recibimos algun valor a mostrar...
			if(ajax.responseText)
			{
				var response =ajax.responseText.split('_-_');
				document.getElementById('val_email').innerHTML=response[1];
				
			}
		}else{
			
		}

	}
	if(is_ie)
		ajax.send(null);
	else
		ajax.send(1);
}

function verificarUsuario(usuario)
{
	var ajax=nuevoAjax();

	ajax.open("POST",url_sit+"contenido/motor_ajax.aspx?comID=8&b="+usuario,true);
	
	// Añade un par etiqueta/valor a la cabecera HTTP a enviar. Si no lo colocamos, no se pasan los parametros.
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

	// Cada vez que el estado de la conexión (readyState) cambie se ejecutara el contenido de esta "funcion()"
	ajax.onreadystatechange=function()
	{
	if(ajax.readyState!=4) return;
	
	if(ajax.status==200) // Si conexion HTTP es buena !!!
		{
			//si recibimos algun valor a mostrar...
			if(ajax.responseText)
			{
				var response =ajax.responseText.split('_-_');
				document.getElementById('val_usuario').innerHTML=response[1];
				
			}
		}else{
			
		}

	}
	if(is_ie)
		ajax.send(null);
	else
		ajax.send(1);
}
function buscadorPredeterminado()
{
	document.getElementById('sel_buscador_habitat').checked=true;
}


function PageQuery(q) 
	    {
			if(q.length > 1) this.q = q.substring(1, q.length);
			else this.q = null;
			this.keyValuePairs = new Array();
			if(q) 
			{
				for(var i=0; i < this.q.split("&").length; i++) 
				{
				this.keyValuePairs[i] = this.q.split("&")[i];
				}
            }
            this.getKeyValuePairs = function() 
				{ 
					return this.keyValuePairs; 
				}
            this.getValue = function(s) 
				{
				for(var j=0; j < this.keyValuePairs.length; j++) 
					{
					if(this.keyValuePairs[j].split("=")[0] == s)
					return this.keyValuePairs[j].split("=")[1];
					}
				return false;
				}
            this.getParameters = function()		
            {
				var a = new Array(this.getLength());
				for(var j=0; j < this.keyValuePairs.length; j++) 
				{	
					a[j] = this.keyValuePairs[j].split("=")[0];
				}
				return a;
            }
            this.getLength = function() 
            { 
				return this.keyValuePairs.length; 
            }            
        }
        
        function queryString(key)
        {
			var page = new PageQuery(window.location.search); 
            return unescape(page.getValue(key)); 
        }
        
        
function opinar()
{
	var ajax=nuevoAjax();

	ajax.open("POST",url_sit+"contenido/motor_ajax.aspx?comID=8&b=1",true);
	
	// Añade un par etiqueta/valor a la cabecera HTTP a enviar. Si no lo colocamos, no se pasan los parametros.
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

	// Cada vez que el estado de la conexión (readyState) cambie se ejecutara el contenido de esta "funcion()"
	ajax.onreadystatechange=function()
	{
	if(ajax.readyState!=4) return;
	
	if(ajax.status==200) // Si conexion HTTP es buena !!!
		{
			//si recibimos algun valor a mostrar...
			if(ajax.responseText)
			{
				var response =ajax.responseText.split('_-_');
				document.getElementById('calificado').innerHTML=response[1];

			}
		}else{
			
		}

	}
	if(is_ie)
		ajax.send(null);
	else
		ajax.send(1);
}


function cargaOpine()
{
	if(document.getElementById('estado_ingreso_hlk_salir').innerHTML=="Salir")
	{
		document.getElementById('opine_div_opine').style.display="";
		document.getElementById('opine_rbl_opciones_0').checked=true;
		
		
	}
	else
	{
		
		document.getElementById('opine_div_opine').style.display="none";
	}
}
function validarCaracteres(e,control,boton)
{

document.getElementById(control).value=(document.getElementById(control).value).replace(/[<>\"\']/,'');
document.getElementById(control).focus();

}

function validarCaracteresBuscador(e,control)
{

document.getElementById(control).value=(document.getElementById(control).value).replace(/[^\w\séáíóú]/,'');

document.getElementById(control).value=(document.getElementById(control).value).replace(/[\d]/,'');
document.getElementById(control).focus();

}
function cambiarHojaEstilos(id_hoja)
{
	if(id_hoja==2)
		document.getElementById('hoja_estilos').href="../css/estilos.css";
	if(id_hoja==1)
		document.getElementById('hoja_estilos').href="../css/estilos1.css";
	if(id_hoja==3)
		document.getElementById('hoja_estilos').href="../css/estilos3.css"
	
	
		
}

function salir()
{
	var ajax=nuevoAjax();

	ajax.open("POST",url_sit+"contenido/motor_ajax.aspx?comID=10&b=1",true);
	
	// Añade un par etiqueta/valor a la cabecera HTTP a enviar. Si no lo colocamos, no se pasan los parametros.
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

	// Cada vez que el estado de la conexión (readyState) cambie se ejecutara el contenido de esta "funcion()"
	ajax.onreadystatechange=function()
	{
	if(ajax.readyState!=4) return;
	
	if(ajax.status==200) // Si conexion HTTP es buena !!!
		{
			//si recibimos algun valor a mostrar...
			if(ajax.responseText)
			{
				document.getElementById('registro_usuarios_div_controles').style.display="";
				document.getElementById('div_estado_login').style.display="none";

			}
		}else{
			
		}

	}
	if(is_ie)
		ajax.send(null);
	else
		ajax.send(1);
}

