function ShowPerfomance(id,isNew,lang)
{
	window.location="?perfomance="+id+"&new="+isNew+"&lang="+lang;
}

function ShowPageComment(num)
	{
		$("#Comments > div").hide();
		$("#Comments *:[id^=PageComment]").css({"font-weight" : "normal"});
		
		$("#PageComment_"+num).css({"font-weight" : "bold"});
		$("#MessageDiv_"+num).show();
	}

function ShowPerfomEdit()
{	
	$("#PerfomName").show();
	$("#PerfomAuthor").show();
	$("#StylePerfomance").show();
	$("#SavePerfom").show();
	$("#CanclePerfom").show();
	$("#PerfomAbout").show();
	$("#SelectPostanivshik").show();
	$("a[id=DeleteRole]").show();
	$("#AddRole").show();
	$("#ShowOnTumba").show();
	$("#Children").show();
	$("img[id=DeletePicture]").show();		
	$("input[id=AltPicture]").show();		
	$("input[id=ActorOrderID]").show();		
	//alert($("input[id=RolesIN]"));
	$("input[id=RolesIN]").show();	
	
	$("input[id=radio]").show();	
	$("#Divform").show();
	$("#ActorAboutDiv").show();
	$("#PerfomNameLabel").show();
	$("#PerfomAuthorLabel").show();
	$("#ChildrenLabel").show();
	$("#StylePerfomanceLabel").show();
	
	
	$("#Name").hide();
	$("#Author").hide();
	$("#Style").hide();
	$("#EditPerfom").hide();
	$("#About").hide();
	$("#postanovhik").hide();

	}

function DeletePerfom(id)
{
//if (ShowConfirm()==true)
if (confirm("Вы уверены, что хотите удалить этот спектакль?")==true)
	{
		$.post("ajax/deletePerfomance.php",{id:id},function () {window.location="perfomances.php";})
	}
}

function CanclePerfom()
{
//if (ShowConfirm()==true)
if (confirm("Отменить все изменения?")==true)
	{
	$("#PerfomName").hide();
	$("#PerfomAuthor").hide();
	$("#StylePerfomance").hide();
	$("#SavePerfom").hide();
	$("#CanclePerfom").hide();
	$("#ActorAboutDiv").hide();
	$("input[id=AltPicture]").hide();	
	$("a[id=DeleteRole]").hide();
	$("#AddRole").hide();
	$("img[id=DeletePicture]").hide();
	$("input[id=radio]").hide();
	$("#ShowOnTumba").hide();
	$("#Children").hide();
	$("#Divform").hide();
	$("#ChildrenLabel").hide();
	$("#StylePerfomanceLabel").hide();
	$("input[id=ActorOrderID]").hide();		
	$("input[id=RolesIN]").hide();	
	$("#PerfomNameLabel").hide();
	$("#PerfomAuthorLabel").hide();
	
	$("#Name").show();
	$("#Author").show();
	$("#Style").show();
	$("#EditPerfom").show();
	$("#About").show();
	
	}
}


function SavePerfom(lang)
{
//if (ShowConfirm()==true)
//if (confirm("Are you sure?")==true)
	{
		
		var editor_data = CKEDITOR.instances.AboutText.getData();
		$("#AboutText").text(editor_data);
		query = $('#Perfomance').serialize();
		query += '&text'+'='+editor_data+'&lang='+lang;
				$.post("ajax/editPerfomance.php",query,function (data) {if (data!="") alert(data); else window.location="perfomances.php";})
	}
}

function AddNew(lang)
{
	$.post("ajax/AddNew.php",{tablename:"perfomance"},function (data) {ShowPerfomance(data,"yes",lang);});
}


function addMessage()
{
	$.post("ajax/messages/addMessage.php",{Author:$("#AuthorMessage").attr("value"),text:$("#text").attr("value"),idPerfomance:$("#idPerfomanceMessage").attr("value")},function (data)
	{
		$("#AuthorMessage").attr("value","");
		$("#text").attr("value","");
		//showShadowAND_Hide(data);
		showShadowAND_Hide('Ваш комментарий будет проверен админом.');
	}
	
	);
}

function DeleteMessage(id)
{
		if (confirm("Удалить коммент?"))
	{
	$.post("ajax/messages/deleteMessage.php",{id:id});
	$("#Message"+id).remove();}
}

function ConfirmMessage(id)
{
	$("#Message"+id).css({"background-color":"#FFFFFF"});
	$.post("ajax/messages/confirmMessage.php",{id:id});
	$("#ConfirmMessage"+id).remove();
}

function Ratio(IncDec,id)
{
	$.post("ajax/IncDecRatio.php",{idPerfomance:id,IncDec:IncDec*1},function (data){});
	x = $("#Ratio").html()*1+IncDec*1;
	$("#Ratio").text(x);
	$("#PlusRatio").hide();
	$("#DecRatio").hide();
	$("#AlreadyRatio").show();
	$.cookie("ChangeRatio"+id,"yes");
}


