function Flash3D(id, w, h) {
   fw=window.open('/imgs/flash3d/showflash.php?id='+id,'main','toolbar=0,scrollbars=0,location=0,directories=0,status=0,menubar=0,width='+w+',height='+h+',border=thin,top=0,left=0,help=0');
  }
 
function Picture(name, image, width, height){
  var resx=screen.availWidth, resy=screen.availHeight, scroll="no";
  var tp=Math.floor((resy-height-20)/2);tp=(tp<0)?0:tp;
  var lt=Math.floor((resx-width-10)/2);lt=(lt<0)?0:lt;
  
  if(height>resx || width>resx){
    scroll="yes";
    height=resy-80
    width=resx-60;
  }
  
  pw=window.open("","pic","scrollbars="+scroll+",resizable="+scroll+",toolbar=no,location=no,directories=no,status=no,width="+width+",height="+height+",top="+tp+",left="+lt+"");
  pw.document.open();
  pw.document.writeln("<html><head><title>-= "+name+" =- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </title><body bgcolor='white' text=white topmargin='0' leftmargin='0' marginwidth='0' marginheight='0'>"+'<img src="'+image+'" border=0>'+'</head></html>');
//  pw.document.writeln("<html><head><title>-= "+name+" =- &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </title><body onload='window.focus();' onblur='self.close();' "+(scroll=="yes"?"":"onresize='self.close();' ")+"bgcolor='white' text=white topmargin='0' leftmargin='0' marginwidth='0' marginheight='0'>"+'<img src="'+image+'" border=0 onclick="window.close();">'+'</head></html>');
  pw.document.close();
  return false;
}

var bigimg = new Image();

function create_small_filename(filename) {
  var pos = filename.lastIndexOf(".");
  if (pos == 0) {
    return filename;
  } else {
    return (filename.substring(0, pos) + "-small" + filename.substring(pos, filename.length));
  }
}

function showphoto(url, w, h) {
  document.getElementById("phonecolor").src = create_small_filename(url);
  bigimg.src = url;
  bigimg.width = w;
  bigimg.height = h;
  return false;
}