//	Created by SADAS
//	http://www.dreinius.net
//	dreinius@gmail.com


var srv_link = "http://www.pasjanina.lt/";

function pic(pid){
  img= ''+srv_link+'images/'+pid;
  foto= new Image();
  foto.src=(img);
  Control(pid);
}

function Control(pid){
  if((foto.width!=0)&&(foto.height!=0)){
    viewFoto(pid);
  }
  else{
    temp="Control('"+pid+"')";
    interval=setTimeout(temp,10);
  }
}

function viewFoto(pid){
  ilg=foto.width;
  plot=foto.height;
  LeftPosition = (screen.width) ? (screen.width-ilg)/2 : 0;
  TopPosition = (screen.height) ? (screen.height-plot)/2 : 0;
  
  settings ='top='+TopPosition+', left='+LeftPosition+', width='+ilg+', height='+plot+', buttons=no, scrollbars=no, location=no, menubar=no, resizable=no, status=no, directories=no, toolbar=no'

  rnd = (Math.round((Math.random()*999)+1));
  url =''+srv_link+'inc/pic.php?pic='+pid+''

  window.open(url, "w"+rnd, settings);
}
