var formCheckList=new formCheckList();var dblSubmit=false;var skipValidation=false;function formCheckList(){this.checkList=new Array();this.addElement=addElement;this.removeElement=removeElement;this.removeAllElements=removeAllElements;this.getElement=getElement;this.check=checkForm}function addElement(c){if(typeof c.group!="undefined"){for(var b=0;b<this.checkList.length;b++){if(this.checkList[b].name==c.group){this.checkList[b].addElement(c);return}}var a=new CheckGroup(c);a.addElement(c);this.checkList[this.checkList.length]=a;return}this.checkList[this.checkList.length]=c}function removeElement(a){for(var b=0;b<this.checkList.length;++b){if(this.checkList[b].fieldName==a){this.checkList.splice(b,1)}}}function getElement(a){for(var b=0;b<this.checkList.length;++b){if(this.checkList[b].fieldName==a){return this.checkList[b]}}}function removeAllElements(){var a=this.checkList.length;this.checkList.splice(0,a)}function checkForm(){if(typeof(window.invalidAnswersTmp)!="undefined"){window.invalidAnswersTmp=[]}var b=true;for(var a=0;a<this.checkList.length;a++){if(!this.checkList[a].check()){if(this.checkList[a].answerChk){b=false}else{return false}}}return b}function inputText(a){if(a.id){this.element=$(a.id)}else{this.element='document.forms[0]["'+a.name+'"]'}this.shouldFocus=a.shouldFocus;if(a.shouldFocus===undefined){this.shouldFocus=true}if(this.shouldFocus){this.formatElement='document.forms[0]["'+a.display_format+'"]';this.focusElement=a.focus_element}this.fieldName=a.name;this.disable_script=a.disable_script;this.ref_label=a.ref_label;this.custom_alert=a.custom_alert;this.custom_alert_cmp=a.custom_alert_cmp;this.minlength=a.minlength;this.maxlength=a.maxlength;this.trim=a.trim;this.regex=a.regex;this.regex_msg=a.regex_msg;this.regex_match=a.regex_match;this.verify=a.verify;this.check=inputTextCheck;this.valid_number=a.valid_number;this.min_value=a.min_value;this.nonnegative=a.nonnegative;this.valid_float=a.valid_float;this.allow_negative_float=a.allow_negative_float;this.valid_percent=a.valid_percent;this.valid_efloat=a.valid_efloat;this.valid_email=a.valid_email;this.valid_url=a.valid_url;this.required_url=a.required_url;this.invalid_chars=a.invalid_chars;this.cmp_element='document.forms[0]["'+a.cmp_field+'"]';this.cmp_ref_label=a.cmp_ref_label;this.xor=a.xor;this.cmp_required=a.cmp_required;this.activeX=a.activeX;this.isHtmlDoc=a.isHtmlDoc;this.img_check=a.img_check;this.empty_value_warn=a.empty_value_warn;this.valid_system_role_id=a.valid_system_role_id;this.required=a.required;this.min_value_name=a.min_value_name;this.check_max_min=a.check_max_min;if(document.all&&document.getElementById(a.name+"_ax")){this.axobj=document.getElementById(a.name+"_ax")}}function inputTextCheck(){if(this.shouldFocus===undefined){this.shouldFocus=true}var element=eval(this.element);var cmp_element=eval(this.cmp_element);if(typeof element!="undefined"){var focusElement=element;if(this.axobj){focusElement=this.axobj}this.custom_alert=(typeof this.custom_alert!="undefined")?this.custom_alert:"";this.custom_alert_cmp=(typeof this.custom_alert_cmp!="undefined")?this.custom_alert_cmp:"";this.ref_label=(typeof this.ref_label!="undefined")?this.ref_label:JS_RESOURCES.getFormattedString("field_name.substitute",new Array(element.name));var val=element.value;if(val==null||!val.replace(/<p><\/p>/gi,"").trim()){val=""}if(this.activeX&&isEmptyWysiwyg(element)){element.value="";val=""}if(typeof eval(this.formatElement)!="undefined"){if(/<APPLET ID="(\d+)" NAME="(\w+)"/.test(element.value)){if(getRadioValue(eval(this.formatElement))=="P"){if(!confirm(JS_RESOURCES.getString("validation.plain_text.confirm"))){if(this.shouldFocus){element.focus()}return false}}}}if(this.trim){val=val.trim();element.value=val}if(typeof cmp_element!="undefined"){if(this.xor){if(val.trim()==""^cmp_element.value.trim()==""){if(val.trim()==""){alert(this.custom_alert?this.custom_alert:JS_RESOURCES.getFormattedString("validation.cmp_field.required",new Array(this.ref_label,this.cmp_ref_label)));if(this.shouldFocus){shiftFocus(focusElement,this.activeX)}}else{alert(this.custom_alert_cmp?this.custom_alert_cmp:JS_RESOURCES.getFormattedString("validation.cmp_field.required",new Array(this.cmp_ref_label,this.ref_label)));if(this.shouldFocus){cmp_element.focus()}}return false}}}if(this.disable_script){if(typeof eval(this.formatElement)=="undefined"||getRadioValue(eval(this.formatElement))!="P"){var re=/<\s*script/ig;var re1=/<\s*\/\s*script\s*>/ig;val=val.replace(re,"<disabled-script");val=val.replace(re1,"</disabled-script>");var re2=/href\s*=\s*(['"]*)\s*javascript\s*:/ig;val=val.replace(re2,"href=$1disabled-javascript:");element.value=val}}if(this.valid_number){var trimmedVal=val.trim();if(trimmedVal!=""){var numVal=parseInt(trimmedVal);var isValidNum=!isNaN(numVal);if(isValidNum){isValidNum=!isNaN(numVal)&&(numVal.toString().length==trimmedVal.length)}if(!isValidNum){alert(JS_RESOURCES.getFormattedString("validation.number",new Array(this.ref_label)));if(this.shouldFocus){element.focus()}return false}if(this.nonnegative&&numVal<0){alert(JS_RESOURCES.getFormattedString("validation.negative",new Array(this.ref_label)));if(this.shouldFocus){element.focus()}return false}if(this.min_value&&numVal<this.min_value){alert(JS_RESOURCES.getFormattedString("validation.invalid_value",new Array(this.ref_label)));if(this.shouldFocus){element.focus()}return false}}}if(this.valid_float){var trimmedVal=val.trim();var numFormat;if(this.allow_negative_float){numFormat=LOCALE_SETTINGS.getString("float.allow.negative.format")}else{numFormat=LOCALE_SETTINGS.getString("float.format")}var numVal,isValidNum;if(typeof(numFormat)!="undefined"){var re=new RegExp(numFormat);isValidNum=trimmedVal.search(re)==0}else{numVal=parseFloat(trimmedVal);isValidNum=!isNaN(numVal);if(isValidNum&&numVal.toString().length!=trimmedVal.length){var re=/^[\.0]+$/;isValidNum=re.test(trimmedVal.substring(numVal.toString().length))}}if(!isValidNum){alert(JS_RESOURCES.getFormattedString("validation.number",new Array(this.ref_label)));if(this.shouldFocus){element.focus()}return false}}if(this.valid_percent){if(!isPercent(val)){alert(JS_RESOURCES.getFormattedString("validation.percent",new Array(this.ref_label)));if(this.shouldFocus){element.focus()}return false}}if(this.valid_efloat){if(!isNumeric(val)){alert(JS_RESOURCES.getFormattedString("validation.number",new Array(this.ref_label)));if(this.shouldFocus){var focusElement=(this.focusElement?this.focusElement:this.element);if(focusElement.focus){focusElement.focus()}}return false}}if(this.check_max_min){if(_getNumber(val)<_getNumber(document.forms[0][this.min_value_name].value)){alert(JS_RESOURCES.getFormattedString("validation.maximum_less_than.minimum",new Array(this.ref_label)));var focusElement=(this.focusElement?this.focusElement:this.element);if(focusElement.focus){focusElement.focus()}return false}}if(this.valid_email){if(val.trim()==""){if(confirm(JS_RESOURCES.getString("warning.email"))){return true}else{if(this.shouldFocus){element.focus()}return false}}else{re=/^(['`a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;if(!re.test(val)){alert(JS_RESOURCES.getFormattedString("validation.email",new Array(this.ref_label)));if(this.shouldFocus){element.focus()}return false}}}if(this.empty_value_warn){if(val.trim()==""){if(confirm(this.ref_label)){return true}else{if(this.shouldFocus){element.focus()}return false}}}if(val.length<this.minlength){if(this.minlength==1){alert(this.custom_alert?this.custom_alert:JS_RESOURCES.getFormattedString("validation.required",new Array(this.ref_label)))}else{alert(this.custom_alert?this.custom_alert:JS_RESOURCES.getFormattedString("validation.minimum_length",new Array(this.minlength,this.ref_label)))}if(this.shouldFocus){shiftFocus(focusElement,this.activeX)}return false}var extra=0;if(navigator.appName=="Netscape"&&parseInt(navigator.appVersion)>=5){var index=val.indexOf("\n");while(index!=-1){extra+=1;index=val.indexOf("\n",index+1)}}if(this.maxlength<val.length+extra){var newlength=val.length+extra;if((newlength-this.maxlength)>1){alert(JS_RESOURCES.getFormattedString("validation.maximum_length.plural",new Array(this.ref_label,this.maxlength,(newlength-this.maxlength))))}else{alert(JS_RESOURCES.getFormattedString("validation.maximum_length.singular",new Array(this.ref_label,this.maxlength)))}if(this.shouldFocus){shiftFocus(focusElement,this.activeX)}return false}if(this.required_url){if(val.trim()==""){alert(JS_RESOURCES.getFormattedString("validation.required",new Array(this.ref_label)));return false}if(!isValidUrl(val)){alert(JS_RESOURCES.getFormattedString("validation.url",new Array(this.ref_label)));if(this.shouldFocus){element.focus()}return false}}if(this.valid_url){if(val.trim()==""){return true}var oRegExp=/[^:]+:\/\/[^:\/]+(:[0-9]+)?\/?.*/;if(!oRegExp.test(val)){alert(JS_RESOURCES.getFormattedString("validation.url",new Array(this.ref_label)));if(this.shouldFocus){element.focus()}return false}}if(typeof(this.regex)=="string"){this.regex=eval(this.regex)}if((typeof(this.regex)=="object"||typeof(this.regex)=="function")&&val.trim()!=""){re=this.regex;if(this.regex_match&&val.search(re)==-1){alert(this.regex_msg+this.ref_label+".");if(this.shouldFocus){shiftFocus(focusElement,this.activeX)}return false}if(!this.regex_match&&re.test(val)){alert(this.regex_msg+this.ref_label+".");if(this.shouldFocus){shiftFocus(focusElement,this.activeX)}return false}}if(this.invalid_chars){var arr=val.invalidChars(this.invalid_chars);if(arr&&arr.length){alert(JS_RESOURCES.getFormattedString("validation.invalid_chars",new Array(this.ref_label,arr.join(", "))));if(this.shouldFocus){shiftFocus(focusElement,this.activeX)}return false}}if(this.verify){var chk_field=document.forms[0][element.name.replace(/_inp$/,"_chk")];var field=document.forms[0][element.name.replace(/_inp$/,"")];if(chk_field.value!=val){alert(JS_RESOURCES.getFormattedString("validation.mismatch",new Array(this.ref_label)));if(this.shouldFocus){chk_field.focus()}return false}if(element.type=="password"){element.value=element.value.trim();if(element.value!=""){element.value=field.value=chk_field.value=calcMD5(element.value)}else{alert(JS_RESOURCES.getString("validation.password"));element.value=field.value="";if(this.shouldFocus){element.focus()}return false}}}if(this.cmp_required&&element.value.trim()!=""){if(!cmp_element.value.trim().length){alert(JS_RESOURCES.getFormattedString("validation.cmp_field.rejected",new Array(this.ref_label,this.cmp_ref_label)));if(this.shouldFocus){cmp_element.focus()}return false}}if(this.img_check){return image_check(element)}imgTag_check(element,0);if(this.valid_system_role_id){if(element.value.indexOf("BB")==0||element.value.indexOf("bb")==0){alert(this.custom_alert?this.custom_alert:JS_RESOURCES.getFormattedString("validation.system_role.reserve",new Array(this.ref_label)));if(this.shouldFocus){element.focus()}return false}else{return true}}}return true}function imgTag_check(b,e){var c=b.value.indexOf("<img",e);if(c>-1){var a=b.value.indexOf(">",c);var d=b.value.substring(c,a+1);if(d.indexOf("alt")==-1){d='<img alt="" '+d.substring(4);b.value=b.value.substring(0,c)+d+b.value.substring(a)}imgTag_check(b,a)}}function image_check(a){ext=a.value.match(/.*\.(.*)/);ext=ext?ext[1]:"";re=/gif|jpeg|png|tif|bmp|jpg/i;if(!re.test(ext)&&a.value){if(!confirm(JS_RESOURCES.getFormattedString("validation.image_type",new Array(ext)))){a.focus();return false}}return true}function inputDate(a){this.element_mm='document.forms[0]["'+a.name+'_0_mm"]';this.element_dd='document.forms[0]["'+a.name+'_0_dd"]';this.element_yyyy='document.forms[0]["'+a.name+'_0_yyyy"]';this.fieldName=a.name;this.ref_label=a.ref_label;this.custom_alert=a.custom_alert;this.custom_alert_cmp=a.custom_alert_cmp;this.check=inputDateCheck}function inputDateCheck(){var element_mm=eval(this.element_mm);var element_dd=eval(this.element_dd);var element_yyyy=eval(this.element_yyyy);if(typeof element_mm!="undefined"&&element_dd!="undefined"&&element_yyyy!="undefined"){this.custom_alert=(typeof this.custom_alert!="undefined")?this.custom_alert:"";this.ref_label=(typeof this.ref_label!="undefined")?this.ref_label:JS_RESOURCES.getFormattedString("field_name.substitute",new Array(element.name));if(element_mm.selectedIndex==-1||element_dd.selectedIndex==-1||element_yyyy==-1){alert(this.custom_alert?this.custom_alert:JS_RESOURCES.getFormattedString("validation.date.required",new Array(this.ref_label)));if(element_mm.selectedIndex==-1){element_mm.focus()}else{if(element_dd.selectedIndex==-1){element_dd.focus()}else{element_yyyy.focus()}}return false}}return true}function inputTime(a){this.element_hh='document.forms[0]["'+a.name+'_0_hh"]';this.element_mi='document.forms[0]["'+a.name+'_0_mi"]';this.element_am='document.forms[0]["'+a.name+'_0_am"]';this.fieldName=a.name;this.ref_label=a.ref_label;this.custom_alert=a.custom_alert;this.custom_alert_cmp=a.custom_alert_cmp;this.check=inputTimeCheck}function inputTimeCheck(){var element_hh=eval(this.element_hh);var element_mi=eval(this.element_mi);var element_am=eval(this.element_am);if(typeof element_hh!="undefined"&&element_mi!="undefined"&&element_am!="undefined"){this.custom_alert=(typeof this.custom_alert!="undefined")?this.custom_alert:"";this.ref_label=(typeof this.ref_label!="undefined")?this.ref_label:JS_RESOURCES.getFormattedString("field_name.substitute",new Array(element.name));if(element_hh.selectedIndex==-1||element_mi.selectedIndex==-1||element_am==-1){alert(this.custom_alert?this.custom_alert:JS_RESOURCES.getFormattedString("validation.time.required",new Array(this.ref_label)));if(element_hh.selectedIndex==-1){element_hh.focus()}else{if(element_mi.selectedIndex==-1){element_mi.focus()}else{element_am.focus()}}return false}}return true}function inputSelect(a){this.element='document.forms[0]["'+a.name+'"]';this.fieldName=a.name;this.ref_label=a.ref_label;this.minSelected=a.minSelected;this.maxSelected=a.maxSelected;this.title=a.title;this.isMultiSelect=a.isMultiSelect;this.custom_alert=a.custom_alert;this.custom_alert_cmp=a.custom_alert_cmp;this.check=inputSelectCheck}function inputSelectCheck(){var element=eval(this.element);var checked=0;if(typeof element!="undefined"){if(this.isMultiSelect){if(this.minSelected){checked=element.options.length;if(checked<this.minSelected){alert(this.title+" -- "+JS_RESOURCES.getFormattedString("validation.multiSelect.minItems",[this.minSelected]));element.focus();return false}}checked=0;if(this.maxSelected){checked=element.options.length;if(checked>this.maxSelected){alert(this.title+" -- "+JS_RESOURCES.getFormattedString("validation.multiSelect.maxItems",[this.maxSelected]));element.focus();return false}}}else{this.custom_alert=(typeof this.custom_alert!="undefined")?this.custom_alert:"";this.ref_label=(typeof this.ref_label!="undefined")?this.ref_label:JS_RESOURCES.getFormattedString("field_name.substitute",new Array(element.name));if((element.selectedIndex==-1)||(element.options[element.selectedIndex].value=="")){alert(this.custom_alert?this.custom_alert:JS_RESOURCES.getFormattedString("validation.required",new Array(this.ref_label)));element.focus();return false}}}return true}function inputFile(a){this.element='document.forms[0]["'+a.name+'"]';this.fieldName=a.name;this.ref_label=a.ref_label;this.custom_alert=a.custom_alert;this.custom_alert_cmp=a.custom_alert_cmp;this.invalid_chars=a.invalid_chars;this.minlength=a.minlength;this.img_check=a.img_check;this.check=inputFileCheck}function inputFileCheck(){var element=eval(this.element);if(typeof element!="undefined"){this.custom_alert=(typeof this.custom_alert!="undefined")?this.custom_alert:"";this.ref_label=(typeof this.ref_label!="undefined")?this.ref_label:JS_RESOURCES.getFormattedString("field_name.substitute",new Array(element.name));var val=element.value;if(this.invalid_chars){var arr=val.invalidChars(this.invalid_chars);if(arr&&arr.length){alert(JS_RESOURCES.getFormattedString("validation.invalid_chars",new Array(this.ref_label,arr.join(", "))));shiftFocus(focusElement,false);return false}}if(val.length<this.minlength){if(this.minlength==1){alert(this.custom_alert?this.custom_alert:JS_RESOURCES.getFormattedString("validation.required",new Array(this.ref_label)))}else{alert(this.custom_alert?this.custom_alert:JS_RESOURCES.getFormattedString("validation.minimum_length",new Array(this.minlength,this.ref_label)))}return false}if(this.img_check){return image_check(element)}}return true}function Check_EventTime(obj){if(eval("document.forms[0]['"+obj.name+"']")){this.start="document.forms[0]['"+obj.name+"']";this.end="document.forms[0]['"+obj.cmp_field+"']";this.restrict="document.forms[0]['"+obj.restrict_flag+"']";this.cmp_restrict="document.forms[0]['"+obj.cmp_restrict_flag+"']"}else{this.start="document.forms[1]['"+obj.name+"']";this.end="document.forms[1]['"+obj.cmp_field+"']";this.restrict="document.forms[1]['"+obj.restrict_flag+"']";this.cmp_restrict="document.forms[1]['"+obj.cmp_restrict_flag+"']"}this.ref_lbl=obj.ref_label;this.cmp_ref_lbl=obj.cmp_ref_label;this.notEqual=obj.duration;this.pastDue=obj.past_due;this.show_end_time=obj.show_end_time;this.check=Check_EventTime_check}function Check_EventTime_check(){var start,end,restr,cmp_restr;start=eval(this.start);end=eval(this.end);restr=eval(this.restrict);cmp_restr=eval(this.cmp_restrict);restr=(typeof(restr)!="undefined")?restr.checked:true;cmp_restr=(typeof(cmp_restr)!="undefined")?cmp_restr.checked:true;if(!restr){start.value=""}if(!cmp_restr||(this.show_end_time&&!restr)){end.value=""}start=start.value;if(typeof end!="undefined"){end=end.value}if(!restr||!cmp_restr){this.notEqual=0}if(!restr){this.pastDue=0}if(this.pastDue){var confirm;var start_ms=Date.parse(start.replace(/-/g,"/"));if(start_ms<Date.parse(new Date())-this.pastDue*1000*60){if(!window.confirm(JS_RESOURCES.getFormattedString("validation.date_past.confirm",new Array(this.ref_lbl)))){return false}}}if((document.forms[0].restrict_start&&document.forms[0].restrict_end)||(document.forms.length>1&&document.forms[1].restrict_start&&document.forms[1].restrict_end)){if((document.forms[0].restrict_start&&document.forms[0].restrict_end&&document.forms[0].restrict_start.checked&&document.forms[0].restrict_end.checked)||(document.forms.length>1&&document.forms[1].restrict_start&&document.forms[1].restrict_end&&document.forms[1].restrict_start.checked&&document.forms[1].restrict_end.checked)){if(start>end&&this.notEqual){alert(JS_RESOURCES.getFormattedString("validation.date_past",new Array(this.cmp_ref_lbl,this.ref_lbl)));return false}else{if(end==start&&this.notEqual){alert(JS_RESOURCES.getFormattedString("validation.date_equal",new Array(this.cmp_ref_lbl,this.ref_lbl)));return false}}}}else{if(start>end&&this.notEqual){alert(JS_RESOURCES.getFormattedString("validation.date_past",new Array(this.cmp_ref_lbl,this.ref_lbl)));return false}else{if(end!=undefined&&end==start&&this.notEqual){alert(JS_RESOURCES.getFormattedString("validation.date_equal",new Array(this.cmp_ref_lbl,this.ref_lbl)));return false}}}return true}function Check_EventTime_multiple(a){this.start="document.forms[0]['"+a.name+"']";this.end="document.forms[0]['"+a.cmp_field+"']";this.restrict="document.forms[0]['"+a.restrict_flag+"']";this.cmp_restrict="document.forms[0]['"+a.cmp_restrict_flag+"']";this.ref_lbl=a.ref_label;this.cmp_ref_lbl=a.cmp_ref_label;this.notEqual=a.duration;this.pastDue=a.past_due;this.show_end_time=a.show_end_time;this.check=Check_EventTime_check_multiple}function Check_EventTime_check_multiple(){var start,end,restr,cmp_restr;start=eval(this.start);end=eval(this.end);restr=eval(this.restrict);cmp_restr=eval(this.cmp_restrict);restr=(typeof(restr)!="undefined")?restr.checked:true;cmp_restr=(typeof(cmp_restr)!="undefined")?cmp_restr.checked:true;if(!restr){start.value=""}if(!cmp_restr||(this.show_end_time&&!restr)){end.value=""}start=start.value;if(typeof end!="undefined"){end=end.value}if(!restr||!cmp_restr){this.notEqual=0}if(!restr){this.pastDue=0}if(this.pastDue){var confirm;var start_ms=Date.parse(start.replace(/-/g,"/"));if(start_ms<Date.parse(new Date())-this.pastDue*1000*60){if(!window.confirm(JS_RESOURCES.getFormattedString("validation.date_past.confirm",new Array(this.ref_lbl)))){return false}}}if(restr&&cmp_restr){if(start>end&&this.notEqual){alert(JS_RESOURCES.getFormattedString("validation.date_past",new Array(this.cmp_ref_lbl,this.ref_lbl)));return false}else{if(end==start&&this.notEqual){alert(JS_RESOURCES.getFormattedString("validation.date_equal",new Array(this.cmp_ref_lbl,this.ref_lbl)));return false}}}return true}function sql_datetime(d){var c=d.getFullYear();var b=d.getMonth();b++;b=(b<10)?"0"+b:b;var a=d.getDate();a=(a<10)?"0"+a:a;hh=d.getHours();hh=(hh<10)?"0"+hh:hh;mi=d.getMinutes();mi=(mi<10)?"0"+mi:mi;ss=d.getSeconds();ss=(ss<10)?"0"+ss:ss;return c+"-"+b+"-"+a+" "+hh+":"+mi+":"+ss}function DoubleSubmit(){this.submitted=0;this.check=checkDoubleSubmit}function checkDoubleSubmit(){if(this.submitted>0){alert(JS_RESOURCES.getString("notification.submit"));return false}else{this.submitted++}return true}function RadioCheckBox(a){return a}function CheckGroup(a){this.name=a.group;this.ref_label=a.ref_label;this.elements=new Array();this.addElement=groupAddElement;this.check=checkGroupChecked}function groupAddElement(a){this.elements[this.elements.length]=a.name}function checkGroupChecked(){var c=this.elements;var a=false;for(var b=0;b<c.length;b++){if(groupIsChecked(c[b])){return true}}var e=null;var d=document.forms[0][c[0]];d=(typeof d[0]!="undefined")?d[0]:d;if(d.type=="radio"){e=JS_RESOURCES.getFormattedString("validation.radio.required",new Array(this.ref_label))}else{e=JS_RESOURCES.getFormattedString("validation.option.required",new Array(this.ref_label))}alert(e);d.focus();return false}function groupIsChecked(groupName){var group=eval('document.forms[0]["'+groupName+'"]');var checked=false;if(typeof group!="undefined"){if(group.length>1){for(var i=0;i<group.length;i++){if(group[i].checked){checked=true;return checked}}}else{if(group.checked){checked=true;return checked}}}return checked}function selector(a){this.element='document.forms[0]["'+a.name+'"]';this.fieldName=a.name;this.ref_label=a.ref_label;this.custom_alert=a.custom_alert;this.custom_alert_cmp=a.custom_alert_cmp;this.required=a.required;this.check=selectorCheck}function selectorCheck(){if(this.required){var a=selectorElementAvailable(this.fieldName);this.custom_alert=(typeof this.custom_alert!="undefined")?this.custom_alert:"";this.ref_label=(typeof this.ref_label!="undefined")?this.ref_label:JS_RESOURCES.getFormattedString("field_name.substitute",new Array(element.name));if(!a){alert(this.custom_alert?this.custom_alert:JS_RESOURCES.getFormattedString("validation.required",new Array(this.ref_label)));return false}}return true}function selectorElementAvailable(groupName){var group=eval('document.forms[0]["'+groupName+'"]');var available=false;if(typeof group!="undefined"){if(group.length>1){for(var i=0;i<group.length;i++){if(!group[i].checked){available=true;return available}}}else{if(!group.checked){available=true;return available}}}return available}function ltrim(){return this.replace(/^\s+/g,"")}String.prototype.ltrim=ltrim;function rtrim(){return this.replace(/\s+$/g,"")}String.prototype.rtrim=rtrim;function trim(){return this.rtrim().ltrim()}String.prototype.trim=trim;function invalidChars(b){var a=this.match(b);if(a){for(j=0;j<a.length;j++){if(a[j]==" "){a[j]=JS_RESOURCES.getString("invalid_char.space")}else{if(a[j]==","){a[j]=JS_RESOURCES.getString("invalid_char.comma")}else{if(a[j]=="\\"){a[j]="\\\\"}}}}}return a}String.prototype.invalidChars=invalidChars;function getRadioValue(a){for(var b=0;b<a.length;b++){if(a[b].checked){return a[b].value}}}function isEmptyWysiwyg(e){var d=/^(\s|\u00A0|\u2028|\u2029|&nbsp;)*$/i;var c=/(<\s*(img)|(object)|(embed)|(hr)|(applet))/i;if(typeof(e)!="undefined"&&typeof(e.value)=="string"&&e.value!=null){var b=e.value.replace(/<.*?>/g,"");var a=d.test(b);return(a&&!c.test(e.value))}return true}var VALID_URL_REGEXP=/[^:]+:\/\/[^:\/]+(:[0-9]+)?\/?.*/;function isValidUrl(a){return(VALID_URL_REGEXP.test(a))}var EFLOAT_REGEXP=LOCALE_SETTINGS.getString("efloat.format");var THOUSANDS_SEP=LOCALE_SETTINGS.getString("number_format.thousands_sep");function isNumeric(a){a=a.trim();a=a.replace(THOUSANDS_SEP,"");if(a.search(new RegExp(EFLOAT_REGEXP))==0){var b=parseFloat(a);return !isNaN(b)}return false}function _getNumber(a){a=a.trim();a=a.replace(THOUSANDS_SEP,"");if(a.search(new RegExp(EFLOAT_REGEXP))==0){return parseFloat(a)}}var FLOAT_REGEXP=LOCALE_SETTINGS.getString("float.format");function isPercent(a){a=a.trim();if(a.search(new RegExp(FLOAT_REGEXP))==0){var b=parseFloat(a);return(!isNaN(b)&&b>=0&&b<=100)}return false}function submitForm(){if(validateForm()){document.forms[0].submit()}}function validateForm(){if(typeof(finalizeEditors)=="function"){finalizeEditors()}var h=(typeof(api)!="undefined"&&api!=null);if(h){api.setHtml()}if(skipValidation){return true}var e=formCheckList.check();var c=new Array();if(typeof(invalidAnswers)=="object"&&invalidAnswers.length>0){for(var d=0;d<invalidAnswers.length;++d){c.push(invalidAnswers[d])}}if(typeof(invalidAnswersTmp)=="object"&&invalidAnswersTmp.length>0){for(var d=0;d<invalidAnswersTmp.length;++d){c.push(invalidAnswersTmp[d])}}var b="";if(c.length>0){var g=c.length-1;for(var a=0;a<c.length;a++){b+=c[a];if(a<g){if(((a+1)%10)==0){b+=",\n"}else{b+=","}}}}if(b!=""&&e){var f;if(c.length==1){f="assessment.incomplete.confirm.single"}else{if(c.length>1){f="assessment.incomplete.confirm"}}if(!confirm(JS_RESOURCES.getFormattedString(f,new Array(b)))){e=false}invalidAnswersTmp=[]}if(h&&!e){api.setMathmlBoxes()}if(e&&dblSubmit!=false){e=dblSubmit.check()}return e}function boxSelector(list,action){var action=(action=="select")?true:(action=="unselect")?false:action;for(var i=0;i<list.length;i++){var group='document.forms[0]["'+list[i]+'"]';if(typeof(group=eval(group))!="undefined"){if(action=="invert"){for(var j=0;j<group.length;j++){group[j].checked=!group[j].checked}}else{for(var j=0;j<group.length;j++){group[j].checked=action}}}}}function setHidden(from,to){var hide=eval(to);hide.value=from.value}var invalidAnswers=new Array();function Check_Answer(a){if(typeof(window.invalidAnswersTmp)=="undefined"){window.invalidAnswersTmp=[]}this.form="document.forms[0]";this.element='document.forms[0]["'+a.name+'"]';this.name=a.name;this.answerChk=true;this.ref_label=a.ref_label;this.check=Check_Answer_check}function Check_Answer_check(){el=eval(this.element);var qtype=/^(\w+)-/.exec(this.name);if(!qtype){qtype=/^([^_]+)_/.exec(this.name)}qtype=qtype[1];if(qtype=="ma"){qtype=/-\d+$/.test(this.name)?"mat":"ma"}if(qtype=="tf"||qtype=="mc"||qtype=="ma"||qtype=="eo"){if(!isChecked(el)){invalidAnswersTmp[invalidAnswersTmp.length]=this.ref_label}}else{if(qtype=="ord"||qtype=="mat"){if(el.selectedIndex==0&&this.ref_label!=invalidAnswersTmp[invalidAnswersTmp.length-1]){invalidAnswersTmp[invalidAnswersTmp.length]=this.ref_label}}else{if(qtype=="fitb"||qtype=="essay"||qtype=="num"||qtype=="calc"||qtype=="hs"||qtype=="jumbled_sentence"||qtype=="fib_plus"||qtype=="quiz_bowl"){var val=el.value;if(val==null||!val.replace(/<p><\/p>/gi,"").trim()){val=""}if(isEmptyWysiwyg(el)){el.value="";val=""}if(val.trim().length<1){invalidAnswersTmp[invalidAnswersTmp.length]=this.ref_label}}else{if(qtype=="file"){var haveFile=false;var hiddenField=eval(this.form+'.elements["'+this.name+'-override"]');if(hiddenField&&hiddenField.value=="true"){haveFile=true}el=eval(this.form+'.elements["'+this.name+'_attachmentType"]');if(!haveFile&&el&&(!el.value=="")){haveFile=true}if(!haveFile){invalidAnswersTmp[invalidAnswersTmp.length]=this.ref_label}}}}}if(invalidAnswersTmp.length>0){var tmpArray=[];var tmpObject=new Object();for(var i=0;i<invalidAnswersTmp.length;++i){if(!tmpObject[invalidAnswersTmp[i]]){tmpObject[invalidAnswersTmp[i]]=true;tmpArray[tmpArray.length]=invalidAnswersTmp[i]}}invalidAnswersTmp=tmpArray}return true}function isChecked(a){for(var b=0;b<a.length;b++){if(a[b].checked){return true}}return false}function shiftFocus(b,a){if(typeof(b)!="undefined"){if(typeof(a)!="undefined"&&a&&typeof(editors)!="undefined"&&typeof(editors[b.name].focusEditor)=="function"){editors[b.name].focusEditor()}else{if(!b.disabled&&!b.readOnly&&b.type!="hidden"){b.focus()}}}return}function RadioButtonValueValidator(a,b){this.element=document.forms[0][a];this.value=b;this.check=RadioButtonValueValidator_check}function RadioButtonValueValidator_check(){for(var a=0;a<this.element.length;a++){if(this.element[a].value==this.value){return this.element[a].checked}}return false}function OrValidator(b,a){this.first=b;this.second=a;this.check=OrValidator_check}function OrValidator_check(){return this.first.check()||this.second.check()};
