function ImagePopup(img){
  Image1= new Image();
  Image1.src=(img);
  Control(img);
}
function Control(img){
  if((Image1.width!=0)&&(Image1.height!=0)){
    ViewImage(img);
  }
  else{
    action="Control('"+img+"')";
  }
}
function ViewImage(img){
  fine=window.open(img,"");
}
