var _G = {currentId:0,getRandomId:function(){return this.currentId++;}};
                
function _(){
                if(arguments.length == 0) return null;
                var i = null;
                var element = null;
                var elements = new Array();
                for (i = 0; i < arguments.length; i++){
                               element = arguments[i];
                               if (typeof element == 'string'){
                                               element = _C(arguments[i]);
                                               if(element){
                                                               for (var j = 0; j < element.length; j++) elements.push(element[j]);}
                                               if(document.getElementById(arguments[i])) elements.push(document.getElementById(arguments[i]));
                                               element = document.getElementsByName(arguments[i]);       
                                               if(element){
                                                               for (var j = 0; j < element.length; j++){
                                                                              elements.push(element[j]);}}
                                               element = document.getElementsByTagName(arguments[i]);                
                                               if(element){
                                                               for (var j = 0; j < element.length; j++){
                                                                              elements.push(element[j]);}}}
                               else if (typeof element == 'object') elements.push(element);}
                for (var j = 0; j < elements.length; j++) elements[j] = _append(elements[j]);
                elements = _append(elements);            
                return elements;
}

function _C(searchClass,node,tag) {
                var classElements = new Array();
                if ( node == null ) node = document;
                if ( tag == null ) tag = '*';
                var els = node.getElementsByTagName(tag);
                var elsLen = els.length;
                var pattern = new RegExp('(^|\\\\s)'+searchClass+'(\\\\s|$)');
                var strClass = '';
                var j = 0;
                for (var i = 0; i < elsLen; i++) {
                               if(document.all) strClass = els[i].getAttribute('className');
                               else strClass = els[i].getAttribute('class');
                               if(pattern.test(strClass)) {
                                               classElements[j] = els[i];
                                               classElements[j].intKey = j;
                                               j++;}}
                return classElements;
}

function _append(elements){
                if(!elements) return;

                elements.param = new Object();

                elements._get = function(strAtt){
                               if(!strAtt) return;
                               else{
                                               if(!this.length) return this[strAtt];
                                               else{                                     
                                                               var result = new Array();
                                                               for (var i = 0; i < this.length; i++) result.push(this[i]._get(strAtt));}}
                               return result;};

                elements._set = function(strAtt,strValue){
                               if(!this.length){
                                               if(typeof(strValue)!='array'&&typeof(strValue)!='object') this[strAtt] = strValue;
                                               else this[strAtt] = strValue[this.intKey];}
                               else{                                     
                                               for(var i = 0; i < this.length; i++) this[i]._set(strAtt,strValue);}}

                elements._isHidden = function(){
                               if(this.length) return false;
                               else if(this.style.display == 'none') return true;
                               else return false;
                }

                elements._style = function(strStyle,strValue){
                               if(!this.length){
                                               if(!this.style) this.style = new Array();
                                                               this.style[strStyle] = strValue;}
                               else{
                                               for (var i = 0; i < this.length; i++) this[i]._style(strStyle,strValue);}
                               return this;};                                     

                elements._opac = function(intValue){
                               intValue = parseInt(intValue);
                               if(!this.length){
                                               if(intValue!=100){
                                                               if(document.all) this._style('filter',"alpha(opacity='"+intValue+"');");
                                                               else{
                                                                              this._style('MozOpacity',(intValue/100));
                                                                              this._style('opacity',(intValue/100));
                                                                              this._style('KhtmlOpacity',(intValue/100));}}
                                               else{
                                                               if(document.all) this._style('filter',"");
                                                               else{
                                                                              this._style('MozOpacity','100');
                                                                              this._style('opacity','100');
                                                                              this._style('KhtmlOpacity','100');}}}
                               else{
                                               for (var i = 0; i < this.length; i++) this[i]._opac(intValue);}
                               return this;};

                elements._function = function(strName,strCode){
                               if(!this.length) this[strName] = strCode;
                               else{      
                                               for (var i = 0; i < this.length; i++) this[i]._function(strName,strCode);}
                               return this;};
                               
                elements._toggle = function(){
                               if(!this.length){
                                               if(this.style.display == 'none') this.style.display = '';
                                               else this.style.display = 'none';}
                               else{      
                                               for (var i = 0; i < this.length; i++) this[i]._toggle();}
                               return this;};
                               
                elements._animOpac = function(arrayOpac,intTimer,strDisplay){
                               if(!strDisplay) strDisplay = false;
                               var intTimer = intTimer;
                               var arrayOpac = arrayOpac;
                               if(!arrayOpac || !intTimer) return;
                                               if(strDisplay=='block') this._style('display','block');
                                               for (var j = 0; j < arrayOpac.length; j++){
                                                               if(document.all){
                                                                              this.uniqueId = _G.getRandomId();
                                                                              _G[this.uniqueId] = new Array(this,arrayOpac[j]);
                                                                              setTimeout('_G["' + this.uniqueId + '"][0]["_opac"](_G["' + this.uniqueId + '"][1]);',intTimer*j);}
                                                               else window.setTimeout(function(thisObj,opac){ thisObj._opac(opac); },intTimer*j,this,arrayOpac[j]);}
                               if(strDisplay=='none'){
                                               if(document.all){
                                                                              this.uniqueId = _G.getRandomId();
                                                                              _G[this.uniqueId] = new Array(this);
                                                                              setTimeout('_G["' + this.uniqueId + '"][0]["_style"]("display","none");',intTimer*j);}
                                               else setTimeout(function(thisObj){ thisObj._style('display','none'); },(intTimer*(j+1)),this);}
                               return this;};

                elements._animHeight = function(intStep,intTimer,strMod){
                               var stepHeight = parseInt(this.openH/intStep);
                               var setHeight = null;
                               if(strMod=='open'){
                                               for (var j = 1; j <= intStep; j++){
                                                               if(j==intStep) setHeight = this.openH;
                                                               else setHeight = stepHeight*j;
                                                               if(document.all){
                                                                              this.uniqueId = _G.getRandomId();
                                                                              _G[this.uniqueId] = new Array(this,setHeight);
                                                                              setTimeout('_G["' + this.uniqueId + '"][0]["_style"]("height",_G["' + this.uniqueId + '"][1]+"px");',intTimer*j);}
                                                               else window.setTimeout(function(thisObj,intHeight){ thisObj._style("height",intHeight+'px'); },intTimer*j,this,setHeight);}}
                               else{
                                               var z = 0;
                                               for (var j = intStep; j > 0; j--){
                                                               z++;
                                                               setHeight = stepHeight*j;
                                                               if(document.all){
                                                                              this.uniqueId = _G.getRandomId();
                                                                              _G[this.uniqueId] = new Array(this,setHeight);
                                                                              setTimeout('_G["' + this.uniqueId + '"][0]["_style"]("height",_G["' + this.uniqueId + '"][1]+"px");',intTimer*z);}
                                                               else window.setTimeout(function(thisObj,intHeight){ thisObj._style("height",intHeight+'px');},intTimer*z,this,setHeight);}}};
                
                return elements;
}

function setTimer(){
                if(arguments.length == 0 || arguments.length == 1) return null;
                var fct = arguments[0];
                var timer = arguments[1];
                if(arguments.length == 2){
                               if(typeof(fct)=='string'){
                                               return setTimeout(function(){ eval(fct)},timer);}}
                else{
                               if(document.all){
                                               var intID = null;
                                               intID = _G.getRandomId();
                                               /**
                                               to complete
                                               **/
                               }
                               else{
                                               /**
                                               to complete
                                               **/
                               }
                               
                }
                
}

function _accordion(toggler,content,param){
                if(!param) param = new Object();
                if(!param.allHide) param.allHide = false;
                if(!param.timer) param.timer = 30;
                if(!param.closeAnim) param.closeAnim = new Array(100,90,80,70,60,50,40,30,20,10);
                if(!param.openAnim) param.openAnim = new Array(10,20,30,40,50,60,70,80,90,100);
                toggler = _(toggler);
                content = _(content);
                content._set('openH',content._get('offsetHeight'));
                content._style('position','relative');
                content._style('overflow','hidden');
                content._style('height','auto');
                if(param.allHide){
                               content._style('display','none');
                               content._opac(0);}
                toggler._function('onclick',function(){
                               var single = content[this.intKey];
                               if(!single._isHidden()){
                                               single._animOpac(param.closeAnim,param.timer,'none');
                                               single._animHeight(param.openAnim.length,param.timer,'hide');}
                               else{
                                               single._animOpac(param.openAnim,param.timer,'block');
                                               single._animHeight(param.openAnim.length,param.timer,'open');}
                });
                
}
