function empty(obj){return obj===undefined||obj==null||obj===false||obj==='';}
function alt(a,b,c){if(empty(c)){return empty(a)?b:a;}else{return empty(a)?c:b;}}
function $count(obj){var count=0;for(var i in obj){count++;}
return count;}
function redirect(url){url=url.substr(0,4)=='http'?url:BASE.web+url;window.location=url;}
function reload(){window.location=window.location.href+'';}
function moneda(n,s){n=n.toFixed(2)+'';var x=n.split('.');var rgx=/(\d+)(\d{3})/;while(rgx.test(x[0])){x[0]=x[0].replace(rgx,'$1'+' '+'$2');}
return(s?s+' ':'')+x[0]+'.'+x[1];}
function noSelects(mode){if(Browser.Engine.trident4){if(mode){$('body').addClass('noSelects');}else{$('body').removeClass('noSelects');}}}
var b64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(input){var output="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;input=utf8.encode(input);while(i<input.length){chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}
output=output+this._keyStr.charAt(enc1)+this._keyStr.charAt(enc2)+this._keyStr.charAt(enc3)+this._keyStr.charAt(enc4);}
return output;},decode:function(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^\w\d\+\/\=]/gi,"");while(i<input.length){enc1=this._keyStr.indexOf(input.charAt(i++));enc2=this._keyStr.indexOf(input.charAt(i++));enc3=this._keyStr.indexOf(input.charAt(i++));enc4=this._keyStr.indexOf(input.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+String.fromCharCode(chr2);}
if(enc4!=64){output=output+String.fromCharCode(chr3);}}
output=utf8.decode(output);return output;}};var utf8={encode:function(string){string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c);}else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);}else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}}
return utftext;},decode:function(utftext){var string="";var i=0;var c=c1=c2=0;while(i<utftext.length){c=utftext.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++;}else if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}
return string;}};function luhn_check(number){var number_length=number.length;var parity=number_length%2;var total=0;for(i=0;i<number_length;i++){var digit=number.charAt(i);if(i%2==parity){digit=digit*2;if(digit>9){digit=digit-9;}}
total=total+parseInt(digit);}
return total%10==0;}
var fileTypes={acrobat:['pdf'],application:['exe','bat'],compress:['zip','7z','rar','ace','cab','gz','gzip','tar','tar.z','tar.gz','tz','taz','tgz','jar','bz','bz2'],excel:['ods','xlsx','xls','csv'],image:['jpg','gif','bmp','png','tif','jpeg'],powerpoint:['odp','pptx','ppsx','ppt','pps'],text:['txt','inf','log'],word:['odt','doc','docx']};function fileExt(str){var ext=str.match(/\.(.+)$/);return ext?ext[1].toLowerCase():false;}
function fileType(str){var type='unknown';var ext=fileExt(str);if(ext){for(var _type in fileTypes){if(fileTypes[_type].contains(ext)){type=_type;break;}}}
return type;}
var Loading={initialize:function(){if(!this.initialized){this.initialized=true;this.overlay=new Element('div',{'id':'loadingOverlay','class':'hidden'}).setOpacity(0.7).inject(document.body);this.modal=new Element('div',{'id':'loadingModal','class':'hidden'}).inject(document.body);this.body=document.getElement('body');}},set:function(msg,klass,full){this.modal.className=klass||'wait';this.modal.innerHTML=full?(msg||_jlng.wait):'<p>'+(msg||_jlng.wait)+'</p>';return this;},show:function(msg,klass,full){if(!this.open){this.open=true;this.initialize();this.body.focus();if(Browser.Engine.trident4){noSelects(true);this.body.setStyle('overflow','hidden');this.overlay.setStyle('top',document.body.scrollTop+'px');this.modal.setStyle('top',(document.body.scrollTop+(document.body.offsetHeight/2))+'px');}
this.overlay.className='';this.body.setStyle('cursor','wait');this.set(msg,klass,full);}},hide:function(){if(this.open){this.open=false;this.overlay.className='hidden';this.modal.className='hidden';if(Browser.Engine.trident4){this.body.setStyle('overflow','auto');noSelects(false);}
this.body.setStyle('cursor','');}}};var Overlay={initialize:function(){if(!this.initialized){this.initialized=true;this.overlay=new Element('div',{'class':'overlay hidden'}).inject(document.body);}},show:function(ref,opacity,zindex){this.initialize();var overlay=(ref||$('body')).getCoordinates();var height=Browser.Engine.trident4?overlay.height+document.body.scrollTop:overlay.height;this.overlay.setStyles({'width':overlay.width+'px','height':height+'px','left':overlay.left+'px','top':overlay.top+'px','opacity':opacity||0.5,'z-index':zindex||21});this.overlay.removeClass('hidden');},hide:function(){this.overlay.addClass('hidden');}};var onError=function(){alert('Error: '+this.status+'\nPor favor, comunique al administrador.\nGracias');Loading.hide();};var iRules={"text":{"msg":"No menos de 3 letras.","regx":"\/^.{3,128}$\/"},"email":{"msg":"Email incorrecto.","regx":"\/^([\\w\\d_\\.\\-])+\\@(([\\w\\d_\\-])+\\.)+([\\w\\d]{2,4})+$\/"},"password":{"msg":"Debe contener s\u00f3lo n\u00fameros y letras.","regx":"\/^[\\w\\d]{4,16}$\/"},"phone":{"msg":"Ejemplos: 425-2354 , 051(511) +01 254 25402","regx":"\/^[\\d()+\\- ]{7,24}$\/"},"number":{"msg":"Debe contener s\u00f3lo numeros.","regx":"\/^\\d+$\/"},"date":{"msg":"dd\/mm\/aaaa (ejemplo: 16\/02\/1981)","regx":"\/^[\\d]{2}\\\/[\\d]{2}\\\/[\\d]{4}$\/"},"hour":{"msg":"S\u00f3lo intervalos de 10 minutos.<br \/><b>Ejemplos<\/b>: 16:20, 00:40, 8:50, 13:00","regx":"\/^([0-9]|[0-1][0-9]|2[0-3]):[0-5]0$\/"},"bool":{"msg":"Debe elegir una de las opciones.","regx":"\/^0|1$\/"},"color":{"msg":"Debe elegir un color.","regx":"\/^#([\\w\\d]{3}|[\\w\\d]{6})|([\\d]{1,3},[\\d]{1,3},[\\d]{1,3})$\/"},"image":{"msg":"Debe elegir archivos de tipo imagen.","regx":"\/\\.(jpg|jpeg|gif|png)$\/i"},"jpg":{"msg":"Debe elegir una imagen tipo JPG.","regx":"\/\\.jpg$\/i"},"select":{"msg":"Debe seleccionar una opci\u00f3n.","regx":"\/^.+$\/"},"price":{"msg":"Valores de precio (10, 10.00, 10.25)","regx":"\/^[\\d]{1,5}(\\.[\\d]{1,2})?$\/"},"decimal":{"msg":"Ejemplos: 10, 10.5, 10.05 ","regx":"\/^[\\d]{1,}(\\.[\\d]{1,2})?$\/"},"dni":{"msg":"DNI incorrecto","regx":"\/^[\\d]{8}$\/"},"ruc":{"msg":"RUC incorrecto","regx":"\/^[\\d]{11}$\/"},"zipcode":{"msg":"C\u00f3digo postal incorrecto","regx":"\/^[\\d]{5}(-[\\d]{4})?$\/"},"ccard":{"msg":"N\u00famero de tarjeta incorrecto","regx":"\/^[\\d]{14,19}$\/"},"cvv":{"msg":"C\u00f3digo de tarjeta incorrecto","regx":"\/^[\\d]{3,4}$\/"}};for(var i in iRules){var rgxmtch=iRules[i].regx.match(/^\/(.+)\/([^\/]+)?$/);if(rgxmtch[2]){iRules[i].regx=new RegExp(rgxmtch[1],rgxmtch[2]);}else{iRules[i].regx=new RegExp(rgxmtch[1]);}}
delete(rgxmtch);var _jlng={"requerido":"Campo requerido.","wait":"espere por favor..."};
/*Date: Wed, 08 Sep 2010 20:18:15 GMT */