
var DOMLoaded=false;var launchPad__LastModuleOrder='';var launchPad_CurrentModuleDragging='';$(document).ready(function(){DOMLoaded=true;$('.launchPad__DropZoneHolder').hover(function(){$(this).find('.launchPad_dropZoneBarInner').show(0);},function(){$(this).find('.launchPad_dropZoneBarInner').hide(0);});$('.launchPad_ModuleLIWrapper').each(function(){$(this).hover(function(){$(this).addClass('launchPad_ModuleWrapperHover');$(this).find('.launchPad_ModuleEditBar').show(0);$(this).find('.launchPad_ModuleNameBar').remove();var moduleNameBar=$('<div class="launchPad_ModuleNameBar"><div>'+$.base64Decode($(this).find('.launchPad_ModuleSpanWrapper').attr('rel'))+'</div></div>');moduleNameBar.css('opacity','0.75').click(function(){$(this).hide(0);});$(this).find('.launchPad_ModuleEditBar').before(moduleNameBar);window.setTimeout(function(){moduleNameBar.fadeOut(250,function(){moduleNameBar.remove();});},2000);},function(){$(this).find('.launchPad_ModuleEditBar').hide(0);$(this).removeClass('launchPad_ModuleWrapperHover');$(this).find('.launchPad_ModuleNameBar').remove();});});$('.formRowContent input, .formRowContent textarea, .formRowContent select').live('focus',function(){$(this).parents('.formRow:first').siblings('.formRow').removeClass('formRowFocus');$(this).parents('.formRow:first').addClass('formRowFocus');return true;});$('.launchPad_button').live('mouseover',function(){$(this).addClass('launchPad_buttonHover');});$('.launchPad_button').live('mouseout',function(){$(this).removeClass('launchPad_buttonHover');});$('.formRowContent').live('click',function(){$(this).parents('.formRow:first').siblings('.formRow').removeClass('formRowFocus');$(this).parents('.formRow:first').addClass('formRowFocus');return true;});$('.formRowContent input, .formRowContent textarea, .formRowContent select').live('blur',function(){$(this).parents('.formRow:first').removeClass('formRowFocus');return true;});$('.translationAdmin').live('mouseover',function(){var translationAdminContainer=$(this);if(translationAdminContainer.find('.translationAdminLink').length==0){var translationAdminLink=$('<img src="/__resource/LaunchPad.Core/Resources.Images/edit_icon_small.gif" style="border:0;vertical-align:middle;" alt="Edit Translation" class="translationAdminLink" />');$(this).prepend(translationAdminLink);translationAdminLink.css('cursor','pointer');translationAdminLink.click(function(){$.shade(function(){},250);$('#shadeContent').dataObjectForm({type:'LaunchPad.Core.Translation',template:'CreateEdit',dataObjectId:translationAdminContainer.attr('rel'),onCancel:function(){$('#shade,#shadeContentHolder').remove();}});});$(this).find('.translationAdminLink').hover(function(){translationAdminContainer.data('noRemove',true);},function(){translationAdminContainer.data('noRemove',false);});}});$('.translationAdmin').live('mouseout',function(){var translationAdminContainer=$(this);window.setTimeout(function(){if(translationAdminContainer.data('noRemove')!==true){translationAdminContainer.find('.translationAdminLink').remove();}},100);});});$.postJSON=function(url,data,callback){$.post(url,data,callback,"json");};var _GLOBAL_LoadingHTML='<img src="/__resource/LaunchPad.Core/Resources.Images/loading_alt.gif" style="border:0;" class="launchPad_icon" alt="" /> Loading...';function killEvent(e){e.cancelBubble=true;e.returnValue=false;if(e.stopPropagation){e.stopPropagation();e.preventDefault();}}
function __mps(text){if(text&&text.indexOf){if(text.indexOf('/')>-1){text=text.replace(/\//g,'{{SLASH}}');}
if(text.indexOf('&')>-1){text=text.replace(/\&/g,'{{ANDAMP}}');}
if(text.indexOf('&')>-1){text=text.replace(/\+/g,'{{PLUS}}');}}
return text;}
function __fnMakeUpdateCall(type,method,params,onComplete){__fnMakeCustomUpdateCall('/__service/'+type+'/'+method+'/default.aspx','POST','__ServiceParameters='+params,onComplete);}
function __fnMakeCustomUpdateCall(url,verb,body,onComplete){switch(verb.toLowerCase()){case'get':$.get(url,onComplete);break;case'post':$.post(url,body,onComplete);break;}}
function launchPadLogOut(callback){$.postJSON('/__service/LaunchPad.Core.LaunchPadUser/DoLogout',{logout:1},function(logOutResponse){if(typeof callback!='undefined'&&callback){callback(logOutResponse);}});}
var launchPad_ShadeCheck=function(setCallback){if($('#shade:visible').length>0){var shadeContentHolder=$('#shadeContentHolder');var shadeContent=$('#shadeContent');var titleCount=$('#shadeContentHolder .shadeTitle').length;if(titleCount>0){shadeContentHolder.css('padding','0px');$('#shadeContentHolder .shadeTitle').each(function(){$(this).css('cursor','move');if($(this).parent().attr('id')!='shadeContentHolder'){$(this).prependTo(shadeContentHolder);}else if(titleCount>1){$(this).remove();}});if(!$('#shadeContentHolder').hasClass('ui-draggable')){$('#shadeContentHolder').draggable({handle:'.shadeTitle',stop:function(evt,ui){launchPad_UpdateShadeSettings();}});}}
var baseHeight=parseInt(shadeContentHolder.height());var mainTitleHeight=$('#shadeContentHolder .shadeTitle:first').length>0?parseInt($('#shadeContentHolder .shadeTitle:first').height()):0;var submitRowHeight=(shadeContent.find('.submitRow').length>0?(shadeContent.find('.submitRow').outerHeight(true)+30):35);shadeContent.css('height',parseInt(baseHeight-(submitRowHeight+mainTitleHeight))+'px');shadeContentHolder.css({});if(setCallback){window.setTimeout(function(){launchPad_ShadeCheck(true);},100);}}};$.shadeClose=function(){$('#shade,#shadeContentHolder,#shadeContent').remove();};$.shade=function(closeCallback,customHeight,backgroundColour){if(launchPadShadeSettings.h>-1){customHeight=launchPadShadeSettings.h;}else{if(!customHeight){customHeight=480;}}
if(!backgroundColour){backgroundColour='#fff';}
$('#shade').remove();var shade=$('<div id="shade"></div>');shade.css({opacity:0.8});var width=launchPadShadeSettings.w;if(width==-1){width=720;}
var top=launchPadShadeSettings.t;if(top==-1){top=parseInt((parseInt($(window).height()-(customHeight+10))/2)+$(window).scrollTop());}
var left=launchPadShadeSettings.l;if(left==-1){left=parseInt(parseInt($(window).width()-width)/2);}
$('body').append(shade);var shadeContentHolder=$('<div id="shadeContentHolder"><div id="shadeClose"><img src="/__resource/LaunchPad.Core/Resources.Images/cross.gif" alt="Close" /></div></div>');shadeContentHolder.addClass('shadeColor_'+backgroundColour.replace('#',''));var shadeContent=$('<div id="shadeContent"></div>');shadeContentHolder.css({height:customHeight+'px',width:width+'px',left:left+'px',top:top+'px',background:backgroundColour});shadeContentHolder.append(shadeContent);$('body').append(shadeContentHolder);$.shadeClose=function(){if(closeCallback&&typeof closeCallback=='function'){closeCallback();}
$('#shade,#shadeContentHolder').remove();};shade.click($.shadeClose);$('#shadeClose').click($.shadeClose);shadeContentHolder.resizable({resize:function(evt,ui){launchPad_ShadeCheck(false);},stop:function(evt,ui){launchPad_UpdateShadeSettings();}});launchPad_ShadeCheck(true);};var launchPad_UpdateShadeSettings=function(){var shadeContentHolder=$('#shadeContentHolder');if(shadeContentHolder.length>0){launchPadShadeSettings.t=parseInt(shadeContentHolder.css('top'));launchPadShadeSettings.l=parseInt(shadeContentHolder.css('left'));launchPadShadeSettings.w=parseInt(shadeContentHolder.width());launchPadShadeSettings.h=parseInt(shadeContentHolder.height());$.invoke('LaunchPad.Core.Web.Controls.LaunchPadEditor/UpdateShadeSettings',[launchPadShadeSettings.t,launchPadShadeSettings.l,launchPadShadeSettings.w,launchPadShadeSettings.h],function(r){});}};(function($){$.fn.type=function(callback,timeout){return this.keyup(function(e){var thisRef=$(this);var thisVal=thisRef.val();window.setTimeout(function(){if(thisVal==thisRef.val()){callback();}},timeout);return true;});};})(jQuery);(function($){$.fn.enterPressed=function(callback){return this.keypress(function(e){var code=e.keyCode||e.which;if(code==13){return callback();}
return true;});};})(jQuery);(function($){$.fn.escapePressed=function(callback){return this.keypress(function(e){var code=e.keyCode||e.which;if(code==27){return callback();}
return true;});};})(jQuery);(function($){$.fn.notification=function(message,timeout,callback){return $(this).each(function(){var me=$(this);me.prepend($('<div class="launchPadNotification" style="display: none;">'+message+'</div>'));var note=me.find('.launchPadNotification');if(me.css('textAlign')=='left'){note.css({position:'relative',left:parseInt((parseInt(me.width())-parseInt(note.width()))/2)+'px'});}
note.fadeIn(250);note.click(function(){$(this).fadeOut(250,function(){$(this).remove();});if(typeof callback!='undefined'&&callback){callback();}});if(typeof timeout!='undefined'){window.setTimeout(function(){note.fadeOut(250,function(){note.remove();});if(typeof callback!='undefined'&&callback){callback();}},timeout);}});}})(jQuery);function launchPadUpdateModuleOrder(){var moduleOrders=[];$('.launchPad__DropZoneHolder').each(function(){var modules=[];var zoneID=$(this).attr('rel');var listid='';$('.launchPad__DropZone').each(function(){if($(this).attr('rel')==zoneID){listid=this.id;}});var listOrder='';if(listid!=''){$('#'+listid+' .launchPad_ModuleLIWrapper').each(function(){listOrder+=$(this).attr('rel')+'|';});}
moduleOrders.push(listOrder);});return moduleOrders;}
$(document).ready(function(){launchPad__LastModuleOrder=$.compactJSON(launchPadUpdateModuleOrder());});(function($){$.invoke=function(method,parameterArray,callback){var invokeParams={method:method};$(parameterArray).each(function(paramIndex,item){invokeParams['invokeParam_'+(paramIndex<10?'00':'0')+paramIndex.toString()]=$.compactJSON(item);});$.postJSON('/__invoke',invokeParams,callback);}})(jQuery);(function($){$.fn.deleteDataObject=function(dataObjectId,dataObjectType,onSuccess){$.invoke('LaunchPad.Core.DataObject/DeleteDataObjectIfAuthorised<'+dataObjectType+'>',[dataObjectId],function(json){if(json.error&&json.error.length>0){}else{onSuccess();}});}})(jQuery);(function($){$.fn.deleteDataObjects=function(dataObjectIds,dataObjectType,onSuccess){$.invoke('LaunchPad.Core.DataObject/DeleteDataObjectsIfAuthorised<'+dataObjectType+'>',[dataObjectIds],function(json){if(json.error&&json.error.length>0){}else{onSuccess();}});}})(jQuery);(function($){$.fn.renderTemplate=function(type,template,instance,callback){$(this).setRenderTemplate(type,template,instance,null);$(this).render(callback);}})(jQuery);(function($){$.fn.setRenderTemplate=function(type,template,instance,callback){return $(this).each(function(){var thisRef=this;if(typeof instance=='undefined'||instance==null){instance='';}
var renderData={type:type,template:template,instance:instance,callback:callback};$(this).data('launchPadRenderTemplate',renderData);});}})(jQuery);(function($){$.fn.render=function(callback){return $(this).each(function(){var thisRef=this;var renderTemplate=$(this).data('launchPadRenderTemplate');if(typeof renderTemplate!='undefined'&&renderTemplate){$.postJSON('/__service/LaunchPad.Core.ObjectTemplate/RenderTemplateT='+renderTemplate.type,{Template:renderTemplate.template,Instance:renderTemplate.instance},function(renderTemplateResponse){$(thisRef).html(renderTemplateResponse.markup);if(typeof renderTemplate.callback=='function'){renderTemplate.callback(renderTemplateResponse);}
if(typeof refreshTriggers[thisRef.id]!='undefined'){$(refreshTriggers[thisRef.id]).each(function(){this();});}
$(thisRef).find('*').each(function(){var subElementId=$(this).attr('id');if(subElementId.length>0&&typeof refreshTriggers[subElementId]!='undefined'){$(refreshTriggers[subElementId]).each(function(){this();});}});if(typeof callback!='undefined'&&callback){callback(renderTemplateResponse);}});}});}})(jQuery);var refreshTriggers={};$.refreshTrigger=function(id,trigger){if(typeof refreshTriggers[id]=='undefined'||!refreshTriggers[id]){refreshTriggers[id]=[];}
if(typeof trigger!='function'){switch(trigger){case'clear':refreshTriggers[id]=[];break;case'clearRecurse':$('#'+id+' *').each(function(){if($(this).attr('id').length>0){$.refreshTrigger($(this).attr('id'),'clear');}});break;}}else{refreshTriggers[id].push(trigger);}};(function($){$.fn.refresh=function(callback){return $(this).each(function(){var thisRef=this;var renderTemplate=$(this).data('launchPadRenderTemplate');var renderMethod=$(this).data('refreshMethod');if(typeof renderMethod=='function'){renderMethod($(this),callback);}else if(typeof renderTemplate!='undefined'&&renderTemplate){$(this).render(callback);}else{$.get(location.href,function(getPageResponse){var refreshableStart='<!--RefreshableStart_'+thisRef.id+'-->';var refreshableEnd='<!--RefreshableEnd_'+thisRef.id+'-->';getPageResponse=getPageResponse.substr(getPageResponse.indexOf(refreshableStart)+refreshableStart.length);getPageResponse=getPageResponse.substr(0,getPageResponse.indexOf(refreshableEnd));$(thisRef).html(getPageResponse);if(typeof refreshTriggers[thisRef.id]!='undefined'){$(refreshTriggers[thisRef.id]).each(function(){this();});}
$(thisRef).find('*').each(function(){var subElementId=$(this).attr('id');if(subElementId.length>0&&typeof refreshTriggers[subElementId]!='undefined'){$(refreshTriggers[subElementId]).each(function(){this();});}});if(typeof callback!='undefined'&&callback){callback();}});}});}})(jQuery);(function($){$.fn.dataObjectPicker=function(options){var dopBaseNamespace='LaunchPad.Core.Web.Controls.DataObjectPickerControlWrapper/';var existingWrapper=$(this).next('.dataObjectPickerWrapper');if(existingWrapper.length>0){existingWrapper.remove();}
var picker=$('<div class="dataObjectPickerWrapper">'+_GLOBAL_LoadingHTML+'</div>');$(this).after(picker);$.invoke(dopBaseNamespace+'Get'+(options.multiSelect?'':'SingleSelect')+'ControlMarkup',[options.type,$(this).attr('id')],function(r){picker.html(r.markup);});return $(this);}})(jQuery);(function($){$.fn.fileResourcePicker=function(options){var frpBaseNamespace='LaunchPad.Core.Web.Controls.FileResourcePickerControl/';var picker=$('<div class="fileResourcePicker">'+_GLOBAL_LoadingHTML+'</div>');$(this).after(picker);$.invoke(frpBaseNamespace+'GetControlMarkup',[options.filterType,options.parentFieldId,$(this).attr('id')],function(r){picker.html(r.markup);});return $(this);}})(jQuery);var dataObjectFormDefaults={dataObjectId:'',instanceId:'',formId:'',postVars:{},type:'',template:'',getModelMethod:'',customModel:null,isSingleFieldEditor:false,saveMethod:'',saveMethodGeneric:false,focusFirst:true,submitOnEnter:true,onLoad:function(){},onPreSave:function(obj){return true;},onSave:function(){},onCancel:function(){},onError:function(errObj){},useDataObjectForm:false,dataObjectFormSource:''};(function($){$.fn.dataObjectForm=function(options,value){var cmd='';if(typeof options=='string'){cmd=options;}
if(cmd==''){options=$.extend({},dataObjectFormDefaults,options);var dObj={};if(options.useDataObjectForm){if(options.type==''){options.type='LaunchPad.Core.DataObjectForm';}}
var dataObjectFormBaseUrl='/__service/LaunchPad.Core.DataObjectFormT='+options.type+'/';if(options.saveMethod==''){if(options.useDataObjectForm){options.saveMethod='LaunchPad.Core.DataObjectForm.SaveMethod';}else{options.saveMethod='LaunchPad.Core.DataObject<'+options.type+'>.GenericSaveMethod';}}
var dataObjectFormSetup=function(target,options){var target=$(target);target.addClass('dataObjectFormWrapper');target.data('dataObjectFormOptions',options);target.find('.btnCancel').click(function(){options.onCancel();return false;});target.find('.btnSave').click(function(){dObj=$(target).dataObjectForm('GetObject');delete dObj.Date_Created;delete dObj.Date_Modified;delete dObj.Expiry_Date;if(options.onPreSave(dObj)!==false){target.find('.dataObjectFormError,.dataObjectFormErrorMessage,.dataObjectFormErrorSummary,.dataObjectFormIntroduction').hide(0);target.find('.formRow').removeClass('formRowError');var savePostData={DataObjectID:options.dataObjectId,FormID:options.formId,InstanceID:options.instanceId,DataObject:$.compactJSON(dObj),SaveMethod:options.saveMethod,SaveMethodGeneric:options.saveMethodGeneric,Template:options.template};savePostData=$.extend(savePostData,options.postVars);$.postJSON(dataObjectFormBaseUrl+'Save',savePostData,function(saveResponse){if(!saveResponse.Successful){var summary='';$(saveResponse.Errors).each(function(){var err=this;summary+='<li>'+err.Message+'</li>';target.find('.dataObjectFormErrorMessage').each(function(){if($(this).attr('rel')==err.Field){$(this).html(err.Message)
$(this).show(0);}});target.find('.formRowContent *[rel='+err.Field+']').parents('.formRow:first').addClass('formRowError');});summary='<ul>'+summary+'</ul>';target.find('.dataObjectFormErrorSummary').html(summary);target.find('.dataObjectFormErrorSummary,.dataObjectFormError').show(0);options.onError(saveResponse);}else{target.find('.formRow,.submitRow').hide(0);target.find('.dataObjectFormSuccess').show(0);}
options.onSave(saveResponse);if(saveResponse.Successful&&saveResponse.RedirectUrl!=''){window.location.href=saveResponse.RedirectUrl;}});}
return false;});target.find('.formRowContent input').each(function(){if(options.submitOnEnter){$(this).enterPressed(function(){target.find('.btnSave').click();return false;});}
$(this).escapePressed(function(){options.onCancel();return false;});});var focusCallback=function(){};if(options.focusFirst){focusCallback=function(){target.find('.formRowContent input:first').focus().select();};}
options.onLoad(focusCallback);};return $(this).each(function(){var target=$(this);if(options.customModel!=null){dObj=options.customModel;dataObjectFormSetup(target,options);}else{var postData={DataObjectID:options.dataObjectId,InstanceID:options.instanceId,Template:options.template,GetModelMethod:options.getModelMethod,IsSingleFieldEditor:options.isSingleFieldEditor};postData=$.extend(postData,options.postVars);$.postJSON(dataObjectFormBaseUrl+'GetForm',postData,function(getFormResponse){dObj=getFormResponse.item;options.formId=getFormResponse.formID;if(options.template.length>0){target.html(getFormResponse.markup);}
dataObjectFormSetup(target,options);});}});}else{switch(cmd){case'SetOptions':var target=$(this[0]);var targetOptions=target.data('dataObjectFormOptions');if(!targetOptions){targetOptions=dataObjectFormDefaults;}
targetOptions=$.extend(targetOptions,value);target.data('dataObjectFormOptions',targetOptions);break;case'GetObject':var target=$(this[0]);var targetOptions=target.data('dataObjectFormOptions');if(!targetOptions){targetOptions={};}
options=$.extend(dataObjectFormDefaults,targetOptions);var dObj={};var dObjFormXML='';var dObjFormFieldValues=[];target.find('.formRow').each(function(){if($(this).parents('noscript:first').length>0){return;}
var fieldName='';var fieldValue='';var firstFormRowContent=$(this).find('.formRowContent:first');if(firstFormRowContent.hasClass('CheckboxList')||firstFormRowContent.hasClass('UserList')||firstFormRowContent.hasClass('GroupList')){var isCheckboxList=firstFormRowContent.hasClass('CheckboxList');if(!isCheckboxList||options.useDataObjectForm){fieldValue='|';}
var listVal=[];var chkBoxes=$(this).find('.formRowContent input[type=checkbox]');$(chkBoxes).each(function(){if($(this).is(':checked')){if(isCheckboxList&&!options.useDataObjectForm){listVal.push($(this).attr('value'));}else{fieldValue+=$(this).attr('value')+'|';}}});fieldName=$(chkBoxes[0]).attr('rel');if(isCheckboxList&&!options.useDataObjectForm){fieldValue=listVal;}}else if(firstFormRowContent.hasClass('DateOfBirth')){var dobDropDowns=$(this).find('.formRowContent:first select');if(dobDropDowns.length==3){var dobYear=parseInt($(dobDropDowns[2]).val());var dobMonth=parseInt($(dobDropDowns[1]).val())-1;var dobDay=parseInt($(dobDropDowns[0]).val());fieldName=$(dobDropDowns[0]).attr('rel');if(dobYear>0){fieldValue=new Date(dobYear,dobMonth,dobDay,0,0,0,0);if(options.useDataObjectForm){fieldValue=fieldValue.toString();}else{var tmpYear=fieldValue.getFullYear().toString();var tmpMonth=parseInt(fieldValue.getMonth()+1).toString();if(tmpMonth.length==1){tmpMonth='0'+tmpMonth;}
var tmpDay=fieldValue.getDate().toString();if(tmpDay.length==1){tmpDay='0'+tmpDay;}
fieldValue=tmpYear+"-"+tmpMonth+"-"+tmpDay+"T00:00:00";}}}}else if($(this).hasClass('HTMLRow')){var ctl=$($(this).find('.formRowContent span:first'));fieldName=ctl.attr('rel');fieldValue=ctl.html();}else{var ctl=$($(this).find('.formRowContent:first *:first-child'));fieldName=ctl.attr('rel');if(ctl.attr('type')=='checkbox'){fieldValue=ctl.is(':checked');}else{fieldValue=ctl.val();}}
if(options.useDataObjectForm){dObjFormXML+='<p><k><![CDATA['+(fieldName!=undefined?$.htmlEncode(fieldName):fieldName)+']]></k><v><![CDATA['+(fieldValue!=undefined?$.htmlEncode(fieldValue):fieldValue)+']]></v></p>';dObjFormFieldValues.push(fieldValue);}else{dObj[fieldName]=fieldValue;}});if(options.useDataObjectForm){dObj=$.extend(dObj,{DataObjectFormFieldValues:dObjFormFieldValues,FieldsXML:'<r>'+dObjFormXML+'</r>',Source:options.dataObjectFormSource});}
return dObj;break;}}}})(jQuery);var dataObjectFormSingleFieldEdit=function(singleFieldEditId,dataObjectType,dataObjectId,link,callback){var editorContainer=$('<div>'+_GLOBAL_LoadingHTML+'</div>');$(link).parent().append(editorContainer);editorContainer.slideDown(150);editorContainer.dataObjectForm({type:dataObjectType,template:singleFieldEditId,dataObjectId:dataObjectId,isSingleFieldEditor:true,saveMethod:'LaunchPad.Core.DataObjectTemplateHelper/SaveSingleField',saveMethodGeneric:true,onLoad:function(){editorContainer.find('.formRowContent:first input:first').focus().select();},onSave:function(obj){if(obj.Successful){editorContainer.hide(0).html(_GLOBAL_LoadingHTML);callback();}},onCancel:function(){editorContainer.hide(0).html(_GLOBAL_LoadingHTML);}});}
var launchPad_CopyModule=function(link,instanceID){$.invoke('LaunchPad.Core.LaunchPadModule/CopyModule',[instanceID],function(r){fnDropZoneSetupModulePicker(function(){$('#launchPad_ModulePicker .pickerHeader').each(function(){if($(this).text()=='Copied Modules'){$(this).click();}});});});};var launchPad_DeleteCopiedModule=function(id){$.invoke('LaunchPad.Core.LaunchPadModule/DeleteCopiedModule',[id],null);};var launchPad_DeleteModule=function(link,instanceID){$.invoke('LaunchPad.Core.LaunchPadModule/DeleteModule',[instanceID],function(r){UpdateStatusArea(null);});$(link).parents('.launchPad_ModuleLIWrapper:first').remove();};var launchPad_GetModuleEditor=function(link,moduleType,instanceID){$.shade(null,($(window).height()-100),'#fff');$('#shadeContent').html(_GLOBAL_LoadingHTML);$.invoke('LaunchPad.Core.LaunchPadModule/GetModuleEditor<'+moduleType+'>',[instanceID],function(editor){$('#shadeContent').html(editor);});};var launchPad_GetTemplateModuleInlineEditor=function(link,instanceID){var editContainer=$('<div class="templateModuleInlineEditor">'+_GLOBAL_LoadingHTML+'</div>');$(link).parents('.launchPad_ModuleLIWrapper:first').prepend(editContainer);$.invoke('LaunchPad.Core.LaunchPadModule/GetTemplateModuleInlineEditor',[instanceID],function(editor){editContainer.html(editor);});};var launchPad_GetTemplateModuleEditor=function(link,instanceID){$.shade(null,($(window).height()-100),'#fff');$('#shadeContent').html(_GLOBAL_LoadingHTML);$.invoke('LaunchPad.Core.LaunchPadModule/GetTemplateModuleEditor',[instanceID],function(editor){$('#shadeContent').html(editor);});};(function($){$.fn.center=function(){return $(this).each(function(){$(this).css({marginTop:parseInt($(this).css('marginTop'),10)+jQuery(window).scrollTop(),marginLeft:parseInt($(this).css('marginLeft'),10)+jQuery(window).scrollLeft()});});}})(jQuery);jQuery.fn.fadeToggle=function(speed,easing,callback){return this.animate({opacity:'toggle'},speed,easing,callback);};function launchPad__DataObjectSave(id,dataObjectType,collectionID,onSaveMethod,userVersion,languageVersion,extraInfoID,fieldNames,formIDs,types){var fields=fieldNames.split('|');var ids=formIDs.split('|');var fieldTypes=types.split('|');var params='DataObjectID='+id+'/DataObjectType='+dataObjectType+'/DataObjectCollectionID='+collectionID+'/UserVersion='+userVersion+'/LanguageVersion='+languageVersion+'/OnSaveMethod='+onSaveMethod+'/CreateNotifications='+$('#cn_'+extraInfoID).value+'/';for(var i=0;i<ids.length;i++){if(fieldTypes[i]!=''){var v=launchPad__DataObjectGetValue(fieldTypes[i],ids[i]);if(v.indexOf!=null&&v.indexOf!='undefined'){v=__mps(v);}
params+=fields[i]+'='+v+'/';}}
__fnMakeUpdateCall('LaunchPad.Core.Web.Controls.DataObjectEditor','DataObjectSave',params,null);}
function launchPad__DataObjectGetValue(type,field){var v='';switch(type){case'TextBox':case'Password':case'TextArea':case'ImageSelector':case'Page':case'PageList':case'GroupList':case'PageSelector':case'MultiPageSelector':case'UserList':case'ColourPicker':case'DropDown':case'DynamicDropDown':case'LanguagePicker':case'DataObject':if(type=='Page'||type=='PageList'||type=='PageSelector'||type=='MultiPageSelector'){field+='_selectedPages';}
if($('#'+field)){v=$('#'+field).val();}
break;case'HTML':try{var oEditor=FCKeditorAPI.GetInstance(field);if(oEditor!=null){v=oEditor.GetHTML();}}
catch(e){}
break;case'Date':var vDateField=$find(field);if(vDateField){v=vDateField.get_selectedDate();try{v=v.format('dd-MM-yyyy');}
catch(e){}}
break;case'Checkbox':if($('#'+field)[0].checked){v='true';}
else{v='false';}
break;}
return v;}
function launchPad__DataObjectSetValue(ctlType,ctlID,ctlValue){switch(ctlType){case'TextBox':case'Password':case'TextArea':case'ImageSelector':case'ColourPicker':case'DataObject':case'LanguagePicker':case'DropDown':$('#'+ctlID).val(ctlValue);if(ctlType=='ImageSelector'){}
break;case'HTML':try{var oEditor=FCKeditorAPI.GetInstance(ctlID);if(oEditor!=null){oEditor.SetHTML(ctlValue);}}
catch(e){}
break;case'DynamicDropDown':var ddl=$('#'+ctlID)[0];ddl.options.length=0;var dynamicIter=0;var dynamicOptions=ctlValue.split('}}|{{');for(dynamicIter=0;dynamicIter<dynamicOptions.length;dynamicIter++){if(dynamicIter==(dynamicOptions.length-1)){break;}
var dynOpt=new Option(dynamicOptions[dynamicIter+1],dynamicOptions[dynamicIter]);ddl.options[ddl.options.length]=dynOpt;dynamicIter++;}
ctlValue=dynamicOptions[dynamicIter];$('#'+ctlID).val(ctlValue);break;case'Date':if(ctlValue!=''){var vDateField=$find(ctlID);if(vDateField){vDateField.set_selectedDate(ctlValue);}}
break;case'Checkbox':if($('#'+ctlID).length>0){if(ctlValue=='true'){$('#'+ctlID)[0].checked=true;}
else{$('#'+ctlID)[0].checked=false;}}
break;case'DataObjectCollection':try{eval("__dataObjectCollectionEditorInit_"+ctlID+"('"+ctlValue+"')");}
catch(e){}
break;case'Page':case'PageList':case'PageSelector':case'MultiPageSelector':ctlID+='_selectedPages';$('#'+ctlID).val(ctlValue);eval('__rcmsPageSelectorUpdate(\''+ctlID+'\')');break;case'GroupList':$('#'+ctlID).val(ctlValue);eval('__rcmsGroupSelectorUpdate(\''+ctlID+'\')');break;case'UserList':$('#'+ctlID).val(ctlValue);eval('__rcmsUserSelectorUpdate(\''+ctlID+'\')');break;}}
function launchPad__DataObjectEditInit(data){var splitData=data.split('}}{{');for(var i=0;i<splitData.length;i++){var ctlID=splitData[i];var ctlType=splitData[i+1];var ctlValue=splitData[i+2];launchPad__DataObjectSetValue(ctlType,ctlID,ctlValue);i=i+2;}}
var __dataObjectSelectorCache=new Array();function __fnDataObjectCollectionEditor_Edit(objectType,id,collection,isSession,field,useField,critField)
{$('#'+id+'_wrapper').html(_GLOBAL_LoadingHTML);var perPage=$('#'+id+'_perpage').length>0?$('#'+id+'_perpage').val():'10';var filter=$('#'+id+'_filter').length>0?$('#'+id+'_filter').val():'';var bUse=$('#'+useField).length>0?$('#'+useField).val():'u';var critConfig=$('#'+critField).length>0?$('#'+critField).val():'';$.post('/__service/LaunchPad.Core.Web.Controls.DataObjectSelector/GetHTML',{s:id,t:objectType,p:perPage,c:collection,f:field,fi:filter,u:bUse,uf:useField,cf:critField,cc:critConfig,is:isSession},function(resp){var split=resp.split('}}{{');var guid=split[0].trim();var field=split[3].trim();$('#'+guid+'_wrapper').html(split[1].trim());var ids=$('#'+field).val().split('|');for(var iter=0;iter<ids.length;iter++)
{if(ids[iter]!=null&&ids[iter]!='')
{if($('#'+field).val().indexOf(ids[iter]+'|')>-1)
{if($('#'+ids[iter]+'_item').length>0){$('#'+ids[iter]+'_item').hide(0);$('#'+guid+'_currentItems').html('<div id="'+ids[iter]+'_selectedItem" style="padding: 3px; margin: 1px; border: 1px solid #c4c4c4; cursor: pointer;" onclick="__dataObjectSelectorToggleSelectedItem(guid, field, ids[iter]);">'+$('#'+ids[iter]+'_item').html()+'</div>');}}}}});}
function __dataObjectSelectorUpdateValues(critField,useField,id)
{if($('#'+critField).length>0&&$('#'+id+'_orderField').length>0&&$('#'+id+'_order').length>0&&$('#'+id+'_limit').length>0)
{var concatConfig='';concatConfig+=$('#'+id+'_orderField').val()+'}{';concatConfig+=$('#'+id+'_order').val()+'}{';concatConfig+=$('#'+id+'_limit').val()+'}{';concatConfig+=$('#'+id+'_listformat').val()+'}{';concatConfig+=$('#'+id+'_displayformat').val()+'}{';concatConfig+=$('#'+id+'_whereField').val()+'}{';concatConfig+=$('#'+id+'_whereOperator').val()+'}{';concatConfig+=$('#'+id+'_whereValue').val();$('#'+critField).val(concatConfig);}}
function __dataObjectSelectorToggleItem(element,guid,field,obj,txt)
{if($('#'+field).val().indexOf(obj+'|')==-1)
{$(element).hide(0);$('#'+field).val($('#'+field).val()+obj+'|');$('#'+guid+'_currentItems').html('<div id="'+obj+'_selectedItem" style="padding: 3px; margin: 1px; border: 1px solid #c4c4c4; cursor: pointer;" onclick="__dataObjectSelectorToggleSelectedItem(guid, field, obj);">'+txt+'</div>');}}
function __dataObjectSelectorToggleSelectedItem(guid,field,obj)
{$('#'+obj+'_selectedItem').hide(0).attr('id','_'+obj+'_selectedItem');$('#'+obj+'_item').show(0);$('#'+field).val($('#'+field).val().replace(obj+'|',''));}
(function($){$.launchPad_DataObjectEditor=function(element,params){var opts={type:''};opts=$.extend(opts,params);}})(jQuery);(function($){$.launchPad_DataObjectSelector=function(ddl,params){var opts={type:'',allowCreate:false};opts=$.extend(opts,params);if(opts.allowCreate&&1==2){var createLink=$('&nbsp;&nbsp;&nbsp;<a href="javascript:void(0);">Create...</a>');createLink.click(function(){});ddl.after(createLink);}}})(jQuery);function __updateDialogPos(id,width,fillPage){var __dlg=$('#'+id);__dlg.css('position','absolute').css('z-index',$('#'+id+'_d').val()=='1'?'600':'800');if(fillPage){$('#'+id+'_in').height((parseInt($(window).height())*0.9)+'px');$('#'+id).width(Math.ceil(parseInt(vpWidth*0.96))+'px').css('top','1%').css('left','1%');}
else{if(parseInt(width)>0){__dlg.width(width+'px');}
if($('#'+id+'_x').length>0){__dlg.css('left',$('#'+id+'_x').val()+'px');}
else{$('#'+id).css('left',Math.floor((vpWidth-parseInt(width))/2)+'px');}
if($('#'+id+'_y').length>0){__dlg.css('top',$('#'+id+'_y').val()+'px');}
else{$('#'+id).css('top',(parseInt(parseInt(document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop))+50)+'px');}}
$('#'+id).hide(0);}
function launchPad__ShowShade(shadeID){var scrollTop=parseInt(document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop);$('#'+shadeID).height((parseInt(screen.height)+scrollTop)+'px').width('100%').css('left','0px').slideDown(500);}
var vpWidth,vpHeight;if(window.innerWidth){vpWidth=window.innerWidth;vpHeight=window.innerHeight;}
else if(document.documentElement&&document.documentElement.clientWidth){vpWidth=document.documentElement.clientWidth;vpHeight=document.documentElement.clientHeight;}
else{if($('body').length>0){vpWidth=$('body')[0].clientWidth;vpHeight=$('body')[0].clientHeight;}}
function launchPad__GetWindowScrollTop(){var y;if(self.pageYOffset){y=self.pageYOffset;}
else if(document.documentElement&&document.documentElement.scrollTop){y=document.documentElement.scrollTop;}
else if(document.body){y=document.body.scrollTop;}
return y;}
function launchPad__GetWindowScrollLeft(){var x;if(self.pageYOffset){x=self.pageXOffset;}
else if(document.documentElement&&document.documentElement.scrollTop){x=document.documentElement.scrollLeft;}
else if(document.body){x=document.body.scrollLeft;}
return x;}
$(document).ready(function(){$('#launchPad__EditorShade').width(vpWidth+'px').height(vpHeight+'px').css('opacity',0.8);});(function($){$.toJSON=function(o){if(typeof(JSON)=='object'&&JSON.stringify)
return JSON.stringify(o);var type=typeof(o);if(o===null)
return"null";if(type=="undefined")
return undefined;if(type=="number"||type=="boolean")
return o+"";if(type=="string")
return $.quoteString(o);if(type=='object'){if(typeof o.toJSON=="function")
return $.toJSON(o.toJSON());if(o.constructor===Date){var month=o.getUTCMonth()+1;if(month<10)month='0'+month;var day=o.getUTCDate();if(day<10)day='0'+day;var year=o.getUTCFullYear();var hours=o.getUTCHours();if(hours<10)hours='0'+hours;var minutes=o.getUTCMinutes();if(minutes<10)minutes='0'+minutes;var seconds=o.getUTCSeconds();if(seconds<10)seconds='0'+seconds;var milli=o.getUTCMilliseconds();if(milli<100)milli='0'+milli;if(milli<10)milli='0'+milli;return'"'+year+'-'+month+'-'+day+'T'+
hours+':'+minutes+':'+seconds+'.'+milli+'Z"';}
if(o.constructor===Array){var ret=[];for(var i=0;i<o.length;i++)
ret.push($.toJSON(o[i])||"null");return"["+ret.join(",")+"]";}
var pairs=[];for(var k in o){var name;var type=typeof k;if(type=="number")
name='"'+k+'"';else if(type=="string")
name=$.quoteString(k);else
continue;if(typeof o[k]=="function")
continue;var val=$.toJSON(o[k]);pairs.push(name+":"+val);}
return"{"+pairs.join(", ")+"}";}};$.compactJSON=function(o){return $.toJSON(o);};$.evalJSON=function(src){if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);return eval("("+src+")");};$.secureEvalJSON=function(src){if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,'@');filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']');filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered))
return eval("("+src+")");else
throw new SyntaxError("Error parsing JSON, source is not valid.");};$.quoteString=function(string){if(string.match(_escapeable)){return'"'+string.replace(_escapeable,function(a)
{var c=_meta[a];if(typeof c==='string')return c;c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"';}
return'"'+string+'"';};var _escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var _meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};})(jQuery);$.htmlEncode=function(value){if(value!=undefined&&value.length>0){return $('<div/>').text(value).html();}else{return value;}};$.htmlDecode=function(value){if(value!=undefined&&value.length>0){return $('<div/>').html(value).text();}else{return value;}};(function($){var keyString="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var uTF8Encode=function(string){string=string.replace(/\x0d\x0a/g,"\x0a");var output="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){output+=String.fromCharCode(c);}else if((c>127)&&(c<2048)){output+=String.fromCharCode((c>>6)|192);output+=String.fromCharCode((c&63)|128);}else{output+=String.fromCharCode((c>>12)|224);output+=String.fromCharCode(((c>>6)&63)|128);output+=String.fromCharCode((c&63)|128);}}
return output;};var uTF8Decode=function(input){var string="";var i=0;var c=c1=c2=0;while(i<input.length){c=input.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++;}else if((c>191)&&(c<224)){c2=input.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}else{c2=input.charCodeAt(i+1);c3=input.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}
return string;}
$.extend({base64Encode:function(input){var output="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;input=uTF8Encode(input);while(i<input.length){chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=((chr1&3)<<4)|(chr2>>4);enc3=((chr2&15)<<2)|(chr3>>6);enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64;}else if(isNaN(chr3)){enc4=64;}
output=output+keyString.charAt(enc1)+keyString.charAt(enc2)+keyString.charAt(enc3)+keyString.charAt(enc4);}
return output;},base64Decode:function(input){var output="";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(i<input.length){enc1=keyString.indexOf(input.charAt(i++));enc2=keyString.indexOf(input.charAt(i++));enc3=keyString.indexOf(input.charAt(i++));enc4=keyString.indexOf(input.charAt(i++));chr1=(enc1<<2)|(enc2>>4);chr2=((enc2&15)<<4)|(enc3>>2);chr3=((enc3&3)<<6)|enc4;output=output+String.fromCharCode(chr1);if(enc3!=64){output=output+String.fromCharCode(chr2);}
if(enc4!=64){output=output+String.fromCharCode(chr3);}}
output=uTF8Decode(output);return output;}});})(jQuery);(function($){$.fn.showMenu=function(options){var opts=$.extend({},$.fn.showMenu.defaults,options);$(this).bind("contextmenu",function(e){$(opts.query).show().css({top:e.pageY+"px",left:e.pageX+"px",position:"absolute",opacity:opts.opacity,zIndex:opts.zindex});$(opts.query).find('li').hover(function(){$(this).addClass('hover');},function(){$(this).removeClass('hover');});return false;});$(document).bind("click",function(e){$(opts.query).hide();});};$.fn.showMenu.defaults={zindex:2000,query:document,opacity:1.0};})(jQuery);(function($){$.fn.keyCodePressed=function(keyCode,callback){return this.keypress(function(e){var code=e.keyCode||e.which;if(code==keyCode){return callback();}
return true;});};})(jQuery);jQuery.autocomplete=function(input,options){var me=this;var $input=$(input).attr("autocomplete","off");if(options.inputClass)$input.addClass(options.inputClass);var results=document.createElement("div");var $results=$(results);$results.hide().addClass(options.resultsClass).css("position","absolute");if(options.width>0)$results.css("width",options.width);$("body").append(results);input.autocompleter=me;var timeout=null;var prev="";var active=-1;var cache={};var keyb=false;var hasFocus=false;var lastKeyPressCode=null;function flushCache(){cache={};cache.data={};cache.length=0;};flushCache();if(options.data!=null){var sFirstChar="",stMatchSets={},row=[];if(typeof options.url!="string")options.cacheLength=1;for(var i=0;i<options.data.length;i++){row=((typeof options.data[i]=="string")?[options.data[i]]:options.data[i]);if(row[0].length>0){sFirstChar=row[0].substring(0,1).toLowerCase();if(!stMatchSets[sFirstChar])stMatchSets[sFirstChar]=[];stMatchSets[sFirstChar].push(row);}}
for(var k in stMatchSets){options.cacheLength++;addToCache(k,stMatchSets[k]);}}
$input.keydown(function(e){lastKeyPressCode=e.keyCode;switch(e.keyCode){case 38:e.preventDefault();moveSelect(-1);break;case 40:e.preventDefault();moveSelect(1);break;case 9:case 13:if(selectCurrent()){$input.get(0).blur();e.preventDefault();}
break;default:active=-1;if(timeout)clearTimeout(timeout);timeout=setTimeout(function(){onChange();},options.delay);break;}}).focus(function(){hasFocus=true;}).blur(function(){hasFocus=false;hideResults();});hideResultsNow();function onChange(){if(lastKeyPressCode==46||(lastKeyPressCode>8&&lastKeyPressCode<32))return $results.hide();var v=$input.val();if(v==prev)return;prev=v;if(v.length>=options.minChars){$input.addClass(options.loadingClass);requestData(v);}else{$input.removeClass(options.loadingClass);$results.hide();}};function moveSelect(step){var lis=$("li",results);if(!lis)return;active+=step;if(active<0){active=0;}else if(active>=lis.size()){active=lis.size()-1;}
lis.removeClass("ac_over");$(lis[active]).addClass("ac_over");};function selectCurrent(){var li=$("li.ac_over",results)[0];if(!li){var $li=$("li",results);if(options.selectOnly){if($li.length==1)li=$li[0];}else if(options.selectFirst){li=$li[0];}}
if(li){selectItem(li);return true;}else{return false;}};function selectItem(li){if(!li){li=document.createElement("li");li.extra=[];li.selectValue="";}
var v=$.trim(li.selectValue?li.selectValue:li.innerHTML);input.lastSelected=v;prev=v;$results.html("");$input.val(v);hideResultsNow();if(options.onItemSelect)setTimeout(function(){options.onItemSelect(li)},1);};function createSelection(start,end){var field=$input.get(0);if(field.createTextRange){var selRange=field.createTextRange();selRange.collapse(true);selRange.moveStart("character",start);selRange.moveEnd("character",end);selRange.select();}else if(field.setSelectionRange){field.setSelectionRange(start,end);}else{if(field.selectionStart){field.selectionStart=start;field.selectionEnd=end;}}
field.focus();};function autoFill(sValue){if(lastKeyPressCode!=8){$input.val($input.val()+sValue.substring(prev.length));createSelection(prev.length,sValue.length);}};function showResults(){var pos=findPos(input);var iWidth=(options.width>0)?options.width:$input.width();$results.css({width:parseInt(iWidth)+"px",top:(pos.y+input.offsetHeight)+"px",left:pos.x+"px"}).show();};function hideResults(){if(timeout)clearTimeout(timeout);timeout=setTimeout(hideResultsNow,200);};function hideResultsNow(){if(timeout)clearTimeout(timeout);$input.removeClass(options.loadingClass);if($results.is(":visible")){$results.hide();}
if(options.mustMatch){var v=$input.val();if(v!=input.lastSelected){selectItem(null);}}};function receiveData(q,data){if(data){$input.removeClass(options.loadingClass);results.innerHTML="";if(!hasFocus||data.length==0)return hideResultsNow();if($.browser.msie){$results.append(document.createElement('iframe'));}
results.appendChild(dataToDom(data));if(options.autoFill&&($input.val().toLowerCase()==q.toLowerCase()))autoFill(data[0][0]);showResults();}else{hideResultsNow();}};function parseData(data){if(!data)return null;var parsed=[];var rows=data.split(options.lineSeparator);for(var i=0;i<rows.length;i++){var row=$.trim(rows[i]);if(row){parsed[parsed.length]=row.split(options.cellSeparator);}}
return parsed;};function dataToDom(data){var ul=document.createElement("ul");var num=data.length;if((options.maxItemsToShow>0)&&(options.maxItemsToShow<num))num=options.maxItemsToShow;for(var i=0;i<num;i++){var row=data[i];if(!row)continue;var li=document.createElement("li");if(options.formatItem){li.innerHTML=options.formatItem(row,i,num);li.selectValue=row[0];}else{li.innerHTML=row[0];li.selectValue=row[0];}
var extra=null;if(row.length>1){extra=[];for(var j=1;j<row.length;j++){extra[extra.length]=row[j];}}
li.extra=extra;ul.appendChild(li);$(li).hover(function(){$("li",ul).removeClass("ac_over");$(this).addClass("ac_over");active=$("li",ul).indexOf($(this).get(0));},function(){$(this).removeClass("ac_over");}).click(function(e){e.preventDefault();e.stopPropagation();selectItem(this)});}
return ul;};function requestData(q){if(!options.matchCase)q=q.toLowerCase();var data=options.cacheLength?loadFromCache(q):null;if(data){receiveData(q,data);}else if((typeof options.url=="string")&&(options.url.length>0)){var criteria=q;if(typeof options.getCriteria=="function"){criteria=options.getCriteria();}
$.post(options.url,{criteria:criteria},function(data){data=parseData(data);addToCache(q,data);receiveData(q,data);});}else{$input.removeClass(options.loadingClass);}};function makeUrl(q){var url=options.url+"?q="+encodeURI(q);for(var i in options.extraParams){url+="&"+i+"="+encodeURI(options.extraParams[i]);}
return url;};function loadFromCache(q){if(!q)return null;if(cache.data[q])return cache.data[q];if(options.matchSubset){for(var i=q.length-1;i>=options.minChars;i--){var qs=q.substr(0,i);var c=cache.data[qs];if(c){var csub=[];for(var j=0;j<c.length;j++){var x=c[j];var x0=x[0];if(matchSubset(x0,q)){csub[csub.length]=x;}}
return csub;}}}
return null;};function matchSubset(s,sub){if(!options.matchCase)s=s.toLowerCase();var i=s.indexOf(sub);if(i==-1)return false;return i==0||options.matchContains;};this.flushCache=function(){flushCache();};this.setExtraParams=function(p){options.extraParams=p;};this.findValue=function(){var q=$input.val();if(!options.matchCase)q=q.toLowerCase();var data=options.cacheLength?loadFromCache(q):null;if(data){findValueCallback(q,data);}else if((typeof options.url=="string")&&(options.url.length>0)){$.get(makeUrl(q),function(data){data=parseData(data)
addToCache(q,data);findValueCallback(q,data);});}else{findValueCallback(q,null);}}
function findValueCallback(q,data){if(data)$input.removeClass(options.loadingClass);var num=(data)?data.length:0;var li=null;for(var i=0;i<num;i++){var row=data[i];if(row[0].toLowerCase()==q.toLowerCase()){li=document.createElement("li");if(options.formatItem){li.innerHTML=options.formatItem(row,i,num);li.selectValue=row[0];}else{li.innerHTML=row[0];li.selectValue=row[0];}
var extra=null;if(row.length>1){extra=[];for(var j=1;j<row.length;j++){extra[extra.length]=row[j];}}
li.extra=extra;}}
if(options.onFindValue)setTimeout(function(){options.onFindValue(li)},1);}
function addToCache(q,data){if(!data||!q||!options.cacheLength)return;if(!cache.length||cache.length>options.cacheLength){flushCache();cache.length++;}else if(!cache[q]){cache.length++;}
cache.data[q]=data;};function findPos(obj){var curleft=obj.offsetLeft||0;var curtop=obj.offsetTop||0;while(obj=obj.offsetParent){curleft+=obj.offsetLeft
curtop+=obj.offsetTop}
return{x:curleft,y:curtop};}}
jQuery.fn.autocomplete=function(url,options,data){options=options||{};options.url=url;options.data=((typeof data=="object")&&(data.constructor==Array))?data:null;options.inputClass=options.inputClass||"ac_input";options.resultsClass=options.resultsClass||"ac_results";options.lineSeparator=options.lineSeparator||"\n";options.cellSeparator=options.cellSeparator||"|";options.minChars=options.minChars||1;options.delay=options.delay||400;options.matchCase=options.matchCase||0;options.matchSubset=options.matchSubset||1;options.matchContains=options.matchContains||0;options.cacheLength=options.cacheLength||1;options.mustMatch=options.mustMatch||0;options.extraParams=options.extraParams||{};options.loadingClass=options.loadingClass||"ac_loading";options.selectFirst=options.selectFirst||false;options.selectOnly=options.selectOnly||false;options.maxItemsToShow=options.maxItemsToShow||-1;options.autoFill=options.autoFill||false;options.width=parseInt(options.width,10)||0;this.each(function(){var input=this;new jQuery.autocomplete(input,options);});return this;}
jQuery.fn.autocompleteArray=function(data,options){return this.autocomplete(null,options,data);}
jQuery.fn.indexOf=function(e){for(var i=0;i<this.length;i++){if(this[i]==e)return i;}
return-1;};$(document).ready(function(){$(document).pngFix();});$.setupDraggablePicker=function(picker){var pickerHeight=parseInt(picker.find('.pickerContents').outerHeight(true));var pickerHeaders=picker.find('.pickerHeader');var pickerHeadersCombinedHeight=0;pickerHeaders.each(function(){pickerHeadersCombinedHeight+=parseInt($(this).outerHeight(true));});var pickerSectionHeight=pickerHeight-pickerHeadersCombinedHeight;pickerHeaders.each(function(){$(this).next('ul:first').height(pickerSectionHeight+'px').css('overflow','auto');$(this).click(function(){var siblingHeaders=$(this).parents('.draggablePicker:first .pickerHeader');siblingHeaders.data('active',false);$(this).data('active',true);siblingHeaders.each(function(){var sectionContent=$(this).next('ul:first');if($(this).data('active')!==true){sectionContent.slideUp(100);}else{sectionContent.slideDown(100);}});});});picker.find('.pickerClose a').click(function(){$(this).parents('.draggablePicker:first').hide(250);});if(picker.data('draggableSetup')!==true&&picker.find('.pickerDragHandle').length>0){picker.draggable({handle:'.pickerDragHandle',axis:'y'});picker.data('draggableSetup',true);}};function launchPad_GDOM_Refresh(id,type,callback){launchPad_GDOM_GetItems(id,'',type,callback);}
function launchPad_GDOM_GetItems(id,page,type,callback){var container=$('#'+id+'_c');$('#'+id).data('GDOMMethods').LoadingTransition(container);$.getJSON('/__service/LaunchPad.Modules.GenericDataObjectModuleBase/LaunchPadGDOM_GetItemsT='+type+'/InstanceID='+id+'/Page='+page+'/Cache='+(Math.floor(Math.random()*999999)+1000),{},function(resp){$('#'+id).data('GDOMMethods').SetItems(container,resp);if(callback){callback(resp);}});}
