
var selectedProcessType;$(document).ready(function()
{$(".processTypeDelete").hover(function(){$(this).fadeTo("fast",1);},function(){$(this).fadeTo("fast",.3);}).click(function(){checkProcessTypeNotUsed($(this));});$("#dialogDeleteConfirmation").dialog({autoOpen:false,bgiframe:true,resizable:false,height:140,modal:true,overlay:{backgroundColor:'#000',opacity:0.5},buttons:{Cancel:function()
{$(this).dialog('close');},'Ok':function()
{$(this).dialog('close');deleteProcessType();}}});$("#dialogProcessInUse").dialog({autoOpen:false,bgiframe:true,resizable:false,height:140,modal:true,overlay:{backgroundColor:'#000',opacity:0.5},buttons:{'Ok':function()
{$(this).dialog('close');}}});$('#ctl00_ctl00_ContentBody_ContentMain_btnFinishMetrics').click(function(){$(this).fadeTo('fast',0.2);});});var _processTypeId;function checkProcessTypeNotUsed(processTypeElement)
{_processTypeId=processTypeElement.attr("ptid");selectedProcessType=$(processTypeElement[0].parentNode);$.ajax({type:'POST',contentType:"application/json; charset=utf-8",dataType:"json",data:"{'processTypeId':'"+_processTypeId+"'}",url:_reposRoot+'/ProcessDefinition.asmx/IsProcessTypeInUse',success:function(data){checkProcessTypeNotUsedResult(data);}});}
function checkProcessTypeNotUsedResult(data)
{if(data.d==true)
{$("#dialogProcessInUse").dialog("open");}
else
{$("#dialogDeleteConfirmation").dialog("open");}}
function deleteProcessType()
{$.ajax({type:'POST',contentType:"application/json; charset=utf-8",dataType:"json",data:"{'processTypeId':'"+_processTypeId+"'}",url:_reposRoot+'/ProcessDefinition.asmx/DeleteProcessType',success:function(data){processTypeDeleted();}});}
function processTypeDeleted()
{selectedProcessType.slideUp("normal");}