
var _loadEvent=0;$("document").ready(function()
{$('#txtLibDomain').keyup(function(){checkDomain();});$('#btnCreateLibrary').click(function(){createRepository();});$('#txtLibDomain').focus();});function checkDomain()
{_loadEvent++;var dSend={repositoryName:$('#txtLibDomain').val()};$.ajax({type:'POST',contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify(dSend),url:_reposRoot+'/ProcessDefinition.asmx/CheckLibraryName',success:function(data){onGotCheck(data,_loadEvent);}});}
function onGotCheck(data,loadEvent)
{if(loadEvent==_loadEvent)
{displayFeedback(data);}}
function displayFeedback(data)
{if(data.d.Allowed)
{$('#nameFeedback').removeClass('ui-state-error');}
else
{$('#nameFeedback').addClass('ui-state-error');}
$('#nameFeedback').text(data.d.Message);}
function createRepository()
{var repos=$('#txtLibDomain').val();var dSend={repositoryName:repos};$.ajax({type:'POST',contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify(dSend),url:_reposRoot+'/ProcessDefinition.asmx/CreateRepository',success:function(data){onCreatedRepository(repos,data);}});}
function onCreatedRepository(repos,data)
{if(data.d.Allowed)
{window.location.href=siteScheme+repos+siteRoot;}
else
{displayFeedback(data);}}