/*
 * JSMin
 * Javascript Compressor
 * http://www.crockford.com/
 * http://www.smallsharptools.com/Projects/Packer/
*/

// JobsDB.Web\Content\javascript\Form\JobsDB_System_FormControlContainer.js

function JobsDB_System_FormControlContainer()
{this.formControls=new Object();}
JobsDB_System_FormControlContainer.prototype.AddControl=function(type,controlId)
{switch(type)
{case'text':this.formControls[controlId]=new JobsDB_System_FormControl_SimpleControl(controlId,false,'Text');break;case'password':this.formControls[controlId]=new JobsDB_System_FormControl_SimpleControl(controlId,false,'Password');break;case'textarea':this.formControls[controlId]=new JobsDB_System_FormControl_SimpleControl(controlId,false,'TextArea');break;case'single_selection_list':this.formControls[controlId]=new JobsDB_System_FormControl_SingleSelectionList(controlId);break;case'radio':this.formControls[controlId]=new JobsDB_System_FormControl_SimpleControl(controlId,true,'Radio');break;case'checkbox':this.formControls[controlId]=new JobsDB_System_FormControl_SimpleControl(controlId,true,'CheckBox');break;case'calendar':this.formControls[controlId]=new JobsDB_System_FormControl_Calendar(controlId);break;case'captcha':this.formControls[controlId]=new JobsDB_System_FormControl_Captcha(controlId);break;case'single_checkbox_instead_of_two':this.formControls[controlId]=new JobsDB_System_FormControl_SingleCheckboxInsteadOfTwo(controlId);break;case'hidden':this.formControls[controlId]=new JobsDB_System_FormControl_SimpleControl(controlId,false,'Hidden');break;case'job_ad_builder_company_list':this.formControls[controlId]=new JobsDB_System_FormControl_JobAdBuilderCompanyList(controlId);break;case'job_ad_builder_company_logo_list':this.formControls[controlId]=new JobsDB_System_FormControl_SimpleControl(controlId,true,'JobAdBuilderCompanyLogoList');break;case'tiny_mce':this.formControls[controlId]=new JobsDB_System_FormControl_TinyMCE(controlId);break;case'list_box_with_years_range':this.formControls[controlId]=new JobsDB_System_FormControl_ListBoxWithYearsRange(controlId);break;case'tiny_mce_lazy':this.formControls[controlId]=new JobsDB_System_FormControl_TinyMCELazy(controlId);break;case'list_box_with_month_range':this.formControls[controlId]=new JobsDB_System_FormControl_ListBoxWithMonthRange(controlId);break;case'multiple_level_checkbox_widget':this.formControls[controlId]=new JobsDB_System_FormControl_MultipleLevelCheckboxWidget(controlId);break;case'async_upload':this.formControls[controlId]=new JobsDB_System_FormControl_AsyncUpload(controlId);break;case'checkbox_with_auto_size':this.formControls[controlId]=new JobsDB_System_FormControl_CheckboxWithAutoSize(controlId);break;case'text_with_allow_numeric_only':this.formControls[controlId]=new JobsDB_System_FormControl_TextWithAllowNumericOnly(controlId);break;case'scrolling_checkbox_list':this.formControls[controlId]=new JobsDB_System_FormControl_SimpleControl(controlId,true,'ScrollingCheckBoxList');break;case'textarea_with_counter':this.formControls[controlId]=new JobsDB_System_FormControl_TextAreaWithCounter(controlId);break;case'photo_async_upload':this.formControls[controlId]=new JobsDB_System_FormControl_PhotoAsyncUpload(controlId);break;case'render_only_set_value_java_script':this.formControls[controlId]=new JobsDB_System_FormControl_SimpleControl(controlId,false,'RenderOnlySetValueJavaScript');break;case'availability_radio_list':this.formControls[controlId]=new JobsDB_System_FormControl_SimpleControl(controlId,true,'AvailabilityRadioList');break;case'tree_view_control':this.formControls[controlId]=new JobsDB_System_FormControl_TreeViewControl(controlId);break;case'single_select_checkbox':this.formControls[controlId]=new JobsDB_System_FormControl_SingleSelectCheckbox(controlId);break;default:console.log(type+" is not a valid control type, controlId = "+controlId);break;}}
// JobsDB.Web\Content\javascript\Form\JobsDB_System_FormControl_AsyncUpload.js

function JobsDB_System_FormControl_AsyncUpload(id)
{this._id=id;this._initialized=false;this._firstLoad=true;this._maximumFileLengthAllow=100;}
JobsDB_System_FormControl_AsyncUpload.prototype.SetFieldValue=function(val)
{if(val!=''){var tokens=val.split(":");var fileName=tokens[3];this.AssignValue(fileName,val);}}
JobsDB_System_FormControl_AsyncUpload.prototype.init=function(setFieldValueList,initValue,metaFormSet,downloadSessionControllerAction,downloadControllerAction,uploadControllerAction,requireThumbnail,fileExtension,wordingUpload,wordingUploading,wordingInvalidAttachmentFileLength,wordingFileExtensionNotSupported,wordingFileAttachmentSizeTooLarge,wordingEmptyFile,wordingVirus,wordingErrorDuringAttachmentUpload)
{if(!this._initialized)
{console.log('Jform : '+this._id+" AsyncUploadControl initializing");this._value=initValue;this._downloadSessionControllerAction=downloadSessionControllerAction;this._downloadControllerAction=downloadControllerAction;this._uploadControllerAction=uploadControllerAction;this._requireThumbnail=requireThumbnail;this._fileExtension=fileExtension;this._wordingUpload=wordingUpload;this._wordingUploading=wordingUploading;this._wordingInvalidAttachmentFileLength=wordingInvalidAttachmentFileLength;this._wordingFileExtensionNotSupported=wordingFileExtensionNotSupported;this._wordingFileAttachmentSizeTooLarge=wordingFileAttachmentSizeTooLarge;this._wordingEmptyFile=wordingEmptyFile;this._wordingVirus=wordingVirus;this._wordingErrorDuringAttachmentUpload=wordingErrorDuringAttachmentUpload;var t=this;if(initValue!=null)
{setFieldValueList.push(function()
{t.SetFieldValue(initValue);});}
JobsDB_System.IncludeJs("ajaxupload.3.1.js");JobsDB_System_Messaging.RegisterToListenEvent(metaFormSet+'Enabled',function(){if(t._firstLoad){t._firstLoad=false;JobsDB_System.IncludeJsWithAction("ajaxupload.3.1.js",function(){t.ApplyEffect();});}});$("#"+this._id).val('');this._initialized=true;}}
JobsDB_System_FormControl_AsyncUpload.prototype.GetAttachmentPaths=function(reqThumbnail){var value=$('#'+this._id).val();if(value!=''){var tokens=value.split(":");var mode=tokens[0];var identity=tokens[1].split(",");var countryCode=tokens[2];var fileName=tokens[3];var reqThumbnailArg=(reqThumbnail==true||reqThumbnail=="1"||reqThumbnail=="T");var id=reqThumbnailArg?identity[1]:identity[0];if(mode=='S'){return JobsDB_System_ControllerResponseConversion.CountryCodeToDomain(countryCode)+'en/'+this._downloadSessionControllerAction+'?sessionId='+id;}else if(mode=='P'){return JobsDB_System_ControllerResponseConversion.CountryCodeToDomain(countryCode)+'en/'+this._downloadControllerAction+'?attachmentId='+id;}}
return null;}
JobsDB_System_FormControl_AsyncUpload.prototype.DeleteUploadedItem=function(){$('#'+this._id).setValue('');$('#UploadedFileName'+this._id).html('');$('#UploadButton'+this._id).show();$('#UploadedRegion'+this._id).hide();}
JobsDB_System_FormControl_AsyncUpload.prototype.EditState=function(response){var file='';if(response!=''){var tokens=response.split(":");fileName=tokens[3];}
this.AssignValue(fileName,response);}
JobsDB_System_FormControl_AsyncUpload.prototype.AssignValue=function(file,response){$('#'+this._id).setValue(response);if(file!=''){var downloadLink='<a href="'+this.GetAttachmentPaths(false)+'">'+file+'</a>';$('#UploadedFileName'+this._id).html(downloadLink);}else{$('#UploadedFileName'+this._id).html('');}
$('#UploadedRegion'+this._id).show();$('#UploadButton'+this._id).hide();JobsDB_System_Messaging.PublishEvent(this._id+'_ValueChanged',response);}
JobsDB_System_FormControl_AsyncUpload.prototype.GetSupportedExtList=function(){var supportedExts='.'+this._fileExtension;return supportedExts.replace(/,/g,'/.');}
JobsDB_System_FormControl_AsyncUpload.prototype.IsSupportedExt=function(ext){var supportedExts=this._fileExtension;if(supportedExts==''){return true;}
var supportedExtList=supportedExts.split(',');for(var i=0;i<supportedExtList.length;i++){if(ext==supportedExtList[i].trim()){return true;}}
return false;}
JobsDB_System_FormControl_AsyncUpload.prototype.ApplyEffect=function(){var interval;var button=$('#UploadButton'+this._id);var image='<img width="20px" height="20px" src="'+imagesUrlBase+'Shared/loading.gif" />';if(this._value==null||this._value==''){button.show();}
var t=this;new Ajax_upload(button,{action:virtualDir+t._uploadControllerAction+"?RequireThumbnail="+t._requireThumbnail+"&Id="+t._id,onSubmit:function(file,ext){if(file.length>t._maximumFileLengthAllow)
{alert(t._wordingInvalidAttachmentFileLength);return false;}
if(!t.IsSupportedExt(ext)){alert(t._wordingFileExtensionNotSupported.replace('{0}',ext).replace('{1}',t._fileExtension.replace(/,/g,' ')));return false;}
button.html(image+t._wordingUploading);this.disable();interval=window.setInterval(function(){var text=button.text();if(text.length<13){button.text(text+'.');}else{button.text(t._wordingUploading);}},200);},onComplete:function(file,response){button.html('<input class="greyBtn greyBtnSm" type="button" value="'+t._wordingUpload+'"/>');$("#Error_"+t._id).html('');window.clearInterval(interval);this.enable();var responseTokens=response.split(":");var status=responseTokens[0];if(status=="S"){var ids=responseTokens[1];var sessionIds=ids.split(",");for(var i=0;i<sessionIds.length;i++)
{sessionIds[i]=sessionIds[i].replace("\n","").replace(/ /g,"");}
var value="S:"+sessionIds.toString()+":"+g_countryCode+":"+file;t.AssignValue(file,value);}else if(status=="F"){var failure=responseTokens[1].trim();if(failure=="FileSize"){var maxFileSize=responseTokens[2];alert(t._wordingFileAttachmentSizeTooLarge.replace("{0}",maxFileSize));}else if(failure=="EmptyFile"){alert(t._wordingEmptyFile);}else if(failure=="FileContainVirus"){alert(t._wordingVirus);}else if(failure=="FileFormatUnsupported"){var ext='';var indexOfExt=file.lastIndexOf('.');if(indexOfExt>=0)
{ext=file.substring(indexOfExt);}
alert(t._wordingFileExtensionNotSupported.replace('{0}',ext).replace('{1}',t._fileExtension.replace(/,/g,' ')));}else{alert(t._wordingErrorDuringAttachmentUpload);}}}});$('#UploadDeleteButton'+this._id).click(function(){t.DeleteUploadedItem();});}
// JobsDB.Web\Content\javascript\Form\JobsDB_System_FormControl_Calendar.js

function JobsDB_System_FormControl_Calendar(id)
{this._id=id;this._initialized=false;}
JobsDB_System_FormControl_Calendar.prototype.SetFieldValue=function(val)
{$("#"+this._id).setValue(val);}
JobsDB_System_FormControl_Calendar.prototype.init=function(setFieldValueList,initValue,metaFormSet,minYearOperator,minYear,maxYearOperator,maxYear,minDate,needPublishEvent,eventName)
{if(!this._initialized)
{console.log('Jform : '+this._id+" CalendarControl initializing");this._minYearOperator=minYearOperator;this._minYear=minYear;this._maxYearOperator=maxYearOperator;this._maxYear=maxYear;this._minDate=minDate;this._needPublishEvent=needPublishEvent;this._eventName=eventName;var t=this;this._firstLoad=true;JobsDB_System_Messaging.RegisterToListenEvent(metaFormSet+'Enabled',function(){if(t._firstLoad){t._firstLoad=false;JobsDB_System.IncludeJsWithAction('ui/ui.datepicker.js',function(){t.Datepicker();});}});setFieldValueList.push(function()
{t.SetFieldValue(initValue);});this._initialized=true;}}
JobsDB_System_FormControl_Calendar.prototype.DatapickerCalculation=function(operator,year)
{var returnYear=serverTime.getFullYear();var thisYear=parseInt(year);if(operator=="-")
{returnYear=returnYear-thisYear;}
else if(operator=="+")
{returnYear=returnYear+thisYear;}
return returnYear;}
JobsDB_System_FormControl_Calendar.prototype.Datepicker=function(){var datepickerMinYear=this.DatapickerCalculation(this._minYearOperator,this._minYear);var minMonth=0;var minDate=1;if(this._minDate=="today"){minMonth=serverTime.getMonth();minDate=serverTime.getDate();datepickerMinYear=serverTime.getFullYear();}
var datepickerMaxYear=this.DatapickerCalculation(this._minYearOperator,this._maxYear);var t=this;$("#"+this._id).datepicker({minDate:new Date(datepickerMinYear,minMonth,minDate),maxDate:new Date(datepickerMaxYear,serverTime.getMonth(),serverTime.getDate()),onSelect:t.UpdateLinked,dateFormat:"dd/mm/yy",changeYear:true,changeMonth:true});}
JobsDB_System_FormControl_Calendar.prototype.UpdateLinked=function(date){if(this._needPublishEvent)
{JobsDB_System_Messaging.PublishEvent(this._eventName,date);}
$("#"+this._id).val(date);}
// JobsDB.Web\Content\javascript\Form\JobsDB_System_FormControl_Captcha.js

function JobsDB_System_FormControl_Captcha(id)
{this._id=id;this._initialized=false;this._captchaCheckFlag=false;}
JobsDB_System_FormControl_Captcha.prototype.SetFieldValue=function(val)
{$("#"+this._id).setValue(val);}
JobsDB_System_FormControl_Captcha.prototype.init=function(setFieldValueList,initValue)
{if(!this._initialized)
{console.log('Jform : '+this._id+" CaptchaControl initializing");var t=this;if(initValue!=null)
{setFieldValueList.push(function()
{t.SetFieldValue(initValue);});}
var LibaryList=new Array("jquery.alphanumeric.pack.js");JobsDB_System.IncludeJsInOrderWithAction(LibaryList,function(){t.GetCaptchaImg();});$("#"+t._id+"_ReloadImage").click(function(){t.GetCaptchaImg();focusInvalidField("#"+t._id+"_ReloadImage");});this._initialized=true;}}
JobsDB_System_FormControl_Captcha.prototype.GetCaptchaImg=function()
{$("#"+this._id+"_image").html("");$("#"+this._id+"_image").image(g_currentSite+"/JobSeeker/LoadCaptcha?r="+Math.random(),function(){});var imgChild=$("#"+this._id+"_image").children();$(imgChild).addClass("verAlignBn");}
JobsDB_System_FormControl_Captcha.prototype.CheckCaptcha=function()
{var t=this;var actionUrl=g_currentSite+"/Validation/CaptchaCheck?GuessValue="+$("#"+this._id).val();reqJSON(actionUrl,{},function(json){if(json.captchaCheckFlag==false)
{t._captchaCheckFlag=false;}
else
{t._captchaCheckFlag=true;};},function(){alert("system error");},false);};
// JobsDB.Web\Content\javascript\Form\JobsDB_System_FormControl_CheckboxWithAutoSize.js

function JobsDB_System_FormControl_CheckboxWithAutoSize(id)
{this._id=id;this._initialized=false;this._setValueAfterRender=false;this._firstLoad=true;}
JobsDB_System_FormControl_CheckboxWithAutoSize.prototype.SetFieldValue=function()
{this._setValueAfterRender=true;}
JobsDB_System_FormControl_CheckboxWithAutoSize.prototype.init=function(setFieldValueList,initValue,metaFormSet)
{if(!this._initialized)
{console.log('Jform : '+this._id+" CheckboxWithAutoSizeControl initializing");var t=this;if(initValue!=null)
{this._values=initValue;setFieldValueList.push(function()
{t.SetFieldValue();});}
JobsDB_System_Messaging.RegisterToListenEvent(metaFormSet+'Enabled',function(){if(t._firstLoad){t._firstLoad=false;t.RenderCheckbox();}});this._initialized=true;}}
JobsDB_System_FormControl_CheckboxWithAutoSize.prototype.RenderCheckbox=function()
{if(this._setValueAfterRender)
{if(this._values!=''){var tokens=this._values.split(',');for(var i=0;i<tokens.length;i++)
{$("#"+this._id+"_"+tokens[i].trim()).attr('checked',true);}}}}
// JobsDB.Web\Content\javascript\Form\JobsDB_System_FormControl_JobAdBuilderCompanyList.js

function JobsDB_System_FormControl_JobAdBuilderCompanyList(id)
{this._id=id;this._initialized=false;}
JobsDB_System_FormControl_JobAdBuilderCompanyList.prototype.SetFieldValue=function(val)
{$("#"+this._id).setValue(val);}
JobsDB_System_FormControl_JobAdBuilderCompanyList.prototype.init=function(setFieldValueList,initValue)
{if(!this._initialized)
{console.log('Jform : '+this._id+" JobAdBuilderCompanyListControl initializing");if(initValue!=null)
{var t=this;setFieldValueList.push(function()
{t.SetFieldValue(initValue);});}
this._initialized=true;}}
JobsDB_System_FormControl_JobAdBuilderCompanyList.prototype.SyncInformationToTextBox=function()
{$("#"+this._id).val($("#listbox"+this._id).val());}
// JobsDB.Web\Content\javascript\Form\JobsDB_System_FormControl_ListBoxWithMonthRange.js

function JobsDB_System_FormControl_ListBoxWithMonthRange(id)
{this._id=id;this._initialized=false;this._firstLoad=true;}
JobsDB_System_FormControl_ListBoxWithMonthRange.prototype.SetFieldValue=function(val)
{$("#"+this._id).setValue(val);}
JobsDB_System_FormControl_ListBoxWithMonthRange.prototype.init=function(setFieldValueList,initValue,metaFormSet,enableSorting,isAscending)
{if(!this._initialized)
{console.log('Jform : '+this._id+" ListBoxWithMonthRangeControl initializing");this._enableSorting=enableSorting;this._isAscending=isAscending;var t=this;if(initValue!=null)
{setFieldValueList.push(function()
{t.SetFieldValue(initValue);});}
JobsDB_System_Messaging.RegisterToListenEvent(metaFormSet+'Enabled',function(){if(t._firstLoad){t._firstLoad=false;if(t._enableSorting)
{$("#"+t._id).sortOptions(t._isAscending);}}});this._initialized=true;}}
// JobsDB.Web\Content\javascript\Form\JobsDB_System_FormControl_ListBoxWithYearsRange.js

function JobsDB_System_FormControl_ListBoxWithYearsRange(id)
{this._id=id;this._initialized=false;}
JobsDB_System_FormControl_ListBoxWithYearsRange.prototype.SetFieldValue=function(val)
{$("#"+this._id).setValue(val);}
JobsDB_System_FormControl_ListBoxWithYearsRange.prototype.init=function(setFieldValueList,initValue,subtractYear,gainYear)
{if(!this._initialized)
{console.log('Jform : '+this._id+" ListBoxWithYearsRangeControl initializing");if(initValue!=null)
{var t=this;setFieldValueList.push(function()
{t.SetFieldValue(initValue);});}
var currentYear=(new Date()).getFullYear();var minYear=currentYear-subtractYear;var maxYear=currentYear+gainYear;var option='';while(maxYear>=minYear){var year=maxYear;maxYear=maxYear-1;option+='<option value="'+year+'">'+year+'</option>';}
$('#'+this._id).append(option);this._initialized=true;}}
// JobsDB.Web\Content\javascript\Form\JobsDB_System_FormControl_MultipleLevelCheckboxWidget.js

function JobsDB_System_FormControl_MultipleLevelCheckboxWidget(id)
{this._id=id;this._initialized=false;this._multipleLevelCheckboxReady=false;this._firstLoad=true;this._completelyInited=false;this._previousValue="";this._createdDBox=false;}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.SetFieldValue=function(val)
{$("input[name='"+this._id+"']").setValue(val);this._previousValue=val;if(this._completelyInited)
{$("input[name='"+this._id+"Option']").setValue(val);this.RefreshDisableCheckbox();this.RefreshUl();}}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.init=function(setFieldValueList,applyEffectList,reloadControlTemplateList,lazyInitList,initValue,lazyInit,allowSelectParent,wordingMaximumSelectNumberItems,contentText,isTwoLevel,maximunCheckCount)
{if(!this._initialized)
{console.log('Jform : '+this._id+" MultipleLevelCheckboxWidgetControl initializing");this._lazyInit=lazyInit;this._allowSelectParent=allowSelectParent;this._wordingMaximumSelectNumberItems=wordingMaximumSelectNumberItems;this._contentText=contentText;this._isTwoLevel=isTwoLevel;this._maximunCheckCount=maximunCheckCount;var t=this;if(initValue!=null)
{setFieldValueList.push(function()
{t.LazyInit();t.SetFieldValue(initValue);});}
applyEffectList.add(function(){t.ApplyEffect();});reloadControlTemplateList.add(function(){t.PreReloadAction();});if(lazyInit!='true')
{this.Initialize();}
else if(!this._completelyInited)
{lazyInitList.add(function(){t.LazyInit();});}
$('#'+this._id+'SelectedItems').click(function(){t.ShowLayer();});this._initialized=true;}}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.GetChildrenLi=function(currentCheckbox){return currentCheckbox.parent().parent().next();}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.RefreshDisableCheckbox=function(){if(this._completelyInited)
{if(this._maximunCheckCount==1)
{return;}
var t=this;$.each($("input[name='"+t._id+"Option']:checked"),function(){if(t._allowSelectParent){var childrenLi=t.GetChildrenLi($(this));if(childrenLi.hasClass('JClistSubcat')){$.each(childrenLi.find("input[name='"+t._id+"Option']"),function(){$(this).attr('checked',false);$(this).attr('disabled',true);});}}
else{if($(this).hasClass(t._id+'CategoryParent'))
{var children=$(this).parent().parent().parent().find("input[name='"+t._id+"Option']:gt(0)");$.each(children,function(){$(this).attr('checked',false);$(this).attr('disabled',true);});}}});}}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.RefreshUl=function(){if(this._completelyInited)
{var t=this;$('#'+t._id+'SelectedItemsUl').html('');$.each($("input[name='"+t._id+"Option']:checked:enabled"),function(){var text=$(this).next().text().trimStart();if(text==''){text=$(this).parent().next().text().trimStart();var parentText=$(this).parent().parent().parent().parent().parent().prev().text().trimStart();$('#'+t._id+'SelectedItemsUl').append('<li><b>'+parentText+'<\/b> > '+text+'<\/li>');}
else{if(t._isTwoLevel){$('#'+t._id+'SelectedItemsUl').append('<li><b>'+text+'<\/b> > All<\/li>');}
else{$('#'+t._id+'SelectedItemsUl').append('<li><b>'+text+'<\/b><\/li>');}}});if($('#'+t._id+'SelectedItemsUl').html().length>0)
{$('#'+t._id+'SelectedItemsUl').show();}
else
{$('#'+t._id+'SelectedItemsUl').hide();}
$("input[name='"+t._id+"']").setValue($("input[name='"+t._id+"Option']").getValue());}}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.Clear=function(){if(this._completelyInited)
{$.each($("input[name='"+this._id+"Option']"),function(){$(this).removeAttr('checked');$(this).removeAttr('disabled');});$('#'+this._id+'SelectedItemsUl').html('');$('#'+this._id+'SelectedItemsUl').hide();$("input[name='"+this._id+"']").val('');$("input[name='"+this._id+"Option']").show();$("."+this._id+"icon_disable").hide();}}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.Initialize=function()
{console.time('Initialize');this._completelyInited=true;this._multipleLevelCheckboxReady=true;$("input[name='"+this._id+"Option']").removeAttr('disabled');var t=this;$('.'+this._id+'icon_max').click(function(){var childrenLi=t.GetChildrenLi($(this));if(childrenLi.hasClass('JClistSubcat')){$(this).next().show();$(this).hide();childrenLi.show();}});$('.'+this._id+'icon_min').click(function(){var childrenLi=t.GetChildrenLi($(this));if(childrenLi.hasClass('JClistSubcat')){$(this).prev().show();$(this).hide();childrenLi.hide();}});$("."+this._id+"CategoryParent").click(function(){var children=$(this).parent().parent().parent().find("input[name='"+t._id+"Option']:gt(0)");var isParentChecked=$(this).attr('checked');var totalChecked=$("input[name='"+t._id+"Option']:checked:enabled").length;if(totalChecked<=t._maximunCheckCount)
{$.each(children.find("input[name='"+t._id+"Option']"),function(){if(isParentChecked){$(this).attr('checked',false);$(this).attr('disabled',true);}
else{$(this).attr('checked',false);$(this).removeAttr('disabled');}});$.each(children.find("div[name='"+t._id+"Option']"),function(){if(isParentChecked){$(this).show();}
else{$(this).hide();}});}});$("input[name='"+this._id+"Option']").click(function(){if(t._maximunCheckCount==1)
{var multipleLevelCheckboxPanelBody=$('#'+t._id+'ContentPlaceHolder');$.each(multipleLevelCheckboxPanelBody.find("div[name='"+t._id+"Option']"),function(){$(this).hide();});$.each(multipleLevelCheckboxPanelBody.find("input[name='"+t._id+"Option']"),function(){$(this).attr('checked',false);$(this).removeAttr('disabled');$(this).show();});$(this).attr('checked',true);var childrenLi=t.GetChildrenLi($(this));if(childrenLi.hasClass('JClistSubcat')){if($(this).attr('checked'))
{$.each(childrenLi.find("input[name='"+t._id+"Option']"),function(){$(this).attr('checked',false);$(this).attr('disabled',true);$(this).hide();});$.each(childrenLi.find("div[name='"+t._id+"Option']"),function(){$(this).show();});}
else{$.each(childrenLi.find("input[name='"+t._id+"Option']"),function(){$(this).attr('checked',false);$(this).removeAttr('disabled');$(this).show();});$.each(childrenLi.find("div[name='"+t._id+"Option']"),function(){$(this).hide();});}}
t.RefreshUl();}
else{var totalChecked=$("input[name='"+t._id+"Option']:checked:enabled").length;if(totalChecked<=t._maximunCheckCount)
{var childrenLi=t.GetChildrenLi($(this));if(childrenLi.hasClass('JClistSubcat')){if($(this).attr('checked'))
{$.each(childrenLi.find("input[name='"+t._id+"Option']"),function(){$(this).attr('checked',false);$(this).attr('disabled',true);$(this).hide();});$.each(childrenLi.find("div[name='"+t._id+"Option']"),function(){$(this).show();});}
else{$.each(childrenLi.find("input[name='"+t._id+"Option']"),function(){$(this).attr('checked',false);$(this).removeAttr('disabled');$(this).show();});$.each(childrenLi.find("div[name='"+t._id+"Option']"),function(){$(this).hide();});}}
t.RefreshUl();}
else{alert(t._wordingMaximumSelectNumberItems.replace('{0}',t._maximunCheckCount));$(this).attr('checked',false);}}
$.each($("input[name='"+t._id+"Option']"),function(){$(this).attr('defaultChecked',$(this).attr('checked'));});});$('#'+this._id+'Clear').click(function(){t.Clear();});$('#'+this._id+'Cancel').click(function(){$.each($("input[name='"+this._id+"Option']"),function(){$(this).attr('checked',false);$(this).removeAttr('disabled');});$("input[name='"+t._id+"']").setValue(t._previousValue);$("input[name='"+t._id+"Option']").setValue(t._previousValue);t.RefreshUl();t.RefreshDisableCheckbox();$('#'+t._id+'MultipleLevelCheckboxPanel').dBoxHide();});$('#'+this._id+'Done').click(function(){if($("input[name='"+t._id+"Option']:checked").val()!=null)
{$("#Error_"+t._id).hide();}
else
{$("#Error_"+t._id).show();}
t.RefreshUl();$('#'+t._id+'MultipleLevelCheckboxPanel').dBoxHide();});if($.browser.mozilla){$('#'+this._id+'Selection, #'+this._id+'SelectedItems').keypress(function(event){t.CheckForEnter(event);});}else{$('#'+this._id+'Selection, #'+this._id+'SelectedItems').keydown(function(event){t.CheckForEnter(event);});}
console.timeEnd('Initialize');JobsDB_System_Messaging.PublishEvent(this._id+'InitComplete');}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.ExtractFromContentFromTextArea=function()
{console.time('ExtractFromContentFromTextArea');document.getElementById(this._id+'ContentPlaceHolder').innerHTML=this._contentText;console.timeEnd('ExtractFromContentFromTextArea');}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.ApplyEffect=function()
{if(this._completelyInited)
{this.RefreshUl();}}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.CreateDBox=function()
{$('#'+this._id+'MultipleLevelCheckboxPanel').dBox();this._createdDBox=true;}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.LazyInit=function()
{if(this._lazyInit=='true'&&!this._completelyInited)
{this.ExtractFromContentFromTextArea();this.Initialize();}}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.PreReloadAction=function()
{$("input[name='"+this._id+"Option']").setValue($("input[name='"+this._id+"']").getValue());}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.ShowLayer=function()
{console.time('showLayer');this.LazyInit();if(this._multipleLevelCheckboxReady)
{if(!this._createdDBox)
{this.CreateDBox();}
this._previousValue=$("input[name='"+this._id+"Option']").getValue();this.RefreshDisableCheckbox();$('#'+this._id+'MultipleLevelCheckboxPanel').dBoxShow();}
console.timeEnd('showLayer');}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.CheckForEnter=function(event){if(event.keyCode==13){this.ShowLayer();}}
// JobsDB.Web\Content\javascript\Form\JobsDB_System_FormControl_PhotoAsyncUpload.js

function JobsDB_System_FormControl_PhotoAsyncUpload(id)
{this._id=id;this._initialized=false;this._firstLoad=true;this._multipleLevelCheckboxReady=false;this._ajaxUploadControlInternal=null;}
JobsDB_System_FormControl_PhotoAsyncUpload.prototype.SetFieldValue=function(val)
{if(val!=''){var tokens=val.split(":");var fileName=tokens[3];this.AssignValue(fileName,val);}}
JobsDB_System_FormControl_PhotoAsyncUpload.prototype.init=function(setFieldValueList,initValue,metaFormSet,downloadSessionControllerAction,downloadControllerAction,uploadControllerAction,requireThumbnail,fileExtension,wordingUpload,wordingUploading,wordingFileExtensionNotSupported,wordingFileAttachmentSizeTooLarge,wordingEmptyFile,wordingVirus,wordingErrorDuringAttachmentUpload)
{if(!this._initialized)
{console.log('Jform : '+this._id+" PhotoAsyncUploadControl initializing");this._value=initValue;this._downloadSessionControllerAction=downloadSessionControllerAction;this._downloadControllerAction=downloadControllerAction;this._uploadControllerAction=uploadControllerAction;this._requireThumbnail=requireThumbnail;this._fileExtension=fileExtension;this._wordingUpload=wordingUpload;this._wordingUploading=wordingUploading;this._wordingFileExtensionNotSupported=wordingFileExtensionNotSupported;this._wordingFileAttachmentSizeTooLarge=wordingFileAttachmentSizeTooLarge;this._wordingEmptyFile=wordingEmptyFile;this._wordingVirus=wordingVirus;this._wordingErrorDuringAttachmentUpload=wordingErrorDuringAttachmentUpload;var t=this;if(initValue!=null)
{setFieldValueList.push(function()
{t.SetFieldValue(initValue);});}
var libaryList=new Array("jqGrid/js/jqModal.js","jquery.bgiframe.js");JobsDB_System.IncludeJs("ajaxupload.3.1.js");JobsDB_System.IncludeJsInOrder(libaryList);JobsDB_System_Messaging.RegisterToListenEvent(metaFormSet+'Enabled',function(){if(t._firstLoad){t._firstLoad=false;JobsDB_System.IncludeJsWithAction("ajaxupload.3.1.js",function(){t.ApplyEffect();});JobsDB_System.IncludeJsInOrderWithAction(libaryList,function(){t.LibReady();});}});this._initialized=true;}}
JobsDB_System_FormControl_PhotoAsyncUpload.prototype.GetAttachmentPaths=function(reqThumbnail){var value=$('#'+this._id).val();if(value!=''){var tokens=value.split(":");var mode=tokens[0];var identity=tokens[1].split(",");var countryCode=tokens[2];var fileName=tokens[3];var reqThumbnailArg=(reqThumbnail==true||reqThumbnail=="1"||reqThumbnail=="T");var id=reqThumbnailArg?identity[1]:identity[0];if(mode=='S'){return JobsDB_System_ControllerResponseConversion.CountryCodeToDomain(countryCode)+'en/'+this._downloadSessionControllerAction+'?sessionId='+id;}else if(mode=='P'){return JobsDB_System_ControllerResponseConversion.CountryCodeToDomain(countryCode)+'en/'+this._downloadControllerAction+'?attachmentId='+id+'&fileName='+fileName;}}
return null;}
JobsDB_System_FormControl_PhotoAsyncUpload.prototype.DeleteUploadedItem=function(){$('#'+this._id).setValue('');$('#UploadedFileName'+this._id).html('');$('#UploadButton'+this._id).show();$('#UploadDeleteButton'+this._id).hide();}
JobsDB_System_FormControl_PhotoAsyncUpload.prototype.EditState=function(response){var file='';if(response!=''){var tokens=response.split(":");fileName=tokens[3];}
this.AssignValue(fileName,response);}
JobsDB_System_FormControl_PhotoAsyncUpload.prototype.AssignValue=function(file,response){$('#'+this._id).setValue(response);if(file!=''){var downloadLink='<a href="'+this.GetAttachmentPaths(false)+'">'+file+'</a>';$('#UploadedFileName'+this._id).html(downloadLink);}else{$('#UploadedFileName'+this._id).html('');}
$('#UploadDeleteButton'+this._id).show();$('#UploadButton'+this._id).hide();JobsDB_System_Messaging.PublishEvent(this._id+'_ValueChanged',response);}
JobsDB_System_FormControl_PhotoAsyncUpload.prototype.GetSupportedExtList=function(){var supportedExts='.'+this._fileExtension;return supportedExts.replace(/,/g,'/.');}
JobsDB_System_FormControl_PhotoAsyncUpload.prototype.IsSupportedExt=function(ext){var supportedExts=this._fileExtension;if(supportedExts==''){return true;}
var supportedExtList=supportedExts.split(',');for(var i=0;i<supportedExtList.length;i++){if(ext==supportedExtList[i].trim()){return true;}}
return false;}
JobsDB_System_FormControl_PhotoAsyncUpload.prototype.Submit=function(){if(this._ajaxUploadControlInternal!=null)
{this._ajaxUploadControlInternal.submit();}}
JobsDB_System_FormControl_PhotoAsyncUpload.prototype.ApplyEffect=function(){var interval;var button=$('#UploadButton'+this._id);if(this._value==null||this._value==''){button.show();}
var buttonText='';var t=this;new Ajax_upload(button,{action:virtualDir+t._uploadControllerAction+"?RequireThumbnail="+t._requireThumbnail+"&Id="+t._id,onSubmit:function(file,ext){if(!t.IsSupportedExt(ext)){alert(t._wordingFileExtensionNotSupported.replace('{0}',ext).replace('{1}',t._fileExtension.replace(/,/g,' ')));return false;}
buttonText=button.html();button.text(t._wordingUploading);this.disable();interval=window.setInterval(function(){var text=button.text();if(text.length<13){button.text(text+'.');}else{button.text(t._wordingUploading);}},200);},onComplete:function(file,response){button.html(buttonText);window.clearInterval(interval);this.enable();var responseTokens=response.split(":");var status=responseTokens[0];if(status=="S"){var ids=responseTokens[1];var sessionIds=ids.split(",");for(var i=0;i<sessionIds.length;i++)
{sessionIds[i]=sessionIds[i].replace("\n","").replace(/ /g,"");}
var value="S:"+sessionIds.toString()+":"+g_countryCode+":"+file;t.AssignValue(file,value);}else if(status=="F"){var failure=responseTokens[1].trim();if(failure=="FileSize"){var maxFileSize=responseTokens[2];alert(t._wordingFileAttachmentSizeTooLarge.replace("{0}",maxFileSize));}else if(failure=="EmptyFile"){alert(t._wordingEmptyFile);}else if(failure=="FileContainVirus"){alert(t._wordingVirus);}else if(failure=="FileFormatUnsupported"){var ext='';var indexOfExt=file.lastIndexOf('.');if(indexOfExt>=0)
{ext=file.substring(indexOfExt);}
alert(t._wordingFileExtensionNotSupported.replace('{0}',ext).replace('{1}',t._fileExtension.replace(/,/g,' ')));}else{alert(t._wordingErrorDuringAttachmentUpload);}}}});$('#UploadDeleteButton'+this._id).click(function(){t.DeleteUploadedItem();});}
JobsDB_System_FormControl_PhotoAsyncUpload.prototype.LibReady=function(){this._multipleLevelCheckboxReady=true;}
// JobsDB.Web\Content\javascript\Form\JobsDB_System_FormControl_SimpleControl.js

function JobsDB_System_FormControl_SimpleControl(id,initByName,controlClassName)
{this._id=id;this._initByName=initByName;this._controlClassName=controlClassName;this._initialized=false;}
JobsDB_System_FormControl_SimpleControl.prototype.SetFieldValue=function(val)
{if(this._initByName)
{$("input[name='"+this._id+"']").setValue(val);}
else
{$("#"+this._id).setValue(val);}}
JobsDB_System_FormControl_SimpleControl.prototype.init=function(setFieldValueList,initValue)
{if(!this._initialized)
{console.log('Jform : '+this._id+" "+this._controlClassName+"Control initializing");if(initValue!=null)
{var t=this;setFieldValueList.push(function()
{t.SetFieldValue(initValue);});}
this._initialized=true;}}
// JobsDB.Web\Content\javascript\Form\JobsDB_System_FormControl_SingleCheckboxInsteadOfTwo.js

function JobsDB_System_FormControl_SingleCheckboxInsteadOfTwo(id)
{this._id=id;this._initialized=false;this._valueList=new Array();}
JobsDB_System_FormControl_SingleCheckboxInsteadOfTwo.prototype.SetFieldValue=function(val)
{$("input[name='"+this._id+"']").setValue(''+this._valueList[1]);if(val==this._valueList[0])
{$("input[id='"+this._id+"_CheckBox']").attr("checked",true);$("input[name='"+this._id+"']").setValue(''+this._valueList[0]);}
else
{$("input[id='"+this._id+"_CheckBox']").attr("checked",false);$("input[name='"+this._id+"']").setValue(''+this._valueList[1]);}}
JobsDB_System_FormControl_SingleCheckboxInsteadOfTwo.prototype.init=function(setFieldValueList,initValue,objectId,values)
{if(!this._initialized)
{console.log('Jform : '+this._id+" SingleCheckBoxInsteadOfTwoControl initializing");for(var i=0;i<values.length;++i)
if(values[i]>0)
this._valueList.add(values[i]);var t=this;if(initValue!=null)
{setFieldValueList.push(function()
{t.SetFieldValue(initValue);});}
$("#"+this._id+"_CheckBox").click(function(){if($("input[id='"+t._id+"_CheckBox']").attr("checked"))
{$("#"+t._id).val(''+t._valueList[0]);$("input[id='"+t._id+"_CheckBox']").attr('value',''+t._valueList[0]);}
else
{$("#"+t._id).val(''+t._valueList[1]);$("input[id='"+t._id+"_CheckBox']").attr('value',''+t._valueList[1]);}});JobsDB_System_Messaging.RegisterToListenEvent(objectId+'Reload',function(){t.SetContent();});this._initialized=true;}}
JobsDB_System_FormControl_SingleCheckboxInsteadOfTwo.prototype.SetContent=function(dataHash)
{var checkValue=$("#"+this._id).val();$("input[id='"+this._id+"_CheckBox']").attr('value',''+checkValue);if($("#"+this._id).val()==''+this._valueList[1])
{$("input[id='"+this._id+"_CheckBox']").attr("checked",false);}
else if($("#"+this._id).val()==''+this._valueList[0])
{$("input[id='"+this._id+"_CheckBox']").attr("checked",true);}
else
{$("input[id='"+this._id+"_CheckBox']").attr("checked",false);}}
// JobsDB.Web\Content\javascript\Form\JobsDB_System_FormControl_SingleSelectCheckbox.js

function JobsDB_System_FormControl_SingleSelectCheckbox(id)
{this._id=id;this._initialized=false;}
JobsDB_System_FormControl_SingleSelectCheckbox.prototype.SetFieldValue=function(val)
{$("input[name='"+this._id+"']").setValue(val);}
JobsDB_System_FormControl_SingleSelectCheckbox.prototype.init=function(setFieldValueList,initValue)
{if(!this._initialized)
{console.log('Jform : '+this._id+" SingleSelectCheckboxControl initializing");var t=this;if(initValue!=null)
{setFieldValueList.push(function()
{t.SetFieldValue(initValue);});}
$("input[name='"+this._id+"']").click(function(){var option=$(this);var checked=option.attr("checked");$("input[name='"+t._id+"']").each(function(){$(this).removeAttr("checked");});if(checked)
{option.attr("checked","checked");}});this._initialized=true;}}
// JobsDB.Web\Content\javascript\Form\JobsDB_System_FormControl_SingleSelectionList.js

function JobsDB_System_FormControl_SingleSelectionList(id)
{this._id=id;this._initialized=false;}
JobsDB_System_FormControl_SingleSelectionList.prototype.SetFieldValue=function(val)
{$("#"+this._id).setValue(val);}
JobsDB_System_FormControl_SingleSelectionList.prototype.init=function(setFieldValueList,initValue,enableSorting,isAscending)
{if(!this._initialized)
{console.log('Jform : '+this._id+" SingleSelectionListControl initializing");if(initValue!=null)
{if(enableSorting)
{$("#"+this._id).sortOptions(isAscending);}
var t=this;setFieldValueList.push(function()
{t.SetFieldValue(initValue);});}
this._initialized=true;}}
// JobsDB.Web\Content\javascript\Form\JobsDB_System_FormControl_TextAreaWithCounter.js

function JobsDB_System_FormControl_TextAreaWithCounter(id,initByName,controlClassName)
{this._id=id;this._initialized=false;}
JobsDB_System_FormControl_TextAreaWithCounter.prototype.SetFieldValue=function(val)
{$("#"+this._id).setValue(val);}
JobsDB_System_FormControl_TextAreaWithCounter.prototype.init=function(setFieldValueList,initValue,lengthLimit)
{if(!this._initialized)
{console.log('Jform : '+this._id+" TextAreaWithCounterControl initializing");this._lengthLimit=lengthLimit;var t=this;if(initValue!=null)
{setFieldValueList.push(function()
{t.SetFieldValue(initValue);});$('#'+this._id+'_charsLeft').text(lengthLimit-initValue.length);}
$('#'+this._id).keyup(function(){t.CharCountUpdate();});this._initialized=true;}}
JobsDB_System_FormControl_TextAreaWithCounter.prototype.CharCountUpdate=function(){var textarea=$('#'+this._id);if(textarea.value.length>=this._lengthLimit){textarea.addClass('overlimit');textarea.value=textarea.value.substring(0,this._lengthLimit);}else{textarea.removeClass('overlimit');}
$('#'+this._id+'_charsLeft').text(this._lengthLimit-textarea.value.length);}
// JobsDB.Web\Content\javascript\Form\JobsDB_System_FormControl_TextWithAllowNumericOnly.js

function JobsDB_System_FormControl_TextWithAllowNumericOnly(id)
{this._id=id;this._initialized=false;}
JobsDB_System_FormControl_TextWithAllowNumericOnly.prototype.SetFieldValue=function(val)
{$("#"+this._id).setValue(val);}
JobsDB_System_FormControl_TextWithAllowNumericOnly.prototype.init=function(setFieldValueList,initValue)
{if(!this._initialized)
{console.log('Jform : '+this._id+" TextWithAllowNumericOnlyControl initializing");var t=this;if(initValue!=null)
{setFieldValueList.push(function()
{t.SetFieldValue(initValue);});}
var LibaryList=new Array("jquery.alphanumeric.pack.js");JobsDB_System.IncludeJsInOrderWithAction(LibaryList,function(){$("#"+t._id).numeric();});this._initialized=true;}}
// JobsDB.Web\Content\javascript\Form\JobsDB_System_FormControl_TinyMCE.js

function JobsDB_System_FormControl_TinyMCE(id)
{this._id=id;this._initialized=false;}
JobsDB_System_FormControl_TinyMCE.prototype.SetFieldValue=function(val)
{$("input[name='"+this._id+"']").setValue(val);if(tinyMCE.get('richTextBox'+this._id)!=null&&tinyMCE.get('richTextBox'+this._id)!=undefined)
{this.OnMCEInit();}}
JobsDB_System_FormControl_TinyMCE.prototype.init=function(setFieldValueList,initValue,objectId,width,resizeFlag)
{if(!this._initialized)
{console.log('Jform : '+this._id+" TinyMCEControl initializing");var t=this;if(initValue!=null)
{setFieldValueList.push(function()
{t.SetFieldValue(initValue);});}
JobsDB_System_Messaging.RegisterToListenEvent(objectId+'Reload',function(dataHash){t.SetContent(dataHash);});tinyMCE.init({theme:"advanced",mode:"exact",elements:"richTextBox"+t._id,width:width,oninit:function(){t.OnMCEInit();},onchange_callback:function(inst){t.OnChangeSave(inst);},debug:false,theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",invalid_elements:"IMG,SELECT,AREA,IFRAME,BASE,INPUT,SCRIPT,EMBED,OBJECT,LINK,BUTTON,MARQUEE,BLINK,STYLE,APPLET,IFRAME,FRAME,FORM,TEXTAREA,MAP",convert_newlines_to_brs:true,force_br_newlines:true,entity_encoding:"named",plugins:"iespell",theme_advanced_buttons1:"fontselect,fontsizeselect,backcolor,forecolor,|,cut,copy,paste,pastetext,pasteword,|,bold,italic,underline,|,sub,sup,charmap",theme_advanced_buttons2:"bullist,numlist,|,undo,redo,|,hr,removeformat,|,link,unlink,|,code,preview,iespell",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",theme_advanced_statusbar_location:"bottom",theme_advanced_resizing:resizeFlag});this._initialized=true;}}
JobsDB_System_FormControl_TinyMCE.prototype.SetContent=function(dataHash)
{if(tinyMCE!=null){try{var editorInstance=tinyMCE.get('richTextBox'+this._id);editorInstance.setContent($("#"+this._id).val());}
catch(err){}}}
JobsDB_System_FormControl_TinyMCE.prototype.OnMCEInit=function(){var editorInstance=tinyMCE.get('richTextBox'+this._id);editorInstance.setContent($("#"+this._id).val());}
JobsDB_System_FormControl_TinyMCE.prototype.OnChangeSave=function(inst){$("#"+this._id).val(inst.getBody().innerHTML);}
// JobsDB.Web\Content\javascript\Form\JobsDB_System_FormControl_TinyMCELazy.js

function JobsDB_System_FormControl_TinyMCELazy(id)
{this._id=id;this._initialized=false;this._initedTinyMce=false;this._editorInstance=null;}
JobsDB_System_FormControl_TinyMCELazy.prototype.SetFieldValue=function(val)
{var tValue=tinyfyStripUpHtmlComment(val);$("#"+this._id).setValue(tValue);this.LoadToFakeContentInternal(tValue);}
JobsDB_System_FormControl_TinyMCELazy.prototype.init=function(setFieldValueList,applyEffectList,initValue,objectId,width,height,lengthLimit,eventName,wordingExcessLengthLimit)
{if(!this._initialized)
{console.log('Jform : '+this._id+" TinyMCELazyControl initializing");this._width=width;this._height=height;this._lengthLimit=lengthLimit;this._eventName=eventName;this._wordingExcessLengthLimit=wordingExcessLengthLimit;var t=this;setFieldValueList.push(function(){t.SetFieldValue(initValue);});applyEffectList.add(function(){t.ApplyEffect();});JobsDB_System_Messaging.RegisterToListenEvent(objectId+'Reload',function(){t.LoadToFakeContent();});$("#"+this._id+"TinyMceFakeEditorWithValue").click(function(){t.InitTinyMce();});$("#"+this._id+"TinyMceFakeContentIframe").load(function()
{$("#"+t._id+"TinyMceFakeContentIframe").contents().find("body").click(function()
{t.InitTinyMce();});$("#"+t._id+"TinyMceFakeContentIframe").contents().find("head").html(tinyMceLazyStyle);t.LoadToFakeContent();});$("#"+this._id+"TinyMceFakeContentIframe").attr("src","");if(width!=null)
{var widthMinusBorder=width-2;$('#'+this._id+'TinyMceHeader').width(widthMinusBorder);$('#'+this._id+'TinyMceFakeContent').width(widthMinusBorder);}
if(height!=null)
{$('#'+this._id+'TinyMceFakeContent').height(height-69);}
if(this._lengthLimit!=null)
{$('#'+this._id+'_charsLeft').text(""+(this._lengthLimit-this.RemoveHTMLTag(initValue).length));}
JobsDB_System.AjaxLibraryLoadCompletedFunctionExecutor(function(){t.Initize();});this._initialized=true;}}
JobsDB_System_FormControl_TinyMCELazy.prototype.InitTinyMce=function()
{var t=this;tinyfyspecify(this._id+'richTextBox',function(){t.OnChangeCallback();},function(){t.InitInstanceCallback();},this._width,this._height,this._lengthLimit);$('#'+this._id+'TinyMceWrapper').css({width:'',height:'',overflow:''});$("#"+this._id+"TinyMceFakeEditorWithValue").hide();tinyMCE.execCommand('mceFocus',true,this._id+'richTextBox');}
JobsDB_System_FormControl_TinyMCELazy.prototype.ExecCommand=function(param1,param2,param3){var t=this;var delay=0;if(this._editorInstance==null)
{this.InitTinyMce();this._editorInstance=tinyMCE.get('richTextBox'+this._id);delay=1000;}
$(this).delay(delay,function(){t._editorInstance.execCommand(param1,param2,param3);});this.OnChangeCallback();}
JobsDB_System_FormControl_TinyMCELazy.prototype.LoadToFakeContentInternal=function(content){try{$("#"+this._id+"TinyMceFakeContentIframe").contents().find("body").html(content);}catch(e)
{console.log("Unable to reload the content since the "+this._id+" fake iframe does not ready");}}
JobsDB_System_FormControl_TinyMCELazy.prototype.LoadToFakeContent=function(){var actualValue=$('#'+this._id).val();actualValue=tinyfyStripUpHtmlComment(actualValue);$('#'+this._id).val(actualValue)
this.LoadToFakeContentInternal(actualValue);}
JobsDB_System_FormControl_TinyMCELazy.prototype.ApplyEffect=function()
{if(this._editorInstance!=null)
{this._editorInstance.setContent($("#"+this._id).val());}}
JobsDB_System_FormControl_TinyMCELazy.prototype.RemoveHTMLTag=function(text)
{var trimtext=text.replace(/<\/?[^>]+(>|$)/g,"");var refactoredtext=trimtext.replace(/&(lt|gt);/g,function(strMatch,p1){return(p1=="lt")?"<":">";});refactoredtext=refactoredtext.replace(/&(nbsp);/g," ").replace(/\r/g,"").replace(/\n/g,"");if(refactoredtext.length==1&&refactoredtext==" ")
{refactoredtext="";}
return refactoredtext;}
JobsDB_System_FormControl_TinyMCELazy.prototype.OnChangeCallback=function(){var originalText=tinyfyStripUpHtmlComment(this._editorInstance.getBody().innerHTML);var trimtext=this.RemoveHTMLTag(originalText);if(this._lengthLimit!=null)
{var errorMessageElements=$("#Error_"+this._id);if(trimtext.length==0)
{$("#"+this._id).val("");}
else
{$("#"+this._id).val(originalText);}
if(trimtext.length>this._lengthLimit)
{$('#'+this._id+'_charsLeftHolder').hide();var warning=this._wordingExcessLengthLimit.replace("{0}",this._lengthLimit);errorMessageElements.html('<div class="error formError" htmlfor="'+this._id+'" generated="true">'+warning+'</div>');}
else
{errorMessageElements.html('');$('#'+this._id+'_charsLeft').text(this._lengthLimit-trimtext.length);$('#'+this._id+'_charsLeftHolder').show();}}
else
{if(trimtext.length==0)
{$("#"+this._id).val("");}
else
{$("#"+this._id).val(originalText);}}
console.log(this._id+' value:'+$("#"+this._id).val());if(this._eventName!="")
{JobsDB_System_Messaging.PublishEvent(this._id+this._eventName,$("#"+this._id).val());}}
JobsDB_System_FormControl_TinyMCELazy.prototype.InitInstanceCallback=function(){this._editorInstance=tinyMCE.get(this._id+"richTextBox");this._initedTinyMce=true;this._editorInstance.setContent($("#"+this._id).val());if(this._lengthLimit!=null)
{$("#"+this._id).rules("add",{tinyMceMaximum:[0,this._lengthLimit],messages:{tinyMceMaximum:this._wordingExcessLengthLimit.replace("{0}",this._lengthLimit)}});}}
JobsDB_System_FormControl_TinyMCELazy.prototype.Initize=function(){$('#'+this._id+'TinyMceHeader').image(imagesUrlBase+'Shared/TinyMceHeader.jpg');$("#"+this._id+"TinyMceFakeEditorWithValue").show();}
// JobsDB.Web\Content\javascript\Form\JobsDB_System_FormControl_TreeViewControl.js

function JobsDB_System_FormControl_TreeViewControl(id)
{this._id=id;this._initialized=false;this._checkBoxName=this._id+"OptionCheckBox";this._iconMaxControlName=this._id+"_Max";this._iconMinControlName=this._id+"_Min";this._subCatControlName=this._id+"_SubCat";this._parentCheckBoxClassName=this._id+"_ParentCheckBox";}
JobsDB_System_FormControl_TreeViewControl.prototype.SetFieldValue=function(val)
{this.PopulateToControl(val);this.ExpandTreeControl();}
JobsDB_System_FormControl_TreeViewControl.prototype.init=function(setFieldValueList,reloadControlTemplateList,initValue)
{if(!this._initialized)
{console.log('Jform : '+this._id+" TreeViewControl initializing");var t=this;setFieldValueList.push(function(){t.SetFieldValue(initValue);});reloadControlTemplateList.add(function(){t.ReloadAction();});JobsDB_System_Messaging.RegisterToListenEvent(this._id+'TreeViewControlClear',function(){t.ClearAllValue();});$("."+this._iconMaxControlName).click(function()
{var iconMaxControlId=$(this).attr('id');var catId=iconMaxControlId.replace(t._iconMaxControlName,'');var subCatControlId=t._subCatControlName+"_"+catId;$(this).hide();$("#"+t._iconMinControlName+catId).show();$("#"+subCatControlId).show();});$("."+this._iconMinControlName).click(function()
{var iconMinControlId=$(this).attr('id');var catId=iconMinControlId.replace(t._iconMinControlName,'');var subCatControlId=t._subCatControlName+"_"+catId;$(this).hide();$("#"+t._iconMaxControlName+catId).show();$("#"+subCatControlId).hide();});$("input[name='"+this._checkBoxName+"']").click(function()
{if($(this).hasClass(t._parentCheckBoxClassName))
{t.UpdateTreeControlUI(this);}
var selectedItemsValue=$("input[name='"+t._checkBoxName+"']").getValue();$("#"+t._id).val(selectedItemsValue);});this._initialized=true;}}
JobsDB_System_FormControl_TreeViewControl.prototype.UpdateTreeControlUI=function(parentControl)
{var parentCatId=$(parentControl).attr('value');var subCatControlElementContainer=$("#"+this._subCatControlName+"_"+parentCatId);var subCatCheckBoxes=$("input[name='"+this._checkBoxName+"']",subCatControlElementContainer);if($(parentControl).is(":checked"))
{subCatCheckBoxes.attr('checked',false);subCatCheckBoxes.css('display','none');$(".disabledCheckBoxImage",subCatControlElementContainer).css('display','block');}
else
{subCatCheckBoxes.css('display','block');$(".disabledCheckBoxImage",subCatControlElementContainer).css('display','none');}}
JobsDB_System_FormControl_TreeViewControl.prototype.PopulateToControl=function(value)
{var t=this;$("input[name='"+this._id+"']").setValue(value);$("input[name='"+this._checkBoxName+"']").setValue(value);$("."+this._parentCheckBoxClassName).each(function()
{t.UpdateTreeControlUI(this);});}
JobsDB_System_FormControl_TreeViewControl.prototype.ClearAllValue=function()
{this.PopulateToControl('');}
JobsDB_System_FormControl_TreeViewControl.prototype.ExpandTreeControl=function()
{var t=this;$("."+this._parentCheckBoxClassName).each(function()
{var catId=$(this).attr('value');var subCatListContainer=$("#"+this._subCatControlName+"_"+catId);if(subCatListContainer.length>0)
{var checkedList=$("input[name='"+this._checkBoxName+"']:checked",subCatListContainer);if(checkedList.length>0)
{$("##"+this._iconMaxControlName+catId).click();}}});}
JobsDB_System_FormControl_TreeViewControl.prototype.ReloadAction=function()
{this.PopulateToControl($("#"+this._id).getValue());this.ExpandTreeControl();}
// JobsDB.Web\Content\javascript\JobsDB_System_MetaFormSet.js

function JobsDB_System_MetaFormSet(metaFormSetId){this.MetaFormSetId=metaFormSetId;this.DataActionList=new Array();this.ValidationActionList=new Array();this.ValidationEnableActionList=new Array();this.ValidationDisableActionList=new Array();this.ReloadActionList=new Array();this.ReadyActionList=new Array();this.MetaFormSetClearActionList=new Array();this.Enabled=false;this.LazyInitList=new Array();this.LazyInitComplete=false;this.LibaryList=["jquery.form.js","jquery.field.js","jquery.metadata.js","jquery.validate.js"];this.formControlContainer=new JobsDB_System_FormControlContainer();}
JobsDB_System_MetaFormSet.prototype.GetXml=function(){if(!this.Enabled)
return'';var metaformsArray=new Array();for(var i=0;i<this.DataActionList.length;i++){var func=this.DataActionList[i];try{metaformsArray.add(func());}
catch(e){console.error(e);}}
var metaformJsonTemplate=new Object();metaformJsonTemplate.metaforms=metaformsArray;var result=JSON.stringify(metaformJsonTemplate);return result;}
JobsDB_System_MetaFormSet.prototype.IsValid=function(){if(!this.Enabled)
return false;var isValid=true;for(var i=0;i<this.ValidationActionList.length;i++){var func=this.ValidationActionList[i];try{var isCurrentSectionValid=func();if(!isCurrentSectionValid)
{console.info("Error in Form Section: \n"+func);}
isValid=(isValid&&isCurrentSectionValid);}
catch(e){isValid=false;}}
return isValid;}
JobsDB_System_MetaFormSet.prototype.ValidationEnable=function(){JobsDB_System.Dispatch(this.ValidationEnableActionList);}
JobsDB_System_MetaFormSet.prototype.ValidationDisable=function(){JobsDB_System.Dispatch(this.ValidationDisableActionList);}
JobsDB_System_MetaFormSet.prototype.Clear=function(){JobsDB_System.Dispatch(this.MetaFormSetClearActionList);}
JobsDB_System_MetaFormSet.prototype.ReloadData=function(metaformJsonTemplateStringOrObject,ignoreList){this.ValidationDisable();try{if(!this.LazyInitComplete){JobsDB_System.Dispatch(this.LazyInitList);this.LazyInitComplete=true;}
var reloadActionList=this.ReloadActionList;var metaformJsonTemplate=((typeof metaformJsonTemplateStringOrObject)=='string')?JSON.parse(metaformJsonTemplateStringOrObject):metaformJsonTemplateStringOrObject;var metaforms=metaformJsonTemplate.metaforms;for(var j=0;j<metaforms.length;j++){var metaform=JSON.parse(metaforms[j]);var id=metaform.metaformId;var data=metaform.metaformContent;if(debugMode){console.log('id:'+id+' data:'+data);}
for(var i=0;i<reloadActionList.length;i++){var func=reloadActionList[i];try{func(id,data,ignoreList);}
catch(e){console.error("Error in ReloadData in METAFORM id"+id+'\n'+data);}}}}catch(e){console.error("Error in ReloadData in METAFORM.");}
finally{this.ValidationEnable();}}
JobsDB_System_MetaFormSet.prototype.Enable=function(){this.Enabled=true;console.log(this.MetaFormSetId+'Enabled');JobsDB_System_Messaging.PublishEvent(this.MetaFormSetId+'Enabled',true);}
JobsDB_System_MetaFormSet.prototype.LibaryReady=function(){JobsDB_System.Dispatch(this.ReadyActionList);this.Enable();}
