IE=navigator.appName==="Microsoft Internet Explorer";
Opera=navigator.appName==="Opera";
//alert(IE);
function zoom(src,w,h) {
	
	if (typeof w == "undefined" & typeof h == "undefined"){ 
	//На старой корсике в тексте были картинки. У них у всех был zoom, но без размеров файла
	//поэтому наша стандартная функция не срабатывала. Добавила этот if, что бы при отсутсвии w и h открывать окно опред. разм.
	//а если w и h есть, то как всегда, размер окна по размеру фотографии
			var win = null;
			var i = 0;
			
			w = 680
			h = 520
			
			LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
			TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
			settings =
			'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes'+scroll+',resizable'
			win = window.open('zoom.php?photo='+src, "zoom"+i, settings)
			//i++;
			if(win.window.focus){win.window.focus();}
	}else{	
			ww=w;
			wh=h;	
	
			sb="no";
			if(ww>900) {ww=900; sb='yes';}
			if(wh>700) {wh=700; sb='yes';}
			
			lp = (screen.width) ? (screen.width-ww)/2 : 0;
			tp = (screen.height) ? (screen.height-wh)/2 : 0;
			
			
			
			html='<html><head><title>Zoom</title>'+'</head><body bgcolor=#FFFFFF leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 >'+
					'<a href="javascript:self.close()"><img src="'+src+'" border=0 title="" width='+w+' height='+h+'></a></body></html>';
		  
				if (IE) {
					ww = ww-2;
					wh = wh-2;   
		win=window.open('','_blank','width='+ww+',height='+wh+',resizable=no'+',top='+tp+',left='+lp+',scrollbars='+sb+',status=no');
				
				}
				else {
					//alert(Opera);
					if(Opera) win=window.open(src,'_blank','width='+ww+',height='+wh+',resizable=no'+',top=100,left=100,scrollbars='+sb+',status=no');
					else win=window.open(src,'_blank','width='+ww+',height='+wh+',resizable=no'+',top='+tp+',left='+lp+',scrollbars='+sb+',status=no');
				}
				win.document.open();
				win.document.write(html);
				win.document.close();
				win.focus();
				//win.resizeTo(ww,wh);
	}
}

function refr(id){
	obj=document.getElementById(id);
	obj.src=obj.src;
	
}

function crop(file,w,h,img){
	w=w+45;
	h=h+110;
	win=window.showModalDialog("/crop.php?filename="+file,"","dialogHeight:"+h+"px; dialogWidth:"+w+"px; resizable:no; status:no; help:no; scroll:no");
	
	if(win) setTimeout("refr('"+img+"')",3000);
}
