function popupImage(img){
  imgRef= new Image();
  imgRef.src=(img);
  Controler(img);
}
function Controler(img){
  if((imgRef.width!=0)&&(imgRef.height!=0)){
    viewImage(img);
  }
  else{
    timeOutfunc="Controler('"+img+"')";
    timeOutInterval=setTimeout(timeOutfunc,20);
  }
}
function viewImage(img){
  imgWidth=imgRef.width;
  imgHeight=imgRef.height;
  features="width="+imgWidth+",height="+imgHeight;
  popupWindow=window.open("","",features);
  popupWindow.document.open();
  popupWindow.document.writeln('<html><body marginheight=0 marginwidth=0 topmargin=0 leftmargin=0 rightmargin=0><img src="'+img+'"></body></html>');
}

function showNewWindow(url){
  var targetURL=url;
  window.open(targetURL,"newWindow","toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width=600,height=500,left=20,top=20");
}

