function validar(formulario)
{
cambiaSty(formulario.email,"");
cambiaSty(formulario.password,"");
cambiaSty(formulario.rpassword,"");
cambiaSty(formulario.name,"");
cambiaSty(formulario.nickname,"");
cambiaSty(formulario.year,"");
cambiaSty(formulario.acepto,"");
cambiaSty(formulario.city,"");
cambiaSty(formulario.vcode,"");
if (formulario.email.value.length <= 5)
{
cambiaSty(formulario.email,"errorInput");
formulario.email.select();
formulario.email.focus();
alert("Write your real email.");
return (false);
}
if (formulario.password.value.length < 6)
{
cambiaSty(formulario.password,"errorInput");
formulario.password.select();
formulario.password.focus();
alert("The password must contain at least six characters.");
return (false);
}
if (formulario.rpassword.value != formulario.password.value)
{
cambiaSty(formulario.rpassword,"errorInput");
cambiaSty(formulario.password,"errorInput");
formulario.password.select();
formulario.password.focus();
formulario.rpassword.focus();
alert("The password do not match with the confirmation password.");
return (false);
}
if (formulario.name.value.length <= 3)
{
cambiaSty(formulario.name,"errorInput");
formulario.name.select();
formulario.name.focus();
alert("The name is too short.");
return (false);
}
if (formulario.nickname.value.length < 2)
{
cambiaSty(formulario.nickname,"errorInput");
formulario.nickname.select();
formulario.nickname.focus();
alert("The nickname is too short.");
return (false);
}
if (formulario.year.value.length != 4)
{
cambiaSty(formulario.year,"errorInput");
formulario.year.select();
formulario.year.focus();
alert("The year format is valid. (example: 1975) ");
return (false);
}
var dt = new Date();
var y = dt.getYear();
if (y < 1000) y +=1900;
var min = y - 80;
var max = y - 12;
if (formulario.year.value <= min || formulario.year.value >= max)
{
cambiaSty(formulario.year,"errorInput");
formulario.year.select();
formulario.year.focus();
alert("The year is invalid.");
return (false);
}
if (formulario.city.value.length < 2)
{
cambiaSty(formulario.city,"errorInput");
formulario.city.select();
formulario.city.focus();
alert("The city is empty.");
return (false);
}
if (formulario.acepto.checked == false)
{
cambiaSty(formulario.acepto,"errorInput");
alert("You must agree the conditions..");
return (false);
}
if (formulario.vcode.value.length != 5)
{
cambiaSty(formulario.vcode,"errorInput");
formulario.vcode.select();
formulario.vcode.focus();
alert("The code of the image must have 5 numbers.");
return (false);
}
formulario.cancel.disabled = true;
formulario.reset.disabled = true;
return (true);
}
function css_style(css_choice)
{
var target = $("css_style");
if (!target) return false;
target.setAttribute("href", css_choice);
}
function showLoader(target)
{
if (!target) return false;
target.update('

Loading......
');
}
function sendpm(iduser)
{
alert('En Construccion');
}
function hideLoader(target)
{
if (!target) return false;
}
function showLoaderText(target)
{
if (!target) return false;
target.update('Loading...');
}
function falloAjax(target)
{
if (!target) return false;
target.update('Error...');
}
function falloAjax404(target)
{
if (!target) return false;
target.update('La página no existe...');
}
/***********************************************
* Desactivar Click Derecho en los formularios *
***********************************************/
function manejaEnter (evento) {
var keyCode = evento.keyCode ? evento.keyCode : evento.which ? evento.which : evento.charCode;
if (keyCode == 13) {
return false;
}
else
return true;
}
function onKey(evt)
{
return (true);
}
var pre_imagen;
function cargarimagenes(source){
pre_imagen = new Image();
pre_imagen.src = "http://www.shateros.com/images/Iconos/" + source;
}
function cambiaSty(objeto,clase)
{
objeto.className=clase;
}
function popup(url, ancho, alto, scrolls)
{
var H = (screen.height - alto) / 2;
var L = (screen.width - ancho) / 2;
var WindowOpen = window.open(url, 'popup', 'width='+ancho+',height='+alto+',scrollbars='+scrolls+',resizable=yes,left='+L+',top='+H+'')
try{
var obj = WindowOpen.name;
}
catch(e){
alert("GRR! A popup blocker may be preventing Shateros from opening the page.\nIf you have a popup blocker, try disabling it to open the window.");
}
}
function SetCookie(cookieName,cookieValue,nDays) {
var today = new Date();
var expire = new Date();
if (nDays==null || nDays==0) nDays=1;
expire.setTime(today.getTime() + 3600000*24*nDays);
document.cookie = cookieName+"="+escape(cookieValue)
+ ";expires="+expire.toGMTString()+"; path=/; domian=.shateros.com";
}
function acomodaMenus()
{
var target = $("MiCuenta");
var left1 = ( target ) ? findPosX(target) : 478;
var top = ( target ) ? findPosY(target) + 15 : 160;
target = $("menu1Container");
if( target )
{
target.style.left = left1+'px';
target.style.top = top+'px';
}
target = $("MisMensajes");
left1 = ( target ) ? findPosX(target) : 574;
target = $("menu2Container");
if( target )
{
target.style.left = left1+'px';
target.style.top = top+'px';
}
target = $("MisTokens");
left1 = ( target ) ? findPosX(target) : 634;
target = $("menu3Container");
if( target )
{
target.style.left = left1+'px';
target.style.top = top+'px';
}
}
function muestramenu(elemento)
{
acomodaMenus();
var target = $(elemento+'Container');
if( target ) target.show();
ypSlideOutMenu.showMenu(elemento)
}
function escondemenu(elemento)
{
ypSlideOutMenu.hideMenu(elemento);
}
function findPosX(obj)
{
var curleft = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
}
else if (obj.x)
curleft += obj.x;
return curleft;
}
function findPosY(obj)
{
var curtop = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curtop += obj.offsetTop
obj = obj.offsetParent;
}
}
else if (obj.y)
curtop += obj.y;
return curtop;
}
function checkLogin(destino)
{
if( !logged )
{
window.location.href = 'https://www.shateros.com/passport/login.php?to='+destino;
return false;
}
}
function revisaEmailAjax(strValue, response)
{
cambiaSty(document.signup.email,"");
url = location.protocol+'//www.shateros.com/includes/xml/checkEmail.php?email=' + strValue;
loadXMLDoc(url);
}
var req;
function loadXMLDoc(url)
{
if (window.XMLHttpRequest)
{
req = new XMLHttpRequest();
req.open("GET", url);
req.onreadystatechange = processReqChange;
req.send(null);
}
else if (window.ActiveXObject)
{
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req)
{
req.open("GET", url);
req.onreadystatechange = processReqChange;
req.send('');
}
}
}
function processReqChange()
{
if (req.readyState == 1)
{
cambiaSty(document.getElementById("emailAjax"),"muestra");
document.getElementById("emailAjax").style.color = '#009900';
document.getElementById("emailAjax").innerHTML = 'Checking email...';
}
else if (req.readyState == 4)
{
var respuesta = req.responseText;
if (req.status == 200)
{
if (respuesta != '')
{
cambiaSty(document.getElementById("emailAjax"),"muestra");
document.getElementById("emailAjax").style.color = 'red';
document.getElementById("emailAjax").innerHTML = respuesta;
cambiaSty(document.signup.email,"errorInput");
document.signup.email.select();
document.signup.email.focus();
}
else {
cambiaSty(document.getElementById("emailAjax"),"muestra");
cambiaSty(document.signup.email,"okInput");
document.getElementById("emailAjax").style.color = '#009900';
document.getElementById("emailAjax").innerHTML = 'Congratulations, your email is valid.';
}
}
}
}
function CheckPwd(strValue)
{
var re_numero = new RegExp("[0-9]");
var re_letras = new RegExp("[a-zA-Z]");
var re_especial = new RegExp("[@._]");
if(strValue.length >= 6)
{
if (re_numero.test(strValue) && !re_letras.test(strValue) && !re_especial.test(strValue) || !re_numero.test(strValue) && re_letras.test(strValue) && !re_especial.test(strValue))
{
document.getElementById("pBaja").style.background="#FF0000";
}
if (re_numero.test(strValue) && re_letras.test(strValue) && !re_especial.test(strValue))
{
document.getElementById("pBaja").style.background="#FF6600";
document.getElementById("pMedia").style.background="#FF6600";
}
if (re_numero.test(strValue) && !re_letras.test(strValue) && re_especial.test(strValue))
{
document.getElementById("pBaja").style.background="#FF6600";
document.getElementById("pMedia").style.background="#FF6600";
}
if (!re_numero.test(strValue) && re_letras.test(strValue) && re_especial.test(strValue))
{
document.getElementById("pBaja").style.background="#FF6600";
document.getElementById("pMedia").style.background="#FF6600";
}
if (re_numero.test(strValue) && re_letras.test(strValue) && re_especial.test(strValue))
{
document.getElementById("pBaja").style.background="#00CC00";
document.getElementById("pMedia").style.background="#00CC00";
document.getElementById("pAlta").style.background="#00CC00";
}
if (re_numero.test(strValue) && re_letras.test(strValue) && !re_especial.test(strValue))
{
document.getElementById("pAlta").style.background="#F1F1F1";
}
if (re_numero.test(strValue) && !re_letras.test(strValue) && !re_especial.test(strValue) || !re_numero.test(strValue) && re_letras.test(strValue) && !re_especial.test(strValue))
{
document.getElementById("pMedia").style.background="#F1F1F1";
}
}
else
{
document.getElementById("pBaja").style.background="#F1F1F1";
document.getElementById("pMedia").style.background="#F1F1F1";
document.getElementById("pAlta").style.background="#F1F1F1";
}
}