

function winPopup(image,name)
{
 	 var theImage = new Image();
     theImage.src = image;
     theImage.onerror = function(){
        alert('This image has failed to load!');
     }

     theImage.onload = function(){
      var width  = theImage.width;  if(width <100) { width  = 100 };
      var height = theImage.height; if(height<100) { height = 100 };
      var left = Math.round((screen.width - width) / 2);
      var top  = Math.round((screen.height - height) / 2);
      var features = 'top='+top+',left='+left+',width='+width+',height='+height;
      var openWindow = window.open('','display',features);
       with(openWindow.document){
         writeln('<html><head><title>'+name+'</title></head>');
         writeln('<body onload="self.focus()" onblur="self.close()"');
         writeln('style="background-image:url('+image+');');
         writeln('background-repeat:no-repeat;width:'+width+';height:'+height+'">');
         writeln('</body></html>');
         close();
       }
     }
         return false;
}


