function setHomepate(obj) {
 obj.style.behavior='url(#default#homepage)';
 obj.setHomePage('http://www.quien.com');
}
//inicia carrusel horizontal
var statusflag=true;
var current_photo_galery=0;
 function ticCarruselMediano(max_n) {
  if (statusflag) {
   document.carruselMain.segundosRestantes.value=parseInt(document.carruselMain.segundosRestantes.value-1);
   if (parseInt(document.carruselMain.segundosRestantes.value)<=0) {
    goImg(1+parseInt(current_photo_CarruselHorizontal),max_n);
   }
  }
  fun0="ticCarruselMediano("+max_n+")";
  id=setTimeout(fun0, 1000); 
 } 
function iniciaCarrusel(max_num)
{
document.getElementById('ID0').className='myMnuTopOn';
document.carruselMain.segundosRestantes.value=15;
fun="ticCarruselMediano("+max_num+")";
setTimeout(fun, 1000); 
}

 var current_photo_CarruselHorizontal=0;
 function goImg(x,y) {
  //y=5;
  if (x<0) 
   current_photo_CarruselHorizontal=y-1;
  else if (x>=y) { 
   current_photo_CarruselHorizontal=0;
  } else {
   current_photo_CarruselHorizontal=x;
  }
  for(i=0;i<5;i++)
   document.getElementById('ID'+i).className='myMnuTopOff';
  document.getElementById('ID'+current_photo_CarruselHorizontal).className='myMnuTopOn';
  document.getElementById('chTexto').style.top=-current_photo_CarruselHorizontal*200+'px';
  document.getElementById('chFotos').style.top=-current_photo_CarruselHorizontal*256+'px';
  //document.getElementById('pie').style.top=-current_photo_CarruselHorizontal*16+'px';
  document.carruselMain.segundosRestantes.value=15;
 }
//termina carrusel horizontal
//inicia carrusel vertical
 var current_photo_CarruselVertical=0;
 function goImgV(x) {
  y=5;
  if (x<0) 
   current_photo_CarruselVertical=y;
  else if (x>=y) { 
   current_photo_CarruselVertical=0;
  } else {
   current_photo_CarruselVertical=x;
  }
  for(i=0;i<5;i++)
   document.getElementById('ID'+i).className='myMnuTopOff';
  document.getElementById('ID'+current_photo_CarruselVertical).className='myMnuTopOn';
  document.getElementById('fotosCarrusel').style.top=-current_photo_CarruselVertical*514+'px';
  document.getElementById('textosCarrusel').style.top=-current_photo_CarruselVertical*220+'px';
  document.getElementById('pie').style.top=-current_photo_CarruselVertical*16+'px';
  document.carruselMain.segundosRestantes.value=15;
 }
//termina carrusel vertical
//Inicia Carrusel Circulos
 function goPauseCirculos() {
  statusflagCirculos=!statusflagCirculos;
  if (statusflagCirculos) 
   document.getElementById('pausaCarruselCirculos').src='images/pausa_on.gif';
  else
   document.getElementById('pausaCarruselCirculos').src='images/pausa_off.gif';
 }
 
 function ticCarruselMediano2(num) {
  if (statusflagCirculos) {
   document.carruselCirculosForm.segundosRestantes.value=parseInt(document.carruselCirculosForm.segundosRestantes.value-1);
   if (parseInt(document.carruselCirculosForm.segundosRestantes.value)<=0) {
    goImgCirculos(current_photo_circulos+1,num);
   }
  }
  fun4="ticCarruselMediano2("+num+")";
  id2=setTimeout(fun4, 1000); 
 } 

 function iniciacarcir(cir_num)
 {
  document.carruselCirculosForm.segundosRestantes.value=15;
  fun3="ticCarruselMediano2("+cir_num+")";
  setTimeout(fun3, 1000); 
 }
var statusflagCirculos=true;
var current_photo_circulos=0;
function goImgCirculos(x,y) {
 if (x<0) 
  current_photo_circulos=y-1;
 else if (x>=y) 
  current_photo_circulos=0;
 else
  current_photo_circulos=x;
 document.getElementById('fotosCirculos').style.top=-current_photo_circulos*224+'px';
 document.carruselCirculosForm.segundosRestantes.value=15
}
//Termina Carrusel Circulos

//Inicia Carrusel Fotogalerias
 var current_photo_fotogaleria=0;
 function goImgFotogalerias(x,y) {
  if (x<0) 
   current_photo_fotogaleria=y-1;
  else if (x>=y) 
   current_photo_fotogaleria=0;
  else
   current_photo_fotogaleria=x;

  document.getElementById('dtagFotogaleria').innerHTML='<b>'+(1+current_photo_fotogaleria)+'</b>/<b>'+y+'</b>';
  document.getElementById('fotosFotogaleria').style.top=-current_photo_fotogaleria*229+'px';

 }
//Termina Carrusel Fotogalerias


//inicia horoscopos
var xmlDoc;
var xmlh;
function impXML(fichero) {  
/*
  var mozilla = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined');
  var ie = (typeof window.ActiveXObject != 'undefined');
  if (ie) {
    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async = false;
  } else {
    xmlDoc = document.implementation.createDocument("", "", null)
  }
  xmlDoc.load(fichero);    
  xmlh = xmlDoc.getElementsByTagName("HOROSCOPO");
*/


 var xmlDoc = false;
 if (window.XMLHttpRequest) {
  xmlDoc = new XMLHttpRequest();
 } else if (window.ActiveXObject) {
  xmlDoc = new ActiveXObject("Microsoft.XMLHTTP");
 }
 if(xmlDoc) {
  xmlDoc.open("GET", fichero);
  xmlDoc.onreadystatechange = function() {
   if (xmlDoc.readyState == 4 && xmlDoc.status == 200) {
//    xmlh=xmlDoc.responseText;
    var xmlDocument=xmlDoc.responseXML;
    xmlh = xmlDocument.getElementsByTagName("HOROSCOPO");
    //alert('loaded');

   }
  }
  xmlDoc.send(null);
 }
}
function hor(a)
{
	if(a==1)
	{
		document.getElementById("hcirculos").style.display = 'none';
		document.getElementById("rhoroscopos").style.display = 'block';
	}
	else
	{
		document.getElementById("hcirculos").style.display = 'block';
		document.getElementById("rhoroscopos").style.display = 'none';
	}
	
}

function horos(id){
var lista="";
    var signo;
    var finicio;
    var ffin;
    var prediccion;
    var num;
    var color;
    var hora;
    var altsig;   
    var foto;  

    for(i=0; i< 12 ; i++){ 
     if (xmlh[i].getElementsByTagName("ID")[0].firstChild.nodeValue == id){
     signo=(xmlh[i].getElementsByTagName("SIGNO")[0].firstChild.nodeValue);
     finicio=(xmlh[i].getElementsByTagName("FINICIO")[0].firstChild.nodeValue);
     ffin=(xmlh[i].getElementsByTagName("FFIN")[0].firstChild.nodeValue);
     prediccion=(xmlh[i].getElementsByTagName("PREDICCION")[0].firstChild.nodeValue);
     num=(xmlh[i].getElementsByTagName("NUM")[0].firstChild.nodeValue);
     color=(xmlh[i].getElementsByTagName("COLOR")[0].firstChild.nodeValue);
     hora=(xmlh[i].getElementsByTagName("HORA")[0].firstChild.nodeValue);
     altsig=(xmlh[i].getElementsByTagName("SIGNOCOMPHOY")[0].firstChild.nodeValue);
     foto=(xmlh[i].getElementsByTagName("FOTO")[0].firstChild.nodeValue);      
     document.getElementById("imhoros").src="images/h_"+foto;
	 document.getElementById("sighoros").innerHTML = signo;
	 document.getElementById("fchoros").innerHTML = 'Nacidos entre el '+finicio+' y el '+ffin;
	 document.getElementById("prehoros").innerHTML = prediccion ;
	 document.getElementById("dhoros").innerHTML='<li><font color=\"#333333\">Tu n&uacute;mero de la suerte este d&iacute;a: </font><font color=\"#666666\">'+num+'</font></li><li><font color=\"#333333\">Tu color este d&iacute;a: </font><font color=\"#666666\">'+color+'</font></li>';
	 hor(1);
    } 
    }  
//    document.getElementById("idsigno").innerHTML = lista;
}

//termina horoscopos
//inicia quien recomienda
  function esconde(visible) {
    for ( i=1; i<8 ; i++)
	{
	   idr='rqr'+i;
	   idc='qrc'+i;
	  if (i == visible)
	  {
		//document.getElementById(idr).checked='checked';
		document.getElementById(idr).src='images/opcion_activo.gif';
		document.getElementById(idc).style.display="block";
	  }
	  else
	  {
	  	document.getElementById(idc).style.display="none";
		document.getElementById(idr).src='images/opcion.gif';
	  }
	}
  }
  function getnday() {
  	 hoy= new Date();
	 dia=hoy.getDay();
	 if(dia == 0)
	 {
		 dia=7;
	 }
	 esconde(dia);
  }
  function getnday2() {
  	 hoy= new Date();
	 dia=hoy.getDay();
	 if(dia == 0)
	 {
		 dia=7;
	 }
	 QRseccion(dia);
  }

//termina quien recomienda
//inicia lo mas visto 
function seleccion(opc) {
/*
Funcion javascript que determina el contenido a mostrar de la pesta–a seleccionada por el usuario.
Consta de tres opciones, el valor de la opcion es un numero entero recibido en la variable "opc",
en primer lugar se ocultan todos los contenidos y despues se elige el contenido a mostrar a traves de 
la funcion switch y se aplican los estilos definidos en las clases css.
*/
	//escondemos todos los contenidos
	document.getElementById("op1").style.display="none";
	document.getElementById("op2").style.display="none";
	document.getElementById("pest1").className = 'lomas_ocultar1';
	document.getElementById("pest2").className = 'lomas_ocultar2';
	switch(opc)
	{
		case 1:
			//mostramos elcontenido de la primera opcion
			document.getElementById("op1").style.display="block";
			document.getElementById("pest1").className = 'lomas_resaltar1';
			break;
		case 2:
			//mostramos elcontenido de la segunda opcion
			document.getElementById("op2").style.display="block";
			document.getElementById("pest2").className = 'lomas_resaltar2';
			break;
		case 3:
			//mostramos elcontenido de la tercera opcion
			document.getElementById("op3").style.display="block";
			document.getElementById("pest3").className = 'lomas_resaltar3';
			break;
	}
}
//termina lo mas visto

 //Quien TV
		 
			 var config = new Array();
			 
			 /* 
			 * feel free to edit these configurations
			 * to modify the player experience
			 */
			 config["videoId"] = null; //the default video loaded into the player
			 config["videoRef"] = null; //the default video loaded into the player by ref id specified in console
			 config["lineupId"] = null; //the default lineup loaded into the player
			 config["playerTag"] = null; //player tag used for identifying this page in brightcove reporting
			 config["autoStart"] = false; //tells the player to start playing video on load
			 config["preloadBackColor"] = "#FFFFFF"; //background color while loading the player
			 
			  /* 
			 * set the player's size using the parameters below
			 * to make this player dynamically resizable, set the width and height as a percentage
			 */
			 config["width"] = 355;
			 config["height"] = 290;
			 
			 /* do not edit these config items */
			 config["playerId"] = 1369813335;
			 function ventanaQTV(url)
{
	window.open(url,'','width=488,height=414,scrollbars=no,resizable=no');
}
 //Termina Quien TV

//inicia script de coolcarrusel
 function loadedvidz(iOpc,id) { 
  if(id=='') id=1;
  if (iOpc==1) {
   document.getElementById('loadingvidzbox').style.display = "none"; 
   document.getElementById('bloque_3').style.display = "block";         
  } else if (iOpc==2) {
   document.getElementById('loadingvidzbox2'+id).style.display = "none"; 
   document.getElementById('bloque_2'+id).style.display = "block";         
  } else if (iOpc==3) {
   document.getElementById('loadingportadas').style.display = "none"; 
   document.getElementById('content_portadas').style.height="150px";
   document.getElementById('portadas').style.display = "block";
  }
 }
//termina script de coolcarrusel
//Servicios Quien
    function agreg(vthis){
    if(document.all){      
       vthis.style.behavior='url(#default#homepage)';vthis.sethomepage ('http://www.quien.com');return false;
    }
    else{            
        window.sidebar.addPanel("Quien.com", "http://www.quien.com/", "");
    }        
    }
//Termina Sevicios Quien
//Buscador header
function valida_busqueda3(){
	texto = document.form_header.txt.value;
	if (texto == "Encuentra todo en quien.com"){
	   texto = ""
	}
	if(texto.length < 3){
	   alert("Tienes que buscar palabras de 3 caracteres como minimo.");
  	   return false;
        }
  	return true;			
}

function verificaBusqueda ()
{
	sustit = { '\u00C1':'A', '\u00C9':'E', '\u00CD':'I', '\u00D3':'O', '\u00DA':'U', '\u00C4':'A', '\u00CB':'E', '\u00CF':'I', '\u00D6':'O', '\u00DC':'U', '\u00D1':'N' }; 
	cadena = document.forms[0].q.value;
	cadena = cadena.replace ( /[\u00C1\u00C9\u00CD\u00D3\u00DA\u00C4\u00CB\u00CF\u00DC\u00DC\u00D1]/gi, function (m) {
		var ret = sustit[m.toUpperCase()];
					
		if (m === m.toLowerCase())
			ret = ret.toLowerCase();
			
		return ret;
	} );
	document.forms[0].q.value = cadena;
	return true;
}
//Termina Buscador header


/**
*   Cambia fuentes
*/

function ChangeFont( iOpc )
{
    var ids = [ 'table_info', 'divCita','cambiarFuente' ];
    for( var i = 0; i < ids.length; i++ )
    {
        var el = document.getElementById( ids[ i ] );
        if( el )
        {
            if( iOpc == 1 )
                el.style.fontSize = ( parseInt( el.style.fontSize ) + 1 ) + 'px';
            else
                el.style.fontSize = ( parseInt( el.style.fontSize ) - 1 ) + 'px';
        }
    }
    /*
    if( iOpc == 1 )
    {
       
        if( $( 'table_info' ) ) $( 'table_info' ).style.fontSize = ( 1 + parseInt( $( 'table_info' ).style.fontSize ) ) + 'px'; 
        if( $( 'table_cita' ) ) $( 'table_cita' ).style.fontSize = ( 1 + parseInt( $( 'table_cita' ).style.fontSize ) ) + 'px';
        if( $( 'cambiarFuente' ) ) $( 'cambiarFuente' ).style.fontSize = ( 1 +parseInt( $('cambiarFuente').style.fontSize) ) + 'px';

    }
    else
    {
        if( $( 'table_info' ) ) $( 'table_info' ).style.fontSize = ( parseInt( $( 'table_info' ).style.fontSize ) - 1) + 'px'; 
        if( $( 'table_cita' ) ) $( 'table_cita' ).style.fontSize = ( parseInt( $( 'table_cita' ).style.fontSize ) - 1) + 'px';
        if( $( 'cambiarFuente' ) ) $( 'cambiarFuente' ).style.fontSize = ( parseInt( $('cambiarFuente').style.fontSize ) - 1  ) + 'px';
    }
    */
}

function printto()
{
    window.print();
}
