/*====================================================================
Basement v.1.0.0 build 20071222 JS Auxiliary Library.
Copyright(C)2002-2007 Hapu Estudio Creativo(R) - http://hapu.net
LICENSE, ADDITIONS & FULL CREDITS ON SOURCE CODE
----------------------------------------------------------------------
COMPRESSED. DON'T EDIT/PUBLISH! Latest version at http://hapu.net/src
Feel free to use [at your OWN risk] so long as you keep this copyright
Feedback, bugs, patches to red@hapu.net - DONATIONS ARE WELCOMED! :)
----------------------------------------------------------------------
Includes:
- JS PHP Compatible module - mod_phpinjs_1.0.0.js.php
- PHP2HTML JS aux module - mod_php2html_1.0.0.aux.js.php
*********************************************************************/

// VARIABLES
//mod_php2html_1.0.0.aux.js.php
var defaultstatus = 'Page loaded';
var submitcount=0;
var filter_alp_chrs = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
var filter_num_chrs = '0123456789';


// FUNCTIONS & CLASSES

// mod_phpinjs_1.0.0.js.php
function str_replace(f,r,s,_i){if(typeof(s)=='object'){var rd=new Array();for(k in s){rd[k]=str_replace(f,r,s[k],_i);}return rd;}if(typeof(f)=='object'){for(k in f){if(typeof(r)=='object')s=str_replace(f[k],r[k],s,_i);else s=str_replace(f[k],r,s,_i);}return s;}if(typeof(f)!='string')f=f+'';if(typeof(r)=='undefined') r='';else if(typeof(r)!='string')r=r+'';if(typeof(s)!='string')s=s+'';var rd='';var s1=_i?s.toLowerCase():s;var f1=_i?f.toLowerCase():f;while((io=s1.indexOf(f1))!=-1){rd+=s.substring(0,io)+r;s=s.substring(io+f.length,s.length);s1=s1.substring(io+f.length,s1.length);}return rd+s;}
function str_ireplace(f,r,s){return str_replace(f,r,s,true);}
function addSlashes(s){return str_replace(new Array('\'','"','\n'),new Array('\\\'','\\"','\\n'),s);}
function stripSlashes(s){return str_replace(new Array('\\\'','\\"','\\n'),new Array('\'','"','\n'),s);}

//mod_php2html_1.0.0.aux.js.php
function winStatus(s){if(typeof(s)!='undefined')window.status=s;else if(typeof(defaultstatus)!='undefined')window.status=defaultstatus;return true;}
function firstChkForm(form,anxious,mandatory){if(typeof(mandatory)!='undefined'){a=mandatory.split('|');var i='';for(i=0;i<a.length;i=i+2){if(form[a[i]].value!='')continue;alert(a[i+1]);form[a[i]].focus();return false;}}if(submitcount==0){submitcount++;return true;}else{if(typeof(anxious)!='undefined')alert(anxious);return false;}}
function openWin(u,w,h,r,b,s){scrX=(screen.width-w)/2;scrY=(screen.height-h)/2;r=typeof(r)!='undefined'&&r==true?'yes':'no';b=typeof(b)!='undefined'&&b==true?'auto':'no';s=typeof(s)!='undefined'&&s==true?'yes':'no';window.open(u,'win','width='+w+',height='+h+',resizable='+r+',scrollbars='+b+',status='+s+',toolbar=no,location=no,directories=no,menubar=no,copyhistory=no,screenX='+scrX+',left='+scrX+',screenY='+scrY+',top='+scrY);}
function loadCache(i,u){if(document.images){eval(i+'=new Image()');eval(i+'.src="'+u+'"');}}
function confirmReload(msg){d=new Date();i=d.getMinutes();G=d.getHours();if(G<12){g=G==0?12:G;a='am';A='AM';}else{g=G-12;a='pm';A='PM';}f=new Array('%G','%g','%a','%A','%H','%h','%i');r=new Array(G,g,a,A,(G<10?'0':'')+G,(g<10?'0':'')+g,(i<10?'0':'')+i);if(confirm(str_replace(f,r,msg)))window.location.reload();}
function alertTimeOut(t,msg){window.setTimeout("window.focus();confirmReload('"+addSlashes(msg)+"');",t*60000);}
function unobfAddr(u,d,r) {var a='';var i='';for(i=0;i<u.length;i=i+2)a+=unescape('%'+u.substr(i,2));a+='&#64;';for(i=0;i<d.length;i=i+2)a+=unescape('%'+d.substr(i,2));if(r)return new Array('mailto:',a);document.location='mailto:'+a;return true;}
function filterInput(t,e,d,c){var k,ch,f,a='';if(window.event){k=window.event.keyCode;e=window.event;}else if(e)k=e.which;else return true;a=(t==0||t==2?filter_alp_chrs:'')+(t==1||t==2?filter_num_chrs:'')+(c?c:'');if(a=='')return true;f=e.srcElement?e.srcElement:e.target||e.currentTarget;if((k==null)||(k==0)||(k==8)||(k==9)||(k==13)||(k==27))return true;ch=String.fromCharCode(k);if((a.indexOf(ch)>-1))return true;else if(d&&(ch==d)&&f.value.indexOf(d)==-1)return true;else return false;}
function getElmById(aID){var element=null;if(document.getElementById)element=document.getElementById(aID);else if(document.layers)element=document.layers[aID];else if(document.all)element=document.all[aID];return element;}
function chgImg(id,src,st) {
    var e = getElmById(id);
    if (e==null) return false;
    e.src = src;
    return winStatus(st);
    return true;
}
