/* * Project: SLKV * Commons Utils functions * Date: */ var _w=window, _d=document, _l=_w.location, __mouseX=0,__mouseY=0, __winWidth=0,__winHeight=0, __vertScroll=0,__horiScroll=0; _d.gtn_=_d.getElementsByTagName; _d.gid_=_d.getElementById; _d.ce_=_d.createElement; var _CLS_="className"; var _UDF_="undefined"; var _IMGEXT_="gif"; var _IMGPATH_="_images/"; function BrowserChecking(){ var b=navigator.appName; if(b.indexOf('Netscape')!=-1)this.b="ns"; else if(b=="Opera"||(navigator.userAgent.indexOf("Opera")>0))this.b="opera"; else if(b=="Microsoft Internet Explorer")this.b="ie"; if(!b)alert('Unidentified browser.\nThis browser is not supported!'); this.version=navigator.appVersion; this.fv=parseFloat(this.version); this.v=parseInt(this.version); this.ns=(this.b=="ns"&&this.v>=4); this.ns4=(this.b=="ns"&&this.v==4); this.ns6=(this.b=="ns"&&this.v==5); this.ns7=(navigator.userAgent.indexOf('Netscape/7')>0); this.ie=(this.b=="ie"&&this.v>=4); this.ie4=(this.version.indexOf('MSIE 4')>0); this.ie5=(this.version.indexOf('MSIE 5')>0); this.ie55=(this.version.indexOf('MSIE 5.5')>0); this.ie6=(this.version.indexOf('MSIE 6.0')>0); this.ie7=(this.version.indexOf('MSIE 7.0')>0); if(this.ie){ this.iev=parseInt(this.version.substring(this.version.indexOf('MSIE ')+5)); this.ieFixed=(navigator.appMinorVersion.split(';').length>3)||(navigator.userAgent.indexOf('NT 5.1')>0); } this.opera=(this.b=="opera"); this.dom=(_d.ce_&&_d.appendChild&&_d.gtn_)?true:false; this.def=(this.ie||this.dom); // most used browsers, for faster if loops this.dyn=(this.dom||this.ie||this.ns4); var ua=navigator.userAgent.toLowerCase(); if(ua.indexOf("win")>-1)this.platform="win32"; else if(ua.indexOf("mac")>-1)this.platform="mac"; else this.platform="other"; } var is=new BrowserChecking(); function isObject(v){ return (typeof v=="object"); } function isString(v){ return (typeof v=="string"); } function __getParent(){ return _d._dEs[this.getAttribute("pID__")]; } function __firstObject(obj){ if(obj)for(var i in obj)if(typeof obj[i]=='object'&&obj[i])return obj[i]; return null; } var _tag=new Object(); _tag.tbl=function(w,h,b,cp,cs,cls,bg,s,id){ w=w!=0?' width="'+(w?w:'100%')+'"':''; h=h?' height="'+h+'"':''; b=' border="'+(b?b:'0')+'"'; cp=' cellpadding="'+(cp?cp:'0')+'"'; cs=' cellspacing="'+(cs?cs:'0')+'"'; cls=cls?' class="'+cls+'"':''; bg=bg?' background="'+bg+'"':''; s=s?' style="'+s+'"':''; id=id?' id="'+id+'"':''; return ''; } _tag.tbl_=function(){ return ''; } _tag.td=function(w,bg,cls,nw){ w=w?' width="'+w+'"':''; bg=bg?' background="'+bg+'"':''; cls=cls?' class="'+cls+'"':''; return ''; } _tag._td=function(){ return ''; } _tag.img=function(s,w,h){ if(!is.ie||(s.toLowerCase()).indexOf('.png')<0)return ''; else return '
'; } function getImage(src){ return _IMGPATH_ + src + "." + _IMGEXT_; } function getSpacer(){ return "spacer." + _IMGEXT_; } function attachEvent(e,evt,hdl){ if(e){ if(e.addEventListener)e.addEventListener(evt,hdl,false); else if(e.attachEvent)e.attachEvent("on"+evt,hdl); else e["on"+evt]=hdl; } } function detachEvent(e,evt,hdl){ if(e){ if(e.removeEventListener)e.removeEventListener(evt,hdl,false); else if(e.detachEvent)e.detachEvent("on"+evt,hdl); else e["on"+evt]=null; } } function getWinWidth(d,w){ var ww=0; if(!d)d=_d; if(!w)w=_w; if(d.body&&d.body.clientWidth)ww=d.body.clientWidth; else if(d.documentElement&&d.documentElement.clientWidth)ww=d.documentElement.clientWidth; else if(d.body&&d.body.offsetWidth)ww=d.body.offsetWidth; else if(w.innerWidth)ww=w.innerWidth; return ww; } function getWinHeight(d,w){ var wh=0; if(!d)d=_d; if(!w)w=_w; if(w.innerHeight) { wh=w.innerHeight; }else if(d.documentElement&&d.documentElement.clientHeight){ wh=d.documentElement.clientHeight; }else if(d.body&&d.body.clientHeight){ wh=d.body.clientHeight; } return wh; } function __unSelectable(e){ var i,t; if(is.ie){ e=_w.event; if(!e){ for(i=0;i<_w.frames.length;i++) if(_w.frames[i]&&_w.frames[i].event){ e=_w.frames[i].event; break; } } } if(!e)return false; t=is.ie?e.srcElement:e.target; if(t&&typeof t.form!=_UDF_&&t.tagName.toLowerCase()!='label')return true; else return false; } function __emptyFunc(evt){ return false; } function __removeEvents(el){ var i; for(i in el)if(el[i]&&typeof el[i]=="function")el[i]=null; if(el.childNodes)for(i in el.childNodes)__removeEvents(el.childNodes[i]); } function getClientPos(e){ if(!e)return null; if(isString(e))e=_d.gid_(e); else if(e.el&&e.type=="DynInteface")e=e.el; if(!e)return null; var l=e.offsetLeft,t=e.offsetTop,p=e.parentNode,_wd=e.offsetWidth?e.offsetWidth:e.clientWidth; while(p&&p.offsetLeft!=null&&p.offsetTop!=null&&p.tagName.toLowerCase()!="body"){ if(p.tagName.toLowerCase()!='tr'){ if (p.offsetLeft==24 && is.ns){l+=21;_wd+=3} else{ l+=p.offsetLeft; } t+=p.offsetTop; } if(is.ie&&p.style){ if(p.style.borderLeftStyle&&p.style.borderLeftStyle!='none'&&p.style.borderLeftWidth)l+=parseInt(p.style.borderLeftWidth); else if(p.style.borderStyle&&p.style.borderStyle!='none'&&p.style.borderWidth)l+=parseInt(p.style.borderWidth); if(p.style.borderTopStyle&&p.style.borderTopStyle!='none'&&p.style.borderTopWidth)t+=parseInt(p.style.borderTopWidth); else if(p.style.borderStyle&&p.style.borderStyle!='none'&&p.style.borderWidth)t+=parseInt(p.style.borderWidth); } p=p.offsetParent; } return {left:l,top:t,width:_wd,height:e.offsetHeight?e.offsetHeight:e.clientHeight}; } function trim(s){ if(!s||!s.length)return ''; var c=s.charCodeAt(0); while(s.length>0&&(c==32||c==9||c==13)){s=s.substring(1);if(s.length>0)c=s.charCodeAt(0);} if(s.length>0){ c=s.charCodeAt(s.length-1); while(s.length>0&&(c==32||c==9||c==13)){s=s.substring(0,s.length-1);if(s.length>0)c=s.charCodeAt(s.length-1,1);} } return s; } function isEmptyString(s){ return (trim(s).length==0); } function _TO(){}; var p=_TO.prototype; p._g=function(e,t){return e.getElementsByTagName(t);} p._n=function(e){return e.nextSibling;} p._p=function(e){return e.previousSibling;} p._f=function(e){return e.firstChild;} p._l=function(e){return e.lastChild;} p._pn=function(e){return e.parentNode;} p._a=function(p,c){p.appendChild(c);}; var _to=new _TO(); zOrder=1000;//To manage the zIndex of the layers __dCount=0;//Count of dynamic elements /** * @author Administrator */ function DynInteface(){ var a=DynInteface.arguments,r,c,t; if(!a||!a.length)return; this.type="DynInteface"; if(a.length==1&&isObject(a[0])&&a[0]){ r=a[0]; a[0]=r.parent; a[1]=r.tagName; if(r.ref){ a[2]=r.ref; a[2].id=r.id; }else a[2]=new Object({id:r.id}); } if(isString(a[0]))a[0]=(this._od?this._od:_d).gid_(a[0]); if(!a[0])a[0]=(this._od?this._od.body:_d.body); if(a[0].type&&a[0].type=="DynInteface"&&a[0].el)a[0]=a[0].el; if(!_d._dEs)_d._dEs=new Object(); __dCount++; if(a.length==1&&!r){ this.parent=a[0].parentNode; if(!this._od&&this.parent&&this.parent.ownerDocument)this._od=this.parent.ownerDocument; this.tag=a[0].tagName; this.id=a[0].getAttribute("id"); this.el=a[0]; this.css=this.el.style; }else if(a.length==3||r){ this.parent=a[0]; if(!this._od&&this.parent&&this.parent.ownerDocument)this._od=this.parent.ownerDocument; if(!a[2].id){if(a[2].ID)a[2].id=a[2].id;else a[2].id="__dynElement"+__dCount;} t=a[2].style; if(t){ if(t.position!="absolute"){ c=this.parent.innerHTML; if(a[2].clear||c==" "||c==" "||c.length<=1)this.parent.innerHTML=""; }else{ if(t.left==null&&t.top==null&&!a[2].holder){this.__center=true;} if(t.width!=null&&isString(t.width)&&t.width.indexOf("%")>=0){this.__aWidth=true;this.__w=parseInt(t.width)/100;} if(t.height!=null&&isString(t.height)&&t.height.indexOf("%")>=0){this.__aHeight=true;this.__h=parseInt(t.height)/100;} if(this.parent.tagName=="TD"){ if(t.left!=null)t.left=parseInt(t.left)+this.parent.offsetLeft; if(t.top!=null)t.top=parseInt(t.top)+this.parent.offsetTop; if(is.ns){ if(t.width&&isString(t.width)&&t.width.indexOf("%")>=0)t.width=parseInt(parseInt(t.width)*this.parent.offsetWidth/100)+"px"; if(t.height&&isString(t.height)&&t.height.indexOf("%")>=0)t.height=parseInt(parseInt(t.height)*this.parent.offsetHeight/100)+"px"; } } } } if(a[2].isDialogLayer)this.isDialogLayer=true; this.tag=a[1]; this.id=a[2].id; if(_d._dEs[this.id]){ this.el=_d._dEs[this.id].el; this.ifLayer=_d._dEs[this.id].ifLayer; this.css=_d._dEs[this.id].css; this.parent=_d._dEs[this.id].parent; }else this.__createNode(a[2]); }; _d._dEs[this.id]=this; if(this.tag)this.tag=this.tag.toLowerCase(); try{ if(this.el&&this.css){ if(this.getAbsolute()&&!this.css.zIndex)this.css.zIndex=zOrder++; if((this.__aWidth||this.__aHeight||this.__center)&&!this.isDialogLayer){ this.__resizeMe=new Function('return;'); attachEvent(_w,"resize",this.__resizeMe); if(this.__center)attachEvent(_w,"scroll",this.__resizeMe); } this.el.setAttribute("pID__",this.id); this.el.getParent=__getParent; if(this.__center)this.moveCenter(); } }catch(e){ alert(e.message + " : " + e.lineNumber); }; }; var p=DynInteface.prototype; //////////////////////////////////////////////////////////////////////////////////////////////////////// // destroy method: //To remove this object from memory, before set this object to null, //use this method to remove all html element in this //////////////////////////////////////////////////////////////////////////////////////////////////////// p.destroy=function(removeEvents){this._destroy(removeEvents);} p._destroy=function(removeEvents){ if(this.unloaded)return; // Un register the element from application element manager if(_d._dEs[this.id]){_d._dEs[this.id]=null;delete _d._dEs[this.id];} // Clear the timer if(this.__shw_tmr)clearTimeout(this.__shw_tmr); // Dettach event if raised if(this.__resizeMe)detachEvent(_w,"resize",this.__resizeMe); // Remove element if(this.el){ if(this.css){this.css=null;delete this.css;} if(this.parent){this.parent=null;delete this.parent;} if(is.ie){ if(removeEvents)__removeEvents(this.el); this.el.removeNode(true); }else this.el.parentNode.removeChild(this.el); this.el=null;delete this.el; } // remove/destroy all children for(var i in this){ if(this[i]&&this[i].destroy)this[i].destroy(); this[i]=null; } this.unloaded=true; } //////////////////////////////////////////////////////////////////////////////////////////////////////// // isCompleted method: Check ready status (all resources have to preload from the server!) //////////////////////////////////////////////////////////////////////////////////////////////////////// p.isCompleted=function(){ if(this.__ready)return true; var i,a=this.el.getElementsByTagName("img"); if(a&&a.length)for(i=0;i '); this.el=(this._od?this._od:_d).gid_(this.id); if(this.el)this.el.innerHTML=''; } if(!this.el)return; if(ref.style&&ref.style.position=="absolute"){ if(!ref.style.visibility)ref.style.visibility="hidden"; }else if(ref.style&&!ref.style.display)ref.style.display="none"; for(i in ref){ if(ref[i]!=null){ switch(i){ case "style": for(j in ref.style)if(ref.style[j]!=null) { try{ this.el.style[j]=ref.style[j]; }catch(e){ alert(e.message); } } break; case "events": for(j in ref.events)this.el["on"+j]=new Function(ref.events[j]); case "alpha": if(isString(ref[i])&&!ref[i].length)ref[i]=100; if(is.ie)this.el.style.filter='alpha(opacity='+ref[i]+')shadow()'; else this.el.style.MozOpacity=parseInt(ref[i])/100; break; case "className": this.el[_CLS_]=ref[i]; break; case "innerHTML": this.el.innerHTML=ref[i]; break; default: this.el.setAttribute(i,ref[i]); } } } this.parent.appendChild(this.el); this.css=this.el.style; } //////////////////////////////////////////////////////////////////////////////////////////////////////// // swap method: swap this element with other element //////////////////////////////////////////////////////////////////////////////////////////////////////// p.swapNode=function(node){ if(node){ if(isString(node))node=(this._od?this._od:_d).gid_(node); if(!node)return; if(node.tagName)node=new DynInteface(node); if(!node||!node.el)return; swapHTMLNode(this.el,node.el); } } p.moveTo=function(left,top,force){ //alert("call me: " + left + " : " + top); this._moveTo(left,top,force); } //////////////////////////////////////////////////////////////////////////////////////////////////////// // moveTo method: Move the element to new position (for absolute position style) //////////////////////////////////////////////////////////////////////////////////////////////////////// p._moveTo=function(left,top,force){ //alert(top); if(left!=null&&((this.el.offsetLeft!=left&&left>=0)||force))this.el.style.left=left+"px"; if(top!=null&&((this.el.offsetTop!=top&&top>=0)||force))this.el.style.top=top+"px"; if(this.ifLayer)this.ifLayer._moveTo(left,top); if(this._lys)this._lys._moveTo(left!=null?left+this._sw:null,top!=null?top+this._sw:null); } //////////////////////////////////////////////////////////////////////////////////////////////////////// // moveBy method: Move the element to new position (for absolute position style) //(dLeft,dTop,force) //////////////////////////////////////////////////////////////////////////////////////////////////////// p.moveBy=function(dl,dt,f){ var cl=parseInt(this.el.style.left),ct=parseInt(this.el.style.top); if(cl<=0)cl=this.el.offsetLeft; if(ct<0)ct=this.el.offsetTop; this._moveTo(cl+dl,ct+dt,f); } //////////////////////////////////////////////////////////////////////////////////////////////////////// // moveCenter method : Move the element center the parent object //////////////////////////////////////////////////////////////////////////////////////////////////////// p.moveCenter=function(){ alert("call move center"); return true; } //////////////////////////////////////////////////////////////////////////////////////////////////////// // setSize method: Set the element size //////////////////////////////////////////////////////////////////////////////////////////////////////// p.setSize=function(width,height){this._setSize(width,height);} //////////////////////////////////////////////////////////////////////////////////////////////////////// // setSize method: Set the element size //////////////////////////////////////////////////////////////////////////////////////////////////////// p._setSize=function(width,height){ if(width!=null&&parseInt(width)>0)this.css.width=width+"px"; if(height!=null&&parseInt(height)>0)this.css.height=height+"px"; if(this.ifLayer)this.ifLayer._setSize(width,height); if(this._lys)if(this._lys)this._lys._setSize(width,height); if(this.onresize)this.onresize(); } //////////////////////////////////////////////////////////////////////////////////////////////////////// // getWidth method: Get the width of the element //////////////////////////////////////////////////////////////////////////////////////////////////////// p.getWidth=function(){ var f,w=(this.el.clientWidth?this.el.clientWidth:this.el.offsetWidth); if(is.ns){ f=this.el.firstChild; if(f&&f.tagName.toLowerCase()=='table'&&f.offsetWidth>w)w=f.offsetWidth; } return w; } //////////////////////////////////////////////////////////////////////////////////////////////////////// // getHeight method: Get the height of the element //////////////////////////////////////////////////////////////////////////////////////////////////////// p.getHeight=function(){ var f,h=(this.el.clientHeight?this.el.clientHeight:this.el.offsetHeight); if(is.ns){ f=this.el.firstChild; if(f&&f.tagName.toLowerCase()=='table'&&f.offsetHeight>h)h=f.offsetHeight; } return h; } //////////////////////////////////////////////////////////////////////////////////////////////////////// // getClientLeft method: Get the client left of the element //////////////////////////////////////////////////////////////////////////////////////////////////////// p.getClientLeft=function(){ var l=this.el.offsetLeft,p=this.parent; while(p&&(p.offsetLeft!=null)){ if(p.tagName.toLowerCase()!="tr")l+=p.offsetLeft; p=p.parentNode; } return l; } //////////////////////////////////////////////////////////////////////////////////////////////////////// // getClientTop method: Get the client top of the element //////////////////////////////////////////////////////////////////////////////////////////////////////// p.getClientTop=function(){ var t=this.el.offsetTop,p=this.parent; while(p&&(p.offsetTop!=null)){ if(p.tagName.toLowerCase()!="tr")t+=p.offsetTop; p=p.parentNode; } return t; } //////////////////////////////////////////////////////////////////////////////////////////////////////// // show method, display the element //////////////////////////////////////////////////////////////////////////////////////////////////////// p.show=function(){ if(this.unloaded)return; /*if(!_DII_&&!this.isCompleted()){ if(this.__shw_tmr){clearTimeout(this.__shw_tmr);this.__shw_tmr=null;} this.__shw_tmr=setTimeout('if(_d._dEs["'+this.id+'"])_d._dEs["'+this.id+'"].show()',100); return; }*/ if(this.__shw_tmr){clearTimeout(this.__shw_tmr);this.__shw_tmr=null;} this._show(); } //////////////////////////////////////////////////////////////////////////////////////////////////////// // show method, display the element //////////////////////////////////////////////////////////////////////////////////////////////////////// p._show=function(){ //alert("_show"); if(!this.el)return; if(this.__center)this.moveCenter(); if(this.ifLayer){ //alert("move here"); this.ifLayer.moveTo(this.el.offsetLeft,this.el.offsetTop); this.ifLayer.show(); } if(this._lys){ //alert("move here again"); this._lys.moveTo(this.el.offsetLeft+this._sw,this.el.offsetTop+this._sw); this._lys.show(); } if(this.css){ if(this.getAbsolute()){ if(this.css.visibility!="visible")this.css.visibility="visible"; }else{ if(is.ns){ switch(this.tag){ case 'table': this.css.display='table'; break; case 'td': this.css.display='table-cell'; break; case 'tr': this.css.display='table-row'; break; default: if(this.css.display!="block")this.css.display="block"; } }else if(this.css.display!="block")this.css.display="block"; } } if(this.onshow)this.onshow(); } //////////////////////////////////////////////////////////////////////////////////////////////////////// // hide method, hide the element //////////////////////////////////////////////////////////////////////////////////////////////////////// p.hide=function(){this._hide();} //////////////////////////////////////////////////////////////////////////////////////////////////////// // hide method, hide the element //////////////////////////////////////////////////////////////////////////////////////////////////////// p._hide=function(){ if(this.unloaded)return; if(this.__shw_tmr)clearTimeout(this.__shw_tmr); try{ if(this.getAbsolute())this.css.visibility="hidden"; else this.css.display="none"; }catch(e){ //alert(e.message); }; if(this.ifLayer)this.ifLayer.hide(); if(this._lys)this._lys.hide(); if(this.onhide)this.onhide(); } //////////////////////////////////////////////////////////////////////////////////////////////////////// // hide method, hide the element //////////////////////////////////////////////////////////////////////////////////////////////////////// p.getVisible=function(){ return (this.css.display!='none'&&this.css.visibility!='hidden'); } //////////////////////////////////////////////////////////////////////////////////////////////////////// // check absolute // CHANGED: 08.14.2006: This function causes error: Permission denied in IE //////////////////////////////////////////////////////////////////////////////////////////////////////// p.getAbsolute=function(){ try{ return (this.css.position&&this.css.position.toLowerCase()=="absolute"); }catch(e){ //alert(e.message); }; return false; } //////////////////////////////////////////////////////////////////////////////////////////////////////// // setAlpha method: Set alpha for layer (used only for IE,NS compatible browser) //(value, applyTo) //////////////////////////////////////////////////////////////////////////////////////////////////////// p.setAlpha=function(v,a){ var e=a?(isString(a)?(this._od?this._od:_d).gid_(a):a):this.el; if(isString(v)&&!v.length)v=100; if(is.ie)e.style.filter="alpha(opacity="+v+")"; else if(is.ns)e.style.MozOpacity=parseInt(v)/100; } //////////////////////////////////////////////////////////////////////////////////////////////////////// // setHTML method: Set the content of the element //////////////////////////////////////////////////////////////////////////////////////////////////////// p.setHTML=function(h){this._setHTML(h);} //////////////////////////////////////////////////////////////////////////////////////////////////////// // _setHTML method: Set the content of the element //////////////////////////////////////////////////////////////////////////////////////////////////////// p._setHTML=function(h){ try{ this.el.innerHTML=h; }catch(e){} } //////////////////////////////////////////////////////////////////////////////////////////////////////// // setClass method: Change the class of the element //////////////////////////////////////////////////////////////////////////////////////////////////////// p.setClass=function(cls){ this.el[_CLS_]=cls; } //////////////////////////////////////////////////////////////////////////////////////////////////////// // getClipValues method : Get the clip value //////////////////////////////////////////////////////////////////////////////////////////////////////// p.getClipValues=function(){ if(this.css.clip!=null&&this.css.clip.length>0){ var i,v=this.css.clip.slice(5,-1).split(' '); for(i=0;i<4;i++)v[i]=parseInt(v[i]); return v; }else return false; } //////////////////////////////////////////////////////////////////////////////////////////////////////// // clipBy method : Set the clip range //////////////////////////////////////////////////////////////////////////////////////////////////////// p.clipBy=function(t,r,b,l){ var v=this.getClipValues(); if(!v)return; this.css.clip="rect("+Number(v[0]+t)+"px, "+Number(v[1]+r)+"px, "+Number(v[2]+b)+"px, "+Number(v[3]+l)+"px)"; if(this.ifLayer)this.ifLayer.clipBy(t,r,b,l); } //////////////////////////////////////////////////////////////////////////////////////////////////////// // clipTo method : Set the clip range //////////////////////////////////////////////////////////////////////////////////////////////////////// p.clipTo=function(t,r,b,l){ this.css.clip="rect("+t+"px, "+r+"px, "+b+"px, "+l+"px)"; if(this.ifLayer)this.ifLayer.clipTo(t,r,b,l); } //////////////////////////////////////////////////////////////////////////////////////////////////////// // createIFrame method : create the iframe layer (for IE from 5.5)over all form fields and special object //////////////////////////////////////////////////////////////////////////////////////////////////////// p.createIfLayer=function(){ if(this.getAbsolute()&&this.tag!="iframe"&&is.ie&&is.iev>5&&!this.ifLayer){ var mi=false;//mustIframe try{ mi=_w.frames.length||(this._od?this._od:_d).getElementsByTagName("iframe").length; if(!mi)mi=(this._od?this._od:_d).getElementsByTagName("textarea").length; if(!mi)mi=(this._od?this._od:_d).getElementsByTagName("select").length; if(!mi)mi=(this._od?this._od:_d).getElementsByTagName("object").length; if(!mi)mi=(this._od?this._od:_d).getElementsByTagName("applet").length; }catch(e){ //alert(e.message + " : " + e.lineNumber); } if(mi){ this.ifLayer=new DynInteface(this.parent,"iframe", {id:this.id+"_ily", frameBorder:'0', scrolling:'no', alpha:1, style:{position:'absolute', left:this.el.offsetLeft, top:this.el.offsetTop, width:this.getWidth(), height:this.getHeight(), visibility:this.css.visibility, zIndex:this.css.zIndex?this.css.zIndex-1:0}}); } } } //////////////////////////////////////////////////////////////////////////////////////////////////////// // setZIndex method : Set the order level //////////////////////////////////////////////////////////////////////////////////////////////////////// p.setZIndex=function(z){ if(this.getAbsolute()){ var o=false; if(!z){z=zOrder+1;o=true;} if(this.ifLayer)this.ifLayer.css.zIndex=z++; if(this._lys)this._lys.css.zIndex=z++; this.css.zIndex=z++; if(o)zOrder=z; return z; } } //////////////////////////////////////////////////////////////////////////////////////////////////////// // bringToTop method : move the layer to top most //(notIframe) //////////////////////////////////////////////////////////////////////////////////////////////////////// p.bringToTop=function(ni){ if(this.getAbsolute()&&!ni)this.createIfLayer(); this.setZIndex(); } //////////////////////////////////////////////////////////////////////////////////////////////////////// // setSelectable method : Disable/Enable selectable/dragable by user //(selectable,applyTo) //////////////////////////////////////////////////////////////////////////////////////////////////////// p.setSelectable=function(s,a){ try{ var el=a?a:this.el; if(s){ el.style.cursor=''; if(is.ie)el.onselectstart=el.ondragstart=null; else el.onmousedown=null; }else{ el.style.cursor="default"; if(is.ie)el.onselectstart=el.ondragstart=__unSelectable; else el.onmousedown=__unSelectable; } }catch(e){}; } //////////////////////////////////////////////////////////////////////////////////////////////////////// // attachEvent method: To attach an event handle to this element //INPUT: //eventName: The event name //eventHandle: The event handle function //////////////////////////////////////////////////////////////////////////////////////////////////////// p.attachEvent=function(evt,hdl){ attachEvent(this.el,evt,hdl); }; //////////////////////////////////////////////////////////////////////////////////////////////////////// // detachEvent method: To detach an event handle to this element //INPUT: //eventName: The event name //eventHandle: The event handle function //////////////////////////////////////////////////////////////////////////////////////////////////////// p.detachEvent=function(evt,hdl){ detachEvent(this.el,evt,hdl); }; /** * Project: SKLV * By: pKt */ var AUTO_HIDE=false; function PopupCom(uiID,id,parent,ref,ow){ var r=null; if((PopupCom.arguments.length!=1)||(typeof PopupCom.arguments[0]!="object"))r={uiID:uiID,id:id,parent:parent,ref:ref,ow:ow}; else r=PopupCom.arguments[0]; this.ref=r.ref; if(this.ref&&!this.ref.length)this.ref=[this.ref]; if(r.ow)this._ow=r.ow; else this._ow=_w; this._od=this._ow.document; this.DynInteface=DynInteface; this.DynInteface(r.parent,"div",{id:r.id,style:{position:"absolute",left:"0px",top:"0px"}}); this.el.className='pktPopupMenu'; this.type="PopupCom"; this.__create(); this.setSelectable(false); try{ this.el.oncontextmenu=__emptyFunc; }catch(e){}; attachEvent(this._ow,'unload',new Function('try{_d._dEs["'+this.id+'"].destroy();}catch(e){}')); }; var p=PopupCom.prototype=new DynInteface; ///////////////////////////////////////////////////////////////////////////////////////////// // Layer event handle ///////////////////////////////////////////////////////////////////////////////////////////// p.__layerHandlEvent=function(e){ var p=this.getParent(); if(p){ if(is.ie)e=p._ow.event; if(p.tmr){clearInterval(p.tmr);p.tmr=null;delete p.tmr;} //if(e.type=='mouseout')p.tmr=setInterval('if(!_d._dEs["'+p.id+'"].isChildVisible())_d._dEs["'+p.id+'"].hide();',500); if(e.type=='mouseout')p.tmr=setInterval('try{if(_d._dEs["'+p.id+'"]&&!_d._dEs["'+p.id+'"].isChildVisible())_d._dEs["'+p.id+'"].hide();}catch(e){}',HIDE_DELAY); } return false; } ///////////////////////////////////////////////////////////////////////////////////////////// // Layer event handle ///////////////////////////////////////////////////////////////////////////////////////////// p.__itemHandlEvent=function(e){ var p=_d._dEs[this.parentID],i,img,smn,cmd,td; if(!p)return; if(is.ie)e=p._ow.event; if(p.ref[this.index].caption=='-'||p.ref[this.index].status=='disabled')return; switch(e.type){ case 'mouseover': p.setHover(this); try{ if(this.getAttribute("subMenuID")&&!_d._dEs['__sub__'+this.getAttribute("subMenuID")].getVisible()){ if(p.tmCheck){clearTimeout(p.tmCheck);p.tmCheck=null;} p.tmCheck=setTimeout('try{_d._dEs["__sub__'+this.getAttribute("subMenuID")+'"].moveTo('+(p.getClientLeft()+this.offsetWidth-4)+','+(p.getClientTop()+ this.offsetTop+4)+');_d._dEs["__sub__'+this.getAttribute("subMenuID")+'"].show(true);}catch(e){};',200); } }catch(e){} break; case 'click': //hideTip(); // Raise onclick event if(p.onclick&&!p.onclick(p.ref[this.index]))break; if(this.getAttribute("subMenuID")){ //Call sub menu smn=_d._dEs['__sub__'+this.getAttribute("subMenuID")]; if(p.tmCheck){clearTimeout(p.tmCheck);p.tmCheck=null;} if(!smn||smn.getVisible()||smn.__shw_tmr)return false; smn.moveTo(p.getClientLeft()+p.offsetWidth-4,p.getClientTop()+this.offsetTop+4); smn.show(true); }else{ // Checking radio or check group if(p.ref[this.index].group){ // Option/Radio group // Clear current for(i=0;i0){ cls="haschild"; }*/ h+='
  • '+(this.ref[i].caption?this.ref[i].caption:'')+'
    0){ cls="none"; } h+=cls+'">
  • '; } h+=''; this.setHTML(h); // Create events handle for layer //try{ this.el.onmouseover=this.el.onmouseout=this.__layerHandlEvent; // Create events handle for each items for(i=0;iww-ow)this.moveTo(ww-nw-ow); if((this.el.offsetTop+nh)>wh-ow)this.moveTo(null,wh-nh-ow); this.setSize(nw,nh); this._show(); } ///////////////////////////////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////////////////////////////// p.moveTo=function(left,top,force){ var nw=this.el.firstChild.offsetWidth, nh=this.el.firstChild.offsetHeight, ww=this._od.body.scrollLeft+getWinWidth(this._od,this._ow), wh=this._od.body.scrollTop+getWinHeight(this._od,this._ow), ow=0; //alert(this._od.body.scrollTop + " : " + getWinHeight(this._od,this._ow)); //ow=uii.popMenu.SHADOW?uii.popMenu.SHADOW_WIDTH:0; //alert("left: " + left + " " + ((left+nw)>ww-ow ? ww-nw-ow : "0") + ", top: " + top + ", nw: " + nw + ", nh: " + nh + ", ww: " + ww + ", wh:" + wh); //alert(top); if((left+nw)>ww-ow)left=ww-nw-ow; if((top+nh)>wh-ow)top=wh-nh-ow; //alert("top later: " + top); this._moveTo(left,top,force); } ///////////////////////////////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////////////////////////////// p.onshow=function(){ return this._onshow(); } ///////////////////////////////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////////////////////////////// p._onshow=function(){ /* if(this.ref&&this.ref.length){ for(var i=0;idi chuy峄僴 focus cho Li tr锚n. if(next=lis[i].nextSibling){ for(i=0;idi chuy峄僴 focus cho Li tr锚n. if(prev=lis[i].previousSibling){ for(i=0;i0){ var html=new Array(),i,item,cls=''; html[html.length]='
    '; html[html.length]='
    '; html[html.length]='
      '; var item = root.firstChild; var i=0; while(item){ var cls=(i==0?"as-highlight":""); if(item){ if(i==0)window.top.aslink=item.url; var title=item.firstChild; var url=item.firstChild.nextSibling; html[html.length]='
    • '+title.firstChild.nodeValue+'
    • '; } item=item.nextSibling; i++; } html[html.length]='
    '; html[html.length]='
    '; html[html.length]='
    '; html[html.length]='
    '; window.insSearch.setHTML(html.join('')); window.insSearch.bringToTop(); window.insSearch.doPos(obj); window.insSearch.setHandleAction(); window.insSearch.show(); window.insSearch.hasShow=true; window.insSearch.searching=false; } } } } }; /* Ham nay dung de dieu chinh lai vi tri cua search tooltip va vi tri cua shadow. * Dong thoi chinh lai width va heigh cua popup luon. * */ p.doPos=function(so){ if(typeof so=='string')so=document.getElementById(so); //1. move object to right below the text area var tmp=getClientPos(so),objLeft,objTop,ul; objLeft=tmp.left; objTop=((tmp.top > so.offsetTop) && (!fromSearch) ? so.offsetTop + 50 : tmp.top)+(is.ie?so.clientHeight+4:(so.clientHeight+4)); //move it :) this.moveTo(objLeft,objTop,true); //2. then we need to resize the width and height var asW=so.clientWidth;//advance search width //2.1 Change the width for Content div this.el.firstChild.firstChild.style.width=asW+'px'; //2.2 Change the width for shadow div this.el.firstChild.firstChild.nextSibling.style.width=asW+'px'; //2.3 Change the left and top for shadow. this.el.firstChild.firstChild.nextSibling.style.left=(is.ie?1:2)+'px'; this.el.firstChild.firstChild.nextSibling.style.top=(is.ie?1:2)+'px'; //2.4 set height if(ul=this.el.firstChild.firstChild.getElementsByTagName("ul")[0]){ this.el.firstChild.firstChild.style.height=ul.offsetHeight+'px'; this.el.firstChild.firstChild.nextSibling.style.height=ul.offsetHeight+'px'; } }; p.setHandleAction=function(){ var lis; if(this.el){ lis=this.el.getElementsByTagName('li'); if(lis && lis.length){ for(var i=0;i