
$(document).ready(function(){if(typeof(publishId)!='undefined'){$('.btnSave a').text('Publishing...');$('#ulCancel').hide();$('#progressBar').dpProgress();$('#progressBar').bind('finished',finishedProgress);getPublishProgress();}
else{$('#publishLibrary').click(showPublishDlg);$('#btnCancelPublish').click(cancelPublishLibrary);}});function getPublishProgress(){var params={publishId:publishId};$.ajax({type:'POST',contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify(params),url:_reposRoot+'/ProcessDefinition.asmx/GetPublishProgress',success:function(data){onGotProgress(data);}});}
function finishedProgress(){$('#ulSave').hide();$('#ulCancel').show();$('#ulCancel li a').text('Back to library');}
function onGotProgress(data){$('#publishMsg').text(data.d.Message);$('#progressBar').dpProgress('progress',data.d.Percent);if(data.d.Percent<100)
setTimeout(getPublishProgress,1000);else
$('#waitMsg').hide();}
function showPublishDlg(){$('#publishLibraryDlg').slideUp('fast');$('#publishLibraryDlg').insertAfter('#pnlPublishControls');$('#publishLibraryDlg').css({'top':$(this).position().top,'right':$(window).width()-($(this).parent().position().left+($(this).parent().outerWidth()))}).slideDown('fast',function(){});return false;}
function publishLibrary(){$('#publishLibraryDlg').slideUp('fast');if(Page_ClientValidate('titleVer')){$('.btnSave a').text('Publishing...');}
else
return false;}
function cancelPublishLibrary(){$('#publishLibraryDlg').slideUp('fast');return false;}