function BlindUpAndDown(element) {
      element = $(element);
      if(Element.visible(element)) new Effect.BlindUp(element);
      else new Effect.BlindDown(element); 
    }

function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}

function addLinks(){
  if( document.getElementById &&
      document.getElementsByTagName ){
    if( document.getElementById( 'hide' ) ){
        document.getElementById( 'hide' ).onclick = function(){
          return BlindUpAndDown('para');
        };
      }
	   if( document.getElementById( 'close' ) ){
        document.getElementById( 'close' ).onclick = function(){
          return BlindUpAndDown('para');
        };
      }
    }
    
  }

function cout(){
Element.hide('para');
}

// addLoadEvent(function() {
// cout();
// })

addLoadEvent(function() {
addLinks();
})


/* {{{ code for popups */

if (typeof Function.bind == 'undefined')
{
    Function.prototype.bind = function (object)
    {
        var method = this;
        return function() { return method.apply(object, arguments) }
    }
}

ss = function ()
{
    this.offset = 16;

    this.mDiv = document.createElement('div');
    this.mDiv.className = 'ss';

    this.mPic = null;

    this.pDiv = document.createElement('div');
    this.mDiv.appendChild(this.pDiv);

    document.body.appendChild(this.mDiv);
}

ss.prototype.show = function (e, picture, width, height)
{
    this.pDiv.style.display = 'block';
    this.pDiv.style.width = width + 'px';
    this.pDiv.style.height = height + 'px';

    this.mPic = document.createElement('img');
    this.mPic.onload = function ()
    {
        this.pDiv.style.display = 'none';
    }.bind(this);
    this.mPic.src = picture;
    this.mPic.style.width = width + 'px';
    this.mPic.style.height = height + 'px';
    this.mDiv.appendChild(this.mPic);

    this.mDiv.style.display = 'block';

    this.move(e);
}

ss.prototype.move = function (e)
{
    if (this.mPic != null)
    {
        var mouseX = window.event ? window.event.clientX : e.clientX;
        var mouseY = window.event ? window.event.clientY : e.clientY;
 
        if (document.body.clientHeight - mouseY - this.mDiv.clientHeight - this.offset < 2)
            this.mDiv.style.top = (document.body.clientHeight - this.mDiv.clientHeight - 2) + 'px';
        else
            this.mDiv.style.top = (mouseY + this.offset) + 'px';
 
        if (document.body.clientWidth - mouseX - this.mDiv.clientWidth - this.offset < 2)
            this.mDiv.style.left = (mouseX - this.offset - this.mDiv.clientWidth) + 'px';
        else
            this.mDiv.style.left = (mouseX + this.offset) + 'px';
    }
}

ss.prototype.hide = function ()
{
    this.mDiv.style.display = 'none';

    if (this.mPic != null)
    {
        this.mDiv.removeChild(this.mPic);
        this.mPic = null;
    }
}

/* }}} */

