/*______________________________________________________________________
|        ______   |
|      /      /   |
|     /    O /    |      ___________________________________________
|    /    / /     |
|   /    / /  /|  |       U I Z E     J A V A S C R I P T     A P I
|  /____/ /__/_|  |      ___________________________________________
|            |__  |
|_________________|
|
|           TITLE : Uize.Element Package
|         VERSION : 1.0
|            TYPE : Package Definition
|          AUTHOR : Chris van Rensburg (http://www.tomkidding.com)
|       COPYRIGHT : (c)2004-2005 Chris van Rensburg
|     DESCRIPTION : Implements a suite of methods to facilitate maipulation of HTML elements
|_______________________________________________________________________*/
(function(){if(typeof Uize=='undefined')Uize={};var _a=Uize.Element={},_b='undefined',_c=document,_d='string',_e=true,_f=false,_g=null,_h=navigator,_i=_h.userAgent.toLowerCase(),_j=_i.indexOf('gecko')!= -1,_k='hidden';function _l(_m){
return typeof _m=='object'&&((typeof _m.tagName==_d&&typeof _m.nodeType=='number')||_m.self===_m);}function _n(_m){return _l(_m)?_m:(typeof _c.getElementById!=_b?_c.getElementById(_m):_g);}var _o=_g;function _p(_q){if(_o==_g){_o=[];if(document.body.innerHTML.match(/Uize_Element_id/i)!=_g){var _r=(typeof document.all!=_b&&document.all.length>0)?document.all:document.getElementsByTagName('*');for(var _s=0;_s<_r.length;_s++){var _m=_r[_s],_t=_u(_m,'Uize_Element_id');if(_t!=_g){if(typeof _o[_t]==_b){_o[_t]=[_m];}else{_o[_t][_o[_t].length]=_m;}}}}}var _m=(_o!=_g&&typeof _o[_q]!=_b)?_o[_q]:_g;if(_m==_g)_m=_c.getElementsByName(_q);if(_m.length==1){_m=_m[0];}else if(_m.length==0){_m=_n(_q);}return _m;}function _u(_m,_v){return(typeof _m[_v]!=_b)?_m[_v]:((typeof _m.attributes!=_b&&_m.attributes!=_g&&typeof _m.attributes.getNamedItem!=_b&&_m.attributes.getNamedItem(_v)!=_g)?_m.attributes.getNamedItem(_v).value:((typeof _w[_v]!=_b)?_w[_v]:_g));}function _x(_y){for(var _v in _y)_w[_v]=_y[_v];}function _z(_A,_B){
if(typeof _B!=_b&&_B!=_g){_C(_B,function(_m){_m.innerHTML=_A});}else{document.write(_A);}}function _D(_m,_A){if(typeof _m.insertAdjacentHTML!='undefined'){_m.insertAdjacentHTML('BeforeEnd',_A);}else{var _E=document.createElement('DIV');_E.innerHTML=_A;_F=_E.childNodes;for(var _G=0;_G<_F.length;_G++){_m.appendChild(_F[_G]);}}}function _C(_m,_H){if(_m!=_g){if(typeof _m==_d){_C(_p(_m),_H);}else if(_l(_m)){_H(_m);}else if(typeof _m=='object'){if(typeof _m.length=='number'){for(var _I=0;_I<_m.length;_I++)_C(_m[_I],_H);}else{for(var _J in _m)_C(_m[_J],_H);}}}}function _K(_m){var _L=[];_C(_m,function(_m){_L[_L.length]=_m});return _L;}function _M(_m){var _L={width:0,height:0};_m=_a.getById(_m);if(_m!=_g){_L.width=parseInt(_m.style.width);_L.height=parseInt(_m.style.height);if(isNaN(_L.width)||_m.offsetWidth>_L.width)_L.width=_m.offsetWidth;if(isNaN(_L.height)||_m.offsetHeight>_L.height)_L.height=_m.offsetHeight;}return _L;}function _N(_m){var _O='';if(typeof _m!=_b&&_m!=_g){if(typeof _m.innerText=='string'){
_O=_m.innerText.replace(/\r|\n|\r\n/g,'');}else if(_m.textContent=='string'){_O=_m.textContent;}else{if(_m.nodeType==3)_O=_m.data;if(typeof _m.childNodes!=_b&&_m.childNodes!=_g){var _F=_m.childNodes;for(var _G=0;_G<_F.length;_G++)_O+=_N(_F[_G]);}}}return _O;}function _P(_Q,_R){return'Uize_Element_'+_Q+'Handler'+((_R<0)?'__':'')+Math.abs(_R);}function _S(_m,_Q,_T,_U){if(typeof _U!=_d)_U='after';_C(_m,function(_m){if(typeof _m.Uize_Element_a==_b){_m.Uize_Element_a={};_m.Uize_Element_b={};}if(typeof _m.Uize_Element_a[_Q]==_b){_m.Uize_Element_a[_Q]=0;_m.Uize_Element_b[_Q]= -1;_m[_P(_Q,--_m.Uize_Element_a[_Q])]=(typeof _m[_Q]=='function')?_m[_Q]:function(){return _e};_m[_Q]=new Function('event','return (typeof Uize != \'undefined\' && Uize.Element) ? Uize.Element.execHandlers (this,event,\''+_Q+'\') : false');}if(_U=='before'){_m[_P(_Q,--_m.Uize_Element_a[_Q])]=_T;}else{_m[_P(_Q,++_m.Uize_Element_b[_Q])]=_T;}});}function _V(_m,_W){if(typeof _W!='boolean')_W=_e;
_C(_m,function(_m){_m.style.visibility=_W?'inherit':_k});}function _X(_m,_T){_C(_m,function(_m){_m.onclick=_T;_m.style.cursor=_j?'pointer':'hand';});}function _Y(_m,_W){if(typeof _W!='boolean')_W=_e;_C(_m,function(_m){var _Z=_m.style;_Z.position=_W?'static':'absolute';_Z.visibility=_W?'inherit':_k;});}function _0(_m,_1){var _2=_j?.999:1;_C(_m,function(_m){var _Z=_m.style;_Z.opacity=_Z['-moz-opacity']=_1*_2;_Z.filter='alpha(opacity='+Math.round(_1*100)+')';});}var _w={};_a.execHandlers=function(_3,_4,_Q){_3.Uize_Element_c=_e;var _5=_3.Uize_Element_a[_Q],_6=_3.Uize_Element_b[_Q];for(var _R=_6;_R>=_5;_R--){var _T=_3[_P(_Q,_R)],_7=(typeof _T==_d)?eval(_T):_T(_4,_3);_3.Uize_Element_c=_3.Uize_Element_c&&typeof _7=='boolean'&&_7;}return _3.Uize_Element_c;};_a.addEventHandler=_S;_a.appendHtml=_D;_a.asArray=_K;_a.doForAll=_C;_a.getAttributeValue=_u;_a.getById=_n;_a.getByNameOrId=_p;_a.getDimensions=_M;_a.getText=_N;_a.insertHtml=_z;_a.setAttributeDefaults=_x;_a.setOpacity=_0;_a.show=_V;_a.showInLayoutFlow=_Y;
_a.wireOnClick=_X;})();
