/*******************************************************
 * VMax DHTML Lib  v6.2                                *
 * (C)1996-2000   Virtual_Max  ( http://come.to/vmax ) *
 * This library and it's derivatives  is  free for use * 
 * until this notice remains unchanged and  present in * 
 * all copies and derivatives.                         *
 * revision: 09/12/2000                                *
 *******************************************************/

function getById(id,o){
    if(document.getElementById) return document.getElementById(id);
    if(document.all)            return document.all[id]
    if(o==null) o=window.document;

    if(o.layers[id]){
      return o.layers[id]
    }

    if(o.images[id]){
      return o.images[id]
    }

    for(var i=0; i<o.layers.length; i++){
       var oo=getById(id,o.layers[i].document); 
       if(oo!=null) return oo;
    }
    return null;
}

function Dimension(x,y,w,h) {
  this.w=w; this.h=h; this.x=x; this.y=y;
}

function getDivSizes(id){
 var o = getById(id);
 if(o==null) return null;
 var x,y,w,h;
 if(document.layers) {
     x=o.left;
     y=o.top;
     if(o.height==null) o.height=o.clip.height;
     if(o.width==null)  o.width=o.clip.width;
     h=o.height;
     w=o.width;
  }
  else if(document.all){
     x=o.offsetLeft;
     y=o.offsetTop;
     w=o.scrollWidth;
     h=o.scrollHeight;
 }
 else{
     x=o.offsetLeft;
     y=o.offsetTop;
     w=o.offsetWidth;
     h=o.offsetHeight;
 }
 return new Dimension(x,y,w,h);
}


function getViewPort(){
  var x=0,y=0,w=640,h=480;
  if(document.all) {
     var o=window.document.body;
     x=o.scrollLeft;
     w=o.offsetWidth;
     y=o.scrollTop;
     h=o.offsetHeight;
  } 
  else {
     x=window.pageXOffset;
     w=window.innerWidth;
     y=window.pageYOffset;
     h=window.innerHeight;
  }

  return new Dimension(x,y,w,h);
}

function getPageSize(){
  var w=640,h=480;
  if(document.all) {
     var o=window.document.body;
     w=o.scrollWidth;
     h=o.scrollHeight;
  } 
  else {
     w=document.width;
     h=document.height;
  }
  return new Dimension(0,0,w,h);
}


function showDiv(id,vis) {
  var o = getById(id);
  if( o==null ) return;
  if(!document.layers) o=o.style;
    o.visibility = vis ? "visible" : "hidden";
}



function moveDiv(id,x,y){
  var o = getById(id);
  if( o==null ) return;
  if(document.layers){
     o.moveTo(x,y);     
  }
  else {
    o=o.style;
    if(document.all) {
       o.pixelLeft=x;
       o.pixelTop=y;
    }
    else {
       o.left=x;
       o.top=y;     
    }
  }
}


/*----- zIndex functions -------*/

function setZindex(id, index){
  var o = getById(id);
  if( o==null ) return;
  if(!document.layers)    o=o.style;
  o.zIndex=index;
}

function getZindex(id){
  var o = getById(id);
  if( o==null ) return 0;
  if(!document.layers) o=o.style;
  return parseInt(o.zIndex);
}

	
//==============================================

function changeContent(id,content){
 var o=getById(id); 
 if(o==null) return;
 if(document.layers){
    o.document.writeln(content);
    o.document.close();
 }
 else o.innerHTML = content
}


if(!document.all){
 var oldWidth=window.innerWidth ;
 var oldHeight=window.innerHeight;

 function fixResize(){
  if(document.layers){
    if(oldWidth!=window.innerWidth || oldHeight!=window.innerHeight){ 
      history.go(0);
   }
  }
 }
 window.onresize=fixResize;
}




