
function showImage(photo,width,height,caption) {
var wrapWidth = width + 50;
var wrapHeight= height + 50;

//get browser height/width and scroll positions
var scroll_array= getScrollXY();
var size_array=alertSize();



myleft=(screen.width)?(size_array[0]-wrapWidth)/2:100;
mytop=(screen.height)?(size_array[1]-wrapHeight)/2:100;
myleft+=scroll_array[0]-180;
mytop+=scroll_array[1];

var i = document.getElementById('imageBlock');
i.style.left=myleft+"px";
i.style.top=mytop+"px";
photo.onload=i.style.display="none";
i.innerHTML = "<div id=\"wrapper\" style=\"width:" + wrapWidth + "px;height:" + wrapHeight + "px;z-index:100;\"><div class=\"closemer\" style=\"height:25px !important;\"><a href=\"javascript:loaderClose();\" style=\"color:#808080; font-size:11px; float:right; font-family: Arial, sans-serif; text-transform:uppercase; margin:5px 25px; \" title=\"close here\">x close</a></div><div class=\"largeImage\"><a href=\"javascript:loaderClose();\" class=\"imageClose\"><img src=\"http://www.energist.be/images/uploaded/" + photo + "\" width=\"" + width +"\" height=\"" + height +"\" alt=\"close\" title=\"click to close\" id=\"largeImage\" /></a><div style=\" font-family: verdana; font-size:10px; color: #3f3f3f; \">"+ caption +"</div></div></div>";
//i.innerHTML = "<img src=\"http://test.909.be/images/uploaded/" + photo + "\" width=\"" + width +"\" height=\"" + height +"\" alt=\"$photo\" id=\"largeImage\" /></a>";
i.style.display='block';
i.style.opacity="0.1";
new Rico.Effect.FadeTo( i, 1 , 10, 10, {complete:function() {i.style.display='block';}})


}

function loaderClose() {
var loader = document.getElementById('loader');
//loader.innerHTML = "";
//loader.style.display='none';
var p = document.getElementById('imageBlock');
//new Rico.Effect.FadeTo(element, opacity, duration, steps, options)
new Rico.Effect.FadeTo(p, .0, 50, 10, {complete:function() {p.style.display='none';}})
}

///get scrollposoition

function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}

///getsize of window

function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
 return[ myWidth , myHeight];

}
