var llxaf=new llxafPageScript() function llxafPageScript(){ var Main=this this.events=new llxEventManager() this.popUps=new llxPopUpManager() this.pos=new llxPos() //events function llxEventManager(){ var intv=0 var handlers=new Array() var data=new Array() var This=this function exec(){ for(n in handlers){ if(handlers[n].to>0)handlers[n].to+=-10; if (handlers[n].to<=0){handlers[n].func(handlers[n].ref)} } } this.setHandler=function(ref,timeOut,func){ if (intv==0)intv=setInterval(exec,1); var h=This.getHandler(ref); if (h==undefined){h=new handler();handlers.push(h)} h.func=func;h.ref=ref;h.to=timeOut; } this.removeHandler=function(ref){ for(n in handlers){if(handlers[n].ref==ref){handlers.splice(n,1)}} } this.getHandler=function(ref){for(n in handlers){if(handlers[n].ref==ref){return handlers[n]}}} function handler(){//handler obj this.func=null; this.ref=null; this.to=0; this.startValue=0; this.endValue=0; this.startTime=new Date(); this.duration=0} this.setData=function(ref,value){ var h=This.getData(ref) if (h==undefined){h=new hData();data.push(h)} h.ref=ref;h.value=value } this.removeData=function(ref){ for(n in data){if(data[n].ref==ref){data.splice(n,1)}} } this.getData=function(ref){for(n in data){if(data[n].ref==ref){return data[n].value}}} function hData(){//data obj this.ref=null; this.value=null} this.addDEHandler=function(ob,ev,fu){if (ob.attachEvent) {ob.attachEvent('on'+ev, fu); } else {ob.addEventListener(ev, fu, false);}} } //popups function llxPopUpManager(){ var This=this this.addPopUp=function(control,parent,offX,offY,effect){ control.style.position='absolute' control.style.display='block' control.style.visibility='visible' var mOver=undefined var mOut=undefined switch(effect) { case "slidedown": control.style.top=-control.offsetHeight+'px' mOver=function(){ Main.events.setHandler(control,0,function(s){Main.pos.setAbsPos(s.parentNode,Main.events.getData(s),offX,offY);var h=s.offsetTop;if(h<-10){s.style.top=(h+10)+'px'}else if(h<0){s.style.top=0+'px';Main.events.removeHandler(s)}}) } mOut=function(){ Main.events.setHandler(control,300,function(s){var h=s.offsetTop;if(h>-s.offsetHeight+10){s.style.top=(h-10)+'px'}else if(h>-s.offsetHeight){s.style.top=-s.offsetHeight+'px';Main.events.removeHandler(s)}}) } break; case "fade": control.style.display='none' mOver=function(){ Main.events.setHandler(control,0,function(s){Main.pos.setAbsPos(s,Main.events.getData(s),offX,offY);$(s).fadeIn(300)}) } mOut=function(){ Main.events.setHandler(control,300,function(s){$(s).fadeOut(300)}) } break; default: control.style.display='none' mOver=function(){ Main.events.setHandler(control,0,function(s){Main.pos.setAbsPos(s,Main.events.getData(s),offX,offY);s.style.display='block'}) } mOut=function(){ Main.events.setHandler(control,300,function(s){s.style.display='none'}) } } // var div=document.createElement("DIV") // div.style.position='absolute' // div.style.top='0px' // div.style.left='0px' // div.style.height=control.offsetHeight+'px' // div.style.width=control.offsetWidth+'px' // div.style.overflow='hidden' // div.appendChild(control) // Main.events.addDEHandler(window,'load',function(){document.body.appendChild(div);}) Main.events.setData(control,parent) Main.events.addDEHandler(parent,'mouseover',mOver) Main.events.addDEHandler(parent,'mouseout',mOut) Main.events.addDEHandler(control,'mouseover',mOver) Main.events.addDEHandler(control,'mouseout',mOut) } } //position function llxPos(){ var This=this this.bringToFront=function(o){var zi=10000;var tags=document.getElementsByTagName('*');var i=0;for(i=0;izi){zi=tags[i].style.zIndex+1}};o.style.zIndex=zi} //this.getOffsetLeft=function(o){var x=0;while(o.offsetParent){o=o.offsetParent;x+=o.offsetLeft;};return x} //this.getOffsetTop=function(o){var y=0;while(o.offsetParent){o=o.offsetParent;y+=o.offsetTop;};return y} this.setAbsPos=function(o0,o1,x,y){This.bringToFront(o0);o0.style.position='absolute';o0.style.top=$(o1).offset().top+y+'px';o0.style.left=$(o1).offset().left+x+'px'} } }