//  jwin Popup Library 1.15 - Please don't erase this copyright notice.
//  Copyright Jason Anderson 2001. All rights reserved.
//  http://www.jwinlib.com/
//  http://groups.yahoo.com/group/jwin

var SIMPLE = 1, CAPTION = 2, LEFT = 1, CENTER = 2, RIGHT = 3, ABOVE = 1, BELOW = 2, DELAY_OPEN = 1, DELAY_CLOSE = 2, JWIN_DEF_FONT = "Verdana,Arial,Helvetica", JWIN_OBJECT = 'jw'

function jwin_scr(){}
jc = jwin_scr.prototype
jc.m_X = jc.m_Y = jc.o_X = jc.o_Y = jc.o_W = jc.o_H = 0
jc.mouseout = false


function jwin(){}
jwin.version = '1.15 11/24/2001'         
jwin.ns4mouseout = false
jwin.popups = new Array
jwin.popupscount = 0
jwin.popupszindex = 1234
jwin.inmodalstate = jwin.modalclosed = false

var jwp = jwin.prototype
jwp.popup = new Object       
jwp.show = jwin_show
jwp.hide = jwin_hide
jwp.modalclosed = false
var jw = new jwin()

function jwin_show(d,p,t){
     if(jwin.inmodalstate) return
     if(jwin_playingevents(d)) return

     var x, y, l = 0, write = true, args = jwin_show.arguments, argArr = new Array, tp
     var al = args.length

     if(al > 1){
          if(typeof p == 'object'){
               if(!p.length && (typeof t == 'string' && al == 3)){  
                    tp = jwin_parsetable(t,p)
               }else{
                    if(al > 3 && !p.length && typeof args[2] == 'number'){ 
                         for(var j = 2; j < al; j++) 
                              argArr[l++] = args[j]
                         tp = jwin_parseIt(p,argArr)
                    }else if(p.length){  
                         for(j = 0; j < p.length; j++)
                              if(j%2==0)
                                   if(typeof p[j] == 'string') 
                                        p[j] = eval(p[j].toUpperCase())  
                         tp = jwin_parseIt(null,p)
                         if(al > 2 && typeof t == 'number'){  
                              for(var j = 2; j < al; j++) 
                                   argArr[l++] = args[j]
                              tp = jwin_parseIt(tp, argArr)
                         }else if(al > 2 && typeof t == 'string')
                              tp = jwin_parsetable(t,tp)
                    }else if(typeof t == 'object'){  
                         for(j = 0; j <t.length; j++)
                              if(j%2==0)
                                   if(typeof t[j] == 'string') t[j] = eval(t[j].toUpperCase())  
                         tp = jwin_parseIt(p,t)  
                         if(al > 3 && typeof args[3] == 'number'){  
                              for(var j=3; j<al; j++)
                                   argArr[l++] = args[j]
                              tp = jwin_parseIt(tp, argArr)            
                         }else if(al > 3 && typeof args[3] == 'string') 
                              tp = jwin_parsetable(args[3],tp)
                    }else
                         tp = jwin_parseIt(p, argArr)                                 
               }
          }else{
               if(typeof p == 'string' && al == 2){
                    tp = jwin_parsetable(p)
               }else{
                    if(al > 1) 
                         for(var j = 1; j < al; j++)
                              argArr[l++] = args[j]
                         tp = jwin_parseIt(null, argArr)
               }
          }

          this.popup = tp
          if(this.popup == false)
               this.popup = new cls_jwinpopup()  

          if(this.popup.Function)
               this.popup.text = jwin_callFunction(this.popup.Function)  
          if(this.popup.text == '' && this.popup.captiontext == '')
               write = false        

          this.popup.id = d 
          this.popup.jwError = jwin.modalclosed = false 
          jwin.popups[jwin.popupscount++] = this.popup
          jwin.popups[d] = this.popup
     
          this.window = eval(jwin.popups[d].targetframe) || window     
          jwin.popups[d].layref = jwin_getlyrbyid(d, this.window.document)

          if(jwin.popups[d].layref == null || jwin.popups[d].layref==false){
               jwin_errorhandler()
               return
          }

          var l = jwin.popups[d].layref

          if(jwin.popups[d].capturemouseevents){
               l.mouseOverAction = null
               l.mouseOutAction = null
     
               if(l.captureEvents)
                    l.captureEvents(Event.MOUSEDOWN|Event.MOUSEMOVE|Event.MOUSEUP|Event.MOUSEOVER|Event.MOUSEOUT)

               l.onmouseover = _div_onmouseover
               l.onmouseout = _div_onmouseout

               jwin_setmousevent(l,"MOUSEOVER",jwin_divonmouseover)
               jwin_setmousevent(l,"MOUSEOUT",jwin_divonmouseout)
          }

          jwin.popups[d].styref = jwin.popups[d].layref.style || jwin.popups[d].layref

          var jp = jwin.popups[d]
 
          if(document.styleSheets){
               x = parseInt(jwin_getlyrcssproperty("left",d))
               y = parseInt(jwin_getlyrcssproperty("top",d))
          }else{
               x = parseInt(jp.styref.left)
               y = parseInt(jp.styref.top)        
          }

          jwin_loadbgpic(jp.background,d) 

          if(jp.markername)
               if(!jwin_setmarker(d))
                    return
     
          this.x = jp.x = (x || x == 0) ? x : l.offsetLeft
          this.y = jp.y = (y || y == 0) ? y : l.offsetTop
     }

     var jp = jwin.popups[d]
     if(write)
          jwin_write(d)
     else
          jwin_setwh(d)

     if(jp.debug && typeof jwin_displayProperties != 'undefined'){  
          jwin_displayProperties(jp)
     }

     jwin_move(d)

     if(jp.modal) jwin.inmodalstate = true 
     
     if(jp.autozindex)
          jwin_setz(d,jwin.popupszindex++) 
     else 
          jwin_setz(d,'') 

     if(jp.visible)
          if(jp.delayinterval > 0 && jp.delayevent == DELAY_OPEN && jp.jwEvt_DelayOpenCloseID == 0)
               jp.jwEvt_DelayOpenCloseID = setTimeout('jwin_showme("' + d + '")', jp.delayinterval) 
          else
               jwin_showme(d) 

     if(jp.setstatus) 
          return true    

}


function jwin_write(l){
      var tp = jwin.popups[l]

      if(tp.captiontext || tp.closetext || tp.style == CAPTION)
           tp.code=tp.getCaption()            
      else if(tp.style==SIMPLE)
           tp.code=tp.getSimple() 
      jwin_writeme('',l)
}


function jwin_writeme(istr,l){
     var tp = jwin.popups[l]

     var ostr = istr || tp.code
     if(document.layers){
          tp.layref.document.open() 
          tp.layref.document.write(ostr) 
          tp.layref.document.close()          
     }else
          tp.layref.innerHTML = ostr      

     jwin_setwh(l)
}


function jwin_setwh(l){
     var tp = jwin.popups[l]

     if(tp.height == ''){
          if(!tp.height)
               tp.autoheight = true

          if(nav.opera){
               if(tp.autoheight)
                    tp.height = tp.styref.pixelHeight
          }else{
               if(tp.autoheight) 
                    tp.height =(tp.layref.clip) ? tp.layref.clip.height : tp.layref.offsetHeight
          }
          
     }

     if(tp.width == ''){   
          if(!tp.width)
               tp.autowidth = true

          if(nav.opera){
               if(tp.autowidth) 
                    tp.width = tp.styref.pixelWidth
          }else{
               if(tp.autowidth)
                    tp.width = (tp.layref.clip) ? tp.layref.clip.width : tp.layref.offsetWidth            
          }
    }

    if(tp.playingtextarray || tp.playingcaptionarray)
         tp.height = ''    
}


function isjwin(d){
     return !(typeof jwin.popups[d] == 'undefined')
}


function jwin_setmousevent(l,a,f){
     eval('switch(a){'+
          'case "MOUSEOVER": l.mouseOverAction = f; break;'+
          'case "MOUSEOUT":  l.mouseOutAction = f;  break;'+
          '}')
}


function _div_onmouseover(e){
     if(nav.ns4){
          if(e.target != this){
               routeEvent(e)
               return
          }
     }else if(nav.ie4up){
          if(window.event.srcElement == this && window.event.srcElement.tagName == "DIV")
               window.event.cancelBubble = true
          else if(window.event.srcElement == this)
               return
     }
     if(this.mouseOverAction)
          this.mouseOverAction(e, this.id)
}


function _div_onmouseout(e){
     if(nav.ns4){
          if(e.target != this){
               routeEvent(e)
               return
          }
     }else if(nav.ie4up){
          if(window.event.srcElement == this && window.event.srcElement.tagName == "DIV")
               window.event.cancelBubble = true
          else if(window.event.srcElement == this)
               return
     }
     if(this.mouseOutAction) 
          this.mouseOutAction(e, this.id)
}


function jwin_divonmouseover(e,o){
     if(!isjwin(o)) 
          return

     var jp = jwin.popups[o]

     if(nav.ns4 && !jwin.ns4mouseout){
          if(jp.jwEvt_DelayOpenCloseID > 0){
               clearTimeout(jp.jwEvt_DelayOpenCloseID)    
               jp.jwEvt_DelayOpenCloseID = setTimeout('jwin_hideme("'+o+'")', jp.delayinterval)               
          }
     }else
          jp.mouseover = true
     
     if(jp.styref.zIndex != jwin.popupszindex - 1){
          jwin.ns4mouseout = false
          jwin_setz(o, jwin.popupszindex++) 
     }else
          jwin.ns4mouseout = true
}


function jwin_divonmouseout(e,o){
    if(!isjwin(o))
         return
    jwin.popups[o].mouseover = false
}


function jwin_showme(l){
       jwin.popups[l].styref.visibility = "visible" 
       jwin.popups[l].isvisible = true
}


function jwin_hide(l){
     if(!isjwin(l))
          return
     if(jwin.inmodalstate && jwin.modalclosed)
          jwin.inmodalstate = jwin.modalclosed = jwin.popups[l].modal = false 
     else if(jwin.inmodalstate && jwin.modalclosed == false)
          return      
      
     var jp = jwin.popups[l]
     if (jp == null) return 

     if(jp.playingtextarray && jp.arrayclose)return
     if(jp.playingcaptionarray && jp.arrayclose)return

     jp.playingtextarray = jp.playingcaptionarray = false         
     jp._textarrlen = jp._captionarrlen = 0   
     jp.writetext=''

     if(!jp.stickaround || jp.delayinterval>0)
          if(jp.delayinterval > 0 && jp.delayevent == DELAY_CLOSE && jp.isvisible)
               jp.jwEvt_DelayOpenCloseID = setTimeout('jwin_hideme("' + l + '")', jp.delayinterval) 
          else 
               jwin_hideme(l)        
}


function jwin_hideme(l){ 
     if(!isjwin(l))
          return

     var jp = jwin.popups[l]
     if (jp == null) return
     if(jp.jwError)
          return

     if(jwin.ns4mouseout || !nav.ns4)
          if(jp.mouseover){
               jp.jwEvt_MouseOverID = setTimeout('jwin_hideme("'+l+'")', jp.delayinterval)
               return
          }
     
     jp.styref.visibility = "hidden"
     jp.isvisible = false
     jwin_clearevents(l)
     jp.targetframe.status = ''

     if(jp.autowidth){
          jp.autowidth = false
          jp.width = ''
     }  

     if(jp.autoheight){
          jp.autoheight = false
          jp.height = ''
     } 

     if(jp.delpopup)
          jwin_delpopup(l)
}

function jwin_delpopup(l) {
     var pops = new Array, k=0
     if(jwin.popupscount){
         for(var j = 0; j < jwin.popups.length; j++){
             if(jwin.popups[j].id == l){
                jwin.popups[l] = null
                continue
             }
             pops[k++] = jwin.popups[j]
             jwin.popups[j] = null
         }
         jwin.popups.length = 0

         for(j=0; j<pops.length; j++)
              jwin.popups[j] = pops[j]

         jwin.popupscount = jwin.popups.length
     }
}



function jwin_setz(l,z){
     z = z || jwin.popups[l].styref.zIndex
     jwin.popups[l].styref.zIndex = jwin.popups[l].z = z 
}


function jwin_move(l){
     l = l || jw.popup.id
     var jX = parseInt(jwin_scr.m_X), jY = parseInt(jwin_scr.m_Y), px = jwin_ns ? '':'px', jp = jwin.popups[l]

     jwin_setposition(jX,jY,l)

          if(nav.opera){
               jp.styref.pixelLeft = parseInt(jp.x)
               jp.styref.pixelTop =  parseInt(jp.y)
          }else{ 
               jp.styref.left = parseInt(jp.x) + px
               jp.styref.top = parseInt(jp.y) + px         
          }
     
}


function jwin_clearevents(l){
     if(isjwin(l)){
          var jp = jwin.popups[l]

          clearTimeout(jp.jwEvt_DelayOpenCloseID)    
          jp.jwEvt_DelayOpenCloseID = 0

          clearTimeout(jp.jwEvt_PlayArrayID)
          jp.jwEvt_PlayArrayID = 0
     }
}


function jwin_playingevents(l){
     if(jwin_isdelayeffect(l))return true
     if(jwin_isplayingtextarray(l))return true
     return false
}


function jwin_loadbgpic(p,l){
     var jp = jwin.popups[l]

     if(p == "")
          if(nav.ns4) jp.layref.background.src = "none"
          else jp.styref.backgroundImage = "none" 
     else
          if(nav.ns4) jp.layref.background.src = p 
          else jp.styref.backgroundImage = "url("+p+")"         
}


function jwin_getlyrcssproperty(p,l){
	if(jwin.popups[l].styref[p]) return jwin.popups[l].styref[p]
      else return jwin_getcssproperty("#" + l, p)
}


function jwin_getcssproperty(l,p){
     var s = document.styleSheets, r, j, u, c
     for(j = 0; j < s.length; j++){
          r = s[j].cssRules||s[j].rules
          for(u = 0; u < r.length; u++){
               if(r[u].selectorText == l && r[u].style[p]) c = r[u].style[p]
          }     
     }
     return c
}


function jwin_getlyrbyid(l, d){
     var r = "", j
     d = (d || document)
     if(d.getElementById) return d.getElementById(l)
     else if(d.all) return d.all[l]
     else if(d.layers && d.layers.length > 0){
          if(d.layers[l]) return d.layers[l]
          for(j = 0; j < d.layers.length; j++){
               r = jwin_getlyrbyid(l, d.layers[j].document)
               if(r) return r               
          }
     }
     return false
}


function jwin_getimgbyname(l, d){
     var r = null, j
     d = (d || document)
     if(d.images[l]) 
          return d.images[l]
     else if(d.layers && d.layers.length > 0)
          for(j = 0; j < d.layers.length; j++){
               r = jwin_getimgbyname(l, d.layers[j].document)
		  if(r && r.length > 0) return r
		  else if(r) return [r, d.layers[j]] 
          }
     
     return null
}


function jwin_setposition(toX,toY,l){   
     if(!isjwin(l)) return
     var cX=0, cY=0, jp = jwin.popups[l]
     var pW = parseInt(jp.width)
     var pH = parseInt(jp.height)
     jp.fixedx += ''
     jp.fixedy += ''

     nav.init()
     if(jp.showcenterscreen){
          cX = ((nav.width/2) - (pW/2)) + nav.scrollLeft 
          cY = ((nav.height/2)- (pH/2)) + nav.scrollTop
          jp.x = cX 
          jp.y = cY 
     }else{
          if(jp.fixedx != ''){
               jp.x = jp.fixedx 
          }else{
               var h = jp.halign, ox = parseInt(jp.offsetx)

               if(jp.halignauto)
                    if((toX + pW + ox) > ((nav.width)-ox)-10)
                         h = LEFT 
                    else
                         h = RIGHT                     
                              
               if(h==2 || h == 'center'){
		        jp.x = toX-(pW/2) 
               }else if(h==3||h =='right'){
                    jp.x = toX + ox
                    if((jp.x + pW) > (nav.scrollLeft + nav.width) ){
                         jp.x = nav.width + nav.scrollLeft - pW 
                         if(jp.x < 0) jp.x = 0 
                    }
               }else{
                    jp.x = parseInt(toX-ox-pW)
                    if(jp.x < nav.scrollLeft) jp.x = nav.scrollLeft
               }

               if(jp.snapx != ''){
                    jp.followmouse=true
                    var so = (eval(jp.snapx) == 0 ? 0 : jp.x % jp.snapx) 

                    if(h == 1 || h == 'left') 
                         jp.x = jp.x - (jp.snapx + so) 
                    else
                         jp.x = jp.x + (jp.snapx - so) 
                    
                    if(jp.x < 0) jp.x = 0 
               }
          }
  
          if(jp.fixedy != ''){
               jp.y = jp.fixedy 
          }else{
               var v = jp.valign
               if(jp.valignauto){
                    nav.height = (nav.height / 2) 

                    if((toY - nav.scrollTop)  > nav.height)
                         v = 1 // above
                    else
                         v = 2                     
               }
               var oy = parseInt(jp.offsety)
               if(pH > 0 && v == 1 || v == 'above'){
                    jp.y = toY - (pH + oy) 
                    if(jp.y < nav.scrollTop) jp.y = nav.scrollTop 
               }else
                    jp.y = toY + oy
                    
               if(jp.snapy != ''){
                    jp.followmouse=true
                    var so = (eval(jp.snapy) == 0 ? 0 : jp.y % jp.snapy)

                    if(pH > 0 && v == 1 || v == 'above') 
                         jp.y = jp.y - (jp.snapy + so) 
                    else
                         jp.y = jp.y + (jp.snapy - so) 
                    
                    if(jp.y < 0) jp.y = 0 
               }
         }
    }
    jp.setStat() 
}


function jwin_setmarker(l){
     var jp = jwin.popups[l], mn = jp.markername, mlyr = jwin_getlyrbyid(mn, jw.window.document)

     mlyr = mlyr || jwin_getimgbyname(mn, jw.window.document)

     if(mlyr==null ||mlyr==false){
          jwin_errorhandler()
          return false
     }

     if(document.layers){
	    if(typeof mlyr.length != 'undefined' && mlyr.length > 1){
	         jp.fixedx = mlyr[0].x + mlyr[1].pageX
	         jp.fixedy = mlyr[0].y + mlyr[1].pageY
          }else
		   if(mlyr.toString().indexOf('Image') != -1){
		        jp.fixedx = mlyr.x
		        jp.fixedy = mlyr.y
               }else{
                    jp.fixedx = mlyr.pageX
                    jp.fixedy = mlyr.pageY
	         }          
     }else{
          jp.fixedx = pageLocation(mlyr,'Left')
          jp.fixedy = pageLocation(mlyr,'Top')
     } 

     if(jp.markeroffset){
          mo = jp.markeroffset.split(',')
          if(mo[0]) jp.fixedx += parseInt(mo[0])
          if(mo[1]) jp.fixedy += parseInt(mo[1])
     }

     jp.fixedx += ''
     jp.fixedx += ''
     return true
}


function pageLocation(o, t){
   var x = 0
   while(o.offsetParent != null && o.offsetParent.tagName != "BODY"){
      x += o['offset' + t]
      o = o.offsetParent
   }
   x += o['offset' + t]
   return x
} 

function jwin_callFunction(f){
     var s = ''
     if(typeof f == 'function')
          return f()
     else if(typeof f == 'string'){
          if(/\(/.test(f) && /\)/.test(f))
               return eval(f)
          else return eval(f + '()')
     }else 
          return s
}   

function jwin_parseIt(p,args){
     var key, val
     if(!args) 
          return false

     if(!p)
          var p = new cls_jwinpopup()

     for(var i=0; i < args.length; i++){
          if(typeof args[i] == 'undefined'){
               i++
               continue
          }  
          key = propArr[args[i]].toLowerCase()  
          key = (key == 'function' ? 'Function' : key) 
          val = args[++i]

	    if(val == 'true' || val == 'false') 
               val = eval(val)  

          p[key] = val
          continue
     }
     return p
}


function jwin_parsetable(t,p){
     var start = 1, ch = '',wrd = '',prop = '',val = '',jwshow = '', pause = false, rp = 0,lp = 0

     if(!t) return false
     if(!p)
          var p = new cls_jwinpopup()

     for(var x = 0; x < t.length; x++){
          ch = t.substr(x,1)
          jwshow +=ch
          if(jwshow.indexOf(JWIN_OBJECT+'.show')>0 && pause == false){
               pause = true
               wrd+=ch      
               jwshow=''
          }else if(pause == true){
               if(ch == '(')lp++
               if(ch == ')')rp++
               wrd+=ch  
               if(lp == rp){
                    pause = false
                    jwshow =''
               }                  
          }else{
               if(ch==':'){
                    d = wrd.toLowerCase().trim()
                    d = (d == 'function' ? 'Function' : d)  
                    if(typeof p[d] != 'undefined'){
                         prop = d
                         wrd = ''
                    }else
                         wrd+=ch                              
               }else if(ch==';'){
                    c = t.indexOf(':',x+1)
                    if(c > 0){
                         var pp = t.substr(x+1, c-x-1).trim()
                         pp = (pp == 'function' ? 'Function' : pp)  
                         if(typeof p[pp] != 'undefined'){
                              p[prop] = getVarVal(wrd.trim())
                              wrd = ''
                         }else
                              wrd+=';'               
                    }else{
                         p[prop]  = getVarVal(wrd.trim())
                         wrd = ''
                    }
               }else 
                    wrd+=ch      
          }
     }
     return p 
}


function getVarVal(v){
     if(v.indexOf('[')== 0 && v.lastIndexOf(']') == (v.length-1))
          return eval(v)
     else if(v == 'true' || v == 'false') 
          return eval(v)
     else 
          return v
}


function setStatus(){
     if(this.setstatus){
          if(this.statustext == '')
               this.statustext = this.text 
          window.status = this.statustext 
     }
}


function jwin_closestick(id){
     var jp = jwin.popups[id]

     if(jwin.inmodalstate && !jp.modal) 
          return

     if(jwin.inmodalstate){
          jwin.modalclosed = true 
          jwin.inmodalstate = jp.modal=false 
     }
     jwin_clearevents(id)

     jp.playingtextarray = jp.playingcaptionarray = false 
     jp.jwEvt_PlayArrayID = 0
     jp._textArrLen = jp._captionArrLen=0
     jp.styref.visibility = "hidden"
     jp.isvisible = false

}


function jwin_errorhandler(){
     jwin.popups[jw.popup.id].jwError = true
     var jwc = jwin_errorhandler.caller.toString()
     var f = "function "
     if(jwc.indexOf(f + "jwin_show") >= 0)
          alert("jwinError: Layer " + jw.window.name + '.' + jw.popup.id + " not found.")
     else if(jwc.indexOf(f + "jwin_setmarker") >= 0)
          alert("jwinError: Marker " + jw.window.name + '.' + jw.popup.markername + " not found.")
     else
          alert('Error: ' + jwc)
}


function trim(){
    var s1 = this.replace(/(^ *)/,"")
    var ret = s1.replace(/( *)$/,"")
    return ret 
} 
String.prototype.trim = trim        


function jwin_isdelayeffect(l){
     for(var x = 0; x < jwin.popupscount; x++)
          if(jwin.popups[jwin.popups[x].id].jwEvt_DelayOpenCloseID > 0)
              if(l == jwin.popups[x].id)
                    return true     
     return false
}


function jwin_isplayingtextarray(l){
     for(var x = 0; x < jwin.popupscount; x++)
          if(jwin.popups[jwin.popups[x].id].playingtextarray)
               if(l == jwin.popups[x].id)
                    return true 
     return false
}


function processArrays(l){   
     var jshow = false 
     var jp = jwin.popups[l]

     if(jp.playingtextarray)
          if(jp._textarrcount < jp._textarrlen){
               if(jp.arrayinterval > 0){
                    jp.writetext = jp._textarray[jp._textarrcount] 
                    jp._textarrcount++ 
                    jshow = true 
               }
          }else{
               jp.playingtextarray = false 
               jp._textarrlen = 0
               if(!jp.playingcaptionarray)
                    jshow = false
          }       
     

     if(jp.playingcaptionarray)
          if(jp._captionarrcount < jp._captionarrlen){
               if(jp.arrayinterval > 0){
                    jp.captiontext = jp._captionarray[jp._captionarrcount]
                    jp._captionarrcount++
                    jshow = true 
               }
          }else{
               jp.playingcaptionarray = false  
               jp._captionarrlen = 0
               if(!jp.playingtextarray)
                    jshow = false
          }       
     

     if(jshow){
          jwin_write(l) 
          jp.jwEvt_PlayArrayID = setTimeout('processArrays("'+ l +'")', jp.arrayinterval) 
          jp.statustext = '' 
          jp.setStat(jp.writetext)
     }

     if(jp.arrayclose)
          if(!jp.playingtextarray)
               if(!jp.playingcaptionarray)
                    jwin_hideme(l) 
}


function cls_jwinpopup(){
}
var p = cls_jwinpopup.prototype
p.getSimple          = getSimplePopup 
p.getCaption         = getCaptionPopup 
p.getClosingTableDef = getClosingTableDefVal 
p.getPaddedText      = getPaddedTextContent 
p.getHR              = getHRule 
p.getPopW            = getPopWidth
p.getPopH            = getPopHeight
p.getTPadL           = getTextPadL
p.getTPadR           = getTextPadR
p.getTPadT           = getTextPadT
p.getTPadB           = getTextPadB
p.getTPad            = getTextPad
p.setCIcon           = setCapIcon
p.setStat            = setStatus

var p = cls_jwinpopup.prototype
p.cls_name='cls_table' 
p.styref = p.layref = new Object
p.visible = p.delpopup = true
p.border = p.style = 1 
p.bordercolor = '#333399'  
p.bgcolor='#FFFFFF'
p.textfont=JWIN_DEF_FONT
p.textcolor='#000000' 
p.textsize='2'
p.text = 'A JWIN popup'
p.Function = null  
p.textcellpadding = p.textcellspacing = p.textborder = p.bordercellpadding = p.bordercellspacing = p.delayinterval = p.textpadbottom = p.textpadright = p.textpadtop = p.textpadleft = p.arrayinterval = 0
p.id = p.code = p.width = p.height = p.background = p.captiontext = p.textbordercolor = p.captionicon = p.closetext = p.closetaginsert = p.markername = p.statustext = p.fixedx = p.fixedy = p.snapx = p.snapy = p.markeroffset = p.writetext = ''
p.captiontextcolor = '#FFFFFF' 
p.captiontextfont = JWIN_DEF_FONT 
p.captiontextsize = p.closetextsize = '2' 
p.captionbgcolor = p.captiontextbordercolor = '#333399' 
p.captiontextborder = p.captioncellpadding = p.captioncellspacing = p.jwEvt_MouseOverID = p.jwEvt_DelayOpenCloseID = p.jwEvt_PlayArrayID = 0 
p.closetextcolor = '#9999FF' 
p.closetextfont = JWIN_DEF_FONT 
p.closeonclick = p.playcaptionarray = p.playingcaptionarray = p.playtextarray = p.arrayclose = p.playingtextarray = p.captiontextseparator = p.showcenterscreen = p.stickaround = p.followmouse = p.modal = p.autowidth = p.autoheight = p.textonly = p.captiontextonly = p.valignauto = p.halignauto = p.centertext = p.centercaptiontext = p.setstatus = p.mouseover = p.autozindex = p.closeonframeout = p.isvisible = p.jwError = p.capturemouseevents = p.debug = false
p.targetframe = self 
p.valign = p.delayevent = 2
p.halign = 3
p.offsetx = p.offsety = 10
p.x = p.y = p._textarrlen = p._textarrcount = p._captionarrlen = p._captionarrcount = 0 
p._textarray = p._captionarray = new Array



function getPopWidth(){
     return (this.width) ? ' width="' + this.width + '"' : ''
}


function getPopHeight(){
     return (this.height) ? ' height="' + this.height + '"' : ''
}


function getSimplePopup(){
     if(this.writetext == '')
        this.writetext = this.text

     var d = this.text 
    
     if(this.playtextarray && this.playingtextarray==false && d != null && typeof d == 'object'){
          this._textarrcount = 0

          if(this._textarray == ''){
               jwt = jwin_getarray(this.writetext)
               this._textarray = jwt
          }

          this.writetext = this._textarray[this._textarrcount] 
          this._textarrcount++ 
          if(this._textarrlen == 0) this._textarrlen = this._textarray.length 
          this.playingtextarray = true 
          this.jwEvt_PlayArrayID = setTimeout('processArrays("'+ this.id + '")', this.arrayinterval)
     }

     if(this.textonly){
          return this.writetext 
     }else
          if(this.background != ''){
               var jwin_bgpic = (nav.ie4up) ? this.background:''
	         return '<table' + this.getPopW() + this.getPopH() + ' border="0" cellpadding="0" cellspacing="0" background="' + jwin_bgpic + '"><tr><td>' + this.getPaddedText(this.writetext) + '</td></tr></table>'     
          }else
               return '<table' + this.getPopW() + this.getPopH() + ' border="' + this.border + '" bordercolor="' + this.bordercolor + '" cellpadding="' + this.bordercellpadding + '" cellspacing="' + this.bordercellspacing + '" bgcolor="' + this.bgcolor + '"><tr><td>' + this.getPaddedText(this.writetext) + '</td></tr></table>'               
     
}


function jwin_getarray(t){
     var a = new Array
     if(typeof t == 'string'){
          var cm = t.replace(/\/,/g,"[jw_com]")
          var cm2 = cm.split(',')
          for(var x = 0; x < cm2.length; x++)
               a[x] = cm2[x].replace(/\[jw_com\]/g,",")             
          return a               
     }else
          return t
}


function getCaptionPopup(){
     var processarray = false, jwt = new Array, d

     if(this.writetext == '')
        this.writetext = this.text

     d = this.text 
     if(this.playtextarray && this.playingtextarray==false && this.playingcaptionarray == false &&  d != null && typeof d == 'object'){
         jwin_clearevents(this.id)          
         this._textarrcount = 0        

         if(this._textarray == ''){
              jwt = jwin_getarray(this.writetext)
              this._textarray = jwt
         }
          
         this.writetext = this._textarray[this._textarrcount] 
         this._textarrcount++ 
         if(this._textarrlen == 0) this._textarrlen = this._textarray.length 
         
         processarray = true                                                   
     }

     d = this.captiontext
     if(this.playcaptionarray && this.playingcaptionarray == false && this.playingtextarray == false && d != null && typeof d == 'object'){
          jwin_clearevents(this.id)
          this._captionarrcount = 0

          if(this._captionarray == ''){
               jwt = jwin_getarray(this.captiontext)
               this._captionarray = jwt
          }

          this.captiontext = this._captionarray[this._captionarrcount] 
          this._captionarrcount++
          if(this._captionarrlen == 0) this._captionarrlen = this._captionarray.length 
          processarray = true 
     }

     if(processarray){ 
          this.jwEvt_PlayArrayID = setTimeout('processArrays("'+ this.id + '")', this.arrayinterval)
          this.playingtextarray = true 
          this.playingcaptionarray = true 
     }

     if(this.captionicon!='')
          this.setCIcon(this.captionicon) 

          
     var fs1, s0, s1, s2, s3, s5,s6, ret

     s0 = this.captiontextsize + ''
     s1 = '<table' + this.getPopW() + this.getPopH() + ' border="' + this.border + '" bordercolor="' + this.bordercolor + '" cellpadding="' + this.bordercellpadding + '" cellspacing="' + this.bordercellspacing + '"  bgcolor="' + this.bgcolor + '"><tr><td>'
     s2 = '<table' + this.getPopW() + this.getPopH() + ' border="0" cellpadding="' + this.bordercellpadding + '" cellspacing="' + this.bordercellspacing + '"><tr><td>'
     s3 = '<table width="100%" border="' + this.captiontextborder + '" bordercolor="' + this.captiontextbordercolor + '"  cellpadding="' + this.captioncellpadding + '" cellspacing="' + this.captioncellspacing + '" bgcolor="' + this.captionbgcolor + '"><tr><td><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td align="left">' + this.captionicon + getCenterText(this.centercaptiontext,0) 

     if(s0.indexOf("px") != -1) 
          fs1 = '<font style="font-family: ' + this.captiontextfont + '; color: ' + this.captiontextcolor + '; font-size: ' + this.captiontextsize + '">' 
     else 
          fs1 = '<font color="' + this.captiontextcolor + '" face="' + this.captiontextfont + '" size="' + this.captiontextsize + '">' 

     s4 = s3 + fs1 + this.captiontext +'</font>'+ getCenterText(this.centercaptiontext,1) +'</td>' + this.getClosingTableDef() + '</tr></table></td></tr></table>' + this.getHR() 
     s5 = '<table width="100%" border="' + this.textborder + '" bordercolor="' + this.textbordercolor + '" cellpadding="' + this.textcellpadding + '" cellspacing="' + this.textcellspacing + '" bgcolor="' + this.bgcolor + '"' + this.getPopH() +' background="' + this.background + '"><tr><td>' + this.getPaddedText(this.writetext) + '</td></tr></table>' 
     s6 = '</td></tr></table>' 


     if(this.captiontextonly)
          ret = s2 + this.captiontext
     else
          ret = s1 + s4          

     if(this.textonly)
          ret += this.writetext
     else
          ret += s5

     ret += s6

     return ret
}


function getTextPadL(){return (this.textpadleft) ? ' width="'+ this.textpadleft + '"' : ''}
function getTextPadR(){return (this.textpadright) ? ' width="' + this.textpadright + '"' : ''}
function getTextPadT(){return (this.textpadtop) ? ' height="' + this.textpadtop + '"' : ''}
function getTextPadB(){return (this.textpadbottom) ? ' height="' + this.textpadbottom + '"' : ''}
function getTextPad(){ return (this.width) ? ' width="' + (this.width-this.textpadleft-this.textpadright)+ '"' : ''}


function getPaddedTextContent(text){
    var fs1, s0 = this.textsize + '', s1 = '<table border="0" cellpadding="0" cellspacing="0"><tr><td colspan="3"' + this.getTPadT()+ '></td></tr><tr><td' + this.getTPadL()+ '></td><td'+ this.getTPad()+ '>'

    if(s0.indexOf("px") != -1)
         fs1 = '<font style="font-family:  ' + this.textfont + '; color: ' + this.textcolor + '; font-size: ' + this.textsize + '">' 
    else
         fs1 = '<font color="' + this.textcolor + '" face="' + this.textfont + '" size="' + this.textsize + '">' 
    
    return s1 + getCenterText(this.centertext,0) + fs1 + text + '</font>' + getCenterText(this.centertext,1) + '</td><td' + this.getTPadR() + '></td></tr> <tr><td colspan="3"' + this.getTPadB() + '></td></tr></table>' 
}


function getCenterText(a,e){
     if(a==false)
          return '' 

     if(e)
          return '</div>'
     else 
          return '<div align="center">'    
}


function getHRule(){
     return (this.captiontextseparator) ? '<hr>' : ''
}

function jwin_getcallingframe(){
     if(!nav.ns4up)
          var fr = 'parent.document.frames'
     else 
          var fr = 'parent.frames'

     var efr = eval(fr)
     var fl = efr.length

     for(var x = 0; x < fl; x++){
          var lfr = efr[x] 
          if(lfr == self)
               return fr + '.' + lfr.name            
     }
}

function getClosingTableDefVal(){
     var om = 'onmouseover', cti='', fs1, s0, s1
     var closing = (this.stickaround && this.closetext == '' ? 'Close' : this.closetext)
     var cs = 'jwin_closestick(\''+ this.id + '\')'

     if(this.targetframe != self){
       cs =  jwin_getcallingframe() + '.' + cs
     }   

     if(this.closeonclick)
          om = 'onclick'           

     if(this.closetaginsert != '')
         cti = this.closetaginsert 

     if(closing == ''){
          return ''    
     }else{
          s0 = this.closetextsize + ''
          s1 = '<td align="right"><a href="javascript:void(0);" ' + cti + ' '+ om + '="'+ cs + '">'

          if(s0.indexOf("px") != -1)
               fs1 = '<font style="font-family: ' + this.closetextfont + '; color: ' + this.closetextcolor + '; font-size: ' + this.closetextsize + '">' 
          else
               fs1 = '<font color="' + this.closetextcolor + '" face="' + this.closetextfont + '" size="' + this.closetextsize + '">'
          return s1 + fs1 + closing + '</font></a></td>' 
     }
}


function setCapIcon(c){
    this.captionicon = '<img src="'+ c +'" border="0">' 
}



// nav object
function jwinbrowser(){
    this.agt = navigator.userAgent.toLowerCase()  
    this.major = parseInt(navigator.appVersion) 
    this.minor = parseFloat(navigator.appVersion) 
    this.ns  = ((this.agt.indexOf('mozilla')!=-1) && (this.agt.indexOf('spoofer')==-1) && (this.agt.indexOf('compatible') == -1) && (this.agt.indexOf('opera')==-1) && (this.agt.indexOf('webtv')==-1) && (this.agt.indexOf('hotjava')==-1)) 
    this.ns2 = (this.ns && (this.major == 2)) 
    this.ns3 = (this.ns && (this.major == 3)) 
    this.ns4 = (this.ns && (this.major == 4)) 
    this.ns4up = (this.ns && (this.major >= 4)) 
    this.nsonly = (this.ns && ((this.agt.indexOf(";nav") != -1) || (this.agt.indexOf("; nav") != -1)) ) 
    this.ns6 = (this.ns && (this.major == 5)) 
    this.ns6up = (this.ns && (this.major >= 5)) 
    this.gecko = (this.agt.indexOf('gecko') != -1) 
    this.ie     = ((this.agt.indexOf("msie") != -1) && (this.agt.indexOf("opera") == -1)) 
    this.ie3    = (this.ie && (this.major < 4)) 
    this.ie4    = (this.ie && (this.major == 4) && (this.agt.indexOf("msie 5")==-1) ) 
    this.ie4up  = (this.ie && (this.major >= 4)) 
    this.ie5    = (this.ie && (this.major == 4) && (this.agt.indexOf("msie 5.0")!=-1) ) 
    this.ie5_5  = (this.ie && (this.major == 4) && (this.agt.indexOf("msie 5.5") !=-1)) 
    this.ie5up  = (this.ie && !this.ie3 && !this.ie4) 
    this.ie5_5up =(this.ie && !this.ie3 && !this.ie4 && !this.ie5)     
    this.opera = (this.agt.indexOf("opera") != -1) 
    this.opera2 = (this.agt.indexOf("opera 2") != -1 || this.agt.indexOf("opera/2") != -1) 
    this.opera3 = (this.agt.indexOf("opera 3") != -1 || this.agt.indexOf("opera/3") != -1) 
    this.opera4 = (this.agt.indexOf("opera 4") != -1 || this.agt.indexOf("opera/4") != -1) 
    this.opera5 = (this.agt.indexOf("opera 5") != -1 || this.agt.indexOf("opera/5") != -1) 
    this.opera5up = (this.opera && !this.opera2 && !this.opera3 && !this.opera4)   
    this.getWidth = jwinbrowser_getClientWidth
    this.getHeight = jwinbrowser_getClientHeight
    this.getScrollTop = jwinbrowser_getClientScrollTop
    this.getScrollLeft = jwinbrowser_getClientScrollLeft
    this.init = jwinbrowser_init
}


function jwinbrowser_init(){
    this.getWidth()
    this.getHeight()
    this.getScrollTop()
    this.getScrollLeft()
}


function jwinbrowser_getClientWidth(){
     return this.width = (jwin_ie) ? document.body.offsetWidth-20 : window.innerWidth
}


function jwinbrowser_getClientHeight(){
     return this.height = (jwin_ie) ? document.body.offsetHeight-4 : window.innerHeight
}


function jwinbrowser_getClientScrollTop(){
     return this.scrollTop = (jwin_ie) ? document.body.scrollTop : window.pageYOffset
}


function jwinbrowser_getClientScrollLeft(){
     return this.scrollLeft = (jwin_ie) ? document.body.scrollLeft : window.pageXOffset 
}


var jwin_ie = (document.all) ? true : false
var jwin_ns = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) == 4)
var nav = new jwinbrowser() 

document.onmousemove = jwin_mousehandler 
if(nav.ns4)
     document.captureEvents(Event.MOUSEMOVE) 



function jwin_mousehandler(e){
     var e = (nav.ns4up || nav.ns6up) ? e : event 
     var jc = jwin_scr
     if(nav.ns4){
          jc.o_X = e.pageX - self.pageXOffset
          jc.o_Y = e.pageY - self.pageYOffset
     }else{
          jc.o_X = e.clientX
          jc.o_Y = e.clientY
     }

     if(nav.ns4up || nav.ns6up){
          jc.o_W = self.innerWidth - 2
          jc.o_H = self.innerHeight - 2
     }else{
          jc.o_W = self.document.body.offsetWidth - 4
          jc.o_H = self.document.body.offsetHeight - 4
     }

     if(nav.ns4up || nav.ns6up){
          jc.m_X = e.pageX  
          jc.m_Y = e.pageY
     }else if(nav.ie4){ 
          jc.m_X = e.x  
          jc.m_Y = e.y  
     }else if(nav.ie5up){ 
          jc.m_X = e.x+document.body.scrollLeft  
          jc.m_Y = e.y+document.body.scrollTop 
     }else if(nav.opera){
          jc.m_X = e.clientX
          jc.m_Y = e.clientY
     }
     jc.mouseout = (jc.o_X < 2 || jc.o_X > jc.o_W ||jc.o_Y < 2 || jc.o_Y > jc.o_H) 

     for(var t = 0; t < jwin.popupscount; t++){
        if(!isjwin(t))
             continue   
        var jp = jwin.popups[t]
        if(jwin.popups[jp.id].visible && jwin.popups[jp.id].closeonframeout && jc.mouseout) 
             jwin_closestick(jp.id)
     }

     if(typeof jw != 'undefined')
          if(typeof jw.popup != 'undefined')
               if(jw.popup.followmouse)
                    if(jw.popup.styref.visibility.indexOf('hid') == -1)
                         jwin_move()
          
}


var propArr = new Array, _jwp = new cls_jwinpopup(), pr = 0
for(prop in _jwp){
     propArr[pr++] =((prop.charAt(0) == '_' || prop.indexOf('jwE') != -1 || typeof _jwp[prop] == 'function') ? prop : prop.toUpperCase())  
}
for(var i = 0; i < propArr.length; i++){ 
    eval('var ' + propArr[i] + '=' + i)
}


function s(txt){ //debug
     if(jw.window)jw.window.status = txt
     return true
}


// these var wil be phased out eventually
var JWIN_POPUP_STYLESIMPLE = 1, JWIN_POPUP_STYLECAPTION = 2, JWIN_HALIGN_LEFT = 1, JWIN_HALIGN_CENTER = 2, JWIN_HALIGN_RIGHT = 3,JWIN_VALIGN_ABOVE = 1, JWIN_VALIGN_BELOW = 2, JWIN_DELAY_OPEN = 1, JWIN_DELAY_CLOSE = 2
