function del_str( del, rep , str  )
{
	res = str;

	while( res.search(del) >= 0  )
	{
		res = res.replace( del, rep );
	}

	return res;
}

function photo_win(img_path,img_alt){	
    var str, StrBody;

	str = "resizable=yes,scrollbars=no,status=no,width=200,height=200,screenX=200,screenY=200,left=50,top=50";
	
    StrBody = '<body onload="resize_img();" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="White" onblur="self.window.close();">';
		
	var win_op = window.open('','show', str);
	var lft,tp;

	win_op.document.open();
	lft=screen.width/2;
	tp=screen.height/2;
	
	win_op.document.writeln('<html>');
	win_op.document.writeln('<head>');
	win_op.document.writeln('<title>' + del_str('<br>',' ',img_alt) + '</title>');
	win_op.document.writeln('<script>');
	win_op.document.writeln('function resize_img() {');
	win_op.document.writeln('if(document.image.width>'+screen.width+'){');
	
	win_op.document.writeln('document.image.height=document.image.height*('+screen.width+'/document.image.width);');
	win_op.document.writeln('document.image.width='+screen.width+';');
	win_op.document.writeln('}');
	
	win_op.document.writeln('if(document.image.height>'+screen.height+'-25){');
	
	win_op.document.writeln('document.image.width=document.image.width*(('+screen.height+'-25)/document.image.height);');
	win_op.document.writeln('document.image.height='+screen.height+'-25;');
	win_op.document.writeln('}');
	
	win_op.document.writeln('var lft='+(lft)+'-document.image.width/2;');
	win_op.document.writeln('var tp='+(tp)+'-document.image.height/2;');
	win_op.document.writeln('window.moveTo(lft,tp);');

	win_op.document.writeln('if (!(document.all)){ self.resizeTo(document.image.width,document.image.height); } else { self.resizeTo((document.image.width+12),(document.image.height + 31));');
	win_op.document.writeln(' }');
	
	win_op.document.writeln('}');
	win_op.document.writeln('</script>');	
	win_op.document.writeln('</head>');
	win_op.document.writeln(StrBody);
	win_op.document.writeln('<table width=\"100%\" height=\"100%\"><tr><td align=\"center\" valign=\"center\"><a href="javascript:window.close();">');
	
	win_op.document.writeln('<img name="image" id="name" src='+ img_path + ' border=0 alt="' + del_str('<br>',' ',img_alt) + '">');
	win_op.document.writeln('</a></td></tr></table></body>');
	win_op.document.writeln('</html>');		
	win_op.document.close();
}

function many_photo_win(adr, expid, photoid){	
	str = "resizable=yes,scrollbars=yes,status=no,width=200,height=200,screenX=200,screenY=200,left=50,top=50";
	
    StrBody = '<body onload="resize_img();" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="White" onblur="self.window.close();">';
		
	var win_op = window.open(adr + '?id=' + expid +'#'+ photoid,'show', str);

}

function GetCenterPosition()
{
   var send_left = (screen.availWidth / 2) - (send_width / 2);
   var send_top = (screen.availHeight / 2) - (send_height / 2);

   return "height="+send_height+",width="+send_width+",top="+send_top+",left="+send_left+",toolbar=0,scrollbars=2,resizable=no";
}
function GetCenterPosition_resize()
{
   var send_left = (screen.availWidth / 2) - (send_width / 2);
   var send_top = (screen.availHeight / 2) - (send_height / 2);

   return "height="+send_height+",width="+send_width+",top="+send_top+",left="+send_left+",toolbar=0,scrollbars=2,resizable=yes";
}

