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


function loadGallery(myHeight) {
   $(".imageZoom").click(function () { 
     $.ajax({type:"POST",url:"immoObjectHighRes",data:"img="+$(this).prev().attr("id"),
       success: function(html){

         width = html.substring(html.search(/width.+/)+7,html.search(/height.+/)-2);
         height = html.substring(html.search(/height.+/)+8,html.search(/alt.+/)-2);
         width = (parseInt(width) + 32);
         height = (parseInt(height) + 37);
         $("#highResWrapper").height(parseInt(height)).width(parseInt(width));

         var screenHeight = screenSize(myHeight);
         screenH = (screenHeight > (height))?(screenHeight - height)/2:0;
         $("#highResWrapper").css("padding-top",screenH);

         $("#highRes").html(html);
         $("#highResContainer").fadeIn();
       }
     });
   });

   $("img.imghires").mouseover(function(){$(this).next().fadeIn();});
   $(".imageZoom").mouseout(function(){$(this).animate({opacity: 1.0},450).fadeOut();});

   $("#highRes").click(function(){$("#highResContainer").fadeOut();});

};


