/*
 * 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'read_only_text':this.formControls[controlId]=new JobsDB_System_FormControl_SimpleControl(controlId,false,'ReadOnlyText');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'single_selection_list_with_custom_style':this.formControls[controlId]=new JobsDB_System_FormControl_SingleSelectionListWithCustomStyle(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_CheckBox(controlId);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'async_upload2':this.formControls[controlId]=new JobsDB_System_FormControl_AsyncUpload2(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,true,'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_AsyncUpload2.js

function JobsDB_System_FormControl_AsyncUpload2(id)
{this._id=id;this._initialized=false;this._firstLoad=true;this._maximumFileLengthAllow=100;this._uploadedAttachments=[];}
JobsDB_System_FormControl_AsyncUpload2.prototype.SetFieldValue=function(val)
{if(val!=''){if(this._isUploadMultiple){throw"system internal error";}else{var tokens=val.split(":");var fileName=tokens[3];this.AssignValue(fileName,val,null);}}}
JobsDB_System_FormControl_AsyncUpload2.prototype.init=function(setFieldValueList,initValue,metaFormSet,downloadSessionControllerAction,downloadControllerAction,uploadControllerAction,requireThumbnail,fileExtension,wordingUpload,wordingUploading,wordingInvalidAttachmentFileLength,wordingFileExtensionNotSupported,wordingFileAttachmentSizeTooLarge,wordingEmptyFile,wordingVirus,wordingErrorDuringAttachmentUpload,isUploadMultiple,getFileSizeControllerAction,getFileSizeSessionControllerAction)
{if(!this._initialized)
{console.log('Jform : '+this._id+" AsyncUpload2Control initializing");this._value=initValue;this._getFileSizeSessionControllerAction=getFileSizeSessionControllerAction;this._getFileSizeControllerAction=getFileSizeControllerAction;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;this._isUploadMultiple=isUploadMultiple&&(isUploadMultiple.toLowerCase=='true');if(this._isUploadMultiple){throw"system internal error";}
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_AsyncUpload2.prototype.GetAttachmentPathsInternal=function(value,reqThumbnail){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];return{countryCode:countryCode,mode:mode,id:id};}
return null;}
JobsDB_System_FormControl_AsyncUpload2.prototype.GetAttachmentPaths=function(value,reqThumbnail){var pathData=this.GetAttachmentPathsInternal(value,reqThumbnail);if(pathData!=null){if(pathData.mode=='S'){return JobsDB_System_ControllerResponseConversion.CountryCodeToDomain(pathData.countryCode)+'en/'+this._downloadSessionControllerAction+'?sessionId='+pathData.id;}else if(pathData.mode=='P'){return JobsDB_System_ControllerResponseConversion.CountryCodeToDomain(pathData.countryCode)+'en/'+this._downloadControllerAction+'?attachmentId='+pathData.id;}}
return null;}
JobsDB_System_FormControl_AsyncUpload2.prototype.GetGettingFileSizePaths=function(value,reqThumbnail){var pathData=this.GetAttachmentPathsInternal(value,reqThumbnail);if(pathData!=null){if(pathData.mode=='S'){return JobsDB_System_ControllerResponseConversion.CountryCodeToDomain(pathData.countryCode)+'en/'+this._getFileSizeSessionControllerAction+'?sessionId='+pathData.id;}else if(pathData.mode=='P'){return JobsDB_System_ControllerResponseConversion.CountryCodeToDomain(pathData.countryCode)+'en/'+this._getFileSizeControllerAction+'?attachmentId='+pathData.id;}}
return null;}
JobsDB_System_FormControl_AsyncUpload2.prototype.DeleteUploadedItem=function(attachmentId,attachmentElement){var attachmentIndex=-1;for(var i=0;i<this._uploadedAttachments.length;++i){if(this._uploadedAttachments[0].attachmentId==attachmentId){attachmentIndex=i;break;}}
if(attachmentIndex<0){return;}
var removingRecord=this._uploadedAttachments[attachmentIndex];this._uploadedAttachments.splice(attachmentIndex,1);if(this._isUploadMultiple){throw"system internal error";}else{$('#'+this._id).setValue('');}
$('#UploadedRegion'+this._id).html('');$('#UploadButton'+this._id).show();}
JobsDB_System_FormControl_AsyncUpload2.prototype.AssignValueInternal=function(file,response,fileSize,completeCallBack){var t_=this;if(!this._isUploadMultiple){while(t_._uploadedAttachments.length!=0){t_.DeleteUploadedItem(t_._uploadedAttachments[0].attachmentId,t_._uploadedAttachments[0].attachmentElement);}}
var formatedFileSizeForDisplay='';var formatedFileSize=this.GetFormatedFileSize(fileSize);if(formatedFileSize){formatedFileSizeForDisplay=' ('+formatedFileSize+')';}
if(this._isUploadMultiple){throw"system internal error";}else{$('#'+this._id).setValue(response);}
var downloadLink='<li><a href="'+this.GetAttachmentPaths(response,false)+'">'+file+formatedFileSizeForDisplay+'</a></li>';var downloadLinkElement=$(downloadLink);var removeButton='<a class="remove">&#215;</a>';var removeButtonElement=$(removeButton);removeButtonElement.click(function(){t_.DeleteUploadedItem(response,downloadLinkElement);});downloadLinkElement.append(removeButtonElement);$('#UploadedRegion'+this._id).append(downloadLinkElement);this._uploadedAttachments.push({attachmentId:response,attachmentElement:downloadLinkElement});if(completeCallBack!=null){completeCallBack();}
JobsDB_System_Messaging.PublishEvent(this._id+'_ValueChanged',response);}
JobsDB_System_FormControl_AsyncUpload2.prototype.AssignValue=function(file,response,completeCallBack){var t=this;var url=t.GetGettingFileSizePaths(response,false);var ajax=JobsDB_System_Messaging.GenericAjax().getInstance(url,'POST','MainPage');ajax.addOnSuccessListener(function(fileSize){t.AssignValueInternal(file,response,fileSize,completeCallBack);});ajax.addOnErrorListener(function(){t.AssignValueInternal(file,response,null,completeCallBack);});ajax.innerSubmitWithResultInJson([]);}
JobsDB_System_FormControl_AsyncUpload2.prototype.GetSupportedExtList=function(){var supportedExts='.'+this._fileExtension;return supportedExts.replace(/,/g,'/.');}
JobsDB_System_FormControl_AsyncUpload2.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_AsyncUpload2.prototype.ApplyEffect=function(){var button=$('#UploadButton'+this._id);var uploadingMessage=$('#UploadMessage'+this._id);var errorMessages=$('#UploadErrorMessage'+this._id);var image='<img src="'+imagesUrlBase+'Shared/ani_circular.gif" />';uploadingMessage.html(image);var t=this;new Ajax_upload(button,{action:virtualDir+t._uploadControllerAction+"?RequireThumbnail="+t._requireThumbnail+"&Id="+t._id,onSubmit:function(file,ext){errorMessages.hide();errorMessages.html('');if(file.length>t._maximumFileLengthAllow)
{errorMessages.text(t._wordingInvalidAttachmentFileLength);errorMessages.show();return false;}
if(!t.IsSupportedExt(ext)){errorMessages.text(t._wordingFileExtensionNotSupported.replace('{0}',ext).replace('{1}',t._fileExtension.replace(/,/g,' ')));errorMessages.show();return false;}
button.hide();this.disable();uploadingMessage.show();},onComplete:function(file,response){var ajaxUploadObject=this;function onEveryThingDone(){$("#Error_"+t._id).html('');uploadingMessage.hide();ajaxUploadObject.enable();button.show();}
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,onEveryThingDone);}else if(status=="F"){onEveryThingDone();var failure=responseTokens[1].trim();if(failure=="FileSize"){var maxFileSize=responseTokens[2];errorMessages.text(t._wordingFileAttachmentSizeTooLarge.replace("{0}",maxFileSize));}else if(failure=="EmptyFile"){errorMessages.text(t._wordingEmptyFile);}else if(failure=="FileContainVirus"){errorMessages.text(t._wordingVirus);}else if(failure=="FileFormatUnsupported"){var ext='';var indexOfExt=file.lastIndexOf('.');if(indexOfExt>=0)
{ext=file.substring(indexOfExt);}
errorMessages.text(t._wordingFileExtensionNotSupported.replace('{0}',ext).replace('{1}',t._fileExtension.replace(/,/g,' ')));}else{errorMessages.text(t._wordingErrorDuringAttachmentUpload);}
errorMessages.show();}}});}
JobsDB_System_FormControl_AsyncUpload2.prototype.GetFormatedFileSize=function(rawFileSize){var fileSize=0;try{fileSize=parseInt(rawFileSize);if(fileSize!=fileSize||fileSize<0){return null;}}catch(ex){return null;}
var mb=Math.floor((fileSize/(1024*1024))*100)/100;var kb=Math.floor((fileSize/1024)*100)/100;var b=fileSize;if(mb>=1){return mb+'mb';}else if(kb>=1){return kb+'kb';}else{return b+'bytes';}}
// 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._maxYearOperator,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;this._preferedImageWidth=null;this._preferedImageHeight=null;}
JobsDB_System_FormControl_Captcha.prototype.SetFieldValue=function(val)
{$("#"+this._id).setValue(val);}
JobsDB_System_FormControl_Captcha.prototype.init=function(setFieldValueList,initValue,preferedImageWidth,preferedImageHeight){if(!this._initialized){console.log('Jform : '+this._id+" CaptchaControl initializing");var t=this;if(initValue!=null){setFieldValueList.push(function(){t.SetFieldValue(initValue);});}
if(preferedImageWidth!=null&&preferedImageWidth!=undefined&&preferedImageHeight!=null&&preferedImageHeight!=undefined){this._preferedImageWidth=preferedImageWidth;this._preferedImageHeight=preferedImageHeight;}
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("");var imageRetriveUrl=null;if(this._preferedImageWidth!=null&&this._preferedImageHeight!=null){imageRetriveUrl=g_currentSite+"/JobSeeker/LoadAdvancedCaptcha?width="+this._preferedImageWidth+"&height="+this._preferedImageHeight+"&r="+Math.random();}else{imageRetriveUrl=g_currentSite+"/JobSeeker/LoadCaptcha?r="+Math.random();}
$("#"+this._id+"_image").image(imageRetriveUrl,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_CheckBox.js

function JobsDB_System_FormControl_CheckBox(id){this._id=id;this._initialized=false;var instance=this;var validateOnClick=false;var checkboxJqueryObjects;function CheckBoxClicked(e){if(validateOnClick){checkboxJqueryObjects.valid();}}
function BindEvents(){checkboxJqueryObjects.click(CheckBoxClicked);}
function SetFieldValueImpl(val){checkboxJqueryObjects.setValue(val);}
function InitSetValueList(setFieldValueList,initValue){setFieldValueList.push(function(){SetFieldValueImpl(initValue);});}
this.SetFieldValue=function(val){SetFieldValueImpl(val);}
this.init=function(setFieldValueList,initValue,shouldValidateOnClick){if(!this._initialized){checkboxJqueryObjects=$("input[name='"+this._id+"']");if(initValue!=null){InitSetValueList(setFieldValueList,initValue);}
BindEvents();if(shouldValidateOnClick!=undefined&&shouldValidateOnClick!=null){validateOnClick=shouldValidateOnClick;}
this._initialized=true;}}}
// 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;this._iPadScrollEnabled=false;this._validOptionIds=null;this._readonly=false;}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.SetFieldValue=function(val)
{val=this.FilterWithValidOptionFilter(val);$("input[name='"+this._id+"']").setValue(val);$("input[name='"+this._id+"Option']").setValue(val);this._previousValue=val;if(this._completelyInited)
{this.RefreshDisableCheckbox();this.RefreshUl();}}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.init=function(setFieldValueList,applyEffectList,reloadControlTemplateList,lazyInitList,initValue,lazyInit,allowSelectParent,wordingMaximumSelectNumberItems,contentTextId,isTwoLevel,maximunCheckCount)
{if(!this._initialized)
{console.log('Jform : '+this._id+" MultipleLevelCheckboxWidgetControl initializing");this._lazyInit=lazyInit;this._allowSelectParent=allowSelectParent;this._wordingMaximumSelectNumberItems=wordingMaximumSelectNumberItems;this._contentTextId=contentTextId;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)
{var t=this;$("input[name='"+t._id+"Option']").each(function(){if(t.IsValidOption($(this).val())){$(this).attr('disabled',false);}else{$(this).attr('checked',false);$(this).attr('disabled',true);}});$("."+t._id+"ParentLi").each(function(){var hasValidOption=false;$(this).find("input[name='"+t._id+"Option']").each(function(){hasValidOption=hasValidOption||t.IsValidOption($(this).val());});if(!hasValidOption){$(this).next('li.JClistSubcat').find("input[name='"+t._id+"Option']").each(function(){hasValidOption=hasValidOption||t.IsValidOption($(this).val());});}
if(hasValidOption){$(this).show();}else{$(this).find('.'+t._id+'icon_min').click();$(this).hide();}});if(this._maximunCheckCount==1)
{return;}
$.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);});}}});}}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.HasSelectedOption=function(){return($("input[name='"+this._id+"Option']:checked:enabled").length>0);}
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();}
var newValue=$("input[name='"+t._id+"Option']").getValue();newValue=this.FilterWithValidOptionFilter(newValue);$("input[name='"+t._id+"']").setValue(newValue);}}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.Clear=function(){if(this._completelyInited)
{var t=this;$.each($("input[name='"+this._id+"Option']"),function(){if(t.IsValidOption($(this).val())){$(this).removeAttr('checked');$(this).removeAttr('disabled');}else{$(this).attr('checked',false);$(this).attr('disabled',true);}});$('#'+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;var t=this;$("input[name='"+this._id+"Option']").each(function(){if(t.IsValidOption($(this).val())){$(this).removeAttr('disabled');}else{$(this).attr('checked',false);$(this).attr('disabled',true);}});$('.'+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();}});$("input[name='"+this._id+"Option']").click(function(){if(!t.IsValidOption($(this).val())){return;}
else 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);if(t.IsValidOption($(this).val())){$(this).removeAttr('disabled');}else{$(this).attr('disabled',true);}
$(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);if(t.IsValidOption($(this).val())){$(this).removeAttr('disabled');}else{$(this).attr('disabled',true);}
$(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);if(t.IsValidOption($(this).val())){$(this).removeAttr('disabled');}else{$(this).attr('disabled',true);}
$(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);if(t.IsValidOption($(this).val())){$(this).removeAttr('disabled');}else{$(this).attr('disabled',true);}});var previousValue=t.FilterWithValidOptionFilter(t._previousValue);$("input[name='"+t._id+"']").setValue(previousValue);$("input[name='"+t._id+"Option']").setValue(previousValue);t.RefreshDisableCheckbox();t.RefreshUl();$('#'+t._id+'MultipleLevelCheckboxPanel').dBoxHide();});$('#'+this._id+'Done').click(function(){$('#'+t._id).valid();t.RefreshUl();$('#'+t._id+'MultipleLevelCheckboxPanel').dBoxHide();JobsDB_System_Messaging.PublishEvent(t._id+'DoneClicked',t);});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);});}
this.RefreshDisableCheckbox();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=eval(this._contentTextId);console.timeEnd('ExtractFromContentFromTextArea');}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.ApplyEffect=function()
{if(this._completelyInited)
{this.RefreshDisableCheckbox();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()
{var value=$("input[name='"+this._id+"']").getValue();value=this.FilterWithValidOptionFilter(value);$("input[name='"+this._id+"']").setValue(value);$("input[name='"+this._id+"Option']").setValue(value);if(this._completelyInited)
{this.RefreshDisableCheckbox();this.RefreshUl();}}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.ShowLayer=function(){if(this._readonly){return;}
console.time('showLayer');this.LazyInit();if(this._multipleLevelCheckboxReady){if(!this._createdDBox){this.CreateDBox();}
var previousValue=$("input[name='"+this._id+"Option']").getValue();this._previousValue=this.FilterWithValidOptionFilter(previousValue);this.RefreshDisableCheckbox();var panel=$('#'+this._id+'MultipleLevelCheckboxPanel');panel.dBoxShow();}
if(JobsDB_Common.IsIPad()&&!this._iPadScrollEnabled){var element=$("#"+this._id+"ContentPlaceHolder");JobsDB_Common.CreateIPadWrapperAndEnableScrolling(element[0]);this._iPadScrollEnabled=true;}
console.timeEnd('showLayer');}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.CheckForEnter=function(event){if(event.keyCode==13){this.ShowLayer();}}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.IsValidOption=function(val){if(!this._validOptionIds){return true;}
for(var i=0;i<this._validOptionIds.length;++i){if(this._validOptionIds[i]==val){return true;}}
return false;}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.FilterWithValidOptionFilter=function(value){if(!value||!this._validOptionIds){return value;}
var newValue;var optionList=value.split(',');var newOptionList=new Array();for(var i=0;i<optionList.length;++i){if(this.IsValidOption(optionList[i])){newOptionList.push(optionList[i]);}}
newValue=newOptionList.join(',');return newValue;}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.SetValidOptionFilter=function(validOptionIds){this._validOptionIds=validOptionIds;var currentValue=$("input[name='"+this._id+"']").val();currentValue=this.FilterWithValidOptionFilter(currentValue);this.SetFieldValue(currentValue);}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.ClearValidOptionFilter=function(validOptionIds){this.SetValidOptionFilter(null);}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.IsValidOptionFilterEquals=function(validOptionIds){if(!validOptionIds&&!this._validOptionIds){return true;}
if(validOptionIds&&this._validOptionIds){if(validOptionIds.length!=this._validOptionIds.length){return false;}
var sortedValidOptionIdsA=validOptionIds.clone().sort();var sortedValidOptionIdsB=this._validOptionIds.clone().sort();for(var i=0;i<sortedValidOptionIdsA.length;++i){if(sortedValidOptionIdsA[i]!=sortedValidOptionIdsB[i]){return false;}}
return true;}
return false;}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.GetIsReadOnly=function(){return this._readonly;}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.SetIsReadOnly=function(isReadOnly){JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.SetIsReadOnly(isReadOnly,isReadOnly);}
JobsDB_System_FormControl_MultipleLevelCheckboxWidget.prototype.SetIsReadOnly=function(isReadOnly,isDisableCss){if(isReadOnly==this._readonly){return;}
this._readonly=isReadOnly;if(isDisableCss){$('#'+this._id+'Selection').hide();$('#'+this._id+'SelectedItems').css('cursor','default');$('#'+this._id+'SelectedItemsUl').removeClass('mT30');}else{$('#'+this._id+'SelectedItemsUl').addClass('mT30');$('#'+this._id+'SelectedItems').css('cursor','pointer');$('#'+this._id+'Selection').show();}}
// 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_System_FormControl_SingleCheckboxInsteadOfTwo.prototype.Hide=function(dataHash)
{$("#"+this._id+"_Control").hide();}
// 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_SingleSelectionListWithCustomStyle.js

function JobsDB_System_FormControl_SingleSelectionListWithCustomStyle(id){var instance=this;var selectedOptionContainer;var element;this._id=id;this._initialized=false;function SelectionChanged(e){var selectedText=$("option:selected",this).text();selectedOptionContainer.text(selectedText);}
this.SetFieldValue=function(val){element.setValue(val);element.change();}
this.init=function(setFieldValueList,initValue,enableSorting,isAscending){if(!this._initialized){if(initValue!=null){if(enableSorting){$("#"+this._id).sortOptions(isAscending);}
var t=this;setFieldValueList.push(function(){t.SetFieldValue(initValue);});selectedOptionContainer=$("#"+this._id+"SelectedOptionContainer");element=$("#"+this._id)
var selectedText=$("#"+this._id+" option:first").text();selectedOptionContainer.text(selectedText);element.change(SelectionChanged);}
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 idOfThis=this._id;var lengthLimitOfThis=this._lengthLimit;$('#'+idOfThis).each(function(){if(this.value.length>=lengthLimitOfThis){$(this).addClass('overlimit');this.value=this.value.substring(0,lengthLimitOfThis);}else{$(this).removeClass('overlimit');}
$('#'+idOfThis+'_charsLeft').text(lengthLimitOfThis-this.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){var instance=this;this._id=id;this._initialized=false;this._initedTinyMce=false;this._editorInstance=null;this._customTinyMceHeaderImageName=null;this.SetFieldValue=function(val){var tValue=tinyfyStripUpHtmlComment(val);$("#"+this._id).setValue(tValue);this.LoadToFakeContentInternal(tValue);}
this.init=function(setFieldValueList,applyEffectList,initValue,objectId,width,height,lengthLimit,eventName,wordingExcessLengthLimit,customHeaderImageName,customHeaderImageHeigth){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;this._customTinyMceHeaderImageName=(customHeaderImageName!=undefined&&customHeaderImageName!="")?customHeaderImageName:null;setFieldValueList.push(function(){instance.SetFieldValue(initValue);});applyEffectList.add(function(){instance.ApplyEffect();});JobsDB_System_Messaging.RegisterToListenEvent(objectId+'Reload',function(){instance.LoadToFakeContent();});$("#"+this._id+"TinyMceFakeEditorWithValue").click(function(){instance.InitTinyMce();});$("#"+this._id+"TinyMceFakeContentIframe").load(function(){$("#"+instance._id+"TinyMceFakeContentIframe").contents().find("body").click(function(){instance.InitTinyMce();});$("#"+instance._id+"TinyMceFakeContentIframe").contents().find("head").html(tinyMceLazyStyle);instance.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){var hasCustomHeaderImageHeight=(customHeaderImageHeigth!=undefined&&customHeaderImageHeigth!=null);var headerHeight=(hasCustomHeaderImageHeight)?customHeaderImageHeigth:69;$('#'+this._id+'TinyMceFakeContent').height(height-headerHeight);}
if(this._lengthLimit!=null){$('#'+this._id+'_charsLeft').text(""+(this._lengthLimit-this.RemoveHTMLTag(initValue).length));}
JobsDB_System.AjaxLibraryLoadCompletedFunctionExecutor(function(){instance.Initize();});this._initialized=true;}}
this.InitTinyMce=function(){JobsDB_System_Messaging.PublishEvent(this._id+"BeforeInitialize",this);tinyfyspecify(this._id+'richTextBox',function(){instance.OnChangeCallback();},function(){instance.InitInstanceCallback();},this._width,this._height,this._lengthLimit);$('#'+this._id+'TinyMceWrapper').css({width:'',height:'',overflow:'',zoom:1});$("#"+this._id+"TinyMceFakeEditorWithValue").hide();}
this.ExecCommand=function(param1,param2,param3){var delay=0;if(this._editorInstance==null){this.InitTinyMce();this._editorInstance=tinyMCE.get('richTextBox'+this._id);delay=1000;}
$(this).delay(delay,function(){instance._editorInstance.execCommand(param1,param2,param3);});this.OnChangeCallback();}
this.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");}}
this.LoadToFakeContent=function(){var actualValue=$('#'+this._id).val();actualValue=tinyfyStripUpHtmlComment(actualValue);$('#'+this._id).val(actualValue)
this.LoadToFakeContentInternal(actualValue);}
this.ApplyEffect=function(){if(this._editorInstance!=null){this._editorInstance.setContent($("#"+this._id).val());}}
this.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;}
this.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);}}
if(this._eventName!=""){JobsDB_System_Messaging.PublishEvent(this._id+this._eventName,$("#"+this._id).val());}}
this.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)}});}
tinyMCE.execCommand('mceFocus',true,this._id+'richTextBox');this._editorInstance.onMouseDown.add(function(editor,e){JobsDB_System_Messaging.PublishEvent(instance._id+"Activated",instance);});this._editorInstance.onKeyUp.add(function(editor,e){if(e.keyCode==9){JobsDB_System_Messaging.PublishEvent(instance._id+"Activated",instance);}});this._editorInstance.onKeyDown.add(function(editor,e){if(e.keyCode==9||e.keyCode==33||e.keyCode==34){JobsDB_System_Messaging.PublishEvent(instance._id+"Deactivated",instance);}});$("body").click(function(e){JobsDB_System_Messaging.PublishEvent(instance._id+"Deactivated",instance);});JobsDB_System_Messaging.PublishEvent(this._id+"Initialized",this);JobsDB_System_Messaging.PublishEvent(this._id+"Activated",this);}
this.Initize=function(){var tinyMceHeaderImageUrl=imagesUrlBase+'Shared/TinyMceHeader.jpg';if(this._customTinyMceHeaderImageName!=null){tinyMceHeaderImageUrl=imagesUrlBase+'Shared/'+this._customTinyMceHeaderImageName;}
$('#'+this._id+'TinyMceHeader').image(tinyMceHeaderImageUrl,function(){$(this).css("zoom","1");});$("#"+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";this._validOptionIds=null;}
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(!t.IsValidOption($(this).val())){return;}
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._checkBoxName+"']:disabled").attr('disabled',false);var filteredValue=this.FilterWithValidOptionFilter(value);$("input[name='"+this._id+"']").setValue(filteredValue);$("input[name='"+this._checkBoxName+"']").setValue(filteredValue);$("input[name='"+this._checkBoxName+"']").each(function(){if(!t.IsValidOption($(this).val())){$(this).attr('checked',false);$(this).attr('disabled',true);}});$("."+this._parentCheckBoxClassName).each(function()
{t.UpdateTreeControlUI(this);var hasValidOption=t.IsValidOption($(this).val());if(!hasValidOption){$(this).parent('li').next('li.JClistSubcat').find("input[name='"+this._checkBoxName+"']").each(function(){hasValidOption=hasValidOption||t.IsValidOption($(this).val());});}
if(hasValidOption){$(this).parent().show();}else{$(this).parent().find('.'+t._iconMinControlName).click();$(this).parent().hide();}});}
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_System_FormControl_TreeViewControl.prototype.IsValidOption=function(val){if(!this._validOptionIds){return true;}
for(var i=0;i<this._validOptionIds.length;++i){if(this._validOptionIds[i]==val){return true;}}
return false;}
JobsDB_System_FormControl_TreeViewControl.prototype.FilterWithValidOptionFilter=function(value){if(!value||!this._validOptionIds){return value;}
var newValue;var optionList=value.split(',');var newOptionList=new Array();for(var i=0;i<optionList.length;++i){if(this.IsValidOption(optionList[i])){newOptionList.push(optionList[i]);}}
newValue=newOptionList.join(',');return newValue;}
JobsDB_System_FormControl_TreeViewControl.prototype.SetValidOptionFilter=function(validOptionIds){this._validOptionIds=validOptionIds;var currentValue=$("#"+this._id).val();currentValue=this.FilterWithValidOptionFilter(currentValue);this.SetFieldValue(currentValue);}
JobsDB_System_FormControl_TreeViewControl.prototype.ClearValidOptionFilter=function(validOptionIds){this.SetValidOptionFilter(null);}
// 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=debugMode?["jquery.form.js","jquery.field.js","jquery.metadata.js","jquery.validate.js"]:["jquery.formLibrary.min.js"];this.formControlContainer=new JobsDB_System_FormControlContainer();}
JobsDB_System_MetaFormSet.prototype.GetXmlForListOfInputData=function(inputDataMetaObjectIds){if(!this.Enabled)
return'';var metaformsArray=new Array();for(var i=0;i<this.DataActionList.length;i++){var func=this.DataActionList[i];if(JobsDB_System_MetaFormSet.prototype.ContainsFunction(inputDataMetaObjectIds,func,"GetJsonData")){metaformsArray.add(func());}}
var metaformJsonTemplate=new Object();metaformJsonTemplate.metaforms=metaformsArray;var result=JSON.stringify(metaformJsonTemplate);return result;}
JobsDB_System_MetaFormSet.prototype.GetXml=function(ignoreList){if(!this.Enabled)
return'';var metaformsArray=new Array();for(var i=0;i<this.DataActionList.length;i++){var func=this.DataActionList[i];if(JobsDB_System_MetaFormSet.prototype.ContainsFunction(ignoreList,func,"GetJsonData")){continue;}
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(ignoreList){if(!this.Enabled)
return false;var isValid=true;for(var i=0;i<this.ValidationActionList.length;i++){var func=this.ValidationActionList[i];if(JobsDB_System_MetaFormSet.prototype.ContainsFunction(ignoreList,func,"Validation")){continue;}
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.ContainsFunction=function(ignoreList,func,replaceFunctionString){if(ignoreList==null||ignoreList==undefined){return false;}
var funcName=JobsDB_System_MetaFormSet.prototype.GetFunctionName(func).replace(replaceFunctionString,"");for(var i=0;i<ignoreList.length;i++){if(ignoreList[i]==funcName){return true;}}
return false;}
JobsDB_System_MetaFormSet.prototype.GetFunctionName=function(func){if(typeof func=="function"||typeof func=="object")
var fName=(""+func).match(/function\s*([\w\$]*)\s*\(/);if(fName!==null)return fName[1];}
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();}
if(typeof JobsDB_System_Form=="undefined")var JobsDB_System_Form={};JobsDB_System_Form.GetJson=function(formId){var data=$("#"+formId).formHash();var formItem=new Object();formItem.metaformId=formId;formItem.metaformContent=JSON.stringify(data);var formArray=new Array();formArray.push(JSON.stringify(formItem));var formsJson=new Object();formsJson.metaforms=formArray;return JSON.stringify(formsJson);}

