function NuevaVentana(direccion,tipo){	
	if (tipo == 1)//si la coleccion es de tipo pop up
	{ 
		window.open(direccion,'pagina','width=563,height=570,resizable=yes,toolbar=1,menubar=1,scrollbars=1');
	}
	else{
		if (tipo == 0)//si la coleccion es de tipo normal
		{ 
			this.location.href = direccion;
		}
		else{ //si no es colecciono  o cualquier otra cosa
			this.location.href = direccion;
			} 
		}		
}
	
function abrirClip(clipid)
	{	if (navigator.appName == "Microsoft Internet Explorer" || parseInt(navigator.appVersion) >= 5)
		{
			var propiedades="top=0,left=0,scrollbars=no,width=586px,height=490px,resizeable=no";
			var pag="http://media.terra.com.mx/player/frame_exp.asp?clipid="+clipid;	
			ventana=window.open (pag,"TerraMultimedia",propiedades);
		}
		else{
			var propiedades="top=0,left=0,scrollbars=no,outerWidth=586px,outerHeight=520";
			var pag="http://media.terra.com.mx/player/frame_exp.asp?clipid="+clipid;
			ventana=window.open (pag,"terraMultimedia",propiedades);
			}
	}

function VentanaQuiz(direccion){
	window.open(direccion,'Ventana0','width=700,height=500,resizable=No,scrollbars=yes');
}
function VentanaImagen(direccion){
	window.open(direccion,'VentanaImagen','width=700,height=400,resizable=yes,scrollbars=yes');
}
function VentanaPopup(direccion){
	window.open(direccion,'VentanaPopup','width=490,height=540,resizeable=no,scrollbars=yes');
}
function VentanaSugerencia(direccion){
	window.open(direccion,'VentanaSugerencia','width=700,height=400,resizable=yes,scrollbars=yes');
}
function MediaPlayer(direccion){
	window.open(direccion,'pagina','width=468,height=434,resizable=no,toolbar=no,menubar=no,scrollbars=no');
}	

function VentanaCompleta(pagE,pagN,anchoE,altoE,anchoN,altoN) {	
	if (navigator.appName == "Microsoft Internet Explorer" || parseInt(navigator.appVersion) >= 5){
		var propiedades="top=0,left=0,scrollbars=yes,width="+anchoE+"px,height="+altoE+"px,resizable=yes,toolbar=yes,menubar=yes";
		ventana=window.open (pagE,'VentanaCombo',propiedades);
	}else{
		var propiedades="top=0,left=0,scrollbars=yes,outerWidth="+ anchoN +"px,outerHeight="+ altoN +"px";			
		ventana=window.open (pagN,'VentanaCombo',propiedades);
	}
}

//function VentanaComboUrl(UrlComplemento) {	
function VentanaComboUrl(UrlInicio, UrlComplemento) {	
	if (navigator.appName == "Microsoft Internet Explorer" || parseInt(navigator.appVersion) >= 5){	
		var propiedades = "top=0,left=0,scrollbars=yes,width=400px,height=400px,resizable=yes,toolbar=yes,menubar=yes";
		var page = UrlInicio + UrlComplemento;
		window.open(page,'VentanaCombo',propiedades);
		//window.open(page,'CAPTURA',propiedades);		//Frame: CAPTURA q esta cuando se manda llamar la portada por ej de Deportes
	}else{	
		var propiedades = "top=0,left=0,scrollbars=yes,outerWidth=400px,outerHeight=400px";
		var page = UrlInicio + UrlComplemento;
		window.open(page,'VentanaCombo',propiedades);
		//window.open(page,'CAPTURA',propiedades);	
	}	
}

function irOpcion(s){	
	var d = s.options[s.selectedIndex].value;
	location.href = d;
	s.selectedIndex=0;
}


function VentanaGeneral2002(liga,Ntarget,anchoE,altoE,anchoN,altoN,T,L,RZ,SB,TB,MB) {	
	if (navigator.appName == "Microsoft Internet Explorer" || parseInt(navigator.appVersion) >= 5){
		var propiedades="top="+T+",left="+L+",scrollbars="+SB+",width="+anchoE+"px,height="+altoE+"px,resizable="+RZ+",toolbar="+TB+",menubar="+MB+"";			
		ventana=window.open (liga,Ntarget,propiedades);
	}else{
		var propiedades="top="+T+",left="+L+",scrollbars="+SB+",outerWidth="+ anchoN +"px,outerHeight="+ altoN +"px,resizable="+SB+"";			
		ventana=window.open (liga,Ntarget,propiedades);
	}
}

function votarEncuesta(valor, respuesta, directorio){
	direccion = directorio + "/encuesta/resultado.asp?EncuestaId=" + valor + "&Vota=" + respuesta; parent.top.location = direccion;
}

function votarEncuestaEspeciales(SeccionId, EncuestaId, respuesta, directorio){
	direccion = directorio + "/encuesta/resultado.asp?EncuestaId=" + EncuestaId + "&Vota=" + respuesta + "&SeccionId=" + SeccionId; parent.top.location = direccion;
}

function TipsBuscar(){
direccion = "http://busqueda.terra.com.mx:81/tips.htm";
window.open(direccion, 'TheRemote', 'width=520, height=480, resizable=no')
}

function ChecaDato(){
	if  (document.busqueda.qt.value == "" ){
		TipsBuscar();
		return false;
	}else
		return true;
}

function Comentarios(){
direccion = "http://www.terra.com.mx/general/comentarios/comentarios1.asp?producto=eln";
window.open(direccion, 'TheRemote', 'width=420, height=400, resizable=no')
}

function Arreglo(){
	this.length = Arreglo.arguments.length 
	for (var i = 0; i < this.length; i++)
	 this[i] = Arreglo.arguments[i]
}

function Fecha() {
  var ndia  = new Arreglo('Domingo', 'Lunes', 'Martes', 'Mi&eacute;rcoles', 'Jueves', 'Viernes', 'S&aacute;bado')
  var nmes  = new Arreglo('enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 
                          'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre')
  var ahora
  var fecha = new Date()
  var ano   = fecha.getYear()
  var mes   = fecha.getMonth()
  var dia   = fecha.getDay()
  var dian  = fecha.getDate()

  if (ano < 200)
  		{ano += 1900;}
		
  ahora = ndia[dia] + " " + dian + " de " + nmes[mes] + ", " + ano;
  return ahora
}

function ChecarDatosChat(){
	if  (document.chat.nickname.value == "" )
		{
		alert("Su Nick no ha sido proporcionado");
		return false;
		}
	else
	{
	return true;
	}					
}

function abrirPopUp(pag,anchoE,altoE,anchoN,altoN,nVentana)
{

  if (navigator.appName == "Microsoft Internet Explorer")
    var propiedades = "top=0,left=0,scrollbars=no,width=" + anchoE + "px,height=" + altoE + "px,resizeable=no";
  else
    var propiedades = "top=0,left=0,scrollbars=no,outerWidth=" + anchoN + "px,outerHeight=" + altoN + "px";
  ventana = window.open (pag,'Popup',propiedades);

}

function boletin(boletinId){
window.open('http://www.terra.com.mx/general/boletines/registroexpress.asp?boletinid='+ boletinId,'Boletines','width=780px,height=550px,status=no,scrollbars=yes,resizable=no,menubar=no');
}


function abrirChatTurismo(){	
	if (navigator.appName == "Microsoft Internet Explorer"){
		var propiedades="top=0,left=0,scrollbars=no,width=740px,height=550px,resizeable=no";
		var pag="http://www.terra.com.mx/turismo/chat/frameset.html";			
		ventana=window.open (pag,"chatterra",propiedades);
	}else{
		var propiedades="top=0,left=0,scrollbars=no,outerWidth=752px,outerHeight=530px";
		var pag="http://www.terra.com.mx/turismo/chat/frameset.html";
		ventana=window.open (pag,"chatterra",propiedades);
	}
}

function trim2(objeto){
  while("" + objeto.charAt(0) == " ") {
    objeto = objeto.substring(1, objeto.length) }
  while("" + objeto.charAt(objeto.length-1) == " ") {
    objeto = objeto.substring(0, objeto.length-1) }
  return(objeto);
}
	
ORDVAL=Math.floor (Math.random()*1000000);
document.write('<span ID="oHomePage" style="behavior:url(#default#homepage);"></span>');

function setHomePage (url)
{
	var esp, inicio, fin, ver, plat;
	if (document.all && document.getElementById && navigator.appVersion.indexOf("Win") >= 0)
	{
    		oHomePage.setHomePage(url);
			window.parent.top.location.href = url;
	}
	else
		alert('Tu Navegador no soporta esta funcionalidad.');
}
