/* DefaultButtons.js */
function SearchSubmit(baseURL,searchCtl)
{if(baseURL.indexOf("?")>0)
location.href=baseURL+"&Search_Keywords="+escape(searchCtl.value);else
location.href=baseURL+"?Search_Keywords="+escape(searchCtl.value);}
function DefaultButton(anEvent,btn)
{if(document.all)
{if(event.keyCode==13)
{event.returnValue=false;event.cancel=true;btn.click();}}
else if(document.getElementById)
{if(anEvent.which==13)
{anEvent.returnValue=false;anEvent.preventDefault();if(btn.click)
btn.click(anEvent);else if(btn.onclick)
btn.onclick(anEvent);}}
else if(document.layers)
{if(event.which==13)
{event.returnValue=false;event.cancel=true;btn.click();}}}
function ShowPanel(onPanel,offPanel,suffix)
{document.getElementById(onPanel).style.display="block";document.getElementById(offPanel).style.display="none";if(!suffix)
return;for(var ii=0;ii<Page_Validators.length;++ii)
if(Page_Validators[ii].id.indexOf(suffix)==(Page_Validators[ii].id.length-suffix.length))
ValidatorEnable(Page_Validators[ii],true);else
ValidatorEnable(Page_Validators[ii],false);}
function ValidateLogin(panel,changeMessageID)
{var messageControl=document.getElementById(changeMessageID);if(!messageControl)
return;messageControl.innerText="";messageControl.style.display="none";switch(panel)
{case"changePasswordPanel":if(!document.getElementById("userNameEP").value||!document.getElementById("oldPassword").value||!document.getElementById("newPassword1").value||!document.getElementById("newPassword2").value)
messageControl.innerText="All fields must be supplied";else if(document.getElementById("newPassword1").value!=document.getElementById("newPassword2").value)
messageControl.innerText="New passwords do not match";else if(document.getElementById("newPassword1").value==document.getElementById("oldPassword").value)
messageControl.innerText="New passwords matches old password";break;case"loginOnlyDiv":if(!document.getElementById("userName").value||!document.getElementById("userPassword").value)
messageControl.innerText="All fields must be supplied";break;case"loginAndChangeDiv":if(!document.getElementById("userNameCP").value||!document.getElementById("oldPasswordCP").value||!document.getElementById("newPassword1CP").value||!document.getElementById("newPassword2CP").value)
messageControl.innerText="All fields must be supplied";else if(document.getElementById("newPassword1CP").value!=document.getElementById("newPassword2CP").value)
messageControl.innerText="New passwords do not match";else if(document.getElementById("newPassword1CP").value==document.getElementById("oldPasswordCP").value)
messageControl.innerText="New passwords matches old password";break;}
if(!messageControl.innerText)
{document.getElementById("submitType").value=panel;document.forms[0].submit();}
else
messageControl.style.display="block";}/* FormEditorSupport.js */
function SFGetControlSet(ctlSet)
{return document.getElementsByName(ctlSet);}
function SFGetControl(ctlName)
{if(typeof(ctlName)=="string")
return document.getElementById(ctlName);else
return ctlName;}
function SFGetLabelValue(ctlName)
{ctl=document.getElementById(ctlName);return ctl.innerHTML;}
function SFGetRadioValue(ctlSet)
{var radios=SFGetControlSet(ctlSet);if(radios==null)
return"";if(radios.length==null||radios.length==0)
return(radios.checked?radios.value:null);for(var ii=0;ii<radios.length;++ii)
if(radios[ii].type!='radio')
return null;else if(radios[ii].checked)
return radios[ii].value;return"";}
function SFGetRadioDefaultValue(ctlSet)
{var radios=SFGetControlSet(ctlSet);if(radios==null)
return null;for(var ii=0;ii<radios.length;++ii)
if(radios[ii].type!='radio')
return null;else if(radios[ii].defaultChecked)
return radios[ii].value;return null;}
function SFGetSelectListLength(ctlName)
{return SFGetControl(ctlName).options.length;}
function SFGetSelectValue(ctlSet)
{var options=document.getElementById(ctlSet);if(options==null)
return null;var retVal="";for(var ii=0;ii<options.length;++ii)
if(options[ii].selected)
retVal+=(retVal.length?", ":"")+options[ii].value;return retVal;}
function SFGetSelectDefaultValue(ctlSet)
{var options=document.getElementById(ctlSet);if(options==null)
return null;for(var ii=0;ii<options.length;++ii)
if(options[ii].defaultSelected)
return options[ii].value;return null;}
function SFGetCheckboxState(ctlName)
{var ctl=SFGetControl(ctlName);return(ctl)?ctl.checked:false;}
function SFRemoveAllWhitespace(strValue)
{return strValue.replace(/[\s|\240]/gi,"");}
function SFEditFieldValue(ctlName)
{var ctl=SFGetControl(ctlName);return ctl?SFRemoveAllWhitespace(ctl.value):false;}
function SFEditFieldHasValue(ctlName)
{return(SFEditFieldValue(ctlName)!="");}
function SFEditParseDate(ctlName)
{if(!SFEditFieldIsDate(ctlName))
return new Date();var ctl=SFGetControl(ctlName);if(!ctl||!ctl.value)
return new Date();var date=new Date();var dateRE=/^ *([01]?\d)[\-|\/\.]([0123]?\d)[\-|\/\.]([12][8901]\d{2}) *$/;if(dateRE.test(ctl.value))
{var match=ctl.value.match(dateRE);if(match.length==4)
return new Date(match[3],Number(match[1])-1,match[2]);}
return date;}
function SFEditFieldIsDate(ctlName)
{var ctl=SFGetControl(ctlName);if(!ctl||!ctl.value)
return true;var dateRE=/^ *([01]?\d)[\-|\/\.]([0123]?\d)[\-|\/\.]([12][8901]\d{2}) *$/;if(dateRE.test(ctl.value))
{var match=ctl.value.match(dateRE);if(match.length==4)
{var testDate=new Date(match[3],Number(match[1])-1,match[2]);if(testDate.getFullYear()==match[3]&&testDate.getMonth()==Number(match[1])-1&&testDate.getDate()==match[2])
return true;}}
return false;}
function SFEditFieldIsTime(ctlName)
{var ctl=SFGetControl(ctlName);if(!ctl||!ctl.value)
return true;var timeRE=/^ *([012]?\d)[: ]([0-5]?\d) ?([aApP]?\.?[mM]?\.?) *$/;if(timeRE.test(ctl.value))
{var match=ctl.value.match(timeRE);if(match.length==4)
{var testTime=new Date(1900,0,01);testTime.setHours(match[1]);testTime.setMinutes(match[2]);var hours=testTime.getHours();var minutes=testTime.getMinutes();if((hours!=Number(match[1]))||(minutes!=Number(match[2]))||(testTime.getDate()!=1))
return false;var isAM=(match[3].indexOf('a')>=0||match[3].indexOf('A')>=0);if(isAM&&testTime.getHours()>12)
return false;ctl.value=String(hours)+((minutes<10)?":0":":")+String(minutes)+((match[3])?(" "+match[3]):"");return true;}}
return false;}
function SFTrim(strValue)
{return strValue?strValue.replace(/^\s*|\s*$/gi,""):"";}
function SFEditFieldMatchesRegEx(ctlName,regEx)
{return(SFGetControl(ctlName).value.match(regEx)!=null);}
function SFEditFieldIsEmail(ctlName)
{return SFEditFieldMatchesRegEx(ctlName,"^ *[\\w._\\-']+@[\\w._\\-]*\\.[\\w._\\-]* *$");}
function SFEditFieldIsPhone(ctlName,bNonUS)
{if(bNonUS)
return SFEditFieldMatchesRegEx(ctlName,"^[\\d\\.\\- ]*$");else
return SFEditFieldMatchesRegEx(ctlName,"^ *\\(?\\d{3}\\)?[) -.]\\d{3}[ -.]\\d{4} *$");}
function internal_ActionByType(type,action,container,suffix)
{if(!container)
container=document;var ctls=container.getElementsByTagName(type);var returnValue=true;for(var ii=0;ii<ctls.length;++ii)
if(ctls[ii].name.indexOf("cmsForms_")==0||ctls[ii].name.indexOf("cmsFormS_")==0)
switch(action)
{case"disable":SFDisableControl(ctls[ii].name);break;case"enable":SFEnableControl(ctls[ii].name);break;case"validate":returnValue&=SFValidateControl(ctls[ii].name,suffix);break;case"clearCheck":if(ctls[ii].type=="checkbox")
ctls[ii].checked=false;}
return returnValue;}
function SFClearCheckBoxes()
{internal_ActionByType("input","clearCheck",document,null);}
function SFDisableAll(container)
{if(!container)
container=document;internal_ActionByType("input","disable",container,null);internal_ActionByType("textarea","disable",container,null);internal_ActionByType("select","disable",container,null);}
function SFEnableAll(container)
{if(!container)
container=document;internal_ActionByType("input","enable",container,null);internal_ActionByType("textarea","enable",container,null);internal_ActionByType("select","enable",container,null);}
function SFGeneralValidate(docID,blockID,useCaptcha,specialValidationFunc)
{var containerControl=document.getElementById("DataDiv_"+blockID);if(!containerControl)
{window.alert("Form Container is Missing");return false;}
tic_Utilities.ShowHideById("DataDiv_"+blockID,false);var allPassed=true;if(specialValidationFunc)
allPassed&=specialValidationFunc(blockID,docID);allPassed&=internal_ActionByType("select","validate",containerControl,blockID);allPassed&=internal_ActionByType("input","validate",containerControl,blockID);allPassed&=internal_ActionByType("textarea","validate",containerControl,blockID);if(useCaptcha=="1")
allPassed&=ClientSideCaptchaValidate(blockID);if(!allPassed)
tic_Utilities.ShowHideById("DataDiv_"+blockID,true);return allPassed;}
function SFExtraEventValidation(blockID,docID)
{var allPassed=true;var ctlName="cmsForms_EventStartTime_"+blockID;if(document.getElementById(ctlName)&&document.getElementById(ctlName).value)
allPassed&=SFRespondToValidation(SFEditFieldIsTime(ctlName),"message_"+ctlName,"Start Time is invalid.  Accepted format is HH:MM with am, pm or in 24-hour time",ctlName,blockID);ctlName="cmsForms_EventEndTime_"+blockID;if(document.getElementById(ctlName)&&document.getElementById(ctlName).value)
allPassed&=SFRespondToValidation(SFEditFieldIsTime(ctlName),"message_"+ctlName,"End Time is invalid.  Accepted format is HH:MM with am, pm or in 24-hour time",ctlName,blockID);ctlName="cmsForms_EventStartDate_"+blockID;if(document.getElementById(ctlName)&&document.getElementById(ctlName).value)
allPassed&=SFRespondToValidation(SFEditFieldIsDate(ctlName),"message_"+ctlName,"Start Date is invalid.  Accepted format is MM-dd-yyyy",ctlName,blockID);ctlName="cmsForms_EventEndDate_"+blockID;if(document.getElementById(ctlName)&&document.getElementById(ctlName).value)
allPassed&=SFRespondToValidation(SFEditFieldIsDate(ctlName),"message_"+ctlName,"End Date is invalid.  Accepted format is MM-dd-yyyy",ctlName,blockID);ctlName="cmsForms_EventContactEmail_"+blockID;if(document.getElementById(ctlName)&&document.getElementById(ctlName).value)
allPassed&=SFRespondToValidation(SFEditFieldIsEmail(ctlName),"message_"+ctlName,"Invalid Contact Email detected",ctlName,blockID);ctlName="cmsForms_EventDescription_"+blockID;if(document.getElementById(ctlName)&&document.getElementById(ctlName))
allPassed&=SFRespondToValidation(internal_GetCommentValue(document.getElementById(ctlName))==document.getElementById(ctlName).value,"message_"+ctlName,"Description field cannot contain HTML",ctlName,blockID);ctlName="cmsForms_EventNotes_"+blockID;if(document.getElementById(ctlName)&&document.getElementById(ctlName))
allPassed&=SFRespondToValidation(internal_GetCommentValue(document.getElementById(ctlName))==document.getElementById(ctlName).value,"message_"+ctlName,"Notes field cannot contain HTML",ctlName,blockID);return allPassed;}
function SFFinalEventSubmit(docID,blockID,useCaptcha)
{var attachment=document.getElementById("cmsForms_EventAttachment_"+blockID);if(attachment&&attachment.value)
document.getElementById("cmsForms_EventHasAttachment_"+blockID).value="1";var ctl=document.getElementById("cmsForms_EventName_"+blockID);ctl.form.submit();}
function SFSubmitEvent(docID,blockID,doConfirm,useCaptcha)
{if(!SFGeneralValidate(docID,blockID,useCaptcha,SFExtraEventValidation))
return;if(doConfirm=="1")
return SFConfirmForm(blockID);SFFinalEventSubmit(docID,blockID,useCaptcha);}
function SFSubmitFormUDFButton(ctl)
{var parent=ctl.parentNode;while(parent)
if(parent.tagName=="DIV"&&parent.id&&parent.id.indexOf("DataDiv_")==0)
break;else
parent=parent.parentNode;if(!parent)
return;var blockID=parent.getAttribute("blockID");if(!blockID)
return;var realSubmit=document.getElementById("formSubmit"+blockID);if(!realSubmit)
return;return realSubmit.click();}
function SFSubmitForm(docID,blockID,doConfirm,useCaptcha,submitAction)
{if(!SFGeneralValidate(docID,blockID,useCaptcha,window["FormSpecificValidation"]))
return;if(!document.getElementById("cmsForms_submitUDF")&&submitAction=="ajax"&&doConfirm=="1")
return SFConfirmForm(blockID);SFFinalFormSubmit(docID,blockID,useCaptcha,submitAction);}
function SFReturnToEdit(blockID)
{SFEnableAll(document.getElementById("DataDiv_"+blockID));tic_Utilities.ShowHideById("VerifyMessage_"+blockID,false);tic_Utilities.ShowHideById("SubmitButtons_"+blockID,true);tic_Utilities.ShowHideById("ConfirmButtons_"+blockID,false);tic_Utilities.ShowHideById("DataDiv_"+blockID,true);}
function SFConfirmForm(blockID)
{SFDisableAll(document.getElementById("DataDiv_"+blockID));tic_Utilities.ShowHideById("VerifyMessage_"+blockID,true);tic_Utilities.ShowHideById("SubmitButtons_"+blockID,false);tic_Utilities.ShowHideById("ConfirmButtons_"+blockID,true);tic_Utilities.ShowHideById("cmsForms_DataNotProvided_"+blockID,false);tic_Utilities.ShowHideById("DataDiv_"+blockID,true);}
function SFFinalFormSubmit(docID,blockID,useCaptcha,submitAction)
{SFReturnToEdit(blockID);tic_Utilities.ShowHideById("DataDiv_"+blockID,false);if(submitAction=="post")
return document.forms[0].submit();var containerControl=document.getElementById("DataDiv_"+blockID);var packagedData=tic_Utilities.MakeXmlStartTag("Data",false);packagedData+=internal_PackageByType("select",containerControl);packagedData+=internal_PackageByType("input",containerControl);packagedData+=internal_PackageByType("textarea",containerControl);packagedData+=tic_Utilities.MakeXmlStartTag("Captcha",false);packagedData+=ExtractCaptchaInfo(containerControl);packagedData+=tic_Utilities.MakeXmlEndTag("Captcha",false);packagedData+=tic_Utilities.MakeXmlEndTag("Data",false);var ajaxArgs=new Array();ajaxArgs[ajaxArgs.length]=docID;ajaxArgs[ajaxArgs.length]=blockID;ajaxArgs[ajaxArgs.length]=packagedData;TitanDisplayServiceWrapper.MakeWebServiceCall("Forms",NorthwoodsSoftwareDevelopment.Cms.WebServices.FormBlockAjax.ProcessComment,ajaxArgs,SFFormSubmitComplete,[blockID,submitAction],true);}
function SFFormSubmitComplete(blockID,submitAction,results,context,methodName)
{if(window["ProcessCaptchaResults"])
ProcessCaptchaResults(results);if(submitAction=="remotePost"&&document.getElementById("postURL_"+blockID))
{document.forms[0].action=document.getElementById("postURL_"+blockID).value;return document.forms[0].submit();}
if(!results.status)
{tic_Utilities.ShowHideById("DataDiv_"+blockID,true);SFRespondToValidation(false,"formsubmit",results.message,"foo",blockID);if(document.getElementById("cmsForms_submitUDF"))
document.getElementById("SubmitButtons_"+String(blockID)).style.display="none";}
else if(document.getElementById("ThankYouDiv_"+blockID))
tic_Utilities.ShowHideById("ThankYouDiv_"+blockID,true);else if(document.getElementById("followupUrl_"+blockID))
location.href=document.getElementById("followupUrl_"+blockID).value;}
function SFValidateAll(ctl)
{var allPassed=true;if(window.FormSpecificValidation)
allPassed&=FormSpecificValidation();allPassed&=internal_ActionByType("select","validate",document,null);allPassed&=internal_ActionByType("input","validate",document,null);allPassed&=internal_ActionByType("textarea","validate",document,null);if(allPassed)
ctl.form.submit();}
function SFValidateControl(ctlName,suffix)
{var messageName="alert_"+ctlName;var controlIsValid=true;var ctl=document.getElementById(ctlName);var displayName=ctlName.substring(ctlName.indexOf('_')+1);var bIsRequired=false;if(ctl)
{if(ctl.attributes["errorMessage"]&&ctl.attributes["errorMessage"].value!="")
displayName=ctl.attributes["errorMessage"].value;else if(ctl.attributes["errormessage"]&&ctl.attributes["errormessage"].value!="")
displayName=ctl.attributes["errormessage"].value;bIsRequired=((ctl.attributes["isRequired"]&&(ctl.attributes["isRequired"].value=='true'||ctl.attributes["isRequired"].value=="isRequired"))||(ctl.attributes["isrequired"]&&(ctl.attributes["isrequired"].value=='true'||ctl.attributes["isrequired"].value=="isrequired")));}
if(ctl&&ctl.tagName=="SELECT")
{if(bIsRequired)
{var selectedValue=SFGetSelectValue(ctlName);if(!selectedValue||selectedValue=="")
controlIsValid=false;}
SFRespondToValidation(controlIsValid,messageName,displayName,ctlName,suffix);}
else if(ctl&&ctl.tagName=='INPUT'&&ctl.type=='checkbox')
{if(bIsRequired)
{controlIsValid=ctl.checked;SFRespondToValidation(controlIsValid,messageName,displayName,ctlName,suffix);}}
else if(!ctl||(ctl.tagName=='INPUT'&&ctl.type=='radio'))
{if(!ctl)
{var ctlGroup=document.getElementsByName(ctlName);if(ctlGroup&&ctlGroup.length>0)
{bIsRequired=((ctlGroup[0].attributes["isRequired"]&&(ctlGroup[0].attributes["isRequired"].value=='true'||ctlGroup[0].attributes["isRequired"].value=="isRequired"))||(ctlGroup[0].attributes["isrequired"]&&(ctlGroup[0].attributes["isrequired"].value=='true'||ctlGroup[0].attributes["isrequired"].value=="isrequired")));var ctl=ctlGroup[0];if(ctl.attributes["errorMessage"]&&ctl.attributes["errorMessage"].value!="")
displayName=ctl.attributes["errorMessage"].value;else if(ctl.attributes["errormessage"]&&ctl.attributes["errormessage"].value!="")
displayName=ctl.attributes["errormessage"].value;}}
if(bIsRequired)
{var selectedValue=SFGetRadioValue(ctlName);if(!selectedValue||selectedValue=="")
controlIsValid=false;}
SFRespondToValidation(controlIsValid,messageName,displayName,ctlName,suffix);}
else
{bNeedsValidation=(ctl.attributes["validationType"]&&ctl.attributes["validationType"].value!='None');if(!bNeedsValidation)
bNeedsValidation=(ctl.attributes["validationtype"]&&ctl.attributes["validationtype"].value!='None');if(bIsRequired&&!SFEditFieldHasValue(ctlName))
controlIsValid=false;else if(bNeedsValidation&&!SFEditFieldMatchesRegEx(ctlName,(ctl.getAttribute("regExp")||ctl.getAttribute("regexp"))))
controlIsValid=false;SFRespondToValidation(controlIsValid,messageName,displayName,ctlName,suffix);}
return controlIsValid;}
function internal_MaskEdit(ctl)
{ctl.readOnly=true;tic_Utilities.AddStyle(ctl,"hideBorders");}
function internal_UnMaskEdit(ctl)
{ctl.readOnly=false;tic_Utilities.RemoveStyle(ctl,"hideBorders");}
function SFEnableControl(ctlName)
{var ctl=document.getElementById(ctlName);if(ctl&&ctl.tagName=="SELECT")
{ctl.style.display="block";if(document.getElementById(ctl.id+"_mask"))
document.getElementById(ctl.id+"_mask").parentNode.removeChild(document.getElementById(ctl.id+"_mask"));}
else if(ctl&&ctl.tagName=='INPUT'&&ctl.type=='checkbox')
ctl.disabled=false;else if(!ctl||(ctl.tagName=='INPUT'&&ctl.type=='radio'))
{var ctlGroup=document.getElementsByName(ctlName);for(var ii=0;ii<ctlGroup.length;++ii)
ctlGroup[ii].disabled=false;}
else
internal_UnMaskEdit(ctl);}
function SFDisableControl(ctlName)
{var ctl=document.getElementById(ctlName);if(ctl&&ctl.tagName=="SELECT")
{var parentNode=ctl.parentNode;if(!parentNode)
return window.alert("No parent element found for "+ctlName);var inputControl=document.createElement("input");if(!inputControl)
return window.alert("Unable to create element for "+ctlName);inputControl.id=ctl.id+"_mask";if(!ctl.multiple&&ctl.selectedIndex>=0)
inputControl.value=ctl.options[ctl.selectedIndex].text;else
{var str="";for(var ii=0;ii<ctl.length;++ii)
if(ctl[ii].selected)
str+=((str.length>0)?", ":"")+ctl[ii].text;inputControl.value=str;}
inputControl.className=ctl.className;parentNode.insertBefore(inputControl,ctl);internal_MaskEdit(inputControl);ctl.style.display="none";}
else if(ctl&&ctl.tagName=='INPUT'&&ctl.type=='checkbox')
ctl.disabled=true;else if(!ctl||(ctl.tagName=='INPUT'&&ctl.type=='radio'))
{var ctlGroup=document.getElementsByName(ctlName);for(var ii=0;ii<ctlGroup.length;++ii)
ctlGroup[ii].disabled=true;}
else
internal_MaskEdit(ctl);}
function SFControlIsEnabled(ctlName)
{return document.getElementById(ctlName)!=null&&!document.getElementById(ctlName).disabled;}
function SFControlExists(ctlName)
{return SFGetControl(ctlName)!=null;}
function SFValueHasChanged(ctlName)
{var ctl=SFGetControl(ctlName);if(ctl==null)
return;var value;if(!ctl.tagName)
value=SFGetRadioValue(ctlName);else if(ctl.tagName=="SELECT")
value=SFGetSelectValue(ctlName);else if(ctl.tagName=='INPUT'&&ctl.type=='checkbox')
value=ctl.checked?ctl.value:"";else
value=((!ctl.value)?"":ctl.value);var defaultValue;if(!ctl.tagName)
defaultValue=SFGetRadioDefaultValue(ctlName);else if(ctl.tagName=="SELECT")
defaultValue=SFGetSelectDefaultValue(ctlName);else if(ctl.tagName=='INPUT'&&ctl.type=='checkbox')
defaultValue=ctl.defaultChecked?ctl.value:"";else
defaultValue=((!ctl.defaultValue)?"":ctl.defaultValue);defaultValue=(defaultValue?defaultValue:"");value=(value?value:"");return(defaultValue!=value);}
function SFSetRadioValue(ctlName,ctlValue)
{var ctl=SFGetControlSet(ctlName);if(ctl==null)
return;if(ctl.length&&ctl.length>0)
for(var ii=0;ii<ctl.length;++ii)
ctl[ii].checked=(ctl[ii].value==ctlValue);else
ctl.checked=(ctl.value==ctlValue);}
function SFClearRadioButton(ctlName,ctlValue)
{var ctl=SFGetControlSet(ctlName);if(ctl==null)
return;for(var ii=0;clt.length&&ii<ctl.length;++ii)
if(ctl[ii].value==ctlValue)
ctl[ii].selected=ctl[ii].checked=false;}
function SFSetControlValue(ctlName,ctlValue,bFireChangeEvent)
{var ctl=document.getElementById(ctlName);if(ctl==null)
{ctl=document.getElementsByName(ctlName);if(ctl==null||ctl.length==0)
return;}
var arrayOfValues;if(ctl.tagName=="SELECT"&&ctl.multiple)
arrayOfValues=ctlValue.split(',');else
arrayOfValues=[ctlValue];if(ctl.length&&ctl.length>0)
{for(var ii=0;ii<ctl.length;++ii)
{ctl[ii].selected=false;ctl[ii].checked=false;ctl[ii].defaultChecked=false;ctl[ii].defaultSelected=false;}
for(var jj=0;jj<arrayOfValues.length;++jj)
{for(var ii=0;ii<ctl.length;++ii)
{if(ctl[ii].value.replace(/ /g,'')==arrayOfValues[jj].replace(/ /g,''))
{ctl[ii].selected=true;ctl[ii].checked=true;ctl[ii].defaultChecked=true;ctl[ii].defaultSelected=true;if(bFireChangeEvent&&ctl[ii].onclick)
ctl[ii].onclick();}}}
if(bFireChangeEvent&&ctl.onchange)
ctl.onchange();}
else if(ctl.tagName=="INPUT"&&ctl.type=="file");else if(ctl.tagName=='INPUT'&&ctl.type=='radio')
{var ctlGroup=document.getElementsByName(ctlName);for(var ii=0;ii<ctlGroup.length;++ii)
if(ctlGroup[ii].value==ctlValue)
{ctlGroup[ii].checked=true;if(bFireChangeEvent&&ctl.onclick)
ctl.onclick();}}
else if(ctl.tagName=='INPUT'&&ctl.type=='checkbox')
{ctl.defaultChecked=ctl.checked=(ctlValue!=""&&ctlValue!=0&&ctlValue!="No"&&ctlValue!="off"&&ctlValue!=false);if(bFireChangeEvent&&ctl.onclick)
ctl.onclick();}
else
{ctl.value=ctlValue;ctl.defaultValue=ctlValue;if(bFireChangeEvent&&ctl.onchange)
ctl.onchange();}}
function SFExtractMessageControl(suffix)
{var ctlName="cmsForms_DataNotProvided";if(suffix)
ctlName+="_"+suffix;return document.getElementById(ctlName);}
function SFFindMessage(msgCtl,msgName)
{var message=document.getElementById(msgName);if(message)
msgCtl.style.display="block";return message;}
function SFMessageAreaHasMessage(suffix)
{var ctl=SFExtractMessageControl(suffix);var embeddedDivs=ctl.getElementsByTagName("DIV");for(var ii=0;ii<embeddedDivs.length;++ii)
if(embeddedDivs[ii].className&&embeddedDivs[ii].className=="SFMessage")
return true;return false;}
function SFMessageAreaFinalAdjust(suffix)
{var msgCtl=SFExtractMessageControl(suffix);if(SFMessageAreaHasMessage(suffix))
{msgCtl.style.display="block";if(msgCtl.getAttribute("useClass")=="1")
tic_Utilities.RemoveStyle(msgCtl,"error");else
msgCtl.style.display="none";}
else
{if(msgCtl.getAttribute("useClass")=="1")
tic_Utilities.AddStyle(msgCtl,"error");else
msgCtl.style.display="none";}}
function SFAddMessage(msgName,msgText,suffix)
{var msgCtl=SFExtractMessageControl(suffix);if(SFFindMessage(msgCtl,msgName))
return;var newMessage=document.createElement("DIV");newMessage.className='SFMessage';newMessage.id=msgName;newMessage.innerHTML="&nbsp;&nbsp;&nbsp;"+msgText;msgCtl.appendChild(newMessage);if(msgCtl.getAttribute("useClass")=="1")
tic_Utilities.AddStyle(msgCtl,"error");else
msgCtl.style.display="block";return true;}
function SFRemoveMessage(msgName,suffix)
{var msgCtl=SFExtractMessageControl(suffix);var ctlToRemove=SFFindMessage(msgCtl,msgName);if(ctlToRemove==null||msgCtl==null)
return;msgCtl.removeChild(ctlToRemove);if(msgCtl.getElementsByTagName("DIV").length>0)
return;if(msgCtl.getAttribute("useClass")=="1")
tic_Utilities.RemoveStyle(msgCtl,"error");else
msgCtl.style.display="none";}
function SFDisplayMessage(msgName,message,suffix)
{if(SFFindMessage(SFExtractMessageControl(suffix),msgName))
return;SFAddMessage(msgName,message,suffix);}
function SFRespondToValidation(testHasPassed,msgName,message,ctlName,suffix)
{var containingDiv=null;var errorCtl=document.getElementById(ctlName+"_Error");if(errorCtl)
{containingDiv=errorCtl;while(containingDiv&&containingDiv.tagName!="DIV")
containingDiv=containingDiv.parentNode;if(containingDiv&&containingDiv.tagName!="DIV")
containingDiv=null;}
if(testHasPassed)
{SFRemoveMessage(msgName,suffix);tic_Utilities.RemoveStyle(containingDiv,"messageOn");return true;}
else
{SFDisplayMessage(msgName,message,suffix);tic_Utilities.AddStyle(containingDiv,"messageOn");return false;}}
function IsPhotoDiv(div)
{if(!div.id)
return false;if(div.id.indexOf("/")!=0)
return false;return true;}
function ChangeImageSource(ctlName,newSource,blockIndex)
{var ctl=document.getElementById(ctlName);var divChildren=ctl.getElementsByTagName("DIV");for(var ii=0;ii<divChildren.length;++ii)
{if(!IsPhotoDiv(divChildren[ii]))
continue;if(!divChildren[ii].style.display||divChildren[ii].style.display=="block")
divChildren[ii].style.display="none";if(divChildren[ii].id==newSource)
{divChildren[ii].style.display="block";ResetImageTag(divChildren[ii]);if(document.getElementById("rightArrow"+String(blockIndex)))
document.getElementById("rightArrow"+String(blockIndex)).style.visibility=(((ii+1)<divChildren.length)?"visible":"hidden");if(document.getElementById("leftArrow"+String(blockIndex)))
document.getElementById("leftArrow"+String(blockIndex)).style.visibility=(((ii)>0)?"visible":"hidden");}}}
function OpenFullImage(fullImageLink)
{var hwnd=window.open(fullImageLink);hwnd.focus();}
function ResetImageTag(outerDiv)
{var images=outerDiv.getElementsByTagName("IMG");if(!images||!images.length)
return;var img=images[0];img.src=img.getAttribute("realSrc");}
function PhotoBlockMove(direction,ctlName,blockIndex)
{var ctl=document.getElementById(ctlName);var divChildren=ctl.getElementsByTagName("DIV");for(var ii=0;ii<divChildren.length;++ii)
{if(!IsPhotoDiv(divChildren[ii]))
continue;if(divChildren[ii].style.display&&divChildren[ii].style.display=="none")
continue;if(direction=="right")
{if((ii+1)<divChildren.length)
{divChildren[ii].style.display="none";divChildren[ii+1].style.display="block";ResetImageTag(divChildren[ii+1]);}
document.getElementById("rightArrow"+String(blockIndex)).style.visibility=(((ii+2)<divChildren.length)?"visible":"hidden");document.getElementById("leftArrow"+String(blockIndex)).style.visibility="visible";}
else if(direction=="left")
{if((ii-1)>=0)
{divChildren[ii].style.display="none";divChildren[ii-1].style.display="block";ResetImageTag(divChildren[ii-1]);}
document.getElementById("leftArrow"+String(blockIndex)).style.visibility=(((ii-1)>0)?"visible":"hidden");document.getElementById("rightArrow"+String(blockIndex)).style.visibility="visible";}
break;}}
function internal_ControlHasBeenProcessed(processed,newCtlName)
{for(var ii=0;ii<processed.length;++ii)
if(processed[ii]==newCtlName)
return true;return false;}
function internal_GetCommentValue(ctl)
{switch(ctl.tagName)
{case"INPUT":if(ctl.type=="radio")
return SFGetRadioValue(ctl.name);else if(ctl.type=="checkbox")
return SFGetCheckboxState(ctl.name)?"yes":"no";case"TEXTAREA":return ctl.value.replace(/<|>|&lt;|&gt;|&#60;|&#62;|&#x3c;|&#x3e;|%3c|%3e/gi,"");case"SELECT":return SFGetSelectValue(ctl.id);}}
function internal_PackageByType(type,container)
{if(!container)
container=document;var processedControls=[];var returnValue="";var ctls=container.getElementsByTagName(type);for(var ii=0;ii<ctls.length;++ii)
if(ctls[ii].name.indexOf("cmsForms_")==0||ctls[ii].name.indexOf("cmsFormS_")==0)
{if(internal_ControlHasBeenProcessed(processedControls,ctls[ii].name))
continue;processedControls[processedControls.length]=ctls[ii].name;returnValue+=tic_Utilities.PackageXml(ctls[ii].name,internal_GetCommentValue(ctls[ii]),true);}
return returnValue;}
function CRValidateAndSubmit(ctl)
{var containerControl=document.getElementById("titanComments_CommentForm");if(!containerControl)
return window.alert("Commenting form container is missing");tic_Utilities.ShowHideById("titanComments_CommentForm",false);var allPassed=true;if(window["CommentRating_UserSuppliedValidation"])
allPassed&=CommentRating_UserSuppliedValidation();allPassed&=internal_ActionByType("select","validate",containerControl,null);allPassed&=internal_ActionByType("input","validate",containerControl,null);allPassed&=internal_ActionByType("textarea","validate",containerControl,null);if(window["ClientSideCaptchaValidate"])
allPassed&=ClientSideCaptchaValidate(null);if(!allPassed)
{SFMessageAreaFinalAdjust(null);return tic_Utilities.ShowHideById("titanComments_CommentForm",true);}
var packagedData=tic_Utilities.MakeXmlStartTag("Data",false);packagedData+=internal_PackageByType("select",containerControl);packagedData+=internal_PackageByType("input",containerControl);packagedData+=internal_PackageByType("textarea",containerControl);packagedData+=tic_Utilities.MakeXmlStartTag("Captcha",false);packagedData+=ExtractCaptchaInfo(containerControl);packagedData+=tic_Utilities.MakeXmlEndTag("Captcha",false);packagedData+=tic_Utilities.MakeXmlEndTag("Data",false);var ajaxArgs=new Array();ajaxArgs[ajaxArgs.length]=document.getElementById("cmsForms_DocID").value;ajaxArgs[ajaxArgs.length]=packagedData;SFRespondToValidation(true,"captcha","","cmsForms_TitanRatingReCaptchaZone",null);TitanDisplayServiceWrapper.MakeWebServiceCall("Commenting",NorthwoodsSoftwareDevelopment.Cms.WebServices.CommentingAjax.ProcessComment,ajaxArgs,CRSaveComplete,[],true);}
function CRSaveComplete(results,context,methodName)
{if(!results.status)
{tic_Utilities.ShowHideById("titanComments_CommentForm",true);SFRespondToValidation(false,"formsubmit",results.message,"cmsForms_TitanRatingReCaptchaZone",null);}
else if(document.getElementById("titanComments_Confirmation"))
tic_Utilities.ShowHideById("titanComments_Confirmation",true);else
document.location.href=document.location.href;if(window["ProcessCaptchaResults"])
ProcessCaptchaResults(results);}
function ClientSideCaptchaValidate(suffix)
{if(!document.getElementById("cmsForms_CommentingCaptchaEnabled")||document.getElementById("cmsForms_CommentingCaptchaEnabled").value!="1")
return true;if(document.getElementById("cmsForms_TitanRatingReCaptchaZone"))
return SFRespondToValidation(Recaptcha.get_response(),"titan_captcha","You must respond to the Recaptcha request","cmsForms_TitanCaptcha",suffix);return true;}
function ProcessCaptchaResults(results)
{try
{if(window["Recaptcha"]&&Recaptcha.widget)
Recaptcha.reload();}
catch(e)
{}}
function ExtractCaptchaInfo(containerControl)
{if(!window["Recaptcha"])
return;var retVal=tic_Utilities.PackageXml("RecaptchaChallenge",Recaptcha.get_challenge(),true);retVal+=tic_Utilities.PackageXml("RecaptchaResponse",Recaptcha.get_response(),true);return retVal;}
function CRCommentLimit(ctl,numChars)
{var baseID=ctl.id;var limitSpanCtl=document.getElementById(baseID+"_Count");if(ctl.value.length>numChars)
ctl.value=ctl.value.substring(0,numChars);if(limitSpanCtl)
limitSpanCtl.innerHTML=String(numChars-ctl.value.length);}/* BlockSupport.js */
function FilterBlocks_MakePrefix(blockID)
{return"F"+String(blockID)+"_";}
function FilterBlocks_MakeFullPrefix(blockID,classID)
{return FilterBlocks_MakePrefix(blockID)+"C"+String(classID)+"_";}
function FilterBlocks_GetPageNumCtl(prefix)
{return document.getElementById(prefix+"PageNum");}
function FilterBlocks_GetSortOrderCtl(prefix)
{return document.getElementById(prefix+"SortOrder");}
function FilterBlocks_GetKeywordCtl(prefix)
{return document.getElementById(prefix+"keywordFilter");}
function FilterBlocks_GetFolderIDCtl(prefix)
{return document.getElementById(prefix+"FolderID");}
function FilterBlocks_GetDocIDCtl(prefix)
{return document.getElementById(prefix+"DocID");}
function FilterBlocks_ClassificationMinMax(blockID,classID)
{FilterBlocks_RecalcSeeAllLess(blockID,classID);var fieldset=FilterBlocks_GetTagFieldset(blockID,classID);if(!fieldset)
return;if(tic_Utilities.HasStyle(fieldset,"min"))
tic_Utilities.RemoveStyle(fieldset,"min");else
tic_Utilities.AddStyle(fieldset,"min");}
function FilterBlocks_RecalcSeeAllLess(blockID,classID)
{var fieldset=FilterBlocks_GetTagFieldset(blockID,classID);if(!fieldset)
return;if(!fieldset.getAttribute("limitNum"))
return;var limit=parseInt(fieldset.getAttribute("limitNum"));if(!limit||limit>1000)
return;var inputsDiv=FilterBlocks_GetInputsDiv(blockID,classID);if(!inputsDiv)
return;var hideZeros=tic_Utilities.HasStyle(fieldset,"hideZero");var prefix=FilterBlocks_MakeFullPrefix(blockID,classID);var allInputs=inputsDiv.getElementsByTagName("DIV");for(var ii=0;ii<allInputs.length;++ii)
{if(!allInputs[ii].id||allInputs[ii].id.indexOf(prefix)!=0)
continue;if(tic_Utilities.HasStyle(allInputs[ii],"selected"))
{limit--;tic_Utilities.RemoveStyle(allInputs[ii],"seeMore");}}
var oneHidden=false;for(var ii=0;ii<allInputs.length;++ii)
{if(!allInputs[ii].id||allInputs[ii].id.indexOf(prefix)!=0)
continue;if(tic_Utilities.HasStyle(allInputs[ii],"selected"))
continue;if(hideZeros&&tic_Utilities.HasStyle(allInputs[ii],"zero"))
continue;if(limit--<=0)
{tic_Utilities.AddStyle(allInputs[ii],"seeMore");oneHidden=true;}
else
tic_Utilities.RemoveStyle(allInputs[ii],"seeMore");}
var more=document.getElementById(prefix+"more");var less=document.getElementById(prefix+"less");if(more)
more.style.display=(oneHidden)?"":"none";if(less)
less.style.display=(oneHidden)?"":"none";}
function FilterBlocks_SeeAllLess(blockID,classID)
{var fieldset=FilterBlocks_GetTagFieldset(blockID,classID);if(!fieldset)
return;FilterBlocks_RecalcSeeAllLess(blockID,classID);if(tic_Utilities.HasStyle(fieldset,"seeMore"))
{tic_Utilities.RemoveStyle(fieldset,"seeMore");tic_Utilities.AddStyle(fieldset,"seeLess");}
else
{tic_Utilities.RemoveStyle(fieldset,"seeLess");tic_Utilities.AddStyle(fieldset,"seeMore");}}
function FilterBlocks_ResetSelectClass(target,selected,blockID,classID)
{if(selected)
FilterBlocks_SetInputWrapperSelect(target.id);else
FilterBlocks_RemoveInputWraperSelect(target.id);FilterBlocks_CollapseTagSet(blockID,classID,selected);}
function FilterBlocks_GetFilterDocumentRoot(blockPrefix)
{var root=document.getElementById("FilterArea_"+blockPrefix);if(!root)
return document;return root;}
function FilterBlocks_ResetSelections(blockID,classID)
{var div=FilterBlocks_GetInputsDiv(blockID,classID);if(!div)
return;var boxes=div.getElementsByTagName("INPUT");for(var ii=0;ii<boxes.length;++ii)
if(boxes[ii].checked)
{tic_Utilities.RemoveStyle(document.getElementById(boxes[ii].id+"_div"),"selected");boxes[ii].checked=false;}
FilterBlocks_RecalcSeeAllLess(blockID,classID);var fieldset=FilterBlocks_GetTagFieldset(blockID,classID);tic_Utilities.RemoveStyle(fieldset,"min");if(tic_Utilities.RemoveStyle(fieldset,"seeMore"))
tic_Utilities.AddStyle(fieldset,"seeLess");}
function FilterBlocks_HaveClassificationsChanged(blockPrefix,blockID)
{var hasChanges=false;var allInputs=FilterBlocks_GetFilterDocumentRoot(blockPrefix).getElementsByTagName("INPUT");for(var ii=0;ii<allInputs.length;++ii)
{var myId=allInputs[ii].id;if(allInputs[ii].type=="checkbox"&&myId.indexOf(blockPrefix)==0)
{hasChanges|=(allInputs[ii].checked!=allInputs[ii].defaultChecked);FilterBlocks_ResetSelectClass(allInputs[ii],allInputs[ii].checked,blockID,parseInt(myId.substring(blockPrefix.length+1)));}
if(allInputs[ii].type=="radio"&&myId.indexOf(blockPrefix)==0)
{hasChanges|=(allInputs[ii].checked!=allInputs[ii].defaultChecked);FilterBlocks_ResetSelectClass(allInputs[ii],allInputs[ii].checked,blockID,parseInt(myId.substring(blockPrefix.length+1)));}}
var allSelects=FilterBlocks_GetFilterDocumentRoot(blockPrefix).getElementsByTagName("SELECT");for(var ii=0;ii<allSelects.length;++ii)
{if(allSelects[ii].id.indexOf(blockPrefix)==0&&SFGetSelectValue(allSelects[ii].id)!=SFGetSelectDefaultValue(allSelects[ii].id))
{return true;}}
return hasChanges;}
function FilterBlocks_GetInputWrapperDivFromCtl(prefix,target,container)
{while(target)
{var myTarget=target;target=target.parentNode;if(!target)
return null;if(myTarget.tagName!="DIV")
continue;if(myTarget==container)
return null;if(!myTarget.id||myTarget.id.indexOf(prefix)!=0)
continue;return myTarget;}
return null;}
function FilterBlocks_GetInputWrapperDiv(prefix,container,evt)
{return FilterBlocks_GetInputWrapperDivFromCtl(prefix,tic_Utilities.GetTargetCtl(evt),container);}
function FilterBlocks_ClearInputWrapperSelect(container,fullPrefix)
{var allKids=container.getElementsByTagName("DIV");for(var ii=0;ii<allKids.length;++ii)
if(allKids[ii].id&&allKids[ii].id.indexOf(fullPrefix)==0)
tic_Utilities.RemoveStyle(allKids[ii],"selected");}
function FilterBlocks_SetInputWrapperSelect(id)
{tic_Utilities.AddStyle(document.getElementById(id+"_div"),"selected");}
function FilterBlocks_RemoveInputWraperSelect(id)
{tic_Utilities.RemoveStyle(document.getElementById(id+"_div"),"selected");}
function FilterBlocks_GetTagFieldset(blockID,classID)
{return document.getElementById(FilterBlocks_MakeFullPrefix(blockID,classID)+"fieldset");}
function FilterBlocks_GetInputsDiv(blockID,classID)
{var div=document.getElementById(FilterBlocks_MakeFullPrefix(blockID,classID)+"div");if(tic_Utilities.HasStyle(div,"inputs"))
return div;return null;}
function FilterBlocks_CollapseTagSet(blockID,classID,turnOn)
{var fieldset=FilterBlocks_GetTagFieldset(blockID,classID);if(!fieldset)
return;if(fieldset.getAttribute("runaway")!="1")
return;if(turnOn)
tic_Utilities.AddStyle(fieldset,"min");else
tic_Utilities.RemoveStyle(fieldset,"min");}
function FilterBlocks_HandleCommonLinkSelect(blockID,classID,container,evt)
{var fullPrefix=FilterBlocks_MakeFullPrefix(blockID,classID);var target=FilterBlocks_GetInputWrapperDiv(fullPrefix,container,evt);if(!target)
return;FilterBlocks_ClearInputWrapperSelect(container,fullPrefix);var submitID=target.id.substring(0,target.id.lastIndexOf("_"));FilterBlocks_SetInputWrapperSelect(submitID);SFSetRadioValue(fullPrefix.substring(0,fullPrefix.length-1),submitID);FilterBlocks_CollapseTagSet(blockID,classID,true);}
function FilterBlocks_HasClassifications(blockPrefix)
{var allInputs=FilterBlocks_GetFilterDocumentRoot(blockPrefix).getElementsByTagName("INPUT");for(var ii=0;ii<allInputs.length;++ii)
if(allInputs[ii].id&&allInputs[ii].id.indexOf(blockPrefix)==0)
return true;var allSelects=FilterBlocks_GetFilterDocumentRoot(blockPrefix).getElementsByTagName("SELECT");for(var ii=0;ii<allSelects.length;++ii)
if(allSelects[ii].id&&allSelects[ii].id.indexOf(blockPrefix)==0)
return true;return false;}
function FilterBlocks_FormatClassifications(blockPrefix)
{var checkBoxes=new StringBuilder();checkBoxes.Append("!");var allInputs=FilterBlocks_GetFilterDocumentRoot(blockPrefix).getElementsByTagName("INPUT");for(var ii=0;ii<allInputs.length;++ii)
{var myId=allInputs[ii].id;if(allInputs[ii].type=="checkbox"&&allInputs[ii].checked&&myId.indexOf(blockPrefix)==0)
checkBoxes.Append(myId,"!");if(allInputs[ii].type=="radio"&&allInputs[ii].checked&&myId.indexOf(blockPrefix)==0)
checkBoxes.Append(myId,"!");}
var allSelects=FilterBlocks_GetFilterDocumentRoot(blockPrefix).getElementsByTagName("SELECT");for(var ii=0;ii<allSelects.length;++ii)
{if(!allSelects[ii].value)
continue;if(allSelects[ii].id.indexOf(blockPrefix)==0)
checkBoxes.Append(allSelects[ii].value,"!");}
var retVal=checkBoxes.ReturnAndEmpty();return retVal.substring(1,Math.max(0,retVal.length-1));}
function FilterBlocks_FormatDefaultClassifications(blockPrefix)
{var root=FilterBlocks_GetFilterDocumentRoot(blockPrefix);var checkBoxes=new StringBuilder();checkBoxes.Append("!");var allInputs=root.getElementsByTagName("INPUT");for(var ii=0;ii<allInputs.length;++ii)
{var myId=allInputs[ii].id;if(allInputs[ii].type=="checkbox"&&allInputs[ii].defaultChecked&&myId.indexOf(blockPrefix)==0)
checkBoxes.Append(myId,"!");if(allInputs[ii].type=="radio"&&allInputs[ii].defaultChecked&&myId.indexOf(blockPrefix)==0)
checkBoxes.Append(myId,"!");}
var allSelects=root.getElementsByTagName("SELECT");for(var ii=0;ii<allSelects.length;++ii)
{if(!allSelects[ii].value)
continue;if(allSelects[ii].id.indexOf(blockPrefix)==0)
checkBoxes.Append(SFGetSelectDefaultValue(allSelects[ii].id),"!");}
return checkBoxes.ReturnAndEmpty();}
function FilterBlocks_RemoveExistingFilterBlockParams(params,removeSearch)
{if(!params)
return"";var retVal="&";var paramArray=params.split("&");for(var ii=0;ii<paramArray.length;++ii)
if(paramArray[ii].indexOf("FB_Values")==0||paramArray[ii].match(/^F\d*_/));else if(removeSearch&&paramArray[ii].indexOf("Search_Keywords")==0);else if(paramArray[ii].length)
retVal+=paramArray[ii]+"&";return retVal.substring(1);}
function FilterBlocks_NonTagQueryStringValues(blockPrefix)
{var newQueryString=new StringBuilder();newQueryString.Append("&");var allInputs=document.getElementsByTagName("INPUT");for(var ii=0;ii<allInputs.length;++ii)
{var myId=allInputs[ii].id;if(allInputs[ii].type=="hidden"&&myId.indexOf(blockPrefix)==0)
newQueryString.Append(myId,"=",allInputs[ii].value,"&");else if(allInputs[ii].type=="text"&&myId.indexOf(blockPrefix)==0)
newQueryString.Append(myId,"=",allInputs[ii].value,"&");}
var retVal=newQueryString.ReturnAndEmpty();return retVal.substring(1,Math.max(0,retVal.length-1));}
function FilterBlocks_NonTagQueryStringDefaultValues(blockPrefix)
{var newQueryString=new StringBuilder();newQueryString.Append("&");var allInputs=document.getElementsByTagName("INPUT");for(var ii=0;ii<allInputs.length;++ii)
{var myId=allInputs[ii].id;if(allInputs[ii].type=="hidden"&&myId.indexOf(blockPrefix)==0)
newQueryString.Append(myId,"=",allInputs[ii].defaultValue,"&");else if(allInputs[ii].type=="text"&&myId.indexOf(blockPrefix)==0)
newQueryString.Append(myId,"=",allInputs[ii].defaultValue,"&");}
var retVal=newQueryString.ReturnAndEmpty();return retVal.substring(1,Math.max(0,retVal.length-1));}
function FilterBlocks_ExtractQSParams(blockID,useCurrent)
{var prefix=FilterBlocks_MakePrefix(blockID);if(useCurrent||FilterBlocks_IsAjax(prefix))
return FilterBlocks_NonTagQueryStringValues(prefix);else
return FilterBlocks_NonTagQueryStringDefaultValues(prefix);}
function FilterBlocks_IsAjax(prefix)
{var enabledCtl=document.getElementById(prefix+"ajaxEnabled");if(!enabledCtl)
return false;return enabledCtl.value=="1";}
function FilterBlocks_ExtractTagQueryString(blockID,useCurrent)
{var prefix=FilterBlocks_MakePrefix(blockID);if(useCurrent||FilterBlocks_IsAjax(prefix))
return FilterBlocks_FormatClassifications(prefix);else
return FilterBlocks_FormatDefaultClassifications(prefix);}
function FilterBlocks_BuildFullQueryString(submittingBlockID)
{var params=window.location.search;if(params.indexOf("?")==0)
params=params.substring(1,params.length);params=FilterBlocks_RemoveExistingFilterBlockParams(params,false);if(params.length>0)
params+="&";var tagValues=new StringBuilder();var qsParams=new StringBuilder();var isSegSearch=false;var allDivs=document.getElementsByTagName("DIV");for(var ii=0;ii<allDivs.length;++ii)
{if(!allDivs[ii].id)
continue;if(allDivs[ii].id.indexOf("FilterArea_F")!=0)
continue;var blockID=allDivs[ii].getAttribute("blockID");if(!blockID)
continue;if(allDivs[ii].getAttribute("blockPrefix")=="SegmentedSearch_")
{isSegSearch=1;params=SegmentedSearch_RemoveSegSearchParams(params);}
else if(allDivs[ii].getAttribute("blockPrefix")=="CalendarBlock_")
{params=CalendarBlock_RemoveExistingCalendarParams(params);calendarParams=Cal_PackageQueryStringData(blockID);if(calendarParams&&calendarParams.length)
qsParams.Append(calendarParams,"&");continue;}
var newTags=FilterBlocks_ExtractTagQueryString(blockID,blockID==submittingBlockID);var newQSArgs=FilterBlocks_ExtractQSParams(blockID,blockID==submittingBlockID);if(newTags.length>0)
tagValues.Append(newTags,"!");if(newQSArgs.length>0)
qsParams.Append(newQSArgs,"&");}
if(document.getElementById("FilterArea_F"+String(submittingBlockID)+"_")==null)
qsParams.Append(FilterBlocks_ExtractQSParams(submittingBlockID,true),"&");if(isSegSearch)
{var sort=SS_SortOps.GetValues(blockID);if(sort)
qsParams.Append("SS_Sort=",sort.sortKey,"&SS_SortDir=",sort.sortDir);qsParams.Append("&SS_MinMax=",SS_MinMax.Get(blockID));qsParams.Append("&SS_PageNum=",SS_PageNum.Get(blockID));qsParams.Append("&SS_MinDate=",SS_DateOps.GetMin(blockID),"&SS_MaxDate=",SS_DateOps.GetMax(blockID));qsParams.Append("&SS_Action=",String(SS_NavOps.SelectedAction(blockID)),"&SS_Position=",String(SS_NavOps.SelectedPosition(blockID)))
qsParams.Append("&SS_Keyword=",SS_Keyword.Get(blockID));}
params+="FB_Values="+tagValues.ReturnAndEmpty();if(!qsParams.IsEmpty())
params+="&"+qsParams.ReturnAndEmpty();return params;}
function FilterBlocks_Submit(submittingBlockID)
{location.search=FilterBlocks_BuildFullQueryString(submittingBlockID);}
function FilterBlocks_ResubmitCheckForChanges(blockID)
{var prefix=FilterBlocks_MakePrefix(blockID);var retVal=false;var pageNum=FilterBlocks_GetPageNumCtl(prefix);if(pageNum&&pageNum.value!=pageNum.defaultValue)
retVal|=true;var sortOrderCtl=FilterBlocks_GetSortOrderCtl(prefix);if(sortOrderCtl&&sortOrderCtl.value!=sortOrderCtl.defaultValue)
retVal|=true;var keywordFilterCtl=FilterBlocks_GetKeywordCtl(prefix);if(keywordFilterCtl&&keywordFilterCtl.value!=keywordFilterCtl.defaultValue)
retVal|=true;retVal|=FilterBlocks_HaveClassificationsChanged(prefix,blockID);return retVal;}
function FilterBlocks_UpdateFilterCounts(blockID,filterArray)
{var dataArray=TitanDisplayServiceWrapper.SaferEval(filterArray);if(!dataArray||dataArray.length==0)
return FilterBlocks_ResetFieldsetState(blockID);for(var ii=0;ii<dataArray.length;++ii)
{var ctl=document.getElementById(dataArray[ii].i+"_div");if(!ctl)
continue;if(dataArray[ii].v==0)
tic_Utilities.AddStyle(ctl,"zero");else
tic_Utilities.RemoveStyle(ctl,"zero");var spans=ctl.getElementsByTagName("SPAN");for(var jj=0;jj<spans.length;++jj)
if(tic_Utilities.HasStyle(spans[jj],"uses"))
{spans[jj].innerHTML="&#160;("+String(dataArray[ii].v)+")";spans[jj].setAttribute("uses",dataArray[ii].v);break;}}
FilterBlocks_ResetFieldsetState(blockID);}
function FilterBlocks_ResetFieldsetState(blockID)
{var blockPrefix=FilterBlocks_MakePrefix(blockID)+"C";var fieldsets=document.getElementsByTagName("FIELDSET");for(var ii=0;ii<fieldsets.length;++ii)
{if(fieldsets[ii].id.indexOf(blockPrefix)!=0)
continue;var nonZero=false,hasSelection=false;var allSpans=fieldsets[ii].getElementsByTagName("SPAN");for(var jj=0;jj<allSpans.length;++jj)
{if(!tic_Utilities.HasStyle(allSpans[jj],"uses"))
continue;if(allSpans[jj].getAttribute("uses")!="0")
nonZero=true;else
continue;var parent=allSpans[jj].parentNode;while(parent&&parent.tagName!="DIV")
parent=parent.parentNode;if(tic_Utilities.HasStyle(parent,"selected"))
hasSelection=true;if(nonZero&&hasSelection)
break;}
if(fieldsets[ii].getAttribute("runaway")=="1"&&hasSelection)
tic_Utilities.AddStyle(fieldsets[ii],"min");if(tic_Utilities.HasStyle(fieldsets[ii],"hideZero")&&!nonZero)
fieldsets[ii].style.display="none";else
{fieldsets[ii].style.display="block";FilterBlocks_RecalcSeeAllLess(blockID,fieldsets[ii].getAttribute("classID"));}}}
function PrintPage_PrintPage(printPageString)
{if(printPageString&&printPageString.length&&printPageString[printPageString.length-1]!="&")
printPageString+="&";var params=PrintPage_FormatParams();window.open(window.location.pathname+printPageString+params);}
function PrintPage_Email(subjectLine)
{var params=PrintPage_FormatParams();window.open("mailto:?subject="+encodeURIComponent(subjectLine)+"&body="+encodeURIComponent(window.location.protocol+"//"+window.location.host+window.location.pathname+"?"+params));}
function PrintPage_FormatParams()
{return FilterBlocks_BuildFullQueryString(-1);}
function FilterBlock_PageEvent(blockID,pageNum)
{FilterBlock_Submit(blockID,pageNum);}
function FilterBlock_Submit(blockID,pageNum)
{if(!pageNum)
pageNum=1;var prefix=FilterBlocks_MakePrefix(blockID);var pageNumCtl=FilterBlocks_GetPageNumCtl(prefix);if(pageNumCtl)
pageNumCtl.value=pageNum;return FilterBlocks_Submit(blockID);}
function FilterBlock_ResetClassificationLink(blockID,classID)
{FilterBlock_ResetClassificationCheckbox(blockID,classID);var prefix=FilterBlocks_MakePrefix(blockID);if(!FilterBlocks_IsAjax(prefix))
FilterBlock_Submit(blockID,1);}
function FilterBlock_ResetClassificationCheckbox(blockID,classID)
{FilterBlocks_ResetSelections(blockID,classID);FilterBlock_ClassificationCheck(blockID);var prefix=FilterBlocks_MakePrefix(blockID);if(!FilterBlocks_IsAjax(prefix))
FilterBlock_Submit(blockID,1);}
function FilterBlock_ClassificationSelectChange(blockID)
{FilterBlock_ClassificationCheck(blockID);}
function FilterBlock_ClassificationDynamicCheck(blockID,classID,ctl)
{FilterBlocks_ResetSelectClass(ctl,ctl.checked,blockID,classID);FilterBlock_ClassificationCheck(blockID);}
function FilterBlock_ClassificationLinkSelect(blockID,classID,container,evt)
{FilterBlocks_HandleCommonLinkSelect(blockID,classID,container,evt)
var prefix=FilterBlocks_MakePrefix(blockID);if(FilterBlocks_IsAjax(prefix))
FilterBlock_ClassificationCheck(blockID);else
FilterBlock_Submit(blockID,1);}
function FilterBlock_KeywordFilter(blockID)
{FilterBlock_ClassificationCheck(blockID);}
function FilterBlock_ReCheck(blockID,docID)
{var preifx=FilterBlocks_MakePrefix(blockID);var skipResubmit=(FilterBlock_GetResultsDiv(preifx)&&!FilterBlocks_ResubmitCheckForChanges(blockID))
if(skipResubmit)
return FilterBlock_AjaxComplete(blockID,null,null,null);else
return FilterBlock_ClassificationCheck(blockID);}
function FilterBlock_ClassificationCheck(blockID)
{var blockPrefix=FilterBlocks_MakePrefix(blockID);if(!FilterBlocks_IsAjax(blockPrefix))
return;var ajaxArgs=new Array();ajaxArgs[ajaxArgs.length]=document.getElementById(blockPrefix+"DocID").value;ajaxArgs[ajaxArgs.length]=blockID;if(FilterBlocks_GetKeywordCtl(blockPrefix))
ajaxArgs[ajaxArgs.length]=FilterBlocks_GetKeywordCtl(blockPrefix).value.replace(/&/g,"&amp;");else
ajaxArgs[ajaxArgs.length]="";ajaxArgs[ajaxArgs.length]=FilterBlocks_FormatClassifications(blockPrefix);document.getElementById(blockPrefix+"ResultsDiv").className+=" waiting";TitanDisplayServiceWrapper.MakeWebServiceCall("FilterBlock_"+blockID,NorthwoodsSoftwareDevelopment.Cms.WebServices.AggregationV2Ajax.GetResultsData,ajaxArgs,FilterBlock_AjaxComplete,[blockID],true);}
function FilterBlock_GetResultsDiv(prefix)
{return document.getElementById(prefix+"ResultsDiv");}
function FilterBlock_AjaxComplete(blockID,resultsAsJSON)
{var blockPrefix=FilterBlocks_MakePrefix(blockID);var resultsArea=FilterBlock_GetResultsDiv(blockPrefix);if(!resultsArea)
return;resultsArea.className="AggregationResults";if(resultsAsJSON&&resultsAsJSON.htmlData)
resultsArea.innerHTML=resultsAsJSON.htmlData;if(resultsAsJSON&&resultsAsJSON.filterUpdateArray)
FilterBlocks_UpdateFilterCounts(blockID,resultsAsJSON.filterUpdateArray);else
FilterBlocks_ResetFieldsetState(blockID);}
function ProductBlock_PageEvent(blockID,docID,newPageNum)
{var prefix=FilterBlocks_MakePrefix(blockID);FilterBlocks_GetPageNumCtl(prefix).value=String(newPageNum);ProductBlock_Submit(blockID,docID);}
function ProductBlock_ChangeSortOrder(blockID,docID,newSortOrder,evt)
{var target=tic_Utilities.GetTargetCtl(evt);if(!target)
return;while(target.tagName!="LI")
target=target.parentNode;if(!target)
return;if(tic_Utilities.HasStyle(target,"selected"))
return;var prefix=FilterBlocks_MakePrefix(blockID);var lis=document.getElementById(prefix+"SortList").getElementsByTagName("LI");for(var ii=0;ii<lis.length;++ii)
tic_Utilities.RemoveStyle(lis[ii],"selected");tic_Utilities.AddStyle(target,"selected");FilterBlocks_GetSortOrderCtl(prefix).value=target.getAttribute("sortValue");FilterBlocks_GetPageNumCtl(prefix).value="1";ProductBlock_Submit(blockID,docID);}
function ProductBlock_Submit(blockID,docID)
{var prefix=FilterBlocks_MakePrefix(blockID);var ajaxArgs=new Array();ajaxArgs[ajaxArgs.length]=docID;ajaxArgs[ajaxArgs.length]=blockID;var pageNumCtl=FilterBlocks_GetPageNumCtl(prefix);if(pageNumCtl&&pageNumCtl.value)
ajaxArgs[ajaxArgs.length]=pageNumCtl.value;else
ajaxArgs[ajaxArgs.length]="1";var sortOrderCtl=FilterBlocks_GetSortOrderCtl(prefix);if(sortOrderCtl)
ajaxArgs[ajaxArgs.length]=sortOrderCtl.value;else
ajaxArgs[ajaxArgs.length]="";var keywordFilterCtl=FilterBlocks_GetKeywordCtl(prefix);if(keywordFilterCtl)
ajaxArgs[ajaxArgs.length]=keywordFilterCtl.value.replace(/&/g,"&amp;");else
ajaxArgs[ajaxArgs.length]="";var folderIDCtl=FilterBlocks_GetFolderIDCtl(prefix);if(folderIDCtl&&folderIDCtl.value)
ajaxArgs[ajaxArgs.length]=folderIDCtl.value;else
ajaxArgs[ajaxArgs.length]="0";ajaxArgs[ajaxArgs.length]=FilterBlocks_FormatClassifications(prefix);document.getElementById("Product"+blockID+"_Waiting").className+=" waiting";document.getElementById("Product"+blockID+"_ResultsDiv").style.display="none";TitanDisplayServiceWrapper.MakeWebServiceCall("Product_Main"+blockID,NorthwoodsSoftwareDevelopment.Cms.WebServices.ProductAjax.GetResultsData,ajaxArgs,ProductBlock_AjaxComplete,[blockID],true);}
function ProductBlock_ResetClassificationLink(blockID,classID)
{ProductBlock_ResetClassificationCheckbox(blockID,classID);}
function ProductBlock_ResetClassificationCheckbox(blockID,classID)
{FilterBlocks_ResetSelections(blockID,classID);var docID=document.getElementById(FilterBlocks_MakePrefix(blockID)+"DocID").value;ProductBlock_Submit(blockID,docID);}
function ProductBlock_ClassificationCheck(blockID)
{var prefix=FilterBlocks_MakePrefix(blockID);var pageNumCtl=FilterBlocks_GetPageNumCtl(prefix);if(pageNumCtl&&pageNumCtl.value)
pageNumCtl.value=1;var docID=document.getElementById(prefix+"DocID").value;ProductBlock_Submit(blockID,docID);}
function ProductBlock_ClassificationLinkSelect(blockID,classID,container,evt)
{FilterBlocks_HandleCommonLinkSelect(blockID,classID,container,evt);ProductBlock_ClassificationCheck(blockID);}
function ProductBlock_ClassificationSelectChange(blockID)
{ProductBlock_ClassificationCheck(blockID);}
function ProductBlock_ClassificationDynamicCheck(blockID,classID,ctl)
{FilterBlocks_ResetSelectClass(ctl,ctl.checked,blockID,classID);ProductBlock_ClassificationCheck(blockID);}
function ProductBlock_KeywordFilter(blockID)
{ProductBlock_ClassificationCheck(blockID);}
function ProductBlock_ReCheck(blockID,docID)
{var skipResubmit=(ProductBlock_GetResultsDiv(blockID)&&!FilterBlocks_ResubmitCheckForChanges(blockID))
var prefix=FilterBlocks_MakePrefix(blockID);var sortCtl=FilterBlocks_GetSortOrderCtl(prefix);if(!sortCtl)
return;var selected=sortCtl.value;var lis=document.getElementById(prefix+"SortList").getElementsByTagName("LI");for(var ii=0;ii<lis.length;++ii)
if(lis[ii].getAttribute("sortValue")==selected)
tic_Utilities.AddStyle(lis[ii],"selected");else
tic_Utilities.RemoveStyle(lis[ii],"selected");if(skipResubmit)
return ProductBlock_AjaxComplete(blockID,null,null,null);else
return ProductBlock_Submit(blockID,docID);}
function ProductBlock_GetResultsDiv(blockID)
{return document.getElementById("Product"+blockID+"_ResultsDiv");}
function ProductBlock_AjaxComplete(blockID,responseAsJSON,responseAsXml,responseAsText)
{var resultsArea=ProductBlock_GetResultsDiv(blockID);if(!resultsArea)
return;if(responseAsJSON&&responseAsJSON.htmlData)
resultsArea.innerHTML=responseAsJSON.htmlData;if(responseAsJSON&&responseAsJSON.filterUpdateArray)
FilterBlocks_UpdateFilterCounts(blockID,responseAsJSON.filterUpdateArray);else
FilterBlocks_ResetFieldsetState(blockID);resultsArea.style.display="block";}
function ProductBlock_DetailThumbClick(detailCtlName,imgUrl,stdSize,zoomSize,isZoom)
{var detail=document.getElementById(detailCtlName+"Zoom");if(detail)
detail.src=imgUrl+"?"+zoomSize;if(isZoom)
return;detail=document.getElementById(detailCtlName);if(detail)
detail.src=imgUrl+"?"+stdSize;}
function ProductBlock_DetailImageClick(blockID,size)
{ProductBlock_PopUpResize(blockID);var popup=document.getElementById("productPopUp"+String(blockID));if(popup)
popup.style.display="block";return;}
function ProductBlock_PopUpResize(blockID)
{return;}
function ProductBlock_PopUpClose(blockID,stdSize,zoomSize,evt)
{tic_Utilities.CancelBubble(evt);document.getElementById("productPopUp"+String(blockID)).style.display="none";var stdDetail=document.getElementById("imgDetail_"+String(blockID));var zoomDetail=document.getElementById("imgDetail_"+String(blockID)+"Zoom");if(!stdDetail||!zoomDetail)
return;zoomDetail.src=stdDetail.src.replace(stdSize,zoomSize);}
function DisplaySideUpload_Expand(dataArea,link)
{if(document.getElementById(dataArea).style.display=="none")
{document.getElementById(dataArea).style.display="block";document.getElementById(link).innerHTML="Hide Upload Data";}
else
{document.getElementById(dataArea).style.display="none";document.getElementById(link).innerHTML="Upload File";}}
function DisplaySideUpload_Upload(btnCtl,baseID)
{if(document.getElementById(baseID+"_submitAction"))
document.getElementById(baseID+"_submitAction").value="1";document.getElementById(baseID+"_fileName").value=document.getElementById(baseID+"_fileUploader").value;btnCtl.disabled=true;window.setTimeout("document.forms[0].submit()",0);}
var TitanDisplayServiceWrapper={gCallbackQueue:new Array(),SaferEval:function(script)
{if(!script||script.indexOf("TITAN")!=0)
return"";if(script)
{try
{return eval(script.substring(5));}
catch(e)
{return window.alert("JSLoad: "+e.message);}}},EvalJavascript:function(script)
{if(script)
{try
{return eval(script);}
catch(e)
{return window.alert("JSLoad: "+e.message);}}},WebServiceCallComplete:function(results,context,methodName)
{var callInfo=null;if(TitanDisplayServiceWrapper.gCallbackQueue.length)
callInfo=TitanDisplayServiceWrapper.gCallbackQueue[0];if(callInfo&&!callInfo.discard)
{var matchesExist=false;for(var ii=1;ii<TitanDisplayServiceWrapper.gCallbackQueue.length;++ii)
if(TitanDisplayServiceWrapper.gCallbackQueue[ii].name==callInfo.name&&TitanDisplayServiceWrapper.gCallbackQueue[ii].canSkip)
{matchesExist=true;break;}
if(!matchesExist&&callInfo.postOp)
{var callInfoArgs=callInfo.postOpArgs;callInfoArgs[callInfoArgs.length]=results;callInfoArgs[callInfoArgs.length]=context;callInfoArgs[callInfoArgs.length]=methodName;callInfo.postOp.apply(window,callInfoArgs);}}
TitanDisplayServiceWrapper.gCallbackQueue.shift();document.body.style.cursor="default";if(TitanDisplayServiceWrapper.gCallbackQueue.length)
TitanDisplayServiceWrapper.ActualAsyncCall();},WebServiceErrorFunction:function(myArgs)
{window.alert("An error was encountered processing your request");},ClearWebServiceQueue:function(name)
{var newQueue=[];if(TitanDisplayServiceWrapper.gCallbackQueue.length>0)
{newQueue[0]=TitanDisplayServiceWrapper.gCallbackQueue[0];newQueue[0].discard=true;}
for(var ii=1;ii<TitanDisplayServiceWrapper.gCallbackQueue.length;++ii)
if(TitanDisplayServiceWrapper.gCallbackQueue[ii].name!=name)
newQueue.push(TitanDisplayServiceWrapper.gCallbackQueue[ii]);TitanDisplayServiceWrapper.gCallbackQueue=newQueue;},MakeWebServiceCall:function(name,webServiceFunction,arrayOfArgs,postOpFunction,postOpArguments,canSkip)
{arrayOfArgs[arrayOfArgs.length]=TitanDisplayServiceWrapper.WebServiceCallComplete;arrayOfArgs[arrayOfArgs.length]=TitanDisplayServiceWrapper.WebServiceErrorFunction;var newQueueItem={name:name,callName:webServiceFunction,args:arrayOfArgs,postOp:postOpFunction,postOpArgs:postOpArguments,canSkip:canSkip,discard:false};if(canSkip)
{for(var ii=1;ii<TitanDisplayServiceWrapper.gCallbackQueue.length;++ii)
if(TitanDisplayServiceWrapper.gCallbackQueue[ii].name==name&&TitanDisplayServiceWrapper.gCallbackQueue[ii].canSkip)
{TitanDisplayServiceWrapper.gCallbackQueue[ii]=newQueueItem;return;}}
TitanDisplayServiceWrapper.gCallbackQueue.push(newQueueItem);if(TitanDisplayServiceWrapper.gCallbackQueue.length==1)
TitanDisplayServiceWrapper.ActualAsyncCall();},ActualAsyncCall:function()
{if(TitanDisplayServiceWrapper.gCallbackQueue.length==0)
return;var callInfo=TitanDisplayServiceWrapper.gCallbackQueue[0];callInfo.callName.apply(window,callInfo.args);}};function Login_ToUSubmit(blockID)
{var touCheck=document.getElementById("agreeToToU"+blockID);if(!touCheck)
return;if(!touCheck.checked)
return document.getElementById("touError"+blockID).style.display="block";tic_Utilities.DisableButtons();document.forms[0].submit();}
function Login_ChangePassword(blockID)
{var userCtl=document.getElementById("username"+blockID);var oldPass=document.getElementById("oldpassword"+blockID);var passCtl1=document.getElementById("newpassword1"+blockID);var passCtl2=document.getElementById("newpassword2"+blockID);if(!(userCtl&&oldPass&&passCtl1&&passCtl2))
return;var user=tic_Utilities.Trim(userCtl.value);var old=tic_Utilities.Trim(oldPass.value);var new1=tic_Utilities.Trim(passCtl1.value);var new2=tic_Utilities.Trim(passCtl2.value);var badInfoCtl=document.getElementById("badInfo"+blockID);badInfoCtl.innerHTML=""
if(!(user&&old&&new1&&new2))
return badInfoCtl.innerHTML="All values must be provided";if(new1!=new2)
return badInfoCtl.innerHTML="New password values do not match";if(old==new2)
return badInfoCtl.innerHTML="New password cannot be the same as old password";tic_Utilities.DisableButtons();document.forms[0].submit();}
function Login_ForgotPassword1(blockID)
{var loginPrompt=document.getElementById("login_forgotName_"+blockID);if(!loginPrompt)
return;if(!tic_Utilities.Trim(loginPrompt.value))
return document.getElementById("forgot_ErrorDiv"+blockID).style.display="block";tic_Utilities.DisableButtons();document.forms[0].submit();}
function Login_ForgotPassword2(blockID)
{var regex=new RegExp("login_Response_\\d*_"+blockID);var allElements=document.forms[0].elements;for(var ii=0;ii<allElements.length;++ii)
{var ctl=allElements[ii];if(!ctl.id)
continue;if(regex.test(ctl.id)&&!tic_Utilities.Trim(ctl.value))
return document.getElementById("forgetError"+blockID).style.display="block";}
document.getElementById("login_forgetSubmitted_"+blockID).value="1";tic_Utilities.DisableButtons();document.forms[0].submit();}
function Registration_CreateAccount(blockID,loginIsEmail)
{if(Registration_ValidateForm(blockID,true,loginIsEmail))
{tic_Utilities.DisableButtons();document.forms[0].submit();}}
function Registration_ValidateForm(blockID,isCreate,loginIsEmail)
{var staticErrorDiv=document.getElementById("reg_StaticError"+blockID);if(staticErrorDiv)
staticErrorDiv.style.display="none";var errorDiv=document.getElementById("reg_errorDiv"+blockID);errorDiv.style.display="none";var allElts=document.forms[0].elements;var myCtlTest=new RegExp("^reg_.*"+String(blockID)+"$");var errorLis="";for(var ii=0;ii<allElts.length;++ii)
{var ctl=allElts[ii];if(!myCtlTest.test(ctl.id))
continue;var errorString="";if(ctl.getAttribute("required")=="1"&&!tic_Utilities.Trim(ctl.value))
errorString=ctl.getAttribute("requiredText");var extraValidation=ctl.getAttribute("validation");if(!errorString&&extraValidation)
{if(!window[extraValidation])
{window.alert("Missing validation function: "+extraValidation);continue;}
errorString=window[extraValidation](blockID,loginIsEmail,isCreate,ctl);}
if(errorString)
{tic_Utilities.AddStyle(ctl.parentNode,"error");errorLis+="<li>"+errorString+"</li>"}
else
tic_Utilities.RemoveStyle(ctl.parentNode,"error");}
if(errorLis)
{document.getElementById("reg_errorUL"+blockID).innerHTML=errorLis;errorDiv.style.display="block";document.body.scrollIntoView(true);return false;}
document.getElementById("reg_FormSubmit"+blockID).value="1";return true;}
function Registration_TermsChecked(blockID,loginIsEmail,isCreate,ctl)
{return(ctl.checked?"":"You must acknowledge the Terms of Use");}
function Registration_PasswordValidate(blockID,loginIsEmail,isCreate,ctl)
{if(isCreate&&!tic_Utilities.Trim(ctl.value))
return"Please provide a password";if(tic_Utilities.Trim(ctl.value)&&tic_Utilities.Trim(ctl.value)!=tic_Utilities.Trim(document.getElementById("reg_Password2"+blockID).value))
return"Password fields do not match";var oldPasswordCtl=document.getElementById("reg_OldPassword"+blockID);if(oldPasswordCtl&&tic_Utilities.Trim(ctl.value)&&!tic_Utilities.Trim(oldPasswordCtl.value))
return"Current password must be provided to change your password";if(oldPasswordCtl&&tic_Utilities.Trim(oldPasswordCtl.value)&&tic_Utilities.Trim(ctl.value)==tic_Utilities.Trim(oldPasswordCtl.value))
return"New password cannot match old password";if(ctl.value.indexOf("<")>=0||ctl.value.indexOf(">")>=0)
return"New password cannot contain angle brackets (i.e., <, >)";return"";}
function Registration_GetLabelText(ctl)
{var labels=ctl.parentNode.getElementsByTagName("LABEL");if(!labels||labels.length==0)
return"";var label=labels[0].innerHTML;if(label.indexOf('<')>=0)
return label.substring(0,label.indexOf('<'));if(label.indexOf(':')>=0)
return label.substring(0,label.indexOf(':'));return label;}
function Registration_IsEmail(blockID,loginIsEmail,isCreate,ctl)
{if(!tic_Utilities.Trim(ctl.value))
return"";if(!SFEditFieldIsEmail(ctl))
return"Invalid email format for "+Registration_GetLabelText(ctl);return"";}
function Registration_LoginIsEmail(blockID,loginIsEmail,isCreate,ctl)
{if(!isCreate||!tic_Utilities.Trim(ctl.value)||!loginIsEmail)
return"";if(!SFEditFieldIsEmail(ctl))
return"Your login name must be a valid email address";return"";}
function Registration_LoginMatches(blockID,loginIsEmail,isCreate,ctl)
{if(!isCreate||!tic_Utilities.Trim(ctl.value))
return"";if(tic_Utilities.Trim(ctl.value)&&tic_Utilities.Trim(ctl.value)!=tic_Utilities.Trim(document.getElementById("reg_UserCN"+blockID).value))
return(loginIsEmail?"Email":"Login")+" values do not match";return"";}
function Registration_IsPhone(blockID,loginIsEmail,isCreate,ctl)
{if(!tic_Utilities.Trim(ctl.value))
return"";var countryCtl=document.getElementById("reg_Country"+blockID);var nonUSValue=(countryCtl&&tic_Utilities.Trim(countryCtl.value)&&tic_Utilities.Trim(countryCtl.value)!="United States");if(!SFEditFieldIsPhone(ctl,nonUSValue))
return"Invalid phone number format for "+Registration_GetLabelText(ctl);return"";}
function Registration_HintQuestion(blockID,loginIsEmail,isCreate,ctl)
{var ctlID=ctl.id;var ctlID=ctlID.substring(0,ctlID.length-String(blockID).length);var counter=ctlID.substring(ctlID.lastIndexOf("_")+1);var answer1=tic_Utilities.Trim(document.getElementById("reg_HintResponse_"+counter+blockID).value);var answer2=tic_Utilities.Trim(document.getElementById("reg_HintResponse2_"+counter+blockID).value);var questionChanged=(tic_Utilities.Trim(ctl.defaultValue)!=tic_Utilities.Trim(ctl.value));if(!answer1&&!answer2&&!isCreate&&!questionChanged)
return"";if((!answer1||!answer2)&&(questionChanged&&!isCreate))
return"You have changed "+Registration_GetLabelText(ctl)+'. Please provide new responses';if(!answer1)
return"Please provide "+Registration_GetLabelText(document.getElementById("reg_HintResponse_"+counter+blockID));if(!answer2)
return"Please provide "+Registration_GetLabelText(document.getElementById("reg_HintResponse2_"+counter+blockID));if(answer1!=answer2)
return"Password hint responses for "+Registration_GetLabelText(ctl)+" do not match.";return"";}
function Registration_SaveChanges(blockID)
{if(Registration_ValidateForm(blockID,false,false))
{tic_Utilities.DisableButtons();document.forms[0].submit();}}
function NavInjectionHref(href,evt)
{tic_Utilities.CancelBubble(evt);location.href=href;return false;}
function GoBack(evt)
{tic_Utilities.CancelBubble(evt);history.back();return false;}
function RouterValidation()
{if(window.ValidatorOnSubmit)
return ValidatorOnSubmit();return true;}
function MoveViewState()
{if(document.forms.length==0)
return;if(window["SetupCaptchaInfo"])
SetupCaptchaInfo();var topLevelViewStateVars=document.forms[0]["__VIEWSTATE"];if(topLevelViewStateVars==null)
return;if(topLevelViewStateVars.length)
{for(var ii=1;ii<topLevelViewStateVars.length;++ii)
topLevelViewStateVars[ii].name="EmbeddedControlViewState";}
var target=location.pathname+location.search;target=target.replace("?","\\?");var myPattern=new RegExp(target,"gi");var viewStateData=document.getElementsByName("__VIEWSTATE")[0].value;for(var ii=0;ii<document.forms.length;++ii)
{var aForm=document.forms[ii];if(aForm.action.match(myPattern)!=null&&aForm.__VIEWSTATE!=null)
aForm.__VIEWSTATE.value=viewStateData;}}
var g_playerCtls=[];function TitanLoad()
{if(window["MoveViewState"])
MoveViewState();var flowSettings=document.getElementById("flowPlayerSettings");if(!flowSettings)
return;var allDivs=document.body.getElementsByTagName("DIV");for(var ii=0;ii<allDivs.length;++ii)
if(allDivs[ii].className=="titanFlowHolder")
g_playerCtls[g_playerCtls.length]=allDivs[ii];if(g_playerCtls.length==0)
return;var baseDir=flowSettings.getAttribute("baseDir");var js=flowSettings.getAttribute("js");if(!baseDir||!js)
return;tic_Utilities.LoadScriptFile(baseDir+js);window.setTimeout(TitanFlowPlayer,100);}
function TitanFlowPlayer()
{if(g_playerCtls.length==0)
return;if(!window["flowplayer"])
return window.setTimeout(TitanFlowPlayer,100);var flowSettings=document.getElementById("flowPlayerSettings");var baseDir=flowSettings.getAttribute("baseDir");var swf=baseDir+flowSettings.getAttribute("swf");var keyArray=[];var keyCtl=document.getElementById("flowPlayerKeys");if(keyCtl)
{var keys=keyCtl.value.split(' ');for(var jj=0;jj<keys.length;++jj)
{var key=tic_Utilities.Trim(keys[jj]);if(key.length)
keyArray[keyArray.length]=key;}}
for(var ii=0;ii<g_playerCtls.length;++ii)
{var settings={wmode:'opaque',clip:{},plugins:{controls:{}}};if(keyArray.length)
settings.key=keyArray;settings.clip.url=g_playerCtls[ii].getAttribute("filename");settings.clip.scaling=g_playerCtls[ii].getAttribute("scaling");settings.clip.autoPlay=(g_playerCtls[ii].getAttribute("autoplay")=="1");settings.clip.autoBuffering=(g_playerCtls[ii].getAttribute("autobuffering")=="1");var fadeIn=g_playerCtls[ii].getAttribute("fadin");var fadeOut=g_playerCtls[ii].getAttribute("fadeout");settings.clip.fadeInSpeed=((fadeIn=='slow')?2000:((fadeIn=='medium')?1000:500));settings.clip.fadeOutSpeed=((fadeOut=='slow')?2000:((fadeOut=='medium')?1000:500));settings.plugins.controls.stop=(g_playerCtls[ii].getAttribute("stopbutton")=="1");settings.plugins.controls.scrubber=(g_playerCtls[ii].getAttribute("progressbar")=="1");settings.plugins.controls.fullscreen=(g_playerCtls[ii].getAttribute("fullscreen")=="1");var template=g_playerCtls[ii].getAttribute("templates");if(flowSettings.getAttribute(template))
settings.plugins.controls.url=baseDir+flowSettings.getAttribute(template);if(settings.clip.autoPlay)
g_playerCtls[ii].innerHTML="";else if(g_playerCtls[ii].getAttribute("staticimage"))
settings.clip.autoPlay=true;else
g_playerCtls[ii].innerHTML="";flowplayer(g_playerCtls[ii],swf,settings);}}
function SS_BlocketteUniqueID(docID,blockID,position,isNav)
{return(isNav?"blocketteNav":"blockette")+String(docID)+"_"+String(position)+"_"+String(blockID);}
function SS_GetDocIDFromBlockID(blockID)
{var root=FilterBlocks_GetFilterDocumentRoot(FilterBlocks_MakePrefix(blockID));if(!root)
return-1;return root.getAttribute("DocID");}
var SS_SortOps={Reset:function(blockID,isLoading,sortOptions)
{var toolsDiv=document.getElementById("SSTools"+String(blockID));var sortDiv=document.getElementById("SSSortDiv"+String(blockID));var sortCtl=document.getElementById("SSSort"+String(blockID));if(!toolsDiv||!sortDiv||!sortCtl)
return;if(isLoading)
{SS_MinMax.Set(blockID,'max')
toolsDiv.style.display="none";return;}
toolsDiv.style.display="block";var optPairs=[];if(sortOptions)
optPairs=TitanDisplayServiceWrapper.SaferEval(sortOptions);sortDiv.style.display=(optPairs.length)?"block":"none";sortCtl.style.display=(optPairs.length)?"block":"none";if(!optPairs.length)
return;sortCtl.options.length=0;for(var ii=0;ii<optPairs.length;++ii)
{var newOpt=new Option(optPairs[ii].text,optPairs[ii].value);if(optPairs[ii].selected=="1")
newOpt.selected=1;newOpt.setAttribute("dir",optPairs[ii].dir);sortCtl.options[sortCtl.options.length]=newOpt;}},GetValues:function(blockID)
{var toolsDiv=document.getElementById("SSTools"+String(blockID));var sortDiv=document.getElementById("SSSortDiv"+String(blockID));var sortCtl=document.getElementById("SSSort"+String(blockID));if(!toolsDiv||!sortDiv||!sortCtl)
return null;if(toolsDiv.style.display=="none"||sortDiv.style.display=="none"||sortCtl.style.display=="none")
return null;var selectedIdx=sortCtl.selectedIndex;if(selectedIdx<0)
return null;var opt=sortCtl.options[selectedIdx];if(!opt)
return null;return{sortKey:opt.value,sortDir:opt.getAttribute("dir")};}};var SS_ResultsOps={Divs:function(blockID)
{var allDivs=[];var containerDiv=document.getElementById("SegmentedSearchBody_"+String(blockID));if(!containerDiv)
return allDivs;var childNodes=containerDiv.childNodes;for(var ii=0;ii<childNodes.length;++ii)
{var div=childNodes[ii];if(div.id&&div.getAttribute("docID"))
allDivs[allDivs.length]=div;}
return allDivs;},Get:function(docID,blockID,position)
{return document.getElementById(SS_BlocketteUniqueID(docID,blockID,position,false));},Hide:function(docID,blockID,position)
{var div=SS_ResultsOps.Get(docID,blockID,position);if(div)
div.style.display="none";},NoResultsView:function(blockID,isNothing)
{var emptyDiv=document.getElementById("noResultsFound"+String(blockID));if(!emptyDiv)
return;emptyDiv.style.display=isNothing?"block":"none";},OneResultsView:function(docID,blockID,position)
{var keeperDivID=SS_BlocketteUniqueID(docID,blockID,position,false);var keeperNavID=SS_BlocketteUniqueID(docID,blockID,position,true);var allDivs=SS_ResultsOps.Divs(blockID);for(var ii=0;ii<allDivs.length;++ii)
if(allDivs[ii].id&&allDivs[ii].id!=keeperDivID)
allDivs[ii].style.display="none";SS_NavOps.ClearCounts(blockID);}};var SS_NavOps={_NavRoots:function(blockID)
{var allRoots=[];var container=document.getElementById("SegmentedSearchNav_"+String(blockID));if(!container)
return allRoots;var childNodes=container.childNodes;for(var ii=0;ii<childNodes.length;++ii)
{var li=childNodes[ii];if(li.onclick&&li.id&&li.id.indexOf("blocketteNav")==0)
allRoots[allRoots.length]=li;}
return allRoots;},SelectedAction:function(blockID)
{var navRoots=SS_NavOps._NavRoots(blockID);for(var ii=0;ii<navRoots.length;++ii)
if(tic_Utilities.HasStyle(navRoots[ii],"selected"))
return tic_Utilities.HasStyle(navRoots[ii],"everything")?"Everything":"TopLevel";return"Everything";},SelectedPosition:function(blockID)
{var navRoots=SS_NavOps._NavRoots(blockID);for(var ii=0;ii<navRoots.length;++ii)
if(tic_Utilities.HasStyle(navRoots[ii],"selected"))
return ii;return 0;},_ClearCount:function(item)
{if(!item||item.id.indexOf("blocketteNav")!=0)
return;var allSpans=item.getElementsByTagName("SPAN");if(allSpans.length>1)
allSpans[1].innerHTML="";},_SetCount:function(item,count)
{if(!item||item.id.indexOf("blocketteNav")!=0)
return;var allSpans=item.getElementsByTagName("SPAN");if(allSpans.length>1)
allSpans[1].innerHTML=" ("+count+")";},ClearCounts:function(blockID)
{var allNavRoots=SS_NavOps._NavRoots(blockID);for(var ii=0;ii<allNavRoots.length;++ii)
SS_NavOps._ClearCount(allNavRoots[ii]);},UpdateCounts:function(docID,blockID,position,count)
{if(count==0)
SS_ResultsOps.Hide(docID,blockID,position);var myID=SS_BlocketteUniqueID(docID,blockID,position,true);var allRoots=SS_NavOps._NavRoots(blockID);var pending=false;var totalCount=0;for(var ii=0;ii<allRoots.length;++ii)
{if(tic_Utilities.HasStyle(allRoots[ii],"everything"))
{totalCount=Number(allRoots[ii].getAttribute("total"))+count;allRoots[ii].setAttribute("total",totalCount);}
else if(allRoots[ii].id==myID)
{SS_NavOps._SetCount(allRoots[ii],count);allRoots[ii].setAttribute("pending","0");}
else
pending|=(allRoots[ii].getAttribute("pending")=="1");}
return pending||totalCount;},EverythingIsSelected:function(blockID)
{var allRoots=SS_NavOps._NavRoots(blockID);if(allRoots.length>0&&tic_Utilities.HasStyle(allRoots[0],"everything"))
return tic_Utilities.HasStyle(allRoots[0],"selected");return false;},ResetTopLevel:function(blockID,newSelectedID,isEverything,hideSubNav)
{var prevSelectedID=null;var allRoots=SS_NavOps._NavRoots(blockID);for(var ii=0;ii<allRoots.length;++ii)
{if(tic_Utilities.HasStyle(allRoots[ii],"everything"))
allRoots[ii].setAttribute("total",0);else if(isEverything||allRoots[ii].id==newSelectedID)
allRoots[ii].setAttribute("pending","1");if(tic_Utilities.HasStyle(allRoots[ii],"selected"))
prevSelectedID==allRoots[ii].id;if(allRoots[ii].id==newSelectedID)
tic_Utilities.AddStyle(allRoots[ii],"selected");else
tic_Utilities.RemoveStyle(allRoots[ii],"selected");SS_NavOps._ClearCount(allRoots[ii]);}
if(hideSubNav)
SS_NavOps.HideSubNav(blockID);},HideSubNav:function(blockID)
{var nav=FilterBlocks_GetFilterDocumentRoot(FilterBlocks_MakePrefix(blockID));if(nav)
nav.style.display="none";},SetSubNav:function(blockID,data)
{var nav=FilterBlocks_GetFilterDocumentRoot(FilterBlocks_MakePrefix(blockID));if(!nav||!data)
return;nav.innerHTML=data;FilterBlocks_UpdateFilterCounts(blockID,null);tic_Utilities.RemoveStyle(nav,"loading");nav.style.display="block";}};var SS_Keyword={ReloadGet:function(blockID,reloadValue)
{if(!document.getElementById("Keyword"+blockID))
return reloadValue;return document.getElementById("Keyword"+blockID).value;},Get:function(blockID)
{if(!document.getElementById("Keyword"+blockID))
return"";if(document.getElementById("KeywordSubmit"+blockID))
return document.getElementById("Keyword"+blockID).defaultValue;return document.getElementById("Keyword"+blockID).value;},Set:function(blockID,newValue)
{if(!document.getElementById("Keyword"+blockID))
return;document.getElementById("Keyword"+blockID).value=newValue;document.getElementById("Keyword"+blockID).defaultValue=newValue;}};var SS_DateOps={_ExtractValue:function(blockID,whichOne,defaultValue)
{var root=SS_DateOps._GetRoot(blockID)
if(!root)
return defaultValue;if(root.tagName=="SELECT")
{var idx=root.selectedIndex;if(idx==-1||!root.options||root.options.length<idx)
return defaultValue;return root.options[idx].getAttribute(whichOne);}
else if(root.tagName=="DIV")
{var allRanges=root.getElementsByTagName("SPAN");for(var ii=0;ii<allRanges.length;++ii)
if(!tic_Utilities.HasStyle(allRanges[ii],"item"))
continue;else if(tic_Utilities.HasStyle(allRanges[ii].parentNode,"selected"))
return allRanges[ii].getAttribute(whichOne);return defaultValue;}},_GetLinks:function(root,blockID)
{return root.getElementsByTagName("SPAN");},_GetRoot:function(blockID)
{return document.getElementById("SSDateRange_"+String(blockID));},VerifySelection:function(blockID,evt)
{var root=SS_DateOps._GetRoot(blockID);if(!root)
return;if(root.tagName=="SELECT")
return;if(root.tagName!="DIV")
return;var span=tic_Utilities.GetTargetCtl(evt);if(!span)
return;var allRanges=SS_DateOps._GetLinks(root,blockID);for(var ii=0;ii<allRanges.length;++ii)
{if(!tic_Utilities.HasStyle(allRanges[ii],"item"))
continue;if(allRanges[ii]==span)
tic_Utilities.AddStyle(allRanges[ii].parentNode,"selected");else
tic_Utilities.RemoveStyle(allRanges[ii].parentNode,"selected");}},GetMin:function(blockID,position)
{return SS_DateOps._ExtractValue(blockID,"minValue",-9999);},GetMax:function(blockID,position)
{return SS_DateOps._ExtractValue(blockID,"maxValue",36500);}}
var SS_PageNum={Reset:function(blockID)
{SS_PageNum.Set(blockID,"1");},Get:function(blockID)
{var ctl=document.getElementById("PageNum"+blockID);if(!ctl||!ctl.value)
return 1;return ctl.value;},Set:function(blockID,pageNum)
{var ctl=document.getElementById("PageNum"+blockID);if(!ctl)
return;ctl.value=pageNum;}};var SS_MinMax={Set:function(blockID,direction)
{var ctl=document.getElementById("SegmentedSearchBody_"+blockID);if(direction=="min")
tic_Utilities.AddStyle(ctl,"min");else
tic_Utilities.RemoveStyle(ctl,"min");},Get:function(blockID)
{var ctl=document.getElementById("SegmentedSearchBody_"+blockID);if(!ctl)
return"max";return tic_Utilities.HasStyle(ctl,"min")?"min":"max";}};function SegmentedSearch_PageEvent(docID,blockID,newPageNum)
{SS_PageNum.Set(blockID,newPageNum);SegmentedSearch_AjaxSubmit(docID,blockID);}
function SegmentedSearch_ForceKeywordChange(docID,blockID,newKeyword)
{SS_Keyword.Set(blockID,newKeyword);SegmentedSearch_Resubmit(docID,blockID);}
function SegmentedSearch_KeywordSubmit(docID,blockID)
{SS_Keyword.Set(blockID,document.getElementById("Keyword"+blockID).value);SegmentedSearch_Resubmit(docID,blockID);}
function SegmentedSearch_MinMax(blockID,direction)
{return SS_MinMax.Set(blockID,direction);}
function SegmentedSearch_SortChanged(docID,blockID)
{return SegmentedSearch_PageEvent(docID,blockID,"1");}
function SegmentedSearch_RemoveSegSearchParams(params)
{if(!params)
return"";var retVal="&";var paramArray=params.split("&");for(var ii=0;ii<paramArray.length;++ii)
if(paramArray[ii].indexOf("SS_")==0);else if(paramArray[ii].length)
retVal+=paramArray[ii]+"&";return retVal.substring(1);}
function SegmentedSearch_Resubmit(docID,blockID)
{var params=window.location.search;if(params.indexOf("?")==0)
params=params.substring(1,params.length);params=FilterBlocks_RemoveExistingFilterBlockParams(params,true);params=SegmentedSearch_RemoveSegSearchParams(params);if(params.length&&params[params.length-1]!='&')
params+="&";window.location=window.location.pathname+"?"+params+"Search_Keywords="+encodeURIComponent(SS_Keyword.Get(blockID));}
function SegmentedSearch_DateRangeChanged(docID,blockID,position,evt)
{SS_DateOps.VerifySelection(blockID,evt);SS_PageNum.Set(blockID,"1");SegmentedSearch_AjaxSubmit(docID,blockID);}
function SegmentedSearch_AjaxSubmit(docID,blockID)
{SegmentedSearch_NavClick(docID,blockID,SS_NavOps.SelectedPosition(blockID),SS_NavOps.SelectedAction(blockID)+"Ajax",null);}
function SegmentedSearch_NavClick(docID,blockID,position,action,evt)
{tic_Utilities.CancelBubble(evt);if(action=="Everything"||action=="EverythingAjax")
{TitanDisplayServiceWrapper.ClearWebServiceQueue(SS_BlocketteUniqueID(docID,blockID,1,false));SS_NavOps.ResetTopLevel(blockID,SS_BlocketteUniqueID(docID,blockID,position,true),true,action=="Everything");var allDivs=SS_ResultsOps.Divs(blockID);for(var ii=0;ii<allDivs.length;++ii)
SegmentedSearch_MakeWebCall(action,allDivs[ii].getAttribute("docID"),allDivs[ii].getAttribute("blockID"),allDivs[ii].getAttribute("position"));}
else if(action=="TopLevel")
{TitanDisplayServiceWrapper.ClearWebServiceQueue(SS_BlocketteUniqueID(docID,blockID,1,false));SS_PageNum.Reset(blockID);SS_NavOps.ResetTopLevel(blockID,SS_BlocketteUniqueID(docID,blockID,position,true),false,true);SS_ResultsOps.OneResultsView(docID,blockID,position);SegmentedSearch_MakeWebCall(action,docID,blockID,position);}
else if(action=="TopLevelAjax")
{SS_NavOps.ResetTopLevel(blockID,SS_BlocketteUniqueID(docID,blockID,position,true),false,true);SS_ResultsOps.OneResultsView(docID,blockID,position);SegmentedSearch_MakeWebCall(action,docID,blockID,position);}}
function SegmentedSearch_AjaxComplete(action,docID,blockID,position,resultsAsJSON)
{var div=SS_ResultsOps.Get(docID,blockID,position);if(div)
{tic_Utilities.RemoveStyle(div,"loading");div.style.display="block";div.innerHTML=resultsAsJSON.htmlData;}
if(!SS_NavOps.UpdateCounts(docID,blockID,position,resultsAsJSON.totalCount))
SS_ResultsOps.NoResultsView(blockID,true);SS_SortOps.Reset(blockID,SegmentedSearch_IsEverythingAction(action),resultsAsJSON.sortOptions);if(action!="Loading"&&action!="EverythingAjax")
SS_NavOps.SetSubNav(blockID,resultsAsJSON.updatedFilters);FilterBlocks_ResetFieldsetState(blockID);}
function SegmentedSearch_Recheck(blockID,docID)
{SegmentedSearch_AjaxSubmit(docID,blockID);}
function SegmentedSearch_IsEverythingAction(action)
{return action=="Loading"||action=="Everything"||action=="EverythingAjax";}
function SegmentedSearch_MakeWebCall(action,docID,blockID,position)
{var div=SS_ResultsOps.Get(docID,blockID,position);if(!div)
return;var sortOpts=(action=="TopLevel")?null:SS_SortOps.GetValues(blockID);var ajaxArgs=new Array();ajaxArgs[ajaxArgs.length]=action;ajaxArgs[ajaxArgs.length]=docID;ajaxArgs[ajaxArgs.length]=blockID;ajaxArgs[ajaxArgs.length]=position;ajaxArgs[ajaxArgs.length]=SS_PageNum.Get(blockID);ajaxArgs[ajaxArgs.length]=(sortOpts?sortOpts.sortKey:"");ajaxArgs[ajaxArgs.length]=(sortOpts?sortOpts.sortDir:"");ajaxArgs[ajaxArgs.length]=SS_Keyword.Get(blockID);ajaxArgs[ajaxArgs.length]=SegmentedSearch_FormatClassifications(action,FilterBlocks_MakePrefix(blockID));ajaxArgs[ajaxArgs.length]=SS_DateOps.GetMin(blockID);ajaxArgs[ajaxArgs.length]=SS_DateOps.GetMax(blockID);return SegmentedSearch_CommonWebCall(docID,blockID,ajaxArgs);}
function SegmentedSearch_CommonWebCall(docID,blockID,args)
{var div=SS_ResultsOps.Get(docID,blockID,args[3]);if(!div)
return;SS_ResultsOps.NoResultsView(blockID,false);tic_Utilities.AddStyle(div,"loading");div.style.display="block";var showArea=document.getElementById("searchResults"+String(blockID));if(showArea.innerHTML!=args[7])
showArea.innerHTML=args[7];TitanDisplayServiceWrapper.MakeWebServiceCall(SS_BlocketteUniqueID(docID,blockID,1,false),NorthwoodsSoftwareDevelopment.Cms.WebServices.BlocketteAjax.GetResultsData,args,SegmentedSearch_AjaxComplete,[args[0],docID,blockID,args[3]],!SegmentedSearch_IsEverythingAction(args[0]));}
function SegmentedSearch_FormatClassifications(action,prefix)
{if(action!="TopLevelAjax"||!FilterBlocks_HasClassifications(prefix))
return"NONE";return FilterBlocks_FormatClassifications(prefix);}
function CloneArray(sourceArray)
{var newArray=[];for(var ii=0;ii<sourceArray.length;++ii)
newArray[newArray.length]=sourceArray[ii];return newArray;}
function SegmentedSearch_ReloadPage(blockID,docID,args)
{if(args[3]!=0)
return SegmentedSearch_CommonWebCall(docID,blockID,args);var allDivs=SS_ResultsOps.Divs(blockID);for(var ii=0;ii<allDivs.length;++ii)
{var cloned=CloneArray(args);cloned[3]=allDivs[ii].getAttribute("position");cloned[7]=SS_Keyword.ReloadGet(blockID,cloned[7]);SegmentedSearch_CommonWebCall(docID,blockID,cloned);}}
function SegmentedSearch_ClassificationSelectChange(blockID)
{return SegmentedSearch_ClassificationCheck(blockID);}
function SegmentedSearch_ClassificationLinkSelect(blockID,classID,container,evt)
{FilterBlocks_HandleCommonLinkSelect(blockID,classID,container,evt);return SegmentedSearch_ClassificationCheck(blockID);}
function SegmentedSearch_ClassificationCheck(blockID)
{SS_PageNum.Reset(blockID);SegmentedSearch_AjaxSubmit(SS_GetDocIDFromBlockID(blockID),blockID);}
function SegmentedSearch_ClassificationDynamicCheck(blockID,classID,ctl)
{FilterBlocks_ResetSelectClass(ctl,ctl.checked,blockID,classID);SegmentedSearch_ClassificationCheck(blockID);}
function SegmentedSearch_ResetClassificationLink(blockID,classID)
{return SegmentedSearch_ResetClassificationCheckbox(blockID,classID);}
function SegmentedSearch_ResetClassificationCheckbox(blockID,classID)
{FilterBlocks_ResetSelections(blockID,classID);SegmentedSearch_ClassificationCheck(blockID);}/* CalendarDisplay.js */
function CalendarBlock_ReCheck(blockID)
{var filterPrefix=FilterBlocks_MakePrefix(blockID);var calID=CalendarBlock_MakeCalID(blockID);var cal=document.getElementById(calID);if(!cal)
return FilterBlocks_ResetFieldsetState(blockID);var hasChanges=FilterBlocks_ResubmitCheckForChanges(blockID);hasChanges|=(document.getElementById(calID+"_DateRange").value!=cal.getAttribute("dateRange"));hasChanges|=(document.getElementById(calID+"_SelectedDate").value!=cal.getAttribute("selectedDate"));hasChanges|=(document.getElementById(calID+"_CurrentMonth").value!=cal.getAttribute("currentMonth"));Cal_UpdateRangeDisplay(calID,document.getElementById(calID+"_DateRange").value);cal.setAttribute("dateRange",document.getElementById(calID+"_DateRange").value);cal.setAttribute("selectedDate",document.getElementById(calID+"_SelectedDate").value);cal.setAttribute("currentMonth",document.getElementById(calID+"_CurrentMonth").value);if(hasChanges)
Cal_ResetCalendar(cal,new Date(document.getElementById(calID+"_CurrentMonth").value));else
FilterBlocks_ResetFieldsetState(blockID);}
function CalendarBlock_MakeCalID(blockID)
{return"cal"+String(blockID);}
function CalendarBlock_BlockIDFromCalID(calID)
{if(calID.length<3)
return-1;return parseInt(calID.substring(3));}
function CalendarBlock_KeywordFilter(blockID)
{Cal_ReloadAjaxData(CalendarBlock_MakeCalID(blockID));}
function CalendarBlock_ClassificationSelectChange(blockID)
{Cal_ReloadAjaxData(CalendarBlock_MakeCalID(blockID));}
function CalendarBlock_ResetClassificationLink(blockID,classID)
{return CalendarBlock_ResetClassificationCheckbox(blockID,classID);}
function CalendarBlock_ResetClassificationCheckbox(blockID,classID)
{FilterBlocks_ResetSelections(blockID,classID);Cal_ReloadAjaxData(CalendarBlock_MakeCalID(blockID));}
function CalendarBlock_ClassificationLinkSelect(blockID,classID,container,evt)
{FilterBlocks_HandleCommonLinkSelect(blockID,classID,container,evt)
Cal_ReloadAjaxData(CalendarBlock_MakeCalID(blockID));}
function CalendarBlock_ClassificationCheck(blockID)
{Cal_ReloadAjaxData(CalendarBlock_MakeCalID(blockID));}
function CalendarBlock_ClassificationDynamicCheck(blockID,classID,ctl)
{FilterBlocks_ResetSelectClass(ctl,ctl.checked,blockID,classID);Cal_ReloadAjaxData(CalendarBlock_MakeCalID(blockID));}
function Cal_ResetHiddenState(calTable)
{var calID=calTable.id;if(!document.getElementById(calID+"_DateRange"))
return;document.getElementById(calID+"_DateRange").value=calTable.getAttribute("dateRange");document.getElementById(calID+"_SelectedDate").value=calTable.getAttribute("selectedDate");document.getElementById(calID+"_CurrentMonth").value=calTable.getAttribute("currentMonth");}
function Cal_PackageQueryStringData(blockID)
{var calID="cal"+String(blockID);var calTable=document.getElementById(calID);var prefix=FilterBlocks_MakePrefix(blockID);var params="&DateRange="+calTable.getAttribute("dateRange");var selectedDate=new Date(calTable.getAttribute("selectedDate"));params+="&Date="+String(selectedDate.getMonth()+1)+"/"+String(selectedDate.getDate())+"/"+String(selectedDate.getFullYear());if(FilterBlocks_GetKeywordCtl(prefix))
params+="&Keyword="+FilterBlocks_GetKeywordCtl(prefix).value.replace(/&/g,"&amp;");params+="&Classifications="+Cal_FormatClassifications(blockID);if(document.getElementById("Calendar"+blockID+"_EventID"))
params+=(params.length?"&EventID=":"EventID=")+document.getElementById("Calendar"+blockID+"_EventID").value;return params;}
function CalendarBlock_RemoveExistingCalendarParams(params)
{if(!params)
return"";var retVal="";var paramArray=params.split("&");for(var ii=0;ii<paramArray.length;ii++)
if(paramArray[ii].indexOf("DateRange")==0||paramArray[ii].indexOf("Date")==0||paramArray[ii].indexOf("Keyword")==0||paramArray[ii].indexOf("Classifications")==0||paramArray[ii].indexOf("EventID")==0);else
retVal+=(retVal.length?"&":"")+paramArray[ii];return retVal;}
function Cal_TableClick(ctl,evt)
{var targetCell=tic_Utilities.GetTargetCtl(evt);if(tic_Utilities.HasStyle(targetCell,"otherMonth")||targetCell.tagName!="TD"||targetCell.parentNode.tagName!="TR"||targetCell.parentNode.parentNode.tagName!="TBODY")
return;var selectedDate=new Date(ctl.getAttribute("currentMonth"));selectedDate.setDate(selectedDate.getDate()+Number(targetCell.innerHTML)-1);ctl.setAttribute("selectedDate",selectedDate);if(tic_Utilities.HasStyle(targetCell,"selected"))
return Cal_SwitchRange(ctl.id,"day");Cal_ResetSelection(ctl);}
function Cal_ResetSelection(calTable)
{var firstDay=-1,lastDay=-1,selectedDay=-1;var currentMonth=new Date(calTable.getAttribute("currentMonth"));var selectedDate=new Date(calTable.getAttribute("selectedDate"));if(currentMonth.getMonth()==selectedDate.getMonth()&&currentMonth.getFullYear()==selectedDate.getFullYear())
{selectedDay=selectedDate.getDate();switch(calTable.getAttribute("dateRange"))
{default:case"day":firstDay=lastDay=selectedDay;break;case"month":case"year":firstDay=1;lastDay=31;break;case"week":firstDay=selectedDay-selectedDate.getDay();lastDay=selectedDay+6-selectedDate.getDay();break;}}
var dateRows=Cal_GetDateRows(calTable);var searchRow=0,searchCol=0;for(searchCol=0;searchCol<7;++searchCol)
if(!tic_Utilities.HasStyle(dateRows[searchRow][searchCol],"otherMonth"))
break;for(var rows=searchRow;rows<6;++rows)
for(var cols=(rows?0:searchCol);cols<7;++cols)
{var cell=dateRows[rows][cols];if(tic_Utilities.HasStyle(cell,"otherMonth")&&calTable.getAttribute("dateRange")!="year")
break;if(tic_Utilities.HasStyle(cell,"otherMonth")&&calTable.getAttribute("dateRange")=="year")
{tic_Utilities.AddStyle(cell,"selected");continue;}
var cellDate=Number(cell.innerHTML);if(cellDate>=firstDay&&cellDate<=lastDay)
tic_Utilities.AddStyle(cell,"selected");else
tic_Utilities.RemoveStyle(cell,"selected");if(cellDate==selectedDay)
tic_Utilities.AddStyle(cell,"selectedDate");else
tic_Utilities.RemoveStyle(cell,"selectedDate");}
Cal_ResetHiddenState(calTable);Cal_ReloadAjaxData(calTable.id);}
function Cal_GetRangeDiv(calID)
{var container=document.getElementById(calID+"_calendarNav");if(!container)
return null;if(tic_Utilities.HasStyle(container,'calendarNav'))
return container;return null;}
function Cal_UpdateRangeDisplay(calID,range)
{var container=Cal_GetRangeDiv(calID);if(!container)
return;var anchors=container.getElementsByTagName("SPAN");for(var ii=0;ii<anchors.length;ii++)
if(anchors[ii].getAttribute("dateRange")==range)
anchors[ii].className="selected";else
anchors[ii].className="";}
function Cal_SwitchRange(calID,range)
{if(!Cal_GetRangeDiv(calID))
return;var calTable=document.getElementById(calID);var currRange=calTable.getAttribute("dateRange");if(currRange==range)
return;Cal_UpdateRangeDisplay(calID,range);calTable.setAttribute("dateRange",range);if(currRange=="year")
{var calDate=new Date(calTable.getAttribute("currentMonth"));Cal_ResetCalendar(calTable,calDate);}
else
Cal_ResetSelection(calTable);}
function Cal_InitCalendar(calID)
{var calTable=document.getElementById(calID);var today=new Date(),firstOfMonth=new Date();firstOfMonth.setDate(1);var lastOfMonth=Cal_FindLastOfMonth(new Date());Cal_ResetCalendar(calTable,firstOfMonth);}
function Cal_FindLastOfMonth(dayInMonth)
{var maxDaysToEnd=31-dayInMonth.getDate();var lastOfMonth=new Date();lastOfMonth.setDate(dayInMonth.getDate()+maxDaysToEnd);while(lastOfMonth.getDate()<10)
lastOfMonth.setDate(lastOfMonth.getDate()-1);return lastOfMonth;}
function Cal_ResetCalendar(calTable,firstOfMonth)
{var becauseMacsDontPlayFair=["January","February","March","April","May","June","July","August","September","October","November","December"];Cal_GetHeaderCell(calTable).innerHTML=becauseMacsDontPlayFair[firstOfMonth.getMonth()]+" "+firstOfMonth.getFullYear();var dateRows=Cal_GetDateRows(calTable);var dateToFill=new Date(firstOfMonth.toString());dateToFill.setDate(firstOfMonth.getDate()-(firstOfMonth.getDay()==0?7:firstOfMonth.getDay()));for(var rows=0;rows<6;++rows)
for(var cols=0;cols<7;++cols,dateToFill.setDate(dateToFill.getDate()+1))
{var cell=dateRows[rows][cols];cell.innerHTML=dateToFill.getDate();cell.className=(dateToFill.getMonth()!=firstOfMonth.getMonth())?"otherMonth":"";}
calTable.setAttribute("currentMonth",firstOfMonth.toString());Cal_ResetSelection(calTable);}
function Cal_SelectDates(calID,arrOfDates)
{var calTable=document.getElementById(calID);if(!calTable)
return;var dateIndex=0;var dateRows=Cal_GetDateRows(calTable);var dateToFill=new Date(calTable.getAttribute("currentMonth"));var currentMonth=dateToFill.getMonth();dateToFill.setDate(dateToFill.getDate()-(dateToFill.getDay()==0?7:dateToFill.getDay()));for(dateIndex=0;dateIndex<arrOfDates.length;++dateIndex)
if(arrOfDates[dateIndex].getTime()>=dateToFill.getTime())
break;for(var rows=0;rows<6;++rows)
for(var cols=0;cols<7;++cols,dateToFill.setDate(dateToFill.getDate()+1))
{var cell=dateRows[rows][cols];cell.innerHTML=dateToFill.getDate();if(dateIndex<arrOfDates.length&&arrOfDates[dateIndex].getTime()==dateToFill.getTime())
{tic_Utilities.AddStyle(cell,"hasEvent");dateIndex++;}
else
tic_Utilities.RemoveStyle(cell,"hasEvent");}}
function Cal_JumpSelection(selectedDate,newFirstOfMonth)
{var newDate=new Date(newFirstOfMonth);newDate.setDate(selectedDate.getDate());while(newDate.getMonth()!=newFirstOfMonth.getMonth())
newDate.setDate(newDate.getDate()-1);return newDate;}
function Cal_NextMonth(calID,evt)
{var calTable=document.getElementById(calID);if(!calTable)
return;var calDate=new Date(calTable.getAttribute("currentMonth"));calDate.setMonth(calDate.getMonth()+1);var selectedDate=new Date(calTable.getAttribute("selectedDate"));calTable.setAttribute("selectedDate",Cal_JumpSelection(selectedDate,calDate).toString());Cal_ResetCalendar(calTable,calDate);tic_Utilities.CancelBubble(evt);}
function Cal_PrevMonth(calID,evt)
{var calTable=document.getElementById(calID);if(!calTable)
return;var calDate=new Date(calTable.getAttribute("currentMonth"));calDate.setMonth(calDate.getMonth()-1);var selectedDate=new Date(calTable.getAttribute("selectedDate"));calTable.setAttribute("selectedDate",Cal_JumpSelection(selectedDate,calDate).toString());Cal_ResetCalendar(calTable,calDate);tic_Utilities.CancelBubble(evt);}
function Cal_GetDateRows(calTable)
{var allRows=calTable.getElementsByTagName("TR");var retArray=new Array(6);for(var ii=0;ii<6;++ii)
retArray[ii]=allRows[ii+2].getElementsByTagName("TD");return retArray;}
function Cal_GetHeaderCell(calTable)
{return document.getElementById('calTitle'+calTable.getAttribute("blockId"));}
function Cal_PrevRange(calID)
{var calTable=document.getElementById(calID);if(!calTable)
return;var selectedDate=new Date(calTable.getAttribute("selectedDate"));switch(calTable.getAttribute("dateRange"))
{default:case'day':selectedDate.setDate(selectedDate.getDate()-1);break;case'week':selectedDate.setDate(selectedDate.getDate()-7);break;case'month':case'year':return Cal_PrevMonth(calID);break;}
var firstOfMonth=new Date(selectedDate.toString());firstOfMonth.setDate(1);calTable.setAttribute("selectedDate",selectedDate);Cal_ResetCalendar(calTable,firstOfMonth);}
function Cal_NextRange(calID)
{var calTable=document.getElementById(calID);if(!calTable)
return;var selectedDate=new Date(calTable.getAttribute("selectedDate"));switch(calTable.getAttribute("dateRange"))
{default:case'day':selectedDate.setDate(selectedDate.getDate()+1);break;case'week':selectedDate.setDate(selectedDate.getDate()+7);break;case'month':case'year':return Cal_NextMonth(calID);break;}
var firstOfMonth=new Date(selectedDate.toString());firstOfMonth.setDate(1);calTable.setAttribute("selectedDate",selectedDate);Cal_ResetCalendar(calTable,firstOfMonth);}
function Cal_Return(calID)
{Cal_ReloadAjaxData(calID);}
function Cal_FormatClassifications(blockID)
{var blockPrefix=FilterBlocks_MakePrefix(blockID);return FilterBlocks_FormatClassifications(blockPrefix);}
function Cal_ReloadAjaxData(calID)
{if(!NorthwoodsSoftwareDevelopment||!NorthwoodsSoftwareDevelopment.Cms||!NorthwoodsSoftwareDevelopment.Cms.WebServices||!NorthwoodsSoftwareDevelopment.Cms.WebServices.CalendarAjax||!NorthwoodsSoftwareDevelopment.Cms.WebServices.CalendarAjax.GetResultsData)
return;var calTable=document.getElementById(calID);if(calTable&&calTable.id=="DP_PopupCalendar")
return;var blockID=CalendarBlock_BlockIDFromCalID(calID);var prefix=FilterBlocks_MakePrefix(blockID);var selectedDate=(calTable?(new Date(calTable.getAttribute("selectedDate"))):(new Date()));var ajaxArgs=new Array();ajaxArgs[ajaxArgs.length]=calTable.getAttribute("docID");ajaxArgs[ajaxArgs.length]=blockID;ajaxArgs[ajaxArgs.length]=String(selectedDate.getMonth()+1)+"/"+String(selectedDate.getDate())+"/"+String(selectedDate.getFullYear());ajaxArgs[ajaxArgs.length]=calTable?calTable.getAttribute("dateRange"):"nocal";if(FilterBlocks_GetKeywordCtl(prefix))
ajaxArgs[ajaxArgs.length]=FilterBlocks_GetKeywordCtl(prefix).value.replace(/&/g,"&amp;");else
ajaxArgs[ajaxArgs.length]="";ajaxArgs[ajaxArgs.length]=Cal_FormatClassifications(blockID);document.getElementById("CalendarResults_"+blockID).className+=" waiting";TitanDisplayServiceWrapper.MakeWebServiceCall("Calendar_Main"+blockID,NorthwoodsSoftwareDevelopment.Cms.WebServices.CalendarAjax.GetResultsData,ajaxArgs,Cal_AjaxComplete,[blockID,calID],true);}
function Cal_ViewCalItem(calID,itemNumber)
{var calTable=document.getElementById(calID);var blockID=calTable.getAttribute("blockID");var ajaxArgs=new Array();ajaxArgs[ajaxArgs.length]=calTable.getAttribute("docID");ajaxArgs[ajaxArgs.length]=blockID;ajaxArgs[ajaxArgs.length]=itemNumber;document.getElementById("CalendarResults_"+blockID).className+=" waiting";TitanDisplayServiceWrapper.MakeWebServiceCall("Calendar_Main"+blockID,NorthwoodsSoftwareDevelopment.Cms.WebServices.CalendarAjax.GetEventItem,ajaxArgs,Cal_AjaxComplete,[blockID,calID],true);}
function Cal_AjaxComplete(blockID,calID,responseAsJSON,responseAsXml,responseAsText)
{var resultsArea=document.getElementById("CalendarResults_"+blockID);if(!resultsArea)
    return window.alert("Lost results"); var filterArea = document.getElementById("CalendarFilter_" + blockID);
var filterContent = filterArea.innerHTML;
var newDiv = document.createElement("div");
newDiv.innerHTML = responseAsJSON.htmlData;
var resultsContainerDiv = resultsArea.parentNode;
var filterContainerDiv = filterArea.parentNode;
resultsContainerDiv.innerHTML = "";
filterContainerDiv.innerHTML = "";
filterArea.innerHTML = filterContent;
filterContainerDiv.appendChild(filterArea);
for (var i = 0; i < newDiv.childNodes.length; i++) {
    if (newDiv.childNodes[i].id == "PagingMenu_" + blockID)
        resultsContainerDiv.insertBefore(newDiv.childNodes[i].cloneNode(true), resultsContainerDiv.firstChild);
    else
        resultsContainerDiv.appendChild(newDiv.childNodes[i].cloneNode(true));
}
if (responseAsJSON.javascript)
    Cal_SelectDates(calID, TitanDisplayServiceWrapper.EvalJavascript(responseAsJSON.javascript));
if (responseAsJSON && responseAsJSON.filterUpdateArray)
    FilterBlocks_UpdateFilterCounts(blockID, responseAsJSON.filterUpdateArray);
else
    FilterBlocks_ResetFieldsetState(blockID);
}
function getMonthName(month) {
    switch (++month) {
        case 1:
            return 'January';
            break;
        case 2:
            return 'February';
            break;
        case 3:
            return 'March';
            break;
        case 4:
            return 'April';
            break;
        case 5:
            return 'May';
            break;
        case 6:
            return 'June';
            break;
        case 7:
            return 'July';
            break;
        case 8:
            return 'August';
            break;
        case 9:
            return 'September';
            break;
        case 10:
            return 'October';
            break;
        case 11:
            return 'November';
            break;
        case 12:
            return 'December';
            break;
    }
}
function GetCursorPosition(evt)
{evt=evt||window.event;var cursor={x:0,y:0};if(evt.pageX||evt.pageY)
{cursor.x=evt.pageX;cursor.y=evt.pageY;}
else
{cursor.x=evt.clientX+
(document.documentElement.scrollLeft||document.body.scrollLeft)-
document.documentElement.clientLeft;cursor.y=evt.clientY+
(document.documentElement.scrollTop||document.body.scrollTop)-
document.documentElement.clientTop;}
return cursor;}
function DP_ShowPopup(evt,parent,xOff,yOff)
{var popup=document.getElementById("DP_PopupCalendarContainer");var pos=GetCursorPosition(evt);popup.style.position="absolute";popup.style.left=pos.x+xOff+"px";popup.style.top=pos.y+yOff+"px";popup.style.display="block";}
function DP_HidePopup(evt)
{document.getElementById("DP_PopupCalendarContainer").style.display="none";tic_Utilities.CancelBubble(evt);}
function DP_MouseOut(evt)
{var target=tic_Utilities.GetTargetCtl(evt);if(target.id!="DP_PopupCalendarContainer"&&!tic_Utilities.HasStyle(target,"calendarIcon"))
return;}
function DP_EnableCalendar(inputName,spanCtl,xOff,yOff,evt)
{tic_Utilities.CancelBubble(evt);var calTable=document.getElementById('DP_PopupCalendar');if(calTable.getAttribute("doInit")=="1")
Cal_InitCalendar('DP_PopupCalendar');calTable.setAttribute("openFor",inputName);var date=new Date();var ctl=document.getElementById(inputName);if(SFEditFieldIsDate(inputName))
date=SFEditParseDate(inputName);calTable.setAttribute("selectedDate",date);var setDate=new Date(date);setDate.setDate(1);Cal_ResetCalendar(calTable,setDate);DP_ShowPopup(evt,spanCtl,xOff,yOff);}
function DP_TableClick(ctl,evt)
{var calTable=document.getElementById("DP_PopupCalendar");if(!calTable)
return;var inputCtl=document.getElementById(calTable.getAttribute("openFor"));if(!inputCtl)
return;var target=tic_Utilities.GetTargetCtl(evt);if(target.tagName=="TD"&&(target.className==""||tic_Utilities.HasStyle(target,"selectedDate")))
{var selectedDate=new Date(ctl.getAttribute("currentMonth"));selectedDate.setDate(selectedDate.getDate()+Number(target.innerHTML)-1);inputCtl.value=String(selectedDate.getMonth()+1)+"/"+selectedDate.getDate()+"/"+selectedDate.getFullYear();inputCtl.focus();inputCtl.blur();DP_HidePopup(evt);}
tic_Utilities.CancelBubble(evt);}/* Utilities.js */
var tic_Utilities={LoadScriptFile:function(fileName)
{var fileNameLower=fileName.toLowerCase();var head=document.getElementsByTagName("head")[0]
var allScripts=head.getElementsByTagName("script");for(var ii=0;ii<allScripts.length;++ii)
if(allScripts[ii].src&&allScripts[ii].src.toLowerCase()==fileNameLower)
return;var newElt=document.createElement("script");newElt.src=fileName;newElt.type="text/javascript";head.appendChild(newElt);},ResetStyles:function(element)
{element.style.cssText='margin:0;padding:0;border:0;background-color:transparent;background-image:none;';},AddEventListener:function(sourceObject,eventName,listener)
{if(!sourceObject)
return;if(tic_Utilities.IsIE())
sourceObject.attachEvent('on'+eventName,listener);else
sourceObject.addEventListener(eventName,listener,false);},RemoveEventListener:function(sourceObject,eventName,listener)
{if(!sourceObject)
return;if(tic_Utilities.IsIE())
sourceObject.detachEvent('on'+eventName,listener);else
sourceObject.removeEventListener(eventName,listener,false);},IsFirefox:function()
{var htmlTags=document.getElementsByTagName("HTML");if(htmlTags&&htmlTags.length>0)
return tic_Utilities.HasStyle(htmlTags[0],"Firefox");return false;},IsIE:function()
{var htmlTags=document.getElementsByTagName("HTML");if(htmlTags&&htmlTags.length>0)
return tic_Utilities.HasStyle(htmlTags[0],"IE");return false;},GetTargetCtl:function(evt)
{if(!evt)
evt=window.event;if(evt.originalTarget)
return evt.originalTarget;else if(evt.srcElement)
return evt.srcElement;return null;},GetQueryStringArg:function()
{var hashValue=null;if(location.hash)
hashValue=location.hash;else if(location.search)
hashValue=location.search;return hashValue;},IsFirefox:function()
{var htmlTags=document.getElementsByTagName("HTML");if(htmlTags&&htmlTags.length>0)
return tic_Utilities.HasStyle(htmlTags[0],"Firefox");},DisableButtons:function()
{var buttons=document.getElementsByTagName("INPUT");for(var ii=0;ii<buttons.length;++ii)
if(buttons[ii].type=="button"||buttons[ii].type=="submit")
buttons[ii].disabled=true;},StyleArray:function(ctl)
{if(!ctl||!ctl.className)
return new Array();return ctl.className.split(" ");},HasStyle:function(ctl,style)
{var styles=tic_Utilities.StyleArray(ctl);if(!styles||!styles.length)
return false;for(var ii=0;ii<styles.length;++ii)
if(styles[ii]==style)
return true;return false;},RemoveStyle:function(ctl,style)
{var styles=tic_Utilities.StyleArray(ctl);if(!styles||!styles.length)
return false;var newStyle="";var retVal=false;for(var ii=0;ii<styles.length;++ii)
{if(styles[ii]==style)
retVal=true;else
newStyle+=((newStyle?" ":"")+styles[ii]);}
if(retVal)
ctl.className=newStyle;return retVal;},AddStyle:function(ctl,style)
{if(!ctl)
return;if(tic_Utilities.HasStyle(ctl,style))
return;if(!ctl.className)
ctl.className=style;else
ctl.className+=" "+style;},CancelBubble:function(evt)
{if(!evt)
evt=window.event;if(!evt)
return;evt.cancelBubble=true;evt.returnValue=false;if(evt.stopPropagation)
evt.stopPropagation();if(evt.preventDefault)
evt.preventDefault();return false;},LeftTrim:function(strVal)
{return strVal?strVal.replace(/^\s+/,''):"";},RightTrim:function(strVal)
{return strVal?strVal.replace(/\s+$/,''):"";},Trim:function(strVal)
{return strVal?strVal.replace(/^\s+|\s+$/g,''):"";},PackageXml:function(tagName,data,includeCData)
{var retVal=tic_Utilities.MakeXmlStartTag(tagName,includeCData);retVal+=data;retVal+=tic_Utilities.MakeXmlEndTag(tagName,includeCData);return retVal;},XmlWithAttributes:function(tagName)
{var retVal="<"+tagName;for(var ii=1;ii<arguments.length;ii+=2)
retVal+=" "+arguments[ii]+"='"+EscapeSingleQuotes(arguments[ii+1])+"'";return retVal+"/>";},MakeXmlStartTag:function(tagName,includeCData)
{if(!tagName||tagName.length==0)
return"";return"<"+tagName+">"+(includeCData?"<![CDATA[":"");},MakeXmlEndTag:function(tagName,includeCData)
{if(!tagName||tagName.length==0)
return''
return(includeCData?"]]>":"")+"</"+tagName+">";},ShowHideById:function(ctlID,doShow)
{var ctl=document.getElementById(ctlID);if(ctl)
ctl.style.display=(doShow?"block":"none");},ToggleShowHide:function(ctlID)
{var ctl=document.getElementById(ctlID);if(ctl)
ctl.style.display=(ctl.style.display=="none"?"block":"none");},ForceVisible:function(id)
{var item=document.getElementById(id);if(!item)
return;item.style.display="block";item.style.visibility="visible";}};function StringBuilder()
{this.strings=new Array("");for(var ii=0;ii<arguments.length;++ii)
if(arguments[ii])
this.strings.push(arguments[ii]);}
StringBuilder.prototype.Append=function()
{for(var ii=0;ii<arguments.length;++ii)
if(arguments[ii])
this.strings.push(arguments[ii]);}
StringBuilder.prototype.ReturnAndEmpty=function()
{var retString=this.strings.join("");this.strings=null;return retString;}
StringBuilder.prototype.IsEmpty=function()
{return this.strings.length==1;}
var tic_Positioning={GetViewPaneSize:function(win)
{if(tic_Utilities.IsIE())
{var oSizeSource;var oDoc=win.document.documentElement;if(oDoc&&oDoc.clientWidth)
oSizeSource=oDoc;else
oSizeSource=win.document.body;if(oSizeSource)
return{Width:oSizeSource.clientWidth,Height:oSizeSource.clientHeight};else
return{Width:0,Height:0};}
else
return{Width:win.innerWidth,Height:win.innerHeight};},GetScrollPosition:function(relativeWindow)
{if(tic_Utilities.IsIE())
{var oDoc=relativeWindow.document;var oPos={X:oDoc.documentElement.scrollLeft,Y:oDoc.documentElement.scrollTop};if(oPos.X>0||oPos.Y>0)
return oPos;return{X:oDoc.body.scrollLeft,Y:oDoc.body.scrollTop};}
else
return{X:relativeWindow.pageXOffset,Y:relativeWindow.pageYOffset};},GetElementDocument:function(element)
{return element.ownerDocument||element.document;},GetElementWindow:function(element)
{return tic_Positioning.GetDocumentWindow(tic_Positioning.GetElementDocument(element));},GetDocumentWindow:function(document)
{return document.parentWindow||document.defaultView;},GetDocumentPosition:function(w,node)
{var x=0;var y=0;var curNode=node;var prevNode=null;var curWindow=tic_Positioning.GetElementWindow(curNode);if(tic_Utilities.IsFirefox())
{var obj=tic_Positioning.GetElementPositionForFirefox(node,w);return{"x":obj.X,"y":obj.Y};}
while(curNode&&!(curWindow==w&&(curNode==w.document.body||curNode==w.document.documentElement)))
{x+=curNode.offsetLeft-curNode.scrollLeft;y+=curNode.offsetTop-curNode.scrollTop;if(prevNode&&prevNode.tagName=="IFRAME"&&prevNode.id)
{var scrollNode=prevNode;while(scrollNode&&scrollNode!=curNode)
{x-=scrollNode.scrollLeft;y-=scrollNode.scrollTop;scrollNode=scrollNode.parentNode;}}
prevNode=curNode;if(curNode.offsetParent)
curNode=curNode.offsetParent;else
{if(curWindow!=w)
{curNode=curWindow.frameElement;prevNode=null;if(curNode)
curWindow=curNode.contentWindow.parent;}
else
curNode=null;}}
if(tic_Utilities.GetCurrentElementStyle(w.document.body,'position')!='static'||(tic_Utilities.IsIE()&&tic_Positioning.GetPositionedAncestor(node)==null))
{x+=w.document.body.offsetLeft;y+=w.document.body.offsetTop;}
return{"x":x,"y":y};},GetPositionedAncestor:function(element)
{var currentElement=element;while(currentElement!=tic_Positioning.GetElementDocument(currentElement).documentElement)
{if(tic_Utilities.GetCurrentElementStyle(currentElement,'position')!='static')
return currentElement;if(currentElement==tic_Positioning.GetElementDocument(currentElement).documentElement&&currentWindow!=w)
currentElement=currentWindow.frameElement;else
currentElement=currentElement.parentNode;}
return null;},GetElementPositionForFirefox:function(el,relativeWindow)
{var c={X:0,Y:0};var oWindow=relativeWindow||window;var oOwnerWindow=tic_Positioning.GetElementWindow(el);var previousElement=null;while(el)
{c.X+=el.offsetLeft-el.scrollLeft;c.Y+=el.offsetTop-el.scrollTop;if(previousElement&&previousElement.tagName=="IFRAME"&&previousElement.id)
{var scrollElement=previousElement;while(scrollElement&&scrollElement!=el)
{c.X-=scrollElement.scrollLeft;c.Y-=scrollElement.scrollTop;scrollElement=scrollElement.parentNode;}}
previousElement=el;if(el.offsetParent)
el=el.offsetParent;else
{if(oOwnerWindow!=oWindow)
{el=oOwnerWindow.frameElement;previousElement=null;if(el)
oOwnerWindow=tic_Positioning.GetElementWindow(el);}
else
{c.X+=el.scrollLeft;c.Y+=el.scrollTop;break;}}}
return c;}};
