//
var SEP_AND = new String('|&|');
var SEP_IGUAL = new String('|=|');
var DIR_FIX = new String('../../');
function ltrim(str){
return str.replace(/^(\s+)/g, '');
}
function rtrim(str){
return str.replace(/(\s+)$/g, '');
}
function trim(str){
return ltrim(rtrim(str));
}
function $(i){
return document.getElementById(i);
}
var Navegador = function(){
this.esIE = false;// Internet Explorer
this.esIE6 = false;
this.esIE7 = false;
this.esIE8 = false;
this.esFf = false;// Mozilla
this.esOp = false;// Opera
this.esNs = false;// Netscape
if(window.navigator.userAgent.search(RegExp("MSIE","im"))!=-1){
this.esIE = true;
if(window.navigator.userAgent.search(RegExp("MSIE 8","im"))!=-1) this.esIE8 = true;
else if(window.navigator.userAgent.search(RegExp("MSIE 7","im"))!=-1) this.esIE7 = true;
else if(window.navigator.userAgent.search(RegExp("MSIE 6","im"))!=-1) this.esIE6 = true;
}
else if(window.navigator.userAgent.search(RegExp("Firefox","im"))!=-1) this.esFf = true;
else if(window.navigator.userAgent.search(RegExp("Opera","im"))!=-1) this.esOp = true;
else if(window.navigator.userAgent.search(RegExp("Safari","im"))!=-1) this.esSa = true;
else if(window.navigator.userAgent.search(RegExp("Netscape","im"))!=-1) this.esNs = true;
};
var Nav = new Navegador();
Function.prototype.closure = function(obj){
// Init object storage.
if (!window.__objs){
window.__objs = [];
window.__funs = [];
}
// For symmetry and clarity.
var fun = this;
// Make sure the object has an id and is stored in the object store.
var objId = obj.__objId;
if (!objId) __objs[objId = obj.__objId = __objs.length] = obj;
// Make sure the function has an id and is stored in the function store.
var funId = fun.__funId;
if (!funId) __funs[funId = fun.__funId = __funs.length] = fun;
// Init closure storage.
if (!obj.__closures) obj.__closures = [];
// See if we previously created a closure for this object/function pair.
var closure = obj.__closures[funId];
if (closure) return closure;
// Clear references to keep them out of the closure scope.
obj = null;
fun = null;
// Create the closure, store in cache and return result.
var o = __objs[objId].__closures[funId] = function (){
if(!!__funs[funId] && !!__objs[objId]) return __funs[funId].apply(__objs[objId], arguments);
else return false;
};
o.__funId = funId;
return o;
};
var EliminarClosures = function(o){
var i = 0;
if(o){
if(o.__objId){
for(i in o.__closures){
delete(window.__funs[i]);
delete(o.__closures[i]);
}
delete(window.__objs[o.__objId]);
/*delete(o.__closures);
delete(o.__objId);*/
o.__closures = null;
o.__objId = null;
}
}
i = null;
}
var LimpiarClosures = function(){
if(!!Nav && !Nav.esIE) window.addEventListener('unload', LimpiarClosures, false);
else window.detachEvent("onunload",LimpiarClosures);
if(window.__objs){
for(i in window.__objs) EliminarClosures(window.__objs[i]);
}
window.__objs = [];
window.__funs = [];
};
var Limpiar = function(){
if(!!Nav && !Nav.esIE) window.addEventListener('unload', LimpiarClosures, false);
else window.attachEvent("onunload", LimpiarClosures);
}();
document.LimpiarClosures = LimpiarClosures;
function AddEvent(o, e, f){
if(Nav.esIE) o.attachEvent('on'+e, f);
else o.addEventListener(e, f, ((Nav.esOp)? false : true));
};
function RemEvent(o, e, f){
if(Nav.esIE) o.detachEvent('on'+e, f);
else o.removeEventListener(e, f, ((Nav.esOp)? false : true));
};
function FireEvent(o, e){
var evt = null;
if(Nav.esIE) o.fireEvent('on'+e);
else{
if(e=='click' || e=='dblclick' || e=='mousedown' || e=='mousemove' || e=='mouseout' || e=='mouseover' || e=='mouseup'){
evt = document.createEvent("MouseEvents");
evt.initMouseEvent(e, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
}
else if(e=='keydown' || e == 'keypress' || e == 'keyup'){
evt = document.createEvent("KeyboardEvent");
evt.initKeyEvent(e, true, true, null, false, false, false, false, 9, 0);
}
else{
evt = document.createEvent("Event");
evt.initEvent(e, true, false);
}
o.dispatchEvent(evt);
}
}
function StopEvent(e){
if(Nav.esIE){
e.returnValue = false;
e.cancelBubble = true;
}
else{
e.preventDefault();
e.stopPropagation();
}
}
// JavaScript Document
Request = function(oListener, metodo){
this.pedido = new crearXHR();
this.reportar = true;
this.respuestaXML = null;
this.respuestaHTML = null;
this.archivo = null;
this.valores = null;
this.listener = oListener;
//
this.onError = null;
this.onRetry = null;
this.retrys = 0;
this.curRetry = 0;
if(!metodo) this.metodo = 'POST';
else this.metodo = metodo;
}
Request.prototype.pedir = function(a, v, m, r){
//inicializamos
if(!!a) this.archivo = a;
if(!!v) this.valores = v;
if(!!m) this.metodo = m;
if(!r) this.curRetry = 0;
//
this.respuestaXML = null;
this.respuestaHTML = null;
//
this.cancelar(this.pedido);
//
this.pedido.onreadystatechange = this.procesar.closure(this);
//
this.pedido.open(this.metodo, this.archivo, true);
//
if(this.valores){
this.valores = this.valores.puntualChars();
this.pedido.send(this.valores);
}
else this.pedido.send();
}
Request.prototype.procesar = function(){
var termino = false;
if(this.pedido && this.pedido.readyState == 4){
var stat = this.pedido.status;
if((stat >= 200 && stat < 300) || stat == 304 || stat == 1223){
if(this.pedido.responseXML) this.respuestaXML = this.pedido.responseXML.documentElement;
this.respuestaHTML = this.pedido.responseText;
this.cancelar();
if(this.listener && this.listener.onRequestLoad) this.listener.onRequestLoad();
else if(typeof(this.listener)=='function'){ this.listener(); }
}
else if(this.curRetry < this.retrys){
this.curRetry++;
this.pedir(false, false, false, true);
if(typeof(this.onRetry) == 'function'){ this.onRetry(); }
}
else{
if(this.reportar){
ERROR.reportar("Error en clase Request."+
"\nESTADO: "+this.pedido.status+" "+this.pedido.statusText+
"\nARCHIVO: "+this.archivo+
"\nMETODO: "+this.metodo);
}
if(this.onError && (typeof(this.onError) == 'function' || typeof(this.onError) == 'object')){ this.onError(); }
this.cancelar();
}
}
}
Request.prototype.cancelar = function(){
cancelarPedido(this.pedido);
}
//
String.prototype.puntualChars = function(){
var chrs = new Array({'chr':'€', 'ent':'€'}), i, str = this.toString();
for(i = 0; i < chrs.length; i++){
str = str.replace(chrs[i]['chr'], chrs[i]['ent']);
}
return str;
}
String.prototype.unPuntualChars = function(){
var chrs = new Array({'chr':'€', 'ent':'€'}), i, str = this.toString();
for(i = 0; i < chrs.length; i++){
str = str.replace(chrs[i]['ent'], chrs[i]['chr']);
}
return str;
}
/* FUNCION DE CREACION DE XMLHttpRequest */
crearXHR = function(){
var r = null
if (window.XMLHttpRequest) r = new XMLHttpRequest()
else if(window.ActiveXObject) {
var msp = new Array('Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP', 'Microsoft.XMLHTTP')
for(var i = 0; i < msp.length; i++){
try { r = new ActiveXObject(msp[i]) } catch (e){}
}
}
return r
}
/* FUNCION DE DETENCION DE XMLHttpRequest */
cancelarPedido = function(reqXHR){
if(reqXHR!=null){
reqXHR.onreadystatechange=new Function()//una funcion vacia...
reqXHR.abort()
}
}
//
ReportarError = function(f, m){
this.archivo = (!!f)? f:'xmlHttpRequest/reportarError.php';
this.metodo = (!!m)? m:'POST';
this.req = new Request();
this.req.reportar = false;
this.alerta = true;
this.reportar = function(msj){
var msg = "Ha ocurrido un error.\nLos administradores del sistema ya han sido notificados del mismo."+
"\nSi el error continua pongase en contacto con los mismos.";
alert(msj);
this.req.pedir(this.archivo, msj, this.metodo);
if(this.alerta){
if(LayError){
LayLoader.showed = Blocker.showed = 1;
LayLoader.hide();
Blocker.hide();
LayError.message = msg;
LayError.onAcept = function(){
LayError.hide();
Blocker.hide();
};
LayError.onCancel = function(){
LayLoader.hide();
Blocker.hide();
};
Blocker.show();
LayError.show();
}
else{ alert(msg); }
}
return false;
};
}
ERROR = new ReportarError();
//
fCookie = function(){ this.init(); }
var p = fCookie.prototype;
p.path = DIR_ROOT;
p.init = function(){ }
p.set = function(n, v){
var d = new Date();
d.setHours(d.getHours() + 1);
//d.setSeconds(d.getSeconds() + 3);
var t = d.toGMTString();
document.cookie = n + '=' + escape(v) + '; expires=' + t + '; path=' + DIR_ROOT + ';';
}
p.unset = function(n){
document.cookie = n + '=; expires=Fri, 21 Dec 1976 04:31:24 GMT; path=' + DIR_ROOT + ';';
}
p.get = function(n){
var iIni = 0, iEnd = 0, ret = '';
if (document.cookie.length > 0){
var iIni = document.cookie.indexOf(n + '=');
if (iIni != -1){
iIni = iIni + n.length + 1;
iEnd = document.cookie.indexOf(";", iIni);
if(iEnd == -1) iEnd = document.cookie.length;
ret = unescape(document.cookie.substring(iIni, iEnd));
}
}
return ret;
}
var Cookie = new fCookie();
//Javascript
function ZoomElement(){
//Config
var iZoomEleDelay = 4;//mlsgs
var iZoomEleFrames = 10;//px
var fZoomEleMove = strongEaseInOut;//function
//
var iZoomEleW = 0;
var iZoomEleH = 0;
var iZoomEleY = 0;
var iZoomEleX = 0;
var bZoomEleOn = false;
var bZoomEleAnim = false;
var eZoomEleFrom = null;
var eZoomEleTo = null;
var fZoomEleInEnd = null;
var fZoomEleOutEnd = null;
var fZoomEleAnim = null;
var iIniW, iChangeW, iIniH, iChangeH, iIniX, iChangeX, iIniY, iChangeY, iCurFrame, sMode;
var zoomElementInit = function(){
if(!window.innerWidth){//IE
iZoomEleW = document.documentElement.clientWidth;
iZoomEleH = document.documentElement.clientHeight;
iZoomEleY = document.documentElement.scrollTop;
iZoomEleX = document.documentElement.scrollLeft;
}
else{
iZoomEleW = window.innerWidth;
iZoomEleH = window.innerHeight;
iZoomEleY = window.pageYOffset;
iZoomEleX = window.pageXOffset;
}
}
this.zoomElement = function(eFrom, eTo, fOnInEnd, fOnOutEnd, fOnAmin, bNoStart){
eZoomEleFrom = eFrom;
eZoomEleTo = eTo;
fZoomEleInEnd = fOnInEnd;
fZoomEleOutEnd = fOnOutEnd;
fZoomEleAnim = fOnAmin;
zoomElementInit();
if(!bNoStart){ zoomElementIn(); }
}
var zoomElementIn = function(){
iIniW = eZoomEleFrom.offsetWidth;
iIniH = eZoomEleFrom.offsetHeight;
var iEndW = eZoomEleTo.offsetWidth;
var iEndH = eZoomEleTo.offsetHeight;
var oPos = getElementPos(eZoomEleFrom);
iIniX = oPos.x;
iIniY = oPos.y;
if(bZoomEleAnim != true){
eZoomEleTo.style.overflow = 'hidden';
eZoomEleTo.style.height = iIniH + 'px';
eZoomEleTo.style.width = iIniW + 'px';
eZoomEleTo.style.top = iIniY + 'px';
eZoomEleTo.style.left = iIniX + 'px';
setOpacity(0, eZoomEleTo);
eZoomEleTo.style.visibility = 'visible';
iChangeX = (((iZoomEleW / 2) - (iEndW / 2) - iIniX) + iZoomEleX);
iChangeY = (((iZoomEleH / 2) - (iEndH / 2) - iIniY) + iZoomEleY);
iChangeW = (iEndW - iIniW);
iChangeH = (iEndH - iIniH);
iCurFrame = 0;
sMode = 'in';
setTimeout(zoomElementAnim, iZoomEleDelay);
bZoomEleAnim = true;
oPos = null;
}
}
this.zoomElementOut = function(){
if(bZoomEleAnim != true){
eZoomEleTo.style.overflow = 'hidden';
iIniW = eZoomEleTo.offsetWidth;
eZoomEleTo.__width = iIniW;
iIniH = eZoomEleTo.offsetHeight;
var iEndW = eZoomEleFrom.offsetWidth;
var iEndH = eZoomEleFrom.offsetHeight;
iIniX = parseInt(eZoomEleTo.style.left);
iIniY = parseInt(eZoomEleTo.style.top);
var oPos = getElementPos(eZoomEleFrom);
iChangeX = oPos.x - iIniX;
iChangeY = oPos.y - iIniY;
iChangeW = eZoomEleFrom.offsetWidth - iIniW;
iChangeH = eZoomEleFrom.offsetHeight - iIniH;
iCurFrame = 0;
sMode = 'out';
setTimeout(zoomElementAnim, iZoomEleDelay);
bZoomEleAnim = true;
}
}
var zoomElementAnim = function(){
if(iCurFrame == (iZoomEleFrames + 1)){
bZoomEleAnim = false;
if(sMode == 'in'){ zoomElementInEnd(); }
else{ zoomElementOutEnd(); }
}
else{
var w = fZoomEleMove(iCurFrame, iIniW, iChangeW, iZoomEleFrames);
var h = fZoomEleMove(iCurFrame, iIniH, iChangeH, iZoomEleFrames);
var x = fZoomEleMove(iCurFrame, iIniX, iChangeX, iZoomEleFrames);
var y = fZoomEleMove(iCurFrame, iIniY, iChangeY, iZoomEleFrames);
var i = (sMode == 'in')? (100 / iZoomEleFrames) * iCurFrame : (100 / iZoomEleFrames) * (iZoomEleFrames - iCurFrame);
eZoomEleTo.style.left = x + 'px';
eZoomEleTo.style.top = y + 'px';
eZoomEleTo.style.width = w + 'px';
eZoomEleTo.style.height = h + 'px';
setOpacity(i, eZoomEleTo);
iCurFrame++;
setTimeout(zoomElementAnim, iZoomEleDelay);
}
if(fZoomEleAnim){ fZoomEleAnim(iCurFrame, sMode); }
}.closure(this);
var zoomElementInEnd = function(){
bZoomEleOn = true;
eZoomEleTo.style.height = 'auto';
if(fZoomEleInEnd){ fZoomEleInEnd(); }
}
var zoomElementOutEnd = function(){
bZoomEleOn = false;
eZoomEleTo.style.visibility = 'hidden';
eZoomEleTo.style.top = '-1000px';
eZoomEleTo.style.left = '0';
eZoomEleTo.style.overflow = 'auto';
eZoomEleTo.style.height = 'auto';
eZoomEleTo.style.width = eZoomEleTo.__width + 'px';
if(fZoomEleOutEnd){ fZoomEleOutEnd(); }
}
}
// JavaScript Document
var Exito = new function(){
//
this.show = function(msj){
$('msjExito').innerHTML = msj;
var l = $('capaExito');
l.style.top = (((HScreen() - l.offsetHeight) / 2) + YPos()) + 'px';
l.style.left = (((WScreen() - l.offsetWidth) / 2) + XPos()) + 'px';
l.style.visibility = 'visible';
try{ $('aceptarExito').focus(); }catch(e){ ; }
AddEvent(document, 'keypress', escape);
AddEvent($('aceptarExito'), 'click', accept);
AddEvent($('cerrarExito'), 'click', accept);
}
this.hide = function(){
RemEvent(document, 'keypress', escape);
RemEvent($('aceptarExito'), 'click', accept);
RemEvent($('cerrarExito'), 'click', accept);
var l = $('capaExito');
l.style.visibility = 'hidden';
l.style.top = '-1000px';
}
this.onAccept = null;
var accept = function(e){
if(!!e){ StopEvent(e); }
this.hide();
if(!!this.onAccept){ this.onAccept(); }
}.closure(this);
var escape = function(event){
if(event.keyCode == 27){ accept(); }
}.closure(this);
//
}
// JavaScript Document
var Error = new function(){
//
this.show = function(msj){
$('msjError').innerHTML = msj;
var l = $('capaError');
l.style.top = (((HScreen() - l.offsetHeight) / 2) + YPos()) + 'px';
l.style.left = (((WScreen() - l.offsetWidth) / 2) + XPos()) + 'px';
l.style.visibility = 'visible';
try{ $('aceptarError').focus(); }catch(e){ ; }
AddEvent(document, 'keypress', escape);
AddEvent($('aceptarError'), 'click', accept);
AddEvent($('cerrarError'), 'click', accept);
}
this.hide = function(){
RemEvent(document, 'keypress', escape);
RemEvent($('aceptarError'), 'click', accept);
RemEvent($('cerrarError'), 'click', accept);
var l = $('capaError');
l.style.visibility = 'hidden';
l.style.top = '-1000px';
}
this.onAccept = null;
var accept = function(e){
if(!!e){ StopEvent(e); }
this.hide();
if(!!this.onAccept){ this.onAccept(); }
}.closure(this);
var escape = function(event){
if(event.keyCode == 27){ accept(); }
}.closure(this);
//
}
// JavaScript Document
function layer(nombre, archivo){
var capa = $('lay' + nombre);
var fondo = $('bg' + nombre);
var error = $('error' + nombre);
var seccion = 0;
var arrVars = new Array();
var enviando = false;
var errores = 0;
var aCampos = new Array();
var aValidar = new Array();
var aLimpiar = new Array();
var req = new Request();
var animando = false;
var elemento = false;
var zoomEle = null;
this.onSuccess = null;
this.onError = null;
this.onClose = null;
//
req.listener = function(){
var d = req.respuestaXML;
block(false);
if(!d){ alert(req.respuestaHTML); }
else if(d.getAttribute('exito') == 'si'){
RemEvent(document, 'keypress', this.escape);
block(true);
if(!this.onSuccess){
capa.style.zIndex = 9;
Exito.onAccept = onAcceptSuccess;
Exito.show(d.firstChild.data);
}
else{ this.onSuccess(); }
}
else{
RemEvent(document, 'keypress', this.escape);
block(true);
if(!this.onError){
capa.style.zIndex = 9;
Error.onAccept = onAcceptError;
Error.show(d.firstChild.data);
}
else{ this.onError(); }
}
}.closure(this);
var onAcceptSuccess = function(){
capa.style.zIndex = 10;
clean();
block(false);
this.close();
}.closure(this);
var onAcceptError = function(){
AddEvent(document, 'keypress', this.escape);
block(false);
capa.style.zIndex = 10;
}.closure(this);
var center = function(){
//
if(!!fondo){
fondo.style.height = ((HBody() > HScreen())? HBody():HScreen()) + 'px';
fondo.style.width = ((WBody() > WScreen())? WScreen():WBody()) + 'px';
}
//
capa.style.top = (((HScreen() - capa.offsetHeight) / 2) + YPos()) + 'px';
capa.style.left = (((WScreen() - capa.offsetWidth) / 2) + XPos()) + 'px';
}.closure(this);
this.escape = function(event){ if(event.keyCode == 27){ this.close(); } }.closure(this);
this.enter = function(event){ if(event.keyCode == 13){ this.send(); } }.closure(this);
this.open = function(ele, vars, event){
if(!!event){ StopEvent(event); }
if(!!animando){ return false; }
animando = true;
//
elemento = ele;
arrVars = vars;
//seccion = sec;
animIn();
}
this.close = function(event){
if(!!event){ StopEvent(event); }
if(!!animando){ return false; }
animando = true;
RemEvent(window, 'scroll', center);
RemEvent(window, 'resize', center);
RemEvent(document, 'keypress', this.escape);
clearTimeout(animBgInt);
animBgFrame = 0;
animBgMode = 'out';
animBgInt = setTimeout(animBg, animBgRetardo);
}.closure(this);
this.addField = function(campo, nombre, expresion, clear){
var o = {'c':campo, 'n':nombre};
//
aCampos.push(o);
if(expresion){
campo.expresion = expresion;
campo.inputError = inputError;
campo.onblur = funcVal.closure(campo);
//
aValidar.push(aCampos.length - 1);
}
if(clear){ aLimpiar.push(aCampos.length - 1); }
}
this.setBackground = function(oEle){ fondo = oEle; }
var clean = function(){
var i = null;
//
for(i in aLimpiar){ aCampos[aLimpiar[i]]['c'].value = ''; }
for(i in aCampos){ inputError(aCampos[i]['c'], false); }
errores = 0;
showError();
}
this.send = function(event){
var v = '', i = null;
if(!!event){ StopEvent(event); }
//
if(enviando){ return false; }
else if(validate()){ return false; }
//
block(true);
//
//v += 'seccion' + SEP_IGUAL + seccion + SEP_AND;
if(arrVars){ v += arrVars['nombreIndiceEnvio'] + SEP_IGUAL + arrVars['indiceEnvio'] + SEP_AND; }
for(i in aCampos){ v += aCampos[i]['n'] + SEP_IGUAL + trim(aCampos[i]['c'].value) + SEP_AND; }
//
req.pedir(DIR_ROOT + 'requests/' + archivo + '.php', v);
}.closure(this);
var inputError = function(c, b){
errores += (b)? 1:0;
c.className = (b)? 'inputError':'';
}.closure(this);
var showError = function(){
error.style.display = (errores > 0)? 'block':'none';
}
var funcVal = function(){
this.value = trim(this.value);
if(this.value.search(this.expresion) == 0){ this.inputError(this, false); }
else{ this.inputError(this, true); }
}
var validate = function(){
var i = null;
//
errores = 0;
for(i in aValidar){ aCampos[aValidar[i]]['c'].onblur(); }
showError();
return (errores > 0);
}
var block = function(b){
var i = null;
//
enviando = b;
for(i in aCampos){ aCampos[i]['c'].disabled = b; }
}
//Aminacion
var animBgInt = 0;
var animBgRetardo = 1;
var animBgFrames = 5;
var animBgFrame = 0;
var animBgMode = '';
var animIn = function(){
center();
if(!!fondo){
setOpacity(0, fondo);
fondo.style.display = 'block';
}
iZoomEleDelay = 1;
if(!zoomEle){ zoomEle = new ZoomElement(); }
zoomEle.zoomElement(elemento, capa, animInEnd, animOutEnd, false);
}
var animOut = function(){
zoomEle.zoomElement(elemento, capa, animInEnd, animOutEnd, false, true);
zoomEle.zoomElementOut();
}
var animInEnd = function(){
center();
//
try{ aCampos[0]['c'].focus(); }catch(e){}
AddEvent(window, 'scroll', center);
AddEvent(window, 'resize', center);
AddEvent(document, 'keypress', this.escape);
clearTimeout(animBgInt);
animBgFrame = (!!fondo)? 0 : animBgFrames + 1;
animBgMode = 'in';
animBgInt = setTimeout(animBg, animBgRetardo);
}.closure(this);
var animOutEnd = function(){
if(!!fondo){ fondo.style.display = 'none'; }
if(!!this.onClose){ this.onClose(); }
}.closure(this);
var animBg = function(){
if(animBgFrame == animBgFrames + 1){
animando = false;
if(animBgMode == 'in'){ ; }
else{ animOut(); }
}
else{
var i = (animBgMode == 'in')? (60 / animBgFrames) * animBgFrame : (60 / animBgFrames) * (animBgFrames - animBgFrame);
if(!!fondo){ setOpacity(i, fondo); }
animBgFrame++;
animBgInt = setTimeout(animBg, animBgRetardo);
}
}.closure(this);
}
var DIR_ROOT = '/';
var ER_STR = /^([^ \t\n\r]([ \t\n\r]|[^ \t\n\r])*[^ \t\n\r])+$|^[^ \t\n\r]$/ig;
var ER_ALFA_NUM = /^[a-z0-9][a-z0-9]+[a-z0-9]$/ig;
var ER_EMAIL = /^[a-z0-9_\.\-]+@[a-z0-9_\-]+(\.[a-z0-9_\-]{2,20})*\.[a-z]{2,4}$/ig;
var HR = 'HR';
/////
var aSolActs = new Object;
function cambiarSolapa(id, pos, on, off, event){
if(!!aSolActs[id]){
aSolActs[id]['tit'].className = off;
aSolActs[id]['con'].style.display = 'none';
}
aSolActs[id] = new Object;
aSolActs[id]['tit'] = $('titSolDeCont'+id+'Pos'+pos);
aSolActs[id]['tit'].className = on;
aSolActs[id]['con'] = $('conSolDeCont'+id+'Pos'+pos);
aSolActs[id]['con'].style.display = 'block';
if(event) StopEvent(event);
}
//
function writeInElement(elem, tld, name, acc, inner){
elem['href'] = 'mailto:' + acc + '@' + name + '.' + tld;
if(inner){ elem['innerHTML'] = acc + '@' + name + '.' + tld; }
}
//
function getElementPos(ele){
var p = ele.style.position;
ele.style.position = 'relative';
var x = ele.offsetLeft;
var y = ele.offsetTop;
ele.style.position = p;
while(ele.tagName.toLowerCase() != 'body'){
ele = ele.parentNode;
if(ele.style.position == 'absolute'){
x += ele.offsetLeft;
y += ele.offsetTop;
}
}
return {'x':x, 'y':y};
}
function setOpacity(opa, ele){
if(!window.innerWidth){ ele.style.filter = 'alpha(opacity='+opa+')'; }
else{ ele.style.opacity = (opa / 100); }
}
function strongEaseInOut(t,b,c,d){
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
}
function WScreen(){ return (Nav.esIE)? document.documentElement.clientWidth : window.innerWidth; }
function HScreen(){ return (Nav.esIE)? document.documentElement.clientHeight : window.innerHeight; }
function YPos(){ return (Nav.esIE)? document.documentElement.scrollTop : window.pageYOffset; }
function XPos(){ return (Nav.esIE)? document.documentElement.scrollLeft : window.pageXOffset; }
function HBody(){ return document.documentElement.scrollHeight; }
function WBody(){ return document.documentElement.scrollWidth; }
var setBusqueda = function(url,e){
//Cookie.unset('clavePrivada');
Cookie.set('clavePrivada', $('clavePrivada').value);
document.location = url;
if(e)StopEvent(e);
}
var analizarEnterBuscar = function(e){
if(e.keyCode == 13){
FireEvent($('btnBuscar'),'click');
StopEvent(e);
}
}