function GoInforchat() {window.location.href='http://www.faenquil.br/index.html?d=' + new Date().getTime();}
function GoHispachat() {window.location.href='http://www.faenquil.br/index.html?d=' + new Date().getTime();}
var searchEngineFocus = false;

function paint_oasis195x90(){
	ord=Math.random()*10000000000000000;
	document.write('<SCR' + 'IPT LANGUAGE="JavaScript" SRC="http://ad.es.doubleclick.net/adj/ecom.portadaya/e01home;sz=195x90  ;ord=' + ord + '?" ><\/SCR' + 'IPT>');
}

function paint_oasis195x52(){
	ord=Math.random()*10000000000000000;
	document.write('<SCR' + 'IPT LANGUAGE="JavaScript" SRC="http://ad.es.doubleclick.net/adj/ecom.portadaya/e01home;sz=195x52;ord=' + ord + '?" ><\/SCR' + 'IPT>');	
}

function paint_pub300x80(){	
	sz = "300x80";
	 st = "portada.ya.com";
	 pd = "e01home";
	 vartext = "tile=3";
	 std = "http://ad.es.doubleclick.net/";
	
	var time = new Date();
	randnum= (time.getTime());
	
	
	if (navigator.appName && navigator.appName.indexOf("Netscape")>=0 && navigator.appVersion.substring(0,1)>=5) {
	document.write ('<a href="'+std+'jump/'+st+'/'+pd+';sz='+sz+'">');
	document.write ('<img src="'+std+'ad/'+st+'/'+pd+';sz='+sz+'" width="300" height="80" border="0"></a>'); }
	else {
	document.write ('<SCR'+'IPT language="JavaScript" SRC="'+std+'adj/'+st+'/'+pd+';sz='+sz+';'+vartext+';ord='+randnum+'?"></SCR'+'IPT>'); }
}

function paint_pub300x250(){
	 sz = "300x250";
	 st = "portada.ya.com";
	 pd = "e01home";
	 isnt = "dcopt=ist";
	 vartext = "tile=1";
	 std = "http://ad.es.doubleclick.net/";
	
	var chechkm8inactive=false;
	var time = new Date();
	randnum= (time.getTime());
	
	if (document.cookie.length > 0) {
	cookies=unescape(document.cookie);
	offset = cookies.indexOf("YAKEYS=");
	if (offset != -1) {
	offset = cookies.indexOf("P1=");
	if (offset != -1) {
	end =cookies.indexOf("|", offset);
	vartext=cookies.substring(offset, end);}}}
	
	if (navigator.appName && navigator.appName.indexOf("Netscape")>=0 && navigator.appVersion.substring(0,1)>=5) {
	document.write ('<a href="'+std+'jump/'+st+'/'+pd+';sz='+sz+'">');
	document.write ('<img src="'+std+'ad/'+st+'/'+pd+';sz='+sz+'" width="300" height="250" border="0"></a>'); }
	else {
	document.write ('<SCR'+'IPT language="JavaScript" SRC="'+std+'adj/'+st+'/'+pd+';'+isnt+';sz='+sz+';'+vartext+';ord='+randnum+'?"></SCR'+'IPT>'); }
	
}


var ie4=(document.all);
var ie55=(ie4&&((navigator.userAgent.indexOf("MSIE 5.5")!=-1)||(navigator.userAgent.indexOf("MSIE 6")!=-1)));
var pc=(navigator.platform.indexOf('Win32')!=-1);
var mac=(navigator.platform.indexOf('MacPPC')!=-1);
var sinbordes=(ie4&&pc);

function popupvideo(video,type) {
  if(type==null){
	    document.location.href="http://www.yatv.com/video/yatv2_video_n_" + video +"_1.html"
  }
  else{
  	if(type=="v"){
			document.location.href="http://www2.yatv.com/noticias/?v="+video+"&s=15";
	}
	else{
		if(type=="n"){
			 document.location.href="http://www2.yatv.com/noticias/?f="+video+"&s=15";
		}
		else{
			if(type.indexOf("http")!=-1){
			 	window.open(type);
				document.location.href="http://www.yatv.com/video/yatv2_video_n_" + video +"_1.html"
			}
		}
	}
  }
}

/*Search engine*/

function doOnKeyPress(e,f){
  if (e.keyCode == 13 || e.keyCode == 10){
    doOnSubmit(f);
    return false;
  }else{
    return true;
  }	
}

function getCheckedValue(field){
  if(field.length){
    for(var i=0;i<field.length;i++){
      if(field[i].checked)return field[i].value;	
    }	
  }else{
      return field.value;
  }
}

function doOnSubmit(f){
  var context = (f.context? getCheckedValue(f.context) : "");	
  var query = f.q.value;
	
  if(query.length>1){	
    if ((context=="video")||(context=="image")){            
      self.location.href = "http://www2.yatv.com/jsp/JYatvSearchResults.jsp?s=15177&mode=text&results=5&format="+context+"&query="+query;
    }else if ((context=="cartelera")){        
      self.location.href = "http://cartelera.ya.com/Billboard/$M=filmquery$O=1$FQ="+query;
    }else if ((context=="web-news")){ 
      self.location.href = "http://buscador.noticias.ya.com/Search?M=newsresults&Q=" + query;
    }else if((context=="C")){
      self.location.href = "http://www.finanzas.com/Buscador.asp?SE="+context+"&TE="+query;
    }else if((context=="empresas")){
    	//self.location.href = "http://www.finanzas.com/empresas/buscador.asp?cadena="+query;
    	f.action = "http://www.finanzas.com/empresas/buscador.asp";
    	f.cadena.value=escapeChars(query);
        f.submit();    
    }else{
      f.action = "http://buscar.ya.com/fast-cgi/tsc";
      f.submit();
    }
  }
}
var replaceChars=[["á","a"],["é","e"],["í","i"],["ó","o"],["ú","u"],["Á","A"],["É","E"],["Í","I"],["Ó","O"],["Ú","U"],["ñ","n"],["Ñ","N"]];
function escapeChars(s){
  var length = s.length;
  var output = '';
  for(var i=0;i<length;i++){
    output +=searchChar(s.charAt(i));    	
  }
  return output;
}

function searchChar(c){
  var length = replaceChars.length;
  for(var i=0;i<length;i++){
    if(replaceChars[i][0]==c){
      return replaceChars[i][1];
    } 		
  }
  return c;
}



/*End Search engine*/



