// Copyright (C) by Miroslaw Strzelecki, 2003

   var n4 = ( document.layers ) ? true : false
   var i4 = ( document.all ) ? true : false
   var n6 = ( document.getElementById && !i4 ) ? true : false
   var op = ( navigator.appName.indexOf( "Opera" ) != -1 ) ? true : false

function getE( e ){

   if( n4 || n6 ){
   }
   else {
      wT = document.body.scrollTop
      wL = document.body.scrollLeft
      wB = document.body.clientHeight + wT
      wR = document.body.clientWidth  + wL
      mT = event.clientY + wT - document.body.clientTop  
      mL = event.clientX + wL - document.body.clientLeft
   }
}
function setPos( e, t, l ){
   if( e ){
      if     ( i4 ){ e.style.top  = t;   e.style.left = l }
      else if( n4 ){ e.moveTo( l, t )}
      else if( n6 ){ e.style.top  = t + 'px'; e.style.left = l + 'px' }
   }
}
function getT( e ){
   var curtop = 0;
   if ( e.offsetParent ){
      while( e.offsetParent ){
         curtop += e.offsetTop
         e = e.offsetParent;
      }
   }
   else if ( e.y ) curtop += e.y
   return curtop
}
function getL( e ){
   var curtop = 0;
   if( e.offsetParent ){
      while( e.offsetParent ){
         curtop += e.offsetLeft
         e = e.offsetParent;
      }
   }
   else if ( e.x ) curtop += e.x;
   return curtop;
}

function getW( e ){
   result = 0
   if      ( e.offsetWidth ) result = e.offsetWidth
   else if ( e.clip && e.clip.width ) result = e.clip.width
   else if ( e.style && e.style.pixelWidth ) result = e.style.pixelWidth
   return parseInt( result )
}
function getH( e ) {
   result = 0
   if (e.offsetHeight) result = e.offsetHeight
   else if ( e.clip && e.clip.height ) result = e.clip.height
   else if ( e.style && e.style.pixelHeight ) result = e.style.pixelHeight
   return parseInt( result )
}

function getO( e ){
   if( i4 ){ return document.all[e] }
   if( n4 ){ return document.layers[e] }
   if( n6 ){ return document.getElementById( e )}
}

function setZ( e, z ){
   if( n4 ) e.zIndex = z
   else if( i4 || n6 ) e.style.zIndex = z
}


function newO( name, pT, pL, txt, div ){
   if( i4 ){
      if( !div ) div = document.body
      txt = '<DIV id="' + name + '" name="' + name + '" style="visibility:visible; position:absolute; top:'+pT+'; left:'+pL +'">' + txt + '</DIV> \n'
      div.insertAdjacentHTML( "BeforeEnd", txt )
      obj = document.all( name )
   }
   else if( n6 ){
      obj = document.createElement( 'div' ) 
      document.body.appendChild( obj )
      obj.style.position = 'absolute'
      obj.style.top  = pT + 'px'
      obj.style.left = pL + 'px'
      obj.innerHTML  = txt
   }
   else if( n4 ){

//      if(height>0) div.resizeTo(width,height);
    
//??
//      obj = new Layer( 0, doc )
      obj = new Layer()
      obj.name = name
//    div.moveTo( pL, pT );
      obj.top  = pT
      obj.left = pL
      obj.visibility  = 'visible'
      obj.document.open( 'text/html','replace' )
      obj.document.write( txt )
      obj.document.close()
   }
   return obj
}


function opacity( o, op )
{
   if( o ){
      if ( i4 ) o.style.filter="alpha(opacity="+op+")"
      else if ( n6 ) o.style.MozOpacity=op/100
   }
}
function setClip( div, top, left, bottom, right ){
//        IE4 = 1, IE5+ = 2, NN4 = 3, NN6+ = 4, others = 0
_dom = document.all?(document.getElementById?2:1):(document.getElementById?4:(document.layers?3:0));
   if(_dom==4 || _dom==2 || _dom==1){
     div.style.clip='rect('+top+'px '+right+'px '+bottom+'px '+left+'px)';
   }
   if(_dom==3){
     div.clip.top   =top;   div.clip.right=right;
     div.clip.bottom=bottom;div.clip.left =left;
   }
}

// -----------------------------------

container = ''
function include( url ){

   if( n4 ){
      container = new Layer();
      container.name = includeDIV;
      container.visibility = 'hidden';
      container.src = url;

   }
   else if( i4 ){
      if( !container ){
         html = '<IFRAME name="containerDIV" src="'+url+'" style="visibility:hidden; width:0; height:0"></IFRAME>'
         document.body.insertAdjacentHTML( "BeforeEnd", html )
         container = window.frames['containerDIV'];
      }
      else {
         container.document.location.replace( url )
      }

   }
   else if( n6 ){
      var span = document.createElement('SPAN');
      span.id = "SPAN" + includeDIV;
      document.body.appendChild( span );
      var iframe = document.createElement('IFRAME');
      iframe.name = includeDIV;
      iframe.id = includeDIV;
      span.appendChild( iframe );
      container = iframe;
//    container.src = '';
      container.src = URL; 
   }
}
