
function metadataLoaded(){var frameDoc=this.contentWindow?this.contentWindow.document:this.contentDocument?this.contentDocument:this.document;var newHeight=frameDoc.body.scrollHeight;if(newHeight<1)
newHeight=frameDoc.body.offsetHeight;$(this).height(newHeight+'px');}
function addMetadataTabs(){var checkLinks=[];var checkNames=[];$("#autoLinkProperties a[href]").each(function(){checkLinks[checkLinks.length]=$(this).attr('href');var prevH=$(this).prevALL('h2');if(prevH.length>0)
checkNames[checkNames.length]=$(prevH[0]).text();else
checkNames[checkNames.length]='Description';});$.ajax({type:'POST',contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify({processLinks:checkLinks,sectionNames:checkNames,processId:processId,taskId:thisTaskId}),url:_reposRoot+'/ProcessDefinition.asmx/GetProcessLinkSectionNames',success:function(data){onGotLinkSectionNames(data);}});}
function onGotLinkSectionNames(data){var html="";for(var i=0;i<data.d.length;i++){if(i==0&&data.d[i]=="Data")
html+="<li class=\"ui-state-default ui-corner-top metadataTab metadataData\"><a href=\"#tabsProjectMetadata\" >"+data.d[i]+"</a></li>";else
html+="<li class=\"ui-state-default ui-corner-top metadataTab\"><a href=\"#tabsProjectMetadata\" >"+data.d[i]+"</a></li>";}
$('#ifMetadataTabs').replaceWith(html);$("#tabs").tabs({select:function(ev,ui){onSelectDataTab(ev,ui);},show:function(ev,ui){onShowPostTab(ev,ui);}});}
function onSelectDataTab(ev,ui){$('#ifLinkedMetadata').attr('src',rootDir+"/metadataloading.htm");var tabSel=$(ui.tab).parent();if(tabSel.hasClass('metadataTab')){showMetadata(tabSel.text(),tabSel.hasClass('metadataData'));}}