function loadState(x1,y1,x2,y2)
{
	showCropper = false;
	switchCropper();
	imageCropper.loadState(x1,y1,x2,y2);
	window,scrollTo(0, 150);
}
function saveState()
{
	var comm = dom.gI('comment');
	comm.value += imageCropper.saveState();
}
function switchCropper()
{
	if (showCropper)
	{
		showCropper = false;
		dom.gI('b_cr').src="/img/icon_crop_off.gif";
		imageCropper.hideMe();
	}
	else
	{
		showCropper = true;
		dom.gI('b_cr').src="/img/icon_crop_on.gif";
		imageCropper.showMe();
	}
}
function switchBW()
{
	isBW = !isBW;
	if (isBW)
	{
		dom.gI('b_bw').src="/img/icon_bw_on.gif";
	}
	else
	{
		dom.gI('b_bw').src="/img/icon_bw_off.gif";
	}
	imas = dom.gI('im');
	imas.style.filter = "Gray";
	imas.filters["Gray"].enabled = isBW;
}
function maxArea(ev)
{
	imageCropper.maximizeArea(ev);
}
function crop(x1,y1,x2,y2)
{
	imageCropper.loadState(x1,y1,x2,y2);
	showCropper = true;
	imageCropper.showMe();
	dom.gI('save').style.display="";
	isBW = false;
}
function switchGoldS()
{
	if (showGoldS)
	{
		showGoldS = false;
		dom.gI('b_gs').src="/img/icon_gold_off.gif";
		imageCropper.hideGoldS();
	}
	else
	{
		showGoldS = true;
		dom.gI('b_gs').src="/img/icon_gold_on.gif";
		imageCropper.showGoldS();
		if (!showCropper)
		{
			switchCropper();
		}
	}
}
function setBG(ob)
{
	var i_pad = dom.gI('ipad');
	i_pad.style.backgroundColor = ob.style.backgroundColor;
}
function setBrightness(ob)
{
	var opacity = 100 - Math.abs(ob)*10;
	var o = dom.gI('im');
	var h = dom.gI('holdr');
	if (ob > 0)
	{
		h.style.backgroundColor = '#FFFFFF';
	}
	else
	{
		h.style.backgroundColor = '#000000';
	}
	o.style.filter = "alpha(opacity:"+opacity+",style=0)";
	o.style.KHTMLOpacity = opacity/100;
	o.style.MozOpacity = opacity/100;
	o.style.opacity = opacity/100;
	isBW = false;
	dom.gI('b_bw').src="/img/icon_bw_off.gif";
}
function centerImage()
{
	dom.gI('holdr').style.left = (document.body.clientWidth - parseInt(imas.style.width))/2+'px';
}
