function getObjects(n, d){//get Object
  if (!d)
  {d = document;
  }
  if ( ( p = n.indexOf("?") ) > 0 && parent.frames.length )
  { d=parent.frames[n.substring(p+1)].document; 
    n=n.substring(0,p);
  }
  if ( ! ( x = d[n]) && d.all ) 
  {x=d.all[n]; 
  }
  if ( !x && d.getElementById ) 
  {x=d.getElementById( n );
  }
  for ( var i = 0; !x && i < d.forms.length; i++)
  {x=d.forms[i][n];
  }
  for( var i = 0; !x && d.layers && i < d.layers.length; i++)
  {x=getObjects(n,d.layers[i].document); 
  }
  return x;
}

function showLayer(name){//
  if ((otherobj=getObjects(name))!=null){ 
    if (otherobj.style){ 
      otherobj=otherobj.style;
    }
    otherobj.visibility="visible";
  }
}

function hideLayer(name){//
  if ((otherobj=getObjects(name))!=null){ 
	if (otherobj.style){ 
      otherobj=otherobj.style;
	}
    otherobj.visibility="hidden";
  }
}

function inheritLayer(name){//
  if ((objloc=getObjects(name))!=null){ 
    if (objloc.style){ 
      objloc=objloc.style;
    }
    objloc.visibility="inherit";
  }
}

function moveLayerTo(name,x,y){
  if ((otherobj=getObjects(name))!=null){ 
    if(otherobj.style){
      otherobj=otherobj.style;
      otherobj.left=x+'px';
      otherobj.top=y+'px';
    }
    else{
    otherobj.moveTo(x,y);
    }
  }
}

function moveLayerBy(name,dx,dy){
  if ((otherobj=getObjects(name))!=null){ 
    if(otherobj.style){
      otherobj=otherobj.style;
      otherobj.left=getLayerLeft(name)+dx;
      otherobj.top=getLayerTop(name)+dy;
    }
    else{
    otherobj.moveBy(dx,dy);
    }
  }
}

function setLayerzIndex(name,z){
  if ((otherobj=getObjects(name))!=null){ 
    if(otherobj.style){
      otherobj=otherobj.style
    }
    otherobj.zIndex=z;
  }
}

function resizeLayerTo(name,x,y){
  if(!x){x=getLayerWidth(name);}
  if(!y){y=getLayerHeight(name);}
    if ((otherobj=getObjects(name))!=null){ 
      if(otherobj.style){
         otherobj=otherobj.style
         otherobj.width=x;
         otherobj.height=y;
      }
      else{
        otherobj.resizeTo(x,y);
      }
    }
}

function getLayerLeft(name){
  if ((otherobj=getObjects(name))!=null){ 
    if(otherobj.style){
      otherobj=otherobj.style
      if(otherobj.pixelLeft){
        return otherobj.pixelLeft;
      }
      else{
        return parseInt(otherobj.left);
      }
    }
    return otherobj.left
  }
return -1
}

function getLayerRight(name){
  if ((otherobj=getObjects(name))!=null){ 
    if(otherobj.style){
      otherobj=otherobj.style
      if(otherobj.pixelLeft){
        return otherobj.pixelLeft+getLayerWidth(name);
      }
      else{
        return (parseInt(otherobj.left)+getLayerWidth(name));
      }
    }
    return otherobj.left+getLayerWidth(name)
  }
return -1
}

function getLayerTop(name){
  if ((otherobj=getObjects(name))!=null){ 
    if(otherobj.style){
      otherobj=otherobj.style
      if(otherobj.pixelTop){
        return otherobj.pixelTop;
      }
      else{
        return parseInt(otherobj.top);
      }
    }
    return otherobj.top
  }
return -1
}

function getLayerBottom(name){
  if ((otherobj=getObjects(name))!=null){ 
    if(otherobj.style){
      otherobj=otherobj.style
      if(otherobj.pixelTop){
        return otherobj.pixelTop+getLayerHeight(name);
      }
      else{
        return (parseInt(otherobj.top)+getLayerHeight(name));
      }
    }
    return otherobj.top+getLayerHeight(name)
  }
return -1
}

function getLayerHeight(name){
  if ((otherobj=getObjects(name))!=null){ 
    if(otherobj.style){
      otherobj=otherobj.style
      if(otherobj.pixelHeight){return otherobj.pixelHeight;}
      else{return parseInt(otherobj.height);}
    }
    if(otherobj.height){return otherobj.height;}
    else{return otherobj.clip.bottom-otherobj.clip.top;}
  }
return -1
}

function getLayerWidth(name){
  if ((otherobj=getObjects(name))!=null){ 
    if(otherobj.style){
      otherobj=otherobj.style
      if(otherobj.pixelWidth){return otherobj.pixelWidth;}
      else{return parseInt(otherobj.width);}
    }
    if(otherobj.width){return otherobj.width;}
    else{return otherobj.clip.right-otherobj.clip.left;}
  }
return -1
}

function getLayerVisibility(name){
  if ((otherobj=getObjects(name))!=null){ 
    if(otherobj.style){
      otherobj=otherobj.style
    }
    if(otherobj.visibility=="show")ret = "visible";
    if(otherobj.visibility=="hide")ret = "hidden";
    ret = otherobj.visibility;
  }
if(!ret){ret="inherit";}
return ret;
}

function getLayerzIndex(name){
  if ((otherobj=getObjects(name))!=null){ 
    if(otherobj.style){
      otherobj=otherobj.style
    }
    return otherobj.zIndex;
  }
}

function getWindowWidth(){
if(window.innerWidth)return window.innerWidth;
if(document.body.clientWidth)return document.body.clientWidth;
return-1;
}

function getWindowHeight(){
if(window.innerHeight)return window.innerHeight;
if(document.body.clientHeight)return document.body.clientHeight;
return-1;
}

function getPageWidth(){
if(document.width)return document.width;
if(document.body.scrollWidth)return document.body.scrollWidth;
return-1;
}

function getPageHeight(){
if(document.height)return document.height;
if(document.body.scrollHeight)return document.body.scrollHeight;
return-1;
}

function getPageScrollX(d){
if(!d){d=parent;
if(d.pageXOffset!=null)return d.pageXOffset;
if(d.document.body!=null)return d.document.body.scrollLeft;
}
return -1;
}

function getPageScrollY(d){
if(!d){d=parent;
if(d.pageYOffset!=null) return d.pageYOffset
if(d.document.body!=null)return d.document.body.scrollTop;
}
return -1;
}

function getScreenInfo(n){
scrn = new Array();
scrn[0]= screen.width;
scrn[1]= screen.height;
scrn[2]= screen.availWidth;
scrn[3]= screen.availHeight;
scrn[4]= screen.colorDepth;
return scrn[n];
}


    
function slideLayerTo (sObjectId, xValue, sObjectId2, vis) {
	if(vis == 'block' && document.getElementById(sObjectId2)){
		//document.getElementById(sObjectId2).style.display = 'block';
		showLayer(sObjectId2);
	}	
		
	if(document.getElementById(sObjectId).offsetLeft > xValue){
	
		var step = (Math.abs(xValue)-Math.abs(document.getElementById(sObjectId).offsetLeft))/10;	
		x = Math.min(Math.floor(document.getElementById(sObjectId).offsetLeft-step),-1);
		moveLayerTo(sObjectId, x, 0);
		window.setTimeout("slideLayerTo('"+sObjectId+"', '"+xValue+"', '"+sObjectId2+"', '"+vis+"')", 1);
	} 
	
	if(document.getElementById(sObjectId).offsetLeft < xValue){

		var step = Math.max((Math.abs(document.getElementById(sObjectId).offsetLeft)+Math.abs(xValue))/10,1);	
		x = Math.ceil(document.getElementById(sObjectId).offsetLeft+step);
		moveLayerTo(sObjectId, x, 0);
		window.setTimeout("slideLayerTo('"+sObjectId+"', '"+xValue+"', '"+sObjectId2+"', '"+vis+"')", 1);				
	}
	
	if(document.getElementById(sObjectId).offsetLeft == xValue && vis == 'none' && document.getElementById(sObjectId2)){
		//alert('none');
		//document.getElementById(sObjectId2).style.display = 'none';
		window.setTimeout("hideLayer('"+sObjectId2+"')", 500);
	}

	

}