var _targetX;
var _targetY;
function addEvent(target,eventName,handler)
{
  if(isIe()){target.attachEvent("on"+eventName,handler);}
  else{target.addEventListener(eventName,handler,false);}
}
function deleteEvent(target,eventName,handler)
{
  if(isIe()){target.detachEvent("on"+eventName,handler);}
  else{target.removeEventListener(eventName,handler,false);}
}
function appendChild(parent,child){var tmp=ce("div");tmp.appendChild(child);parent.innerHTML+=tmp.innerHTML;}
function ce(n){return document.createElement(n);}
function de(n){while(n.childNodes.length>0){n.removeChild(n.childNodes[n.childNodes.length-1]);}}
function el(n){return document.getElementById(n);}

function elX(n)
{
  var result=n.offsetLeft;
  while(n.offsetParent!=undefined&&n.offsetParent!=null)
  {
     n=n.offsetParent;
     result+=n.offsetLeft;
  }
  return result;
}

function elY(n)
{
  var result=n.offsetTop;
  while(n.offsetParent!=undefined&&n.offsetParent!=null)
  {
     n=n.offsetParent;
     result+=n.offsetTop;
  }
  return result;
}

function pli(n,x){var img=new Image();plis.push(img);img.src="/images/"+n+"."+x;}
function pxl(n){return n+"px";}
function hscrollPosition(){return isIe()?document.body.parentNode.scrollLeft:window.scrollX;}
function isIe(){return document.all!=undefined;}
function scrollToElement(n)
{
  if(n.offsetHeight>windowHeight() || elY(n)<vscrollPosition())
  {
    slowScroll(0,elY(n));
  }
  else if(elY(n)+n.offsetHeight>windowHeight()+vscrollPosition())
  {
    slowScroll(0,elY(n)+n.offsetHeight-windowHeight());
  }
}
function slowScroll(x,y)
{
  _targetX=x;
  _targetY=y;
  window.setTimeout("slowScrollIncrement()",10);
}
function slowScrollIncrement()
{
  var done=true;
  var xIncrement=0;
  var yIncrement=0;
  var direction;
  
  if(hscrollPosition()!=_targetX)
  {
    done=false;
    direction=hscrollPosition()<_targetX?1:-1;
    if(Math.abs(_targetX-hscrollPosition())>=10)
      xIncrement=(10*direction)+hscrollPosition();
    else
      xIncrement=(Math.abs(_targetX-hscrollPosition())*direction)+hscrollPosition();
  }
  if(vscrollPosition()!=_targetY)
  {
    done=false;
    direction=vscrollPosition()<_targetY?1:-1;
    if(Math.abs(_targetY-vscrollPosition())>=10)
      yIncrement=(10*direction)+vscrollPosition();
    else
      yIncrement=(Math.abs(_targetY-vscrollPosition())*direction)+vscrollPosition();
  }
  if(!done)
  {
    window.scroll(xIncrement,yIncrement);
    window.setTimeout("slowScrollIncrement()",10);
  }
}

function style(n){return el(n).style;}
function vscrollPosition(){return isIe()?document.body.parentNode.scrollTop:window.scrollY;}
function windowHeight(){return isIe()?document.body.parentNode.clientHeight:window.innerHeight;}
function windowWidth(){return isIe()?document.body.parentNode.clientWidth:window.innerWidth;}

var plis = new Array();
