
$(document).ready(function()
{$("#procSelectList").accordion({collapsible:true,autoHeight:false,active:-1});jQuery.extend(jQuery.expr[":"],{containsNoCase:function(a,i,m){return a.innerHTML.toUpperCase().indexOf((m[3]).toUpperCase())!=-1;}});$('#txtFilter').keypress(function(e){if(e.keyCode==13){filterChanged();return false;}});$('.stcheck').click(function(){$(this).toggleClass('stchecked');filterChanged();});});function filterChanged()
{var ftFilter=$('#chkStepUseFtSearch').hasClass('stchecked');var filterText=$('#txtFilter').val();var compTypeOnly=null;if($('#chkFilterToType').hasClass('stchecked'))
{compTypeOnly=_filterProcessType;}
if(ftFilter){$.ajax({type:'POST',contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify({q:filterText,limit:9999,timestamp:''}),url:_reposRoot+'/ProcessDefinition.asmx/GetProcesses',success:function(data){$("#procSelectList li").attr('flt','yes');for(var i=0;i<data.d.length;i++){var itm=$("#procSelectList li.pid_"+data.d[i].ProcessId).attr('flt','no');if(compTypeOnly){itm.not('.ptid_'+compTypeOnly).attr('flt','yes');}}
$("#procSelectList li[flt='no']").css('display','');$("#procSelectList li[flt='yes']").css('display','none');$("#procSelectList h3").css('display','none');var visDiv=$("#procSelectList div:has(li[flt='no'])");visDiv.each(function(i){var pNodes=$(this).prev();var lstHead=pNodes.eq(0);lstHead.css('display','');});showHideSearchResults(filterText);$('#procSelectList').accordion('activate',false);}});}
else{$("#procSelectList li").attr('flt','no');$("#procSelectList li:not(:containsNoCase('"+filterText+"'))").attr('flt','yes');if(compTypeOnly){$('#procSelectList li').not('.ptid_'+compTypeOnly).attr('flt','yes');}
$("#procSelectList li[flt='no']").css('display','');$("#procSelectList li[flt='yes']").css('display','none');$("#procSelectList h3").css('display','none');var visDiv=$("#procSelectList div:has(li[flt='no'])");visDiv.each(function(i){var pNodes=$(this).prev();var lstHead=pNodes.eq(0);lstHead.css('display','');});$('#procSelectList').accordion('activate',false);showHideSearchResults(filterText);}}
function showHideSearchResults(filterText){if(filterText==''){$("#procSelectList h3.ui-accordion-header.tagProcListSearchResults").css('display','none');$("#procSelectList div.ui-accordion-content.tagProcListSearchResults").css('display','none');}
else{$("#procSelectList h3.ui-accordion-header:not(.tagProcListSearchResults)").css('display','none');$("#procSelectList div.ui-accordion-content:not(.tagProcListSearchResults)").css('display','none');$("#procSelectList h3.ui-accordion-header.tagProcListSearchResults").css('display','block');$("#procSelectList div.ui-accordion-content.tagProcListSearchResults").css('display','block');}}
function getHtml()
{var ret="";if($("input:checkbox:checked").length>0)
{if($("input:checkbox:checked").length==1)
{ret="<a href='"+$($("input:checkbox:checked")[0]).val()+"'>"+$('label',$("input:checkbox:checked").eq(0).parent()).html()+"</a>";}
else
{ret="";$("input:checkbox:checked").each(function()
{if(ret.length==0){ret="<p>";}
else{ret=ret+"<br/>";}
ret=ret+"<a href='"+$(this).val()+"'>"+$('label',$(this).parent()).html()+"</a>";});ret=ret+"</p>";}}
return ret;}
function getAbsoluteHtml(){var ret="";if($("input:checkbox:checked").length>0){if($("input:checkbox:checked").length==1){ret="<a href='"+_reposRoot+"/"+$($("input:checkbox:checked")[0]).val()+"'>"+$('label',$("input:checkbox:checked").eq(0).parent()).html()+"</a>";}
else{ret="";$("input:checkbox:checked").each(function(){if(ret.length==0){ret="<p>";}
else{ret=ret+"<br/>";}
ret=ret+"<a href='"+_reposRoot+"/"+$(this).val()+"'>"+$('label',$(this).parent()).html()+"</a>";});ret=ret+"</p>";}}
return ret;}