var max_zoom=3;

jQuery.fn.canvas_zoom=function (params)
{
	if (load_dots_y.length) { return; }
	params=jQuery.extend({zoom_plus:0, zoom:zoom}, params);
	
	zoom=params.zoom;
	var zom_ok=false;
	if (params.zoom_plus==0) { zom_ok=true; }
	if ((params.zoom_plus==1)&&(zoom>1)) // Plus
	{
		zoom--;
		zom_ok=true;
	}
	if ((params.zoom_plus==-1)&&(zoom<2)) // Minus
	{
		zoom++;
		zom_ok=true;
	}
	if (zom_ok)
	{
		if (zoom==1)
		{
			$(".zoom_but").removeClass("zoom_img_plus").addClass("zoom_img_minus");
		}
		if (zoom==2)
		{
			$(".zoom_but").removeClass("zoom_img_minus").addClass("zoom_img_plus");
		}
		//$(".dot_info").remove();
		update_dot_size();
		new_dots();
		load_dots();
	}
	test("zoom: "+zoom);
	return this;
};


jQuery.fn.zoom_but=function ()
{
	$(this).each(function ()
	{
		$(this).click(function ()
		{
			if (zoom==1)
			{
				$(cdrag).canvas_zoom({zoom: 2});
				
			}
			else if (zoom==2)
			{
				$(cdrag).canvas_zoom({zoom: 1});
				$(this).removeClass("zoom_img_plus").addClass("zoom_img_minus");
			}
		});
	});
	
	return this;
};

function update_dot_size()
{
	
		dot_height=dot_height_const/zoom;
		dot_width=dot_width_const/zoom;
}