
	   function formatHour(hour) {	     	   	    	   
	      var req = /^(\d{2}):(\d{2}):(\d{2,3})?$/i;
		  if (res = req.exec(hour)) {
			 document.write(res[1]+":"+res[2]);
		  }	else {
	   		 document.write (hour);
		  }
	   }

	   function getDate(date) {	     	   	    	   
	      var req = /^(\d{4})[-|\/]?(\d{2})[-|\/]?(\d{2})( (\d{2}):(\d{2})(:(\d{2,3}))?)?$/i;
	      if (res = req.exec(date)) {		  
  			 document.write(res[3]+"/"+res[2]+"/"+res[1]);
			 if (res[4]) { document.write(" "+res[5]+":"+res[6]); }
		  }	else {
	   		 document.write (date);
		  }
	   }
	   
	   function getDate2(date) {	     	   	    	   
	      var req = /^(\d{4})(\d{2})(\d{2})?$/i;
	      if (res = req.exec(date)) {		  
  			 document.write(res[3]+"/"+res[2]+"/"+res[1]);
		  }	else {
	   		 document.write (date);
		  }
	   }

	   function getHourGMT(hour) {
   	      var path = location.href;
	      var patern_home   = new RegExp("(http://)([^/]*).terra.([^/]*)/?(.*)","gi"); 
	      path.match(patern_home);
		  var pais = RegExp.$2;   
		  var nota="";
		  
		  var GMTDif=0;
		  if       (pais == 'ar') { GMTDif=-3; }
		  else if  (pais == 'br') { GMTDif=-2; }
		  else if  (pais == 'cl') { GMTDif=-3; }
		  else if  (pais == 'co') { GMTDif=-5; }
		  else if  (pais == 'cr') { GMTDif=-6; }
		  else if  (pais == 'do') { GMTDif=-4; }
		  else if  (pais == 'es') { GMTDif=2; }
		  else if  (pais == 'gt') { GMTDif=-6; }
		  else if  (pais == 'hn') { GMTDif=-6; }
		  else if  (pais == 'mx') { GMTDif=-5; }
		  else if  (pais == 'ni') { GMTDif=-6; }
		  else if  (pais == 'pa') { GMTDif=-5; }
		  else if  (pais == 'pe') { GMTDif=-5; }
		  else if  (pais == 'sv') { GMTDif=-6; }
		  else if  (pais == 'us') { GMTDif=-4; }
		  else if  (pais == 'uy') { GMTDif=-3; }
		  else if  (pais == 've') { GMTDif=-4; }
		  else if  (pais == 'media') { GMTDif=2; }
		  		  	   
	      var req = /^(\d{2}):(\d{2})?$/i;
		  
		  if (res = req.exec(hour)) {
		     hour = parseInt(res[1]) + GMTDif;
			 if (hour<0) {hour=24+hour; nota=" (-1 día)";} 
			 document.write(hour+":"+res[2]+nota);
		  } else {
		     document.write (hour + " GMT");
		  }
		  
	   }


	   function getPais() {
   	      var path = location.href;
	      var patern_home   = new RegExp("(http://)([^/]*).terra.([^/]*)/?(.*)","gi"); 
	      path.match(patern_home);
		  var pais = RegExp.$2;   
		  
		  if       (pais == 'ar') { npais="Argentina"; }
		  else if  (pais == 'br') { npais="Brasil"; }
		  else if  (pais == 'cl') { npais="Chile"; }
		  else if  (pais == 'co') { npais="Colombia"; }
		  else if  (pais == 'cr') { npais="Costa Rica"; }
		  else if  (pais == 'do') { npais="Rep. Dominicana"; }
		  else if  (pais == 'es') { npais="España"; }
		  else if  (pais == 'gt') { npais="Guatemala"; }
		  else if  (pais == 'hn') { npais="Honduras"; }
		  else if  (pais == 'mx') { npais="México DF"; }
		  else if  (pais == 'ni') { npais="Nicarágua"; }
		  else if  (pais == 'pa') { npais="Panamá"; }
		  else if  (pais == 'pe') { npais="Perú"; }
		  else if  (pais == 'sv') { npais="El Salvador"; }
		  else if  (pais == 'us') { npais="EST"; }
		  else if  (pais == 'uy') { npais="Uruguay"; }
		  else if  (pais == 've') { npais="Venezuela"; }
		  else if  (pais == 'media') { npais="España"; }
		  		  	   
		  document.write(npais);
	   }


function abrir_img(im,ti,ex,ancho,alto){
masAlto=alto+48;  features = "width="+ancho+",height="+masAlto; if (!ti.length) ti = "Terra";
window.open("/formula1/2003/popup_fotos.html?imagen=" + im + "&titulo=" + ti + "&ancho=" + ancho + "&alto=" + alto, "Foto", features);
}

function show_foto(src,tit,leg,cre){
top.foto.location.replace("/formula1/2003/galerias/main.html?imagen=" + src + "&tit=" + tit + "&leg=" + leg + "&cre=" + cre);
}

/****************************************************
     Author: Eric King
     Url: http://redrival.com/eak/index.shtml
     This script is free to use as long as this info is left in
     Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}
