function PopUp(img){
photo1 = new Image();
photo1.src=(img);
Control(img);
}
function Control(img){
if((photo1.width!=0)&&(photo1.height!=0)) {
viewPhoto(img);
}
else {
nextfunc = "Control('"+img+"')";
interval = setTimeout(nextfunc,20);
}
}
function viewPhoto(img){
sidemargin = photo1.width + 20;
topmargin = photo1.height + 30;
endstring = "width=" + sidemargin + ",height=" + topmargin;
finished = window.open(img,"",endstring);
}