function GoInforchat() {window.location.href='http://www.inforchat.ya.com/index.html?d=' + new Date().getTime();}
function GoHispachat() {window.location.href='http://www.hispachat.ya.com/index.html?d=' + new Date().getTime();}
var searchEngineFocus = false;

function paint_pub468x60(){
	sz = "468x60";
	 st = "portada.ya.com";
	 pd = "e01home";
	 isnt = "dcopt=ist";
	 vartext = "tile=1";
	 std = "http://ad.es.doubleclick.net/";
	
	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="468" height="60" border="0"></a>'); }
	else {
	document.write ('<SCR'+'IPT language="JavaScript" SRC="'+std+'adj/'+st+'/'+pd+';'+isnt+';sz='+sz+';'+vartext+';ord='+randnum+'?"></SCR'+'IPT>'); }
}

function paint_pub215x200(){
	 sz = "200x200";
 	st = "portada.ya.com";
 	pd = "e01home";
 	vartext = "tile=2";
 	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="200" height="200" border="0"></a>'); }
	else {
		document.write ('<SCR'+'IPT language="JavaScript" SRC="'+std+'adj/'+st+'/'+pd+';sz='+sz+';'+vartext+';ord='+randnum+'?"></SCR'+'IPT>'); }
}

function paint_pub222x82(){
	now = new Date();
	random = now.getTime();
	document.write('<A HREF="http://oasis.ya.com/oasisc.php?s=321&w=222&h=82&cb=' + random + '">');
	document.write('<IMG SRC="http://oasis.ya.com/oasisi.php?s=321&w=222&h=82&cb=' + random + '"');
	document.write(' WIDTH=222 HEIGHT=82 BORDER=0></A>');
}

function paint_pub222x57_1(){
	now = new Date();
	random = now.getTime();
	document.write('<A HREF="http://oasis.ya.com/oasisc.php?s=322&w=222&h=61&cb=' + random + '">');
	document.write('<IMG SRC="http://oasis.ya.com/oasisi.php?s=322&w=222&h=61&cb=' + random + '"');
	document.write(' WIDTH=222 HEIGHT=61 BORDER=0></A>');
}

function paint_pub222x57_2(){
	now = new Date();
	random = now.getTime();
	document.write('<A HREF="http://oasis.ya.com/oasisc.php?s=323&w=222&h=61&cb=' + random + '">');
	document.write('<IMG SRC="http://oasis.ya.com/oasisi.php?s=323&w=222&h=61&cb=' + random + '"');
	document.write(' WIDTH=222 HEIGHT=61 BORDER=0></A>');
}

function paint_pub124x81(){
	document.write('<a href=http://ir.ya.com/app/redir?o=2&prefix=isp_ya_com_&tgt=430&pck=105&afiliado=portada><img src="http://www.ya.com/images/3/b/3ba28fc3131a36ai3.gif" width=124 height=81 border=0 hspace=0 alt="Tarifa Plana 24H"></a>');
}

function paint_pub95x80(){
	sz = "95x80";
	 st = "portada.ya.com";
	 pd = "e01home";
	 vartext = "tile=2";
	 std = "http://ad.es.doubleclick.net/";
	
	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="95" height="68" border="0"></a>'); }
	else {
	document.write ('<SCR'+'IPT language="JavaScript" SRC="'+std+'adj/'+st+'/'+pd+';sz='+sz+';'+vartext+';ord='+randnum+'?"></SCR'+'IPT>'); 
	}	
}	

/*Mixmail*/
function resetField() {
	var f = document.forms["fbody"];
	if (f.u.value == "Escribe tu mail @mixmail o @ya.com") {
		f.u.value = "";
	}
}

function completeMail() {
	var f = document.forms["fbody"];
	if (f.u.value.indexOf("@") == -1) {
		f.u.value = f.u.value + "@mixmail.com";
	}
}

function ValidEmail(email) {
    if (window.RegExp) {
    			 var re1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)");
      var re2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
    			 if (!re1.test(email) && re2.test(email)) return true;
       return false;
    } else {
    			 if(str.indexOf("@") >= 0) return true;
       return false;
    }
}
function passwordKeyPress(e) {
	if (window.event.keyCode == 13) {
		return sendForm();
	}
	return true;
}
function sendForm() {
	var f = document.fbody;
	if(f.u.value == ""){
		alert("El usuario no puede estar vacío");
		f.u.focus();
		return false;
	} else if (!ValidEmail(f.u.value)) {	
		alert("Dirección de correo incorrecta.\nAsegúrate de poner la dirección completa.");
		f.u.focus();
		return false;
	} else if(f.passwd.value == ""){
		alert("La contraseña no puede estar vacía");
		f.passwd.focus();
		return;
	} else {
	    f.u.value = f.u.value.toLowerCase();
		if (f.u.value.indexOf('@mixmail.com') > -1) {
		  f.action = "http://mixmail.ya.com/app/login";
		} else {
		  f.action = "http://webmail.ya.com/app/login";
		}
		f.submit();
	}
}
/*End Mixmail*/

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 inputKeyPress(e,f){
  if (e.keyCode == 13) doSubmit(f);
  return true;
}

function doSubmit(f) {
  var query    = f.q.value;
  f.item.value = query;
  for (i=0;i<f.context.length;i++) { if (f.context[i].checked) { context = f.context[i].value;  break; }  }
  if ((context=="video")||(context=="image")||(context=="mp3")) submitYaTV(context,query);
  else if ((context=="C")||(context=="weather")||(context=="bsc")) submitOthers(context, query);
  else submitYa(f,context,query);
}

function submitYaTV(format,query) {
  var action = "http://www2.yatv.com/jsp/JYatvSearchResults.jsp?s=15177&mode=text&results=5&format="+format+"&query="+query;
  if (query.length<1) action = "http://www.yatv.com";
  self.location.href = action;
}

function submitOthers(context,query) {
  var action = "";
  if (context=="C") {
     action = "http://www.finanzas.com/Buscador.asp?SE="+context+"&TE="+query;
     if (query.length<1) action = "http://www.finanzas.com/";
  } else if (context=="bsc") {
     action = "http://enciclopedia.ya.com/cons?mode="+context+"&query="+query;
     if (query.length<1) action = "http://enciclopedia.ya.com/";
  } else { // weather
     action = "http://buscador.ya.com/cgi-bin/searchweather?it="+query;
     if (query.length<1) action = "http://www.ya.com/tiempo/";
	 }
  self.location.href = action;
}

function submitYa(f,context,query) {
  var action = "http://buscador.ya.com";
  if (query.length<1)    {
    if (context == "fast-news") action = "http://noticias.ya.com";
    self.location.href = action;
  } else {
    f.action = "http://buscar.ya.com/fast-cgi/tsc";
    f.submit();
  }
}
/*End Search engine*/



