if(!Date.MILLI){Date.MILLI=1}if(!Date.SECOND){Date.SECOND=Date.MILLI*1000}if(!Date.MINUTE){Date.MINUTE=Date.SECOND*60}if(!Date.HOUR){Date.HOUR=Date.MINUTE*60}if(!Date.DAY){Date.DAY=Date.HOUR*24}if(!Date.WEEK){Date.WEEK=Date.Day*7}if(!Date.MONTH){Date.MONTH=-1}if(!Date.YEAR){Date.YEAR=-2}if(!Date.DAYS_IN_MONTH){Date.DAYS_IN_MONTH=new Array(31,28,31,30,31,30,31,31,30,31,30,31)}function _Date_toCanonString(){return this.getFullYear()+_pad(this.getMonth()+1)+_pad(this.getDate())}function _Date_getFullYear(){var y=this.getYear();if(y<100&&y>0){y+=1900}return y}function _Date_setFullYear(val){this.setYear(val)}function _Date_compareTo(other){return Date.compare(this,other)}function _Date_isLeapYear(){return Date.leapYear(this.getFullYear())}function _Date_add(date,unit,amount){return Date.addDate(this,date,unit,amount)}function _Date_getDaysInMonth(){return Date.daysInMonth(this.getFullYear(),this.getMonth())}function _isLeapYear(year){return(year%4==0&&year%100!=0)||year%400==0}function _compareDate(d1,d2){return(new Date(d1)).getTime()-(new Date(d2)).getTime()}function _addDate(date,unit,amount){if(unit==Date.MONTH){date.setMonth(date.getMonth()+amount)}else{if(unit==Date.YEAR){date.setFullYear(date.getFullYear()+amount)}else{if(unit==Date.DAY){date.setDate(date.getDate()+parseInt(amount))}else{date.setTime(date.getTime()+unit*amount)}}}return date}function _getDaysInMonth(year,month){return month==1&&Date.leapYear(year)?29:Date.DAYS_IN_MONTH[month]}function _pad(n){return(n<10?"0":"")+n}function buildDateAmPm(date,hour,minute,ampm){if(ampm=="PM"){if(hour!="12"){hour=""+(parseInt(hour)+12)}}else{if(hour=="12"){hour="0"}}var objDate=new Date(date);objDate.setHours(hour,minute);return(objDate)}if(!Date.prototype.toCanonString){Date.prototype.toCanonString=_Date_toCanonString}if(!Date.prototype.getFullYear){Date.prototype.getFullYear=_Date_getFullYear;if(!Date.prototype.setFullYear){Date.prototype.setFullYear=_Date_setFullYear}}if(!Date.prototype.isLeapYear){Date.prototype.isLeapYear=_Date_isLeapYear}if(!Date.prototype.compareTo){Date.prototype.compareTo=_Date_compareTo}if(!Date.prototype.add){Date.prototype.add=_Date_add}if(!Date.prototype.getDaysInMonth){Date.prototype.getDaysInMonth=_Date_getDaysInMonth}Date.leapYear=_isLeapYear;Date.compare=_compareDate;Date.addDate=_addDate;Date.daysInMonth=_getDaysInMonth;(function(cfg){var defaults={context:window,name:"jsxml",file_cache:true,errors:"alert"};if(!cfg){cfg={}}for(var i in defaults){if(cfg[i]){defaults[i]=cfg[i]}}cfg=defaults;var conveyor=function(cb){if(cb){this.cb=cb}this.tasks=[]};conveyor.prototype.add=function(task){this.tasks.push(task)};conveyor.prototype.exe=function(i){if(typeof(i)=="function"){this.cb=i;i=0}i=i?i:0;var $this=this;if(this.tasks.length>i){this.tasks[i](function(){$this.exe(i+1)})}else{if(typeof(this.cb)=="function"){this.cb()}}};var lib=function(){},pro={ajax:function(cfg){if(this._ajax===null){if(window.jQuery){this._ajax=jQuery.ajax}else{if(window.Ext&&window.Ext.Ajax){this._ajax=function(cfg){Ext.Ajax.request({autoAbort:true,disableCaching:false,method:cfg.method||"GET",url:cfg.url,success:function(x){cfg.success(x.responseXML)},failure:cfg.error})}}else{if(window.Ajax&&Ajax.Request){this._ajax=function(cfg){new Ajax.Request(cfg.url,{method:"get",onSuccess:function(x){cfg.success(x.responseXML)},onFailure:cfg.error,onException:function(r,e){cfg.error(e)}})}}else{if(window.YAHOO){this._ajax=function(cfg){YAHOO.util.Connect.asyncRequest("GET",cfg.url,{success:function(x){cfg.success(x.responseXML)},failure:cfg.error})}}else{this._ajax=false}}}}}if(this._ajax){try{this._ajax(cfg)}catch(e){cfg.error(e)}}else{this._throw(this._msgs.noajax)}},nodeTypes:{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12},importNode:function(document,node,allChildren){switch(node.nodeType){case this.nodeTypes.ELEMENT_NODE:var newNode=document.createElement(node.nodeName);if(node.attributes&&node.attributes.length>0){for(var i=0,il=node.attributes.length;i0){for(var i=0,il=node.childNodes.length;i0){this._throw(this._msgs.broken);return false}else{return o}}else{if(window.ActiveXObject){var o=this.newDoc();o.loadXML(str);if(!o.documentElement){this._throw(this._msgs.broken);return false}return o}}},fromFile:function(file,callback,scope){var cl=this._cache_loading,c=this._cache,$this=this;if(cl[file]){if(cl[file]===true){cl[file]=new conveyor}cl[file].add(function(cb){callback.call(scope?scope:c[file],c[file]);cb()})}else{if(c[file]){callback.call(scope?scope:c[file],c[file])}else{cl[file]=true;this.ajax({url:file,success:function(xml){if(!xml.documentElement){$this._throw($this._msgs.brokenfile+": "+file);return}c[file]=xml;callback.call(scope?scope:xml,xml);if(typeof(cl[file])=="object"){cl[file].exe()}if(cl[file]){delete cl[file]}},error:function(e){cl[file]=false;if(e){var m=[];m.push($this._msgs.exception+":\r\n"+file);if(e.name){m.push(e.name)}if(e.message){m.push(e.message)}$this._throw(m.join("\r\n"))}else{$this._throw($this._msgs.brokenfile+": "+file)}}})}}},load:function(source,callback,scope){var o=this.fromStringOrObject(source);if(o){callback.call(scope?scope:o,o)}else{this.fromFile(source,callback,scope)}},toXml:function(source,xmlHeaderNeeded){xmlHeaderNeeded=xmlHeaderNeeded==false?false:true;var xml=typeof(source)=="string"?source:(source.xml?source.xml:new XMLSerializer().serializeToString(source)),xmlHeaderPresent=/^<\?xml/.test(xml);if(xmlHeaderNeeded&&/\="UTF\-16"\?/.test(xml)){xml=xml.replace(/\=\"UTF\-16\"\?/,'="UTF-8"?')}if(xmlHeaderNeeded&&!xmlHeaderPresent){return this._xmlHeader+xml}if(!xmlHeaderNeeded&&xmlHeaderPresent){return xml.replace(/^<\?xml[^<]+/,"")}return xml},_borrowRootName:function(names){return names?(this._isA(names)?names.shift():names):"root"},toDom:function(o,names,parentNode){rootName=this._borrowRootName(names);if(parentNode){parentNode=parentNode.appendChild(parentNode.ownerDocument.createElement(rootName))}else{parentNode=this.newDoc(rootName).documentElement}var t;if(this._isA(o)){for(var i=0;i',""]},_trans2:function(xml,xslSrc,callback,nativeResult,doc){this.load(xslSrc,function(xsl){var scope;if(callback&&typeof callback.length=="number"&&typeof callback.splice=="function"){scope=callback[1];callback=callback[0]}else{scope=callback}callback.call(scope,this.transReady(xml,xsl,nativeResult,doc))},this)},_throw:function(msg){var sourceAppName="JSXML";switch(cfg.errors){case"alert":alert(sourceAppName+":\r\n"+msg);break;case"throw":throw sourceAppName+":\r\n"+msg;break}},_ajax:null,_fromObject:function(el){if(!el.documentElement){if(el.tagName){return this.newDoc(el)}return false}return el},_xmlHeader:'\r\n',_cache:{},_isA:function(v){return v&&typeof v.length=="number"&&typeof v.splice=="function"},_copy:function(o){if(typeof o!="object"||o===null){return o}var r;if(this._isA(o)){r=[];for(var i=0;i]/g,">");strOut=strOut.replace(/[<]/g,"<");strOut=strOut.replace(/["]/g,""");strOut=strOut.replace(/[']/g,"'");return strOut}function xmlUnEscape(strIn){var strOut=strIn.replace(/\&/g,"&");strOut=strOut.replace(/\>/g,">");strOut=strOut.replace(/\</g,"<");strOut=strOut.replace(/\"/g,'"');strOut=strOut.replace(/\'/g,"'");return strOut}function xmlEscapePost(strIn){var strOut=xmlUnEscape(strIn);strOut=strOut.replace(/[&]/g,"~amp~");strOut=strOut.replace(/[>]/g,"~gt~");strOut=strOut.replace(/[<]/g,"~lt~");strOut=strOut.replace(/["]/g,"~quot~");strOut=strOut.replace(/[']/g,"~apos~");return strOut}var ppcDF="m/D/Y";var ppcMN=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");var ppcWN=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");var ppcER=new Array(4);ppcER[0]="Required DHTML functions are not supported in this browser.";ppcER[1]="Target form field is not assigned or not accessible.";ppcER[2]="Sorry, the chosen date is not acceptable. Please read instructions on the page.";ppcER[3]="Unknown error occured while executing this script.";var ppcUC=false;var ppcUX=4;var ppcUY=4;var ppcIE=(navigator.appName=="Microsoft Internet Explorer");var ppcFF=((ppcIE==false)&&(!document.layers)&&(navigator.appName=="Netscape"));var ppcNN=((navigator.appName=="Netscape")&&(document.layers));var ppcDom=document.getElementById;var ppcTT='\n';var ppcCD=ppcTT;var ppcFT='';var ppcTI=false;var ppcOpen=false;var ppcDateSelect=null;var ppcDateControl=null;var ppcRL=null;var ppcXC=null;var ppcYC=null;var ppcML=new Array(31,28,31,30,31,30,31,31,30,31,30,31);var ppcDays=new Array("Su","Mo","Tu","We","Th","Fr","Sa");var ppcMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];var ppcEnd=[2030,12,31];var ppcNow=new Date();var ppcPtr=new Date();if(ppcNN){window.captureEvents(Event.RESIZE);window.onresize=restoreLayers;document.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);document.onmousedown=recordXY;document.onmouseup=confirmXY}function restoreLayers(e){if(ppcNN){with(window.document){open("text/html");write("Restoring the layer structure...");write('');write("");close()}}}function recordXY(e){if(ppcNN){ppcXC=e.x;ppcYC=e.y;hideCal(e);document.routeEvent(e)}}function hideCal(e){var n=!e?self.event.srcElement.name:e.target.name;if(document.layers){if(n!="popcal"){hideCalendar()}}else{if(n!="popcal"){hideCalendar()}}yesSelects()}function parseDate(ds){if(ds){var pd=ds.split("/");if(pd.length==3){var td=new Date(pd[2],pd[0]-1,pd[1]);if(isNaN(td)||td.getMonth()!=pd[0]-1){return null}else{return pd}}else{return null}}else{return null}}function confirmXY(e){if(ppcNN){ppcXC=(ppcXC==e.x)?e.x:null;ppcYC=(ppcYC==e.y)?e.y:null;document.routeEvent(e)}}var ppfnReturn;function getCalendarFor(target,rules,fnReturn){var obj,p;ppcDateControl=target;ppcRL=rules;ppfnReturn=fnReturn;if(!ppcOpen){noSelects();if((ppcDateControl!=null)&&(ppcDateControl)){ppcDateSelect=parseDate(ppcDateControl.value);if(ppcDateSelect==null){ppcDateControl.value="";ppcDateSelect=[0,0,0];setCalendar()}else{ppcDateControl.value=dateFormat(ppcDateSelect[2],ppcDateSelect[0],ppcDateSelect[1]);setCalendar(ppcDateSelect[2],(ppcDateSelect[0]-1))}if(ppcIE){var ieCSS=(document.compatMode)?document.compatMode=="CSS1Compat":false;var canvas=ieCSS?document.documentElement:document.body;obj=document.getElementById("PopUpCalendar");p=fGetXY(ppcDateControl);obj.style.left=p[0]+"px";if(obj.offsetHeight+p[1]>(canvas.clientHeight+canvas.scrollTop-5)){obj.style.top=p[1]-obj.offsetHeight+"px"}else{obj.style.top=p[1]+ppcDateControl.offsetHeight+"px"}obj.style.visibility="visible";ppcOpen=true}else{if(ppcFF){obj=document.getElementById("PopUpCalendar");p=fGetXY(ppcDateControl);obj.style.left=p[0]+"px";if(obj.offsetHeight+p[1]>(document.body.clientHeight+document.body.scrollTop-5)){obj.style.top=p[1]-obj.offsetHeight+"px"}else{obj.style.top=p[1]+ppcDateControl.offsetHeight+"px"}obj.style.visibility="visible";ppcOpen=true}else{if(ppcNN){obj=document.layers.PopUpCalendar;obj.left=ppcXC;obj.top=ppcYC;obj.visibility="show";ppcOpen=true}else{showError(ppcER[0])}}}}else{showError(ppcER[1])}}else{hideCalendar()}}function fGetXY(obj){var p=[2,0];while(obj){var tn=obj.tagName.toUpperCase();p[0]+=obj.offsetLeft-(tn=="DIV"&&obj.scrollLeft?obj.scrollLeft:0);p[1]+=obj.offsetTop-(tn=="DIV"&&obj.scrollTop?obj.scrollTop:0);if(tn=="BODY"){break}obj=obj.offsetParent}return p}function switchMonth(param){var tmp=param.split("|");setCalendar(tmp[1],tmp[0])}function moveMonth(dir){var selMonth=null;var selYear=null;var limit=false;var tmp,dptrYear,dptrMonth;if(ppcFF||document.getElementById){selMonth=document.getElementById("popCalMonth");selYear=document.getElementById("popCalYear")}else{if(ppcIE){selMonth=document.ppcMonthList.sItem;selYear=document.ppcMonthList.sYear}else{if(ppcNN){selMonth=document.layers.PopUpCalendar.document.layers.monthSelector.document.ppcMonthList.sItem;selYear=document.layers.PopUpCalendar.document.layers.monthSelector.document.ppcMonthList.sYear}else{showError(ppcER[0])}}}if(selMonth!=null){if(dir.toLowerCase()=="back"){if(selMonth.selectedIndex>0){setCalendar(selYear[selYear.selectedIndex].value,(selMonth.selectedIndex-1))}else{setCalendar(selYear[selYear.selectedIndex-1].value,11)}}else{if(selMonth.selectedIndex>10){setCalendar(selYear[selYear.selectedIndex+1].value,0)}else{setCalendar(selYear[selYear.selectedIndex].value,(selMonth.selectedIndex+1))}}}}function selectDate(param){var arr=param.split("|");var year=arr[0];var month=arr[1];var date=arr[2];var ptr=parseInt(date);ppcPtr.setDate(ptr);if((ppcDateControl!=null)&&(ppcDateControl)){if(validDate(date)){ppcDateControl.value=dateFormat(year,(parseInt(month)+1),date);ppcDateControl.focus();hideCalendar();if(ppfnReturn){eval(ppfnReturn)}}else{showError(ppcER[2]);if(ppcTI){clearTimeout(ppcTI);ppcTI=false}}}else{showError(ppcER[1]);hideCalendar()}}function setCalendar(year,month){if(year==null){year=ppcNow.getFullYear()}if(year<1900){year+=1900}if(month==null){month=ppcNow.getMonth()}if(month==1){ppcML[1]=(isLeap(year))?29:28}setSelectList(year,month);ppcPtr.setYear(year);ppcPtr.setMonth(month);ppcPtr.setDate(1);updateContent()}function updateContent(){generateContent();if(ppcIE){document.getElementById("monthDays").innerHTML=ppcCD}else{if(ppcFF){document.getElementById("monthDays").innerHTML=ppcCD}else{if(ppcNN){with(document.layers.PopUpCalendar.document.layers.monthDays.document){open("text/html");write('\n\nDynDoc\n\n\n');write(ppcCD);write("\n");close()}}else{showError(ppcER[0])}}}ppcCD=ppcTT}function generateContent(){var year=getFullYear(ppcPtr);if(year<1900){year+=1900}var month=ppcPtr.getMonth();var date=1;var day=ppcPtr.getDay();var len=ppcML[month];var bgr,cnt,tmp="";var j,i=0;ppcCD+="";for(i=0;i<7;i++){ppcCD+="";for(j=0;j<7;++j){if(date>len){break}for(i=0;i<7;++i){bgr=((i==0)||(i==6))?"#99ccff":"#e5e5e5";if(((j==0)&&(ilen)){tmp+=makeCell(bgr,year,month,0)}else{tmp+=makeCell(bgr,year,month,date);++date}}ppcCD+="\n"+tmp+"\n";tmp=""}ppcCD+="
";ppcCD+="
";ppcCD+=ppcTT+"
"+ppcDays[i]+""}ppcCD+="
"+ppcTT;ppcCD+='\n'}function makeCell(bgr,year,month,date){var param="'"+year+"|"+month+"|"+date+"'";var bIsSelected=((ppcDateSelect[2]==year)&&((parseInt(ppcDateSelect[0]))==(parseInt(month)+1))&&(ppcDateSelect[1]==date));var bIsToday=((ppcNow.getDate()==date)&&(ppcNow.getMonth()==month)&&(getFullYear(ppcNow)==year));bgr=(bIsToday)?"#FFFFFF":bgr;var td1='';var td2=(ppcIE||ppcFF)?"\n":"\n";var evt="onmouseover=\"this.style.backgroundColor='yellow'\" onmouseout=\"this.style.backgroundColor='"+bgr+'\'" onmouseup="selectDate('+param+')" ';var ext='
';var lnk='';var cellValue=(date!=0)?date+"":" ";if(bIsToday){cellValue=""+cellValue+""}var cellCode="";if(date==0){if(ppcIE||ppcFF){cellCode=td1+lck+ppcFT+cellValue+td2}else{cellCode=td1+ppcFT+cellValue+td2}}else{if(ppcIE||ppcFF){cellCode=td1+ext+evt+">"+ppcFT+cellValue+td2}else{if(date<10){cellValue=" "+cellValue+" "}cellCode=td1+">"+lnk+ppcFT+cellValue+td2}}return cellCode}function setSelectList(year,month){var i=0;var no;var selMonth,selYear;if(ppcFF||document.getElementById){selMonth=document.getElementById("popCalMonth");selYear=document.getElementById("popCalYear")}else{if(ppcIE){selMonth=document.ppcMonthList.sItem;selYear=document.ppcMonthList.sYear}else{if(ppcNN){selMonth=document.layers.PopUpCalendar.document.layers.monthSelector.document.ppcMonthList.sItem;selYear=document.layers.PopUpCalendar.document.layers.monthSelector.document.ppcMonthList.sYear}}}selMonth.length=0;selYear.length=0;while(i<12){no=new Option();no.value=i;no.text=ppcMN[i];selMonth[i]=no;if(i==month){selMonth.options[i].selected=true}i++}i=0;year=year-5;while(i<20){no=new Option();no.value=year;no.text=year;selYear[i]=no;if(i==5){selYear.options[i].selected=true}i++;year++}}function hideCalendar(){if(ppcIE){document.getElementById("PopUpCalendar").style.visibility="hidden"}else{if(ppcFF){document.getElementById("PopUpCalendar").style.visibility="hidden"}else{if(ppcNN){document.layers.PopUpCalendar.visibility="hide";window.status=" "}else{}}}ppcTI=false;ppcDateControl=null;ppcOpen=false;yesSelects()}function showError(message){window.alert("[ PopUp Calendar ]\n\n"+message)}function isLeap(year){if((year%400==0)||((year%4==0)&&(year%100!=0))){return true}else{return false}}function getFullYear(obj){if(ppcNN){return obj.getYear()+1900}else{return obj.getYear()}}function validDate(date){var reply=true;if(ppcRL==null){}else{var arr=ppcRL.split(":");var mode=arr[0];var arg=arr[1];var key=arr[2].charAt(0).toLowerCase();if(key!="d"){var day=ppcPtr.getDay();var orn=isEvenOrOdd(date);reply=(mode=="[^]")?!((day==arg)&&((orn==key)||(key=="a"))):((day==arg)&&((orn==key)||(key=="a")))}else{reply=(mode=="[^]")?(date!=arg):(date==arg)}}return reply}function isEvenOrOdd(date){if(date-21>0){return"e"}else{if(date-14>0){return"o"}else{if(date-7>0){return"e"}else{return"o"}}}}function dateFormat(year,month,date){if(ppcDF==null){ppcDF="m/d/Y"}var day=ppcPtr.getDay();var crt="";var str="";var chars=ppcDF.length;for(var i=0;i
')}else{if(document.layers){document.writeln("");document.writeln(' ')}}function noSelects(){var selCol=document.getElementsByTagName("SELECT");var selId;for(var i=0;i12){endHour=endHour-12;endAmPm="PM"}else{endAmPm="AM"}}endMin=""+objDate.getMinutes();endMin=(endMin.length==1)?"0"+endMin:endMin;document.frm_display.end_hour.value=endHour;document.frm_display.end_ampm.value=endAmPm;document.frm_display.end_minute.value=endMin;eval("document.frm_display.qty_"+fldId).value=fldDef;eval("document.frm_display.ext_"+fldId).value=formatCurrency(fldDef*curRate);calcTotal()}function recalcHours(fldId,min,max,bolValidate){var bolReturn=true;if(fldId){var startHour=document.frm_display.start_hour.options[document.frm_display.start_hour.selectedIndex].value;var startMin=document.frm_display.start_minute.options[document.frm_display.start_minute.selectedIndex].value;var startAmPm=document.frm_display.start_ampm.options[document.frm_display.start_ampm.selectedIndex].value;var endHour=document.frm_display.end_hour.options[document.frm_display.end_hour.selectedIndex].value;var endMin=document.frm_display.end_minute.options[document.frm_display.end_minute.selectedIndex].value;var endAmPm=document.frm_display.end_ampm.options[document.frm_display.end_ampm.selectedIndex].value;var objStartDate=buildDateAmPm(document.frm_display.event_date.value,startHour,startMin,startAmPm);var objEndDate=buildDateAmPm(document.frm_display.event_end_date.value,endHour,endMin,endAmPm);var intHours=Date.compare(objEndDate,objStartDate)/1000/60/60;var selPrice=eval("document.frm_display.prc_"+fldId);var curRate=parseFloat(selPrice.options[selPrice.selectedIndex].value.split("_")[1]);var objDate;if(bolValidate){if(min==-1){min=0}if(intHours12){endHour=endHour-12;endAmPm="PM"}else{endAmPm="AM"}}intHours=min;endMin=""+objDate.getMinutes();endMin=(endMin.length==1)?"0"+endMin:endMin;document.frm_display.end_hour.value=endHour;document.frm_display.end_ampm.value=endAmPm;document.frm_display.end_minute.value=endMin;bolReturn=false}if(max!=-1){if(intHours>max){alert("The maximum number of hours that can be specified is "+max);objDate=Date.addDate(objStartDate,Date.HOUR,max);document.frm_display.event_end_date.value=(objDate.getMonth()+1)+"/"+objDate.getDate()+"/"+objDate.getYear();endHour=objDate.getHours();if(endHour==0){endHour=12;endAmPm="AM"}else{if(endHour>12){endHour=endHour-12;endAmPm="PM"}else{endAmPm="AM"}}intHours=max;endMin=""+objDate.getMinutes();endMin=(endMin.length==1)?"0"+endMin:endMin;document.frm_display.end_hour.value=endHour;document.frm_display.end_ampm.value=endAmPm;document.frm_display.end_minute.value=endMin;bolReturn=false}}}intHours=intHours>0?intHours:0;eval("document.frm_display.qty_"+fldId).value=intHours;eval("document.frm_display.ext_"+fldId).value=formatCurrency(intHours*curRate);calcTotal();return bolReturn}}function recalcDays(fldId,min,max,bolValidate){var bolReturn=true;var bolDays=document.frm_display.start_hour?false:true;var intDays=Date.compare(document.frm_display.event_end_date.value,document.frm_display.event_date.value)/1000/60/60/24;if(bolDays){intDays++}var selPrice=eval("document.frm_display.prc_"+fldId);var curRate=parseFloat(selPrice.options[selPrice.selectedIndex].value.split("_")[1]);var objDate,strDate;if(bolValidate){if(intDays<1&bolDays){alert("The end date must be equal to or greater than the start date");intDays=1;document.frm_display.event_end_date.value=document.frm_display.event_date.value;bolReturn=false}if(intDays<1&!bolDays){alert("The end must be at least one day after the start date");objDate=Date.addDate(new Date(document.frm_display.event_date.value),Date.DAY,1);strDate=(objDate.getMonth()+1)+"/"+objDate.getDate()+"/"+objDate.getYear();intDays=1;document.frm_display.event_end_date.value=strDate;bolReturn=false}if(min!=-1){if(intDaysmax){alert("The maximum number of days that can be specified is "+max);objDate=Date.addDate(new Date(document.frm_display.event_date.value),Date.DAY,max);strDate=(objDate.getMonth()+1)+"/"+objDate.getDate()+"/"+objDate.getYear();intDays=max;document.frm_display.event_end_date.value=strDate;bolReturn=false}}}intDays=intDays>0?intDays:0;eval("document.frm_display.qty_"+fldId).value=intDays;eval("document.frm_display.ext_"+fldId).value=formatCurrency(intDays*curRate);document.frm_display.event_days.value=Date.compare(document.frm_display.event_end_date.value,document.frm_display.event_date.value)/1000/60/60/24;calcTotal();return bolReturn}function recalcCharge(fldId,min,max){var objQty=eval("document.frm_display.qty_"+fldId);var objPrc=eval("document.frm_display.prc_"+fldId);if(objQty){eval("document.frm_display.ext_"+fldId).value=formatCurrency(objQty.value*objPrc.value);calcTotal()}}function recalcChargeGroup(fldId,min,max){var objQty=eval("document.frm_display.qty_"+fldId);var objPrc=eval("document.frm_display.prc_"+fldId);var prc=objPrc.options[objPrc.selectedIndex].value.split("_")[1];if(objQty){eval("document.frm_display.ext_"+fldId).value=formatCurrency(objQty.value*prc);calcTotal()}}function calcTotal(){var monTotal=0;for(var i=0;ifldMax&&fldMax!=-1){strErr="The maximum quantity that can be specified for this field is "+fldMax+"."}}break;case"chargeopen":objFld=eval("document.frm_display.ext_"+_arValidate[i].fld_id);objFldVal=objFld.value.replace("$","");objFld.value=objFldVal;objFldVal=objFldVal.replace(",","");if(_arValidate[i].fld_req==1||objFldVal.length>0){if(!reCurrency.test(objFldVal)){strErr="Please enter a valid currency amount for the "+_arValidate[i].fld_name+" field."}}objFldVal=parseFloat(objFldVal);if(isNaN(objFldVal)){strErr="Please enter a valid currency amount for the "+_arValidate[i].fld_name+" field."}else{if(objFldVal<0){strErr="An amount greater than or equal to 0 must be entered for this field"}if(objFldValfldMax&&fldMax!=-1){strErr="The maximum amount that can be specified for this field is $"+fldMax+"."}}break;case"chargereserve":if(_arValidate[i].fld_base=="day"){if(!recalcDays(fldId,fldMin,fldMax,true)){return false}}else{if(!recalcHours(fldId,fldMin,fldMax,true)){return false}}break;case"checkbox":objFld=eval("document.frm_display.fld_"+_arValidate[i].fld_id);if(_arValidate[i].fld_req==1&&!objFld.checked){strErr="The "+_arValidate[i].fld_name+" is required. Please check this field to continue."}break;case"checkboxgroup":case"radio":for(var j=0;j<_arValidateOptions.length;j++){if(_arValidateOptions[j].fld_parent_id==fldId){if(objFld==null){objFld=eval("document.frm_display.fld_"+_arValidateOptions[j].fld_id)}if(eval("document.frm_display.fld_"+_arValidateOptions[j].fld_id+".checked")){optCounter++}}}if(_arValidate[i].fld_type=="radio"){if(_arValidate[i].fld_req==1){if(optCounter<1){strErr="You must select at least one option from this group."}}}else{if(optCounterfldMax&&fldMax!=-1){strErr="The maximum number of selections that can be made for this group is "+fldMax+"."}}}break;case"listbox":case"combobox":objFld=eval("document.frm_display.fld_"+_arValidate[i].fld_id);if(_arValidate[i].fld_type=="listbox"){for(var j=0;jfldMax&&fldMax!=-1){strErr="The maximum number of selections that can be made for this group is "+fldMax+"."}}}else{if(objFld.selectedIndex==0&&_arValidate[i].fld_req==1){strErr="You must select one option from this field."}}break;case"file":objFld=eval("document.frm_display.fld_"+_arValidate[i].fld_id);objFldVal=objFld.value;var strFileType=_arValidate[i].fld_base;if(_arValidate[i].fld_req==1&&objFldVal.length==0){strErr="The "+_arValidate[i].fld_name+" field is required. Please select a file to upload."}else{if(objFldVal.length>0){var arFileParts=objFldVal.split(".");var strExt=arFileParts[arFileParts.length-1].toLowerCase();switch(strFileType){case"image":if(strExt!="gif"&&strExt!="jpeg"&&strExt!="jpg"&&strExt!="bmp"&&strExt!="png"){strErr="Please select a valid image type (.gif, .jpeg, .jpg, .bmp, .png) for the "+_arValidate[i].fld_name+" field."}break;case"doc":if(strExt!="doc"&&strExt!="docx"&&strExt!="xls"&&strExt!="xlsx"&&strExt!="ppt"&&strExt!="pptx"&&strExt!="pdf"&&strExt!="zip"&&strExt!="pub"){strErr="Please select a valid document type (.doc, .docx, .xls, .xlsx, .ppt, .pptx, .pdf, .zip, .pub) for the "+_arValidate[i].fld_name+" field."}break;case"all":if(strExt!="doc"&&strExt!="docx"&&strExt!="xls"&&strExt!="xlsx"&&strExt!="ppt"&&strExt!="pptx"&&strExt!="pdf"&&strExt!="zip"&&strExt!="gif"&&strExt!="jpeg"&&strExt!="jpg"&&strExt!="bmp"&&strExt!="png"&&strExt!="pub"){strErr="Please select a valid document or image type (.doc, .docx, .xls, .xlsx, .ppt, .pptx, .pdf, .zip, .gif, .jpeg, .jpg, .bmp, .png, .pub) for the "+_arValidate[i].fld_name+" field."}break}}}break;case"textbox":case"textarea":case"text":case"password":objFld=eval("document.frm_display.fld_"+_arValidate[i].fld_id);if(objFld.value==" "){objFld.value=""}objFldVal=objFld.value;objFldVal=objFldVal.trim();objFldVal=objFldVal.replace(/^[^\w\d\-\_\+\=\(\)\*\&\^\%\$\#\@\!\~\`\[\]\{\}\:\;\"\'\<\>\,\.\/\\\?]+$/g,"");if(_arValidate[i].fld_req==1&&objFldVal.length==0){strErr="The "+_arValidate[i].fld_name+" field is required. Please enter a value for this field."}break;case"email":objFld=eval("document.frm_display.fld_"+_arValidate[i].fld_id);objFldVal=objFld.value;objFldVal=objFldVal.trim();if(_arValidate[i].fld_req==1||objFldVal.length>0){if(!reEmail.test(objFldVal)||objFldVal.match(reEmailIllegalChars)){strErr="Please enter a valid email address for the "+_arValidate[i].fld_name+" field."}}break;case"numeric":objFld=eval("document.frm_display.fld_"+_arValidate[i].fld_id);objFldVal=objFld.value;if(_arValidate[i].fld_req==1||objFldVal.length>0){if(!reInteger.test(objFldVal)){strErr="Please enter a valid number for the "+_arValidate[i].fld_name+" field."}}break;case"currency":objFld=eval("document.frm_display.fld_"+_arValidate[i].fld_id);objFldVal=objFld.value;if(_arValidate[i].fld_req==1||objFldVal.length>0){if(!reCurrency.test(objFld.value)){strErr="Please enter a valid currency amount for the "+_arValidate[i].fld_name+" field."}}break;case"date":objFld=eval("document.frm_display.fld_"+_arValidate[i].fld_id);objFldVal=objFld.value;if(_arValidate[i].fld_req==1||objFldVal.length>0){if(!isDate(objFld.value)){strErr='Please enter a valid date in the format "m/d/yyyy" for the '+_arValidate[i].fld_name+" field."}}break}if(strErr.length>0){alert(strErr);objFld.focus();return false}}if(document.frm_display.start_hour){if(document.frm_display.event_date){if(!isDate(document.frm_display.event_date.value)){alert('The start date is not a valid date. Please enter a valid date in the format "m/d/yyyy"');document.frm_display.event_date.focus();return false}}if(!ValidateSelection(document.frm_display.start_hour,"Please select a valid start time.")){return false}if(!ValidateSelection(document.frm_display.start_minute,"Please select a valid start time.")){return false}var bolCheckEnd=true;if(bolCheckEnd){if(!ValidateSelection(document.frm_display.end_hour,"Please select a valid end time.")){return false}if(!ValidateSelection(document.frm_display.end_minute,"Please select a valid end time.")){return false}var startHour=document.frm_display.start_hour.options[document.frm_display.start_hour.selectedIndex].value;var startMin=document.frm_display.start_minute.options[document.frm_display.start_minute.selectedIndex].value;var endHour=document.frm_display.end_hour.options[document.frm_display.end_hour.selectedIndex].value;var endMin=document.frm_display.end_minute.options[document.frm_display.end_minute.selectedIndex].value;if(document.frm_display.start_ampm.options[document.frm_display.start_ampm.selectedIndex].value=="PM"){if(startHour!="12"){startHour=""+(parseInt(startHour)+12)}}else{if(startHour=="12"){startHour="0"}}if(document.frm_display.end_ampm.options[document.frm_display.end_ampm.selectedIndex].value=="PM"){if(endHour!="12"){endHour=""+(parseInt(endHour)+12)}}else{if(endHour=="12"){endHour="0"}}}var intStart=parseInt(startHour+startMin);if(!intStart>99){alert("Please enter a valid start time for the event.");document.frm_display.start_hour.focus();return false}if(!ValidateSelection(document.frm_display.start_ampm,"Please specify either AM or PM for the start time.")){return false}if(bolCheckEnd){var intEnd=parseInt(endHour+endMin);if(!intEnd>99){alert("Please enter a valid end time for the event.");document.frm_display.end_hour.focus();return false}if(!ValidateSelection(document.frm_display.end_ampm,"Please specify either AM or PM for the end time.")){return false}var objStartDate=new Date(document.frm_display.event_date.value);objStartDate.setHours(startHour,startMin);var objEndDate=new Date(document.frm_display.event_end_date.value);objEndDate.setHours(endHour,endMin);if(Date.compare(objEndDate,objStartDate)<0){alert("Please enter an end time that is equal to or later than the start time.");document.frm_display.end_hour.focus();return false}}if(document.frm_display.event_end_date.value!=""){if(document.frm_display.event_end_date){if(!isDate(document.frm_display.event_end_date.value)){alert('The end date is not a valid date. Please enter a valid date in the format "m/d/yyyy"');document.frm_display.event_end_date.focus();return false}}if(Date.compare(document.frm_display.event_end_date.value,document.frm_display.event_date.value)<0){alert("The end date for the event must be equal to or later than the start date");document.frm_display.event_end_date.focus();return false}}else{document.frm_display.event_end_date.value=document.frm_display.event_date.value}document.frm_display.event_days.value=Date.compare(document.frm_display.event_end_date.value,document.frm_display.event_date.value)/86400000}if(typeof(requireConfirmationAlert)!=="undefined"&&requireConfirmationAlert===true){if(confirm("Are you sure that you want to submit this form?")===false){return false}}return true}var _objResultsXML;function Submit_onclick(skipMvcCheck){var bSubmit=document.getElementById("btnSubmit"),evtDt=document.getElementById("event_date");if(bSubmit){bSubmit.disabled=true}if(!validate()){if(bSubmit){bSubmit.disabled=false}return}if(AV&&AV.isMvc&&evtDt&&!skipMvcCheck){Ext.Ajax.request({url:String.format("/Form/CheckConflictingEvent/{0}~{1}",AV.assn_id,Ext.getDom("frm_id").value),method:"GET",params:{frm_id:Ext.getDom("frm_id").value,event_date:Ext.getDom("event_date").value,event_end_date:Ext.getDom("event_end_date").value,start_hour:Ext.getDom("start_hour")?Ext.getDom("start_hour").value:"",start_minute:Ext.getDom("start_minute")?Ext.getDom("start_minute").value:"",start_ampm:Ext.getDom("start_ampm")?Ext.getDom("start_ampm").value:"",end_hour:Ext.getDom("end_hour")?Ext.getDom("end_hour").value:"",end_minute:Ext.getDom("end_minute")?Ext.getDom("end_minute").value:"",end_ampm:Ext.getDom("end_ampm")?Ext.getDom("end_ampm").value:""},callback:function(post,success,response){var json=Ext.decode(response.responseText);if(success&&!json.error&&!json.conflicting_event){Submit_onclick(true)}else{var isErr=(!success||json.error),title=isErr?"Validation Error":"Conflicting Event",msg=isErr?"There was an error validating your request. Please try again.":"There is an existing event that conflicts with the date and time specified.

"+json.conflicting_event+"

Please select a different date and or time and attempt your request again.";Ext.Msg.show({title:title,msg:msg,buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR,fn:function(){document.frm_display.event_date.focus()}})}}});return}var d=new Date();var t=d.getTime().toString();t=t.slice(t.length-5);if(document.getElementById("file_key")){document.getElementById("file_key").value=t}var debugChar="";var strSubmitXML=""+debugChar;var chargeTotal=0;var sSubmitterEmail="";for(var i=0;i<_arValidate.length;i++){var strType=_arValidate[i].fld_type;var intFldId=_arValidate[i].fld_id;var intQty=0,strChk,strVal,objFld,j;strSubmitXML+="0){intQty=parseFloat(eval("document.frm_display.qty_"+intFldId).value)}var fltPrc=parseFloat(eval("document.frm_display.prc_"+intFldId).value);strSubmitXML+="fld_data_price='"+fltPrc+"' fld_ext_price='"+(fltPrc*intQty)+"' fld_data_val='"+intQty+"' />"+debugChar;chargeTotal+=(fltPrc*intQty);break;case"chargeopen":var fldPrc=parseFloat(eval("document.frm_display.ext_"+intFldId).value.replace(/[,]/g,""));strSubmitXML+="fld_data_price='"+fldPrc+"' fld_ext_price='"+fldPrc+"' fld_data_val='1' />"+debugChar;chargeTotal+=fldPrc;break;case"checkbox":strChk=eval("document.frm_display.fld_"+intFldId+".checked")?"1":"0";strSubmitXML+="fld_data_val='"+strChk+"' />"+debugChar;break;case"chargereserve":case"chargegroup":objFld=eval("document.frm_display.prc_"+intFldId);if(eval("document.frm_display.qty_"+intFldId).value.length>0){intQty=eval("document.frm_display.qty_"+intFldId).value}var arCharge=objFld.options[objFld.selectedIndex].value.split("_");strSubmitXML+="fld_data_price='"+arCharge[1]+"' fld_sel_option_name='"+objFld.options[objFld.selectedIndex].text+"' fld_ext_price='"+(arCharge[1]*intQty)+"' fld_data_val='"+intQty+"'/>"+debugChar;chargeTotal+=(arCharge[1]*intQty);break;case"textarea":case"instr":strVal=eval("document.frm_display.fld_"+intFldId).value.replace(reWhiteSpace," ");strSubmitXML+="fld_data_val='"+xmlEscape(strVal)+"' />"+debugChar;break;case"text":case"numeric":case"email":case"date":case"currency":case"textbox":case"password":var fldName=_arValidate[i].fld_name.toLowerCase();if("email"==fldName||"e-mail"==fldName||"email address"==fldName||"e-mail address"==fldName||"contact email"==fldName||"contact e-mail"==fldName||"property manager email"==fldName||"owner email"==fldName||strType=="email"){sSubmitterEmail+=eval("document.frm_display.fld_"+intFldId).value+","}strSubmitXML+="fld_data_val='"+xmlEscape(eval("document.frm_display.fld_"+intFldId).value)+"' />"+debugChar;break;case"radio":case"checkboxgroup":strSubmitXML+=">"+debugChar;for(j=0;j<_arValidateOptions.length;j++){if(_arValidateOptions[j].fld_parent_id==intFldId){strChk=eval("document.frm_display.fld_"+_arValidateOptions[j].fld_id+".checked")?"1":"0";strSubmitXML+=""+debugChar}}strSubmitXML+=""+debugChar;break;case"combobox":objFld=eval("document.frm_display.fld_"+intFldId);strVal=xmlEscape(objFld.options[objFld.selectedIndex].text);strSubmitXML+="fld_data_val='"+strVal+"' />"+debugChar;break;case"listbox":strSubmitXML+=">"+debugChar;objFld=eval("document.frm_display.fld_"+intFldId);for(j=0;j"+debugChar}strSubmitXML+=""+debugChar;break;case"file":var arPathParts;var fileFldVal=eval("document.frm_display.fld_"+intFldId).value;if(fileFldVal.indexOf("/")>-1){arPathParts=fileFldVal.split("/")}else{arPathParts=fileFldVal.split("\\")}strVal=arPathParts[arPathParts.length-1];if(strVal.length>0){var lastPeriodIndex=strVal.lastIndexOf(".");var strExt=strVal.slice(lastPeriodIndex);var strFileName=strVal.slice(0,lastPeriodIndex);strVal=strFileName+t+strExt}strSubmitXML+="fld_data_val='"+xmlEscape(strVal)+"' />"+debugChar;break}}strSubmitXML+="";document.frm_display.charge_total.value=chargeTotal;sSubmitterEmail=sSubmitterEmail.replace(/,\s*$/,"").replace(/^\s*/,"");document.frm_display.submitter_email.value=sSubmitterEmail;if(_bolPreview){_objResultsXML=jsXML.createDOMDocument();_objResultsXML.loadXML(strSubmitXML);resultsPreview()}else{if(document.frm_display.frm_name.value=="31010"){if(pageTracker&&pageTracker._trackPageview){pageTracker._trackPageview("/AVContactMeSubmit.asp")}}document.frm_display.submit_xml.value=strSubmitXML;document.frm_display.submit()}log(strSubmitXML)}function deleteForm(frmId){Ext.MessageBox.confirm("Delete Form?","Are you sure you want to delete this delete this form?",function(answer){if(answer==="yes"){Ext.Ajax.request({url:String.format("/Form/Delete/{0}~{1}",AV.assn_id,frmId),method:"DELETE",scope:this,callback:function(post,success,response){var json=Ext.decode(response.responseText);if(success&&!json.error){location.href=json.redirect}else{Ext.Msg.show({title:"Error Deleting Form?",msg:"There was an error deleting the form. Please ensure that you are logged in and try again.",buttons:Ext.Msg.OK,icon:Ext.MessageBox.ERROR})}}})}},this)};