function fConfirm(href) 
{
	if (confirm("Вы действительно хотите провести операцию удаления?"))
		location.href = href;
}

function fGenList(type,ownerId) 
{
	eval('document.getElementById("'+type+'").innerHTML = "<div>загрузка...</div>"');
	window.open('/genlist.php?type='+type+'&ownerId='+ownerId+'&rand='+Math.random(), '_gen_list');
}

function fChangeCity(id) 
{
	location.href = "/city"+id+"/index.html";
}

function fChangeFormCity(id,name) 
{
	if (name=="")
	{
		obj = document.forms.reg.city;
		if (obj)
			for(i=0;i<obj.options.length;i++)
				eval("if (obj.options["+i+"].value == id) name = obj.options["+i+"].innerHTML;");
	}

	document.forms.reg.cityId.value = id;
	document.forms.reg.cityName.value = name;
	document.getElementById("selformcity").style.display = "none";
	
		if(document.getElementById('district'))
		{
			document.getElementById('district').innerHTML = "<div>загрузка...</div>";
			window.open('/genlist.php?type=district&ownerId='+id+'&rand='+Math.random(), '_gen_list');
		}
}

function fSaveCity(obj)
{
	if(obj.checked==true)
		window.open('/genlist.php?cityCookie='+obj.value+'&rand='+Math.random(), '_gen_list');
	else
		window.open('/genlist.php?cityCookie='+0+'&rand='+Math.random(), '_gen_list');
}

function fBlock(name,type)
{
	if (1==type)
		eval('document.getElementById("'+name+'").style.display = "block"');
	else
		eval('document.getElementById("'+name+'").style.display = "none"');
}

function fFotoBlock(type)
{
	if (1==type)
	{
			if(document.getElementById("ok"))
				document.getElementById("ok").style.display = "none";

		document.getElementById("addFotoPlace").style.display = "block";
		document.getElementById("addFotoBlock").style.display = "block";
		document.getElementById("addFotoButton1").style.display = "none";
	}
	else
	{
		document.getElementById("addFotoPlace").style.display = "none";
		document.getElementById("addFotoBlock").style.display = "none";
		document.getElementById("addFotoButton1").style.display = "block";
	}
}

function fEditReview(fid,id,v)
{ 
	var editText = document.getElementById('text'+id);
	var editForm = document.getElementById('edit'+id);

	
	if(1==v) 
	{
		var text = editText.innerHTML.split("<br>").join("");
		text = text.split("<BR>").join("");
		text = text.split("<br />").join("");
		text = text.split("<BR />").join("");

		editForm.innerHTML = '<form action="/freview'+fid+'.html#'+id+'" method="post"><table cellpadding="0" cellspacing="0" class="t"><tr><td class="tl2"><div>&#160;</div></td><td class="tc2"><div><textarea name="txt" rows="5">'+text+'</textarea></div><input type=hidden name="editid" value='+id+'><input type=image src="/im/frm_ch.gif" name="editfrm" value="Изменить">&nbsp;<a href="" OnClick="fEditReview(0,'+id+',0);return false;"><img src="/im/frm_cancel.gif" alt="Отмена" class="can"></a></td><td class="tr2"><div>&#160;</div></td></tr><tr><td class="t2l2">&#160;</td><td class="t2c2">&#160;</td><td class="t2r2">&#160;</td></tr></table><br/>';
		editForm.style.display = "block";
	}
	else
	{
		editForm.innerHTML = "";
		editForm.style.display = "none";
	}
}

function fiMagick(params) 
{
	if (params!="")
		window.open('imagick/imagick.php?'+params+'&rand='+Math.random(), '_gen_list');
}

