<!--

var win=null;

function NewWindow(mypage,myname,w,h,sc,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='+sc+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);
if(win.focus){win.focus();}}

function movein(html,cand){
document.getElementById(cand).innerHTML=html
}
function moveout(part,cand){
document.getElementById(cand).innerHTML=part
}

function lTrim(sStr)
{ 
     while (sStr.charAt(0) == " ")  
      sStr = sStr.substr(1, sStr.length - 1); 
     return sStr; 
} 

function rTrim(sStr)
{ 
     while (sStr.charAt(sStr.length - 1) == " ")  
      sStr = sStr.substr(0, sStr.length - 1); 
     return sStr; 
} 

function allTrim(sStr)
{ 
     return rTrim(lTrim(sStr)); 
} 

function Validar(form)
{

var pala = new RegExp("mierda|MIERDA|cojudo|COJUDO|carajo|CARAJO|cabron|CABRON|puta|PUTA|jode|JODE|IDIOTAS|idiotas|putos|PUTOS|huev|HUEV|CACA|cagarte|CAGARTE|VERGA|verga|cholis|CHOLIS|GAY|gay|chucha|CHUCHA|CHOLO|cholo|chupa|CHUPA", "gi"); 

if (coment1.nombre.value == "")
{ alert("Por favor ingrese su nombre completo"); coment1.nombre.focus(); return; }
else { 
		coment1.nombre.value = coment1.nombre.value.replace(pala,"...");
	if (coment1.nombre.value.length < 4)
	  {
	    alert("Escriba por lo menos 4 caracteres en el campo \"nombre\".");
		coment1.nombre.select();
	    coment1.nombre.focus();
	    return (false);
	  }

	var checkOK = "ABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚabcdefghijklmnñopqrstuvwxyzáéíóú ";
	var checkStr = coment1.nombre.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  	}
  	if (!allValid)
  	{
    alert("Escriba sólo letras en el campo \"nombre\".");
	coment1.nombre.select()
	coment1.nombre.focus(); 
    return;
	}		
	}

if (coment1.correo.value == "")
{ 
alert("Por favor ingrese su correo"); coment1.correo.focus(); return; 
}
else 
{ 
	// validar la cuenta de correo usando una expresión regular (RegExp)
	coment1.correo.value=allTrim(coment1.correo.value);
	coment1.correo.value = coment1.correo.value.replace(pala," ... ");	
    if(coment1.correo.value.search(/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/ig))
	{
		alert("Por favor ingrese un correo VÁLIDO"); 
		coment1.correo.select();
		coment1.correo.focus(); 
		return;
    }
}

	
if (coment1.comentario.value == "")
{ alert("Por favor ingrese su comentario"); coment1.comentario.focus();return; }
else { 
	if (coment1.comentario.value.search(pala)){ coment1.comentario.value = coment1.comentario.value.replace(pala,"...");}
	}
NewWindow('','coment','500','400','yes','center');
coment1.titulo.value=document.getElementById("titulo").innerHTML;
coment1.submit();
}

function caracter( formulario ) {
   var maxLongitud = 500;
   var libres = 500;
   if ( formulario.comentario.value.length > maxLongitud ) {
      formulario.comentario.value = formulario.comentario.value.substring(0,maxLongitud);
      libres = 0;
      alert("¡Ha superado el límite!\nUsted dispone de\n" + maxLongitud + " caracteres");
   } else {
      libres = maxLongitud - formulario.comentario.value.length;
   }
   formulario.numero.value = libres;
}
//-->