
__dragAndDrop_version=1;document.onmousemove=mouseMove;document.onmouseup=mouseUp;var __dragAndDrop_dragObject=null;var __dragAndDrop_mouseOffset=0;var __dragAndDrop_marginOffset=0;function getMouseOffset(target,ev)
{ev=ev||window.event;var docPos=getPositionDragAndDrop(target);var mousePos=mouseCoords(ev);return{x:mousePos.x-docPos.x,y:mousePos.y-docPos.y};}
function getPositionDragAndDrop(e)
{var left=0,top=0;while(e.offsetParent)
{left+=e.offsetLeft;top+=e.offsetTop;e=e.offsetParent;}
left+=e.offsetLeft;top+=e.offsetTop;return{x:left,y:top};}
function mouseCoords(ev)
{if(ev.pageX||ev.pageY)
return{x:ev.pageX,y:ev.pageY};if(document.body==null)
return{x:ev.clientX,y:ev.clientY};return{x:ev.clientX+document.body.scrollLeft-document.body.clientLeft,y:ev.clientY+document.body.scrollTop-document.body.clientTop};}
function mouseMove(ev)
{ev=ev||window.event;var mousePos=mouseCoords(ev);if(__dragAndDrop_dragObject)
{__dragAndDrop_dragObject.style.position='absolute';__dragAndDrop_dragObject.style.top=mousePos.y-__dragAndDrop_mouseOffset.y;__dragAndDrop_dragObject.style.left=mousePos.x-__dragAndDrop_mouseOffset.x+__dragAndDrop_marginOffset;return false;}}
function mouseUp()
{__dragAndDrop_dragObject=null;}
function makeDraggable(item,offset)
{if(!item)return;if(offset)
__dragAndDrop_marginOffset=offset;else
__dragAndDrop_marginOffset=0;item.onmousedown=function(ev)
{__dragAndDrop_dragObject=this;__dragAndDrop_mouseOffset=getMouseOffset(this,ev);return false;}}

function NumericKeyDown(event,e)
{if(IsControlKey(event))
return;if(IsFuncKey(event))
return;if(IsNumbericKey(event))
return;event.returnValue=false;}

var __base_version=1,__show_errors=false;function IsControlKey(event)
{if(event.altKey==true)
return true;if(event.ctrlKey==true)
return true;return false;}
function IsTabKey(event)
{if(event.keyCode==9)
return true;return false;}
function IsShiftKey(event)
{if(event.keyCode==16)
return true;return false;}
function IsFuncKey(event)
{if(event.keyCode==8)
return true;if(event.keyCode==46)
return true;if(event.keyCode==9)
return true;if(event.keyCode==37)
return true;if(event.keyCode==39)
return true;if(event.keyCode==38)
return true;if(event.keyCode==40)
return true;if(event.keyCode==36)
return true;if(event.keyCode==35)
return true;if(event.keyCode==39)
return true;if(event.keyCode==39)
return true;return false;}
function IsUpArrowKey(event)
{if(event.keyCode==38)
return true;}
function IsDownArrowKey(event)
{if(event.keyCode==40)
return true;}
function IsLeftBracketKey(event)
{if((event.shiftKey==true)&&(event.keyCode==9))
return true;return false;}
function IsRightBracketKey(event)
{if((event.shiftKey==true)&&(event.keyCode==0))
return true;return false;}
function IsNumbericKey(event)
{if(event.shiftKey==true)
return false;if((event.keyCode>47)&&(event.keyCode<58))
return true;if((event.keyCode>95)&&(event.keyCode<106))
return true;return false;}
function EnableControlOnCheckBoxClick(checkBoxId,controlId,onclick)
{var eCheckBox=$get(checkBoxId);if(eCheckBox==null)
return;var eControl=$get(controlId);if(eControl==null)
return;eControl.disabled=eCheckBox.checked?false:true;eControl.className="button";if(eControl.onclick==null)
{eControl.onclick="$get('"+controlId+"').style.visibility='hidden'";if(eControl.addEventListener)
eControl.addEventListener('click',new Function(eControl.onclick),false);else if(eControl.attachEvent)
eControl.attachEvent('onclick',new Function(eControl.onclick));}}
function CopySelectedItemToTextArea(listId,txtId,option,maxLen,resetSelection)
{if(option<0)
return;if(option>5)
return;var eList=$get(listId);if(eList==null)
return;var eTextArea=$get(txtId);if(eTextArea==null)
return;var selectedText="";if(option<3)
selectedText=eList.options[eList.selectedIndex].value;else
selectedText=eList.options[eList.selectedIndex].text;if(selectedText.length==0||selectedText=="< N/A >"||selectedText=="< Select ... >"||selectedText=="< Blank >")
return;if((option==0||option==3)&&CheckMaxLengthAndShowMessage(selectedText,maxLen))
eTextArea.value=selectedText;else if(option==1||option==4)
{var newValue=selectedText;if(eTextArea.value.length>0)
newValue=newValue+"; "+eTextArea.value;if(CheckMaxLengthAndShowMessage(newValue,maxLen))
eTextArea.value=newValue;}
else if(option==2||option==5)
{var newValue=eTextArea.value;if(newValue.length>0)
newValue=newValue+"; ";newValue=newValue+selectedText;if(CheckMaxLengthAndShowMessage(newValue,maxLen))
eTextArea.value=newValue;}
if(resetSelection=="True")
eList.selectedIndex=0;}
function CheckMaxLengthAndShowMessage(text,maxLen)
{if(maxLen==0)
return true;if(text.length>=maxLen)
{msg='Cannot add data because the maximum number ';msg+='of allowable characters ('+maxLen+') ';msg+='will be exceeded.  Your data was not added.  Please check your data.';alert(msg);return false;}
return true;}
function CopySelectedItemToTextAreaWithoutSemicolon(listId,txtId,option,maxLen,resetSelection)
{if(option<0)
return;if(option>5)
return;var eList=$get(listId);if(eList==null)
return;var eTextArea=$get(txtId);if(eTextArea==null)
return;var selectedText="";if(option<3)
selectedText=eList.options[eList.selectedIndex].value;else
selectedText=eList.options[eList.selectedIndex].text;if(selectedText.length==0||selectedText=="< N/A >"||selectedText=="< Select ... >"||selectedText=="< Blank >")
return;if((option==0||option==3)&&CheckMaxLengthAndShowMessage(selectedText,maxLen))
eTextArea.value=selectedText;else if(option==1||option==4)
{var newValue=selectedText;if(eTextArea.value.length>0)
newValue=newValue+" "+eTextArea.value;if(CheckMaxLengthAndShowMessage(newValue,maxLen))
eTextArea.value=newValue;}
else if(option==2||option==5)
{var newValue=eTextArea.value;if(newValue.length>0)
newValue=newValue+" ";newValue=newValue+selectedText;if(CheckMaxLengthAndShowMessage(newValue,maxLen))
eTextArea.value=newValue;}
if(resetSelection=="True")
eList.selectedIndex=0;}
function getScreenCenterY()
{return getScrollOffset()+(getInnerHeight()/2);}
function getScreenCenterX()
{return(document.body.clientWidth/2);}
function getInnerHeight()
{var y;if(self.innerHeight)
y=self.innerHeight;else if(document.documentElement&&document.documentElement.clientHeight)
y=document.documentElement.clientHeight;else if(document.body)
y=document.body.clientHeight;return y;}
function getScrollOffset()
{var y;if(self.pageYOffset)
y=self.pageYOffset;else if(document.documentElement&&document.documentElement.scrollTop)
y=document.documentElement.scrollTop;else if(document.body)
y=document.body.scrollTop;return y;}
$getControl=function()
{var elements=new Array();for(var i=0;i<arguments.length;i++)
{var element=arguments[i];if(typeof(element)=='string')element=document.getElementById(element);if(arguments.length==1)return element;elements.push(element);}
return elements;}
document.FindElements=function(element,tag)
{var elementsFound=new Array();if(tag==undefined||tag==null)
tag='*';var elements=document.getElementsByTagName(tag);for(var i=0;i<elements.length;i++)
{if(elements[i].id.search(element)>-1)
elementsFound.push(elements[i]);}
return elementsFound;}
__getGUID=function()
{var hex=function(){return(((1+Math.random())*0x10000)|0).toString(16).substring(1)}
return(hex()+hex()+hex()+hex()+hex()+hex()+hex()+hex()).toUpperCase();}
__handle_error=function(err)
{if(__show_errors)throw err;return err.description;}
function StyleSheet(style_sheet)
{this.Sheet=(style_sheet==null)?null:this.Get(style_sheet);}
StyleSheet.prototype.Get=function(style_sheet)
{if(style_sheet==null)
{return document.styleSheets[0];}
else
{for(i=0;i<document.styleSheets.length;i++)
{if(document.styleSheets[i].href.search(style_sheet+'.css')>-1)
{return document.styleSheets[i];}}}}
StyleSheet.prototype.GetAttribute=function(className,attribute)
{if(this.Sheet==null)
return'';var sheet=this.Sheet;try
{for(i=0;i<sheet.rules.length;i++)
{if(sheet.rules[i].selectorText.toLowerCase().indexOf(className.toLowerCase())>-1)
return eval('sheet.rules[i].style.'+attribute);}}
catch(e){}
return'';}
__addEvent=function(control,js,event_name)
{if(typeof(control)=='string')control=$getControl(control);var change_handler=null;switch(event_name)
{case'onmouseover':if(__eventExists(control.onmouseover,js))
return;control.onmouseover=js;change_handler=new Function(control.onmouseover);break;case'onmouseout':if(__eventExists(control.onmouseout,js))
return;control.onmouseout=js;change_handler=new Function(control.onmouseout);break;case'onchange':if(__eventExists(control.onchange,js))
return;control.onchange=js;change_handler=new Function(control.onchange);break;case'onclick':if(__eventExists(control.onclick,js))
return;control.onclick=js;change_handler=new Function(control.onclick);break;}
if(control.addEventListener)
control.addEventListener(event_name.substr(2),change_handler,false);else if(control.attachEvent)
control.attachEvent(event_name,change_handler);}
__eventExists=function(currentEventValue,newEventValue)
{if(currentEventValue!=null&&currentEventValue.indexOf(newEventValue)>-1)
return true;return false;}
__removeEvent=function(control,js,event_name)
{if(control.detachEvent)
{control.detachEvent(event_name,new Function(js));eval('control.'+event_name+'=null;');}
else
control.removeEventListener(event_name.substr(2),js,false);}
__clearEvent=function(control,event_name)
{var fnc=eval('control.'+event_name);if(typeof(fnc)=='string')fnc=new Function(fnc);if(control.detachEvent)
{control.detachEvent(event_name,fnc);eval('control.'+event_name+'=null;');}
else
control.removeEventListener(event_name.substr(2),fnc,false);}
__replaceEvent=function(control,js,event_name)
{__clearEvent(control,event_name);__addEvent(control,js,event_name);}
function FormatControl(control,required)
{if(control!=null&&control!='undefined')
{control.innerHTML=control.innerHTML.replace("<FONT color=red>*</FONT> ","");control.innerHTML=control.innerHTML.replace("<FONT COLOR=RED>*</FONT> ","");if(required)
control.innerHTML="<FONT color=red>*</FONT> "+control.innerHTML;}}
function findPosX(obj)
{return getPosition(obj).x;}
function findPosY(obj)
{return getPosition(obj).y;}
function getPosition(element)
{var left=0;var top=0;if(element!=null)
{try
{while(element.offsetParent)
{left+=element.offsetLeft;if(element.offsetParent.scrollLeft){left-=element.offsetParent.scrollLeft;}
top+=element.offsetTop;if(element.offsetParent.scrollTop){top-=element.offsetParent.scrollTop;}
element=element.offsetParent;}}
catch(e)
{}
left+=element.offsetLeft+document.body.scrollLeft-document.body.clientLeft;top+=element.offsetTop+document.body.scrollTop-document.body.clientTop;}
return{x:left,y:top};}

function PhoneKeyDown(event,e)
{if(IsControlKey(event))
return;if(IsFuncKey(event))
return;if(IsLeftBracketKey(event))
return;if(IsRightBracketKey(event))
return;if(IsNumbericKey(event))
return;if(IsOtherValidPhoneKey(event))
return;event.returnValue=false;}
function PhoneKeyDownOption(event,e,dropDownID)
{var dropDown=$get(dropDownID);if(dropDown.value.toUpperCase()!="EMAIL")
PhoneKeyDown(event,e);}
function PhoneFocusOut(event,e,isFax)
{var s=e.value,phone="",temp="";for(i=0;i<s.length;i++)
{temp=s.substr(i,1);if(temp<"0")
continue;if(temp>"9")
continue;phone+=temp;}
if(phone.length==0)
return;if(isFax)
{if(phone.length!=10)
{alert("Please enter a 10 digit fax number");e.focus();return;}}
else if(phone.length<10)
{alert("Please enter a minimum of 10 digits for the phone number");e.focus();return;}
var newPhone="("+phone.substr(0,3)+") "+phone.substr(3,3)+" - "+phone.substr(6,4);if(phone.length>10)
newPhone=newPhone+" x"+phone.substr(10,phone.length-10);e.value=newPhone;}
function PhoneFocusOutOption(event,e,dropDownID)
{var dropDown=$get(dropDownID);if(dropDown.value.toUpperCase()!="EMAIL")
PhoneFocusOut(event,e,0);}
function IsOtherValidPhoneKey(event)
{if(event.keyCode==189)
return true;if(event.keyCode==88)
return true;return false;}

function ZipcodeFocusOut(event,e)
{var zip=e.value;if(zip==null||zip=="")
return;if(zip.match(/^\d{5}(-\d{4})?$/))
{e.value=zip;return;}
zip=zip.toUpperCase();if(zip.match(/^[ABCEGHJKLMNPRSTVXY]\d[A-Z] \d[A-Z]\d$/))
{e.value=zip;return;}
alert('Zip code is Invalid.');e.focus();}

function FreeTextKeyDown(event,e,maxLen)
{if(IsControlKey(event))
return;if(IsFuncKey(event))
return;if(e.value.length>=maxLen)
event.returnValue=false;}
function FreeTextOnPaste(event,e,maxLen)
{var Data=window.clipboardData.getData('Text');var SelText;var Range;var msg;if(maxLen!=null)
{Range=window.document.selection.createRange();SelText=Range.text;if(SelText!=null&&SelText!=''&&SelText!=undefined)
{if((e.value.length-SelText.length)+Data.length<maxLen)
{return;}}
if(e.value.length+Data.length>=maxLen)
{msg='Cannot paste complete data because the maximum number ';msg+='of allowable characters ('+maxLen+') ';msg+='will be exceeded.  Your data has been cut off at the maximum number ';msg+='of characters allowed.  Please check your data.';alert(msg);e.value+=Data;e.value=e.value.substr(0,maxLen);event.returnValue=false;;}}}

function EventUtils()
{this.addHandler=EventUtils.addHandler;}
EventUtils.addHandler=function(objRefOrID,eventName,func)
{var obj=null;var eventRef;var eventHandlers;try
{if(typeof objRefOrID=="object")
obj=objRefOrID;else if(objRefOrID=="window")
obj=window;else if(objRefOrID=="document")
obj=document;else
obj=document.getElementById(objRefOrID);if(obj==null)
throw("Invalid object reference.");eventRef="obj.on"+eventName;eventHandlers=eval(eventRef);if(typeof eventHandlers=="function")
eval(eventRef+" = function(event) {eventHandlers(event); func(event);}");else
eval(eventRef+" = func;");}
catch(err)
{}}

var __IrthErrorVersion=1;function IrthError(originator,functionName,description)
{this.Originator=obj;this.Function=func;this.Description=desc;}
IrthError.prototype.Throw=function()
{throw new Error("Irth Error\nObject: "+this.Originator+"\nFunction: "+this.Function+"\nDescription: "+this.Description);}

__ModalDialogue_version=1;function ModalDialogue(caption,text)
{if(__base_version==undefined&&__IrthErrorVersion>0)
new IrthError("ModalDialogue","Constructor","Object requires the inclusion of the GeneralScript.js file.").Throw();if(__dragAndDrop_version==undefined&&__IrthErrorVersion>0)
new IrthError("ModalDialogue","Constructor","Object requires the inclusion of the DragAndDrop.js file.").Throw();this.Title=(caption==undefined||caption==null)?'':caption;this.Text=(text==undefined||text==null)?'':text;this.ID=__getGUID();this.BackdropID=this.ID+'modal';this.EnableClose=true;this.Buttons=new Array();this.ImagesLocation='../Images/';this.Draggable=true;this.NoButtons=false;}
ModalDialogue.prototype.AddButton=function(text,onclick)
{this.Buttons.push(new Button(text,onclick));}
ModalDialogue.prototype.ClearButtons=function()
{this.Buttons.clear();}
ModalDialogue.prototype.Dispose=function(backdropID)
{document.body.removeChild($getControl(this.ID));document.body.removeChild($getControl(this.BackdropID));}
ModalDialogue.prototype.Show=function(container)
{var dialogueContainer=document.createElement("DIV"),dialogue=document.createElement("TABLE"),title=dialogue.insertRow(),filler=title.insertCell(),titleText=title.insertCell(),close=title.insertCell(),text=dialogue.insertRow().insertCell(),buttonContainer=dialogue.insertRow().insertCell(),closeImage=document.createElement("IMG"),backdropID=this.BackdropID,closeOnClick="__ModalDialogue_toggle('"+this.ID+"', '"+this.BackdropID+"')";if(this.Buttons.length==0&&!this.NoButtons)
this.Buttons.push(new Button('OK'));if(container==undefined||container==null)
{var modalBackdrop=document.createElement("DIV");modalBackdrop.className='ModalDialogueBackground';modalBackdrop.id=backdropID;modalBackdrop.style.width=document.body.clientWidth;modalBackdrop.style.height=document.body.clientHeight;document.body.appendChild(modalBackdrop);}
else
{container.className='ModalDialogueBackground';backdropID=container.id;}
dialogueContainer.className='ModalDialogueContainer';dialogueContainer.id=this.ID;if(typeof container=='undefined'||container==null)
document.body.appendChild(dialogueContainer);else
container.appendChild(dialogueContainer);dialogue.className='ModalDialogue';title.className='ModalDialogueTitle';titleText.className='ModalDialogueTitleText';titleText.innerHTML=this.Title;if(this.EnableClose)
{close.className='ModalDialogueClose';closeImage.src=this.ImagesLocation+'close.PNG';closeImage.onclick=closeOnClick;closeImage.onmouseover="this.src='"+this.ImagesLocation+"close_hover.PNG'";closeImage.onmouseout="this.src='"+this.ImagesLocation+"close.PNG'";closeImage.alt='X';close.appendChild(closeImage);}
text.className='ModalDialogueText';text.colSpan=3;text.innerHTML=this.Text;buttonContainer.className='ModalDialogueButtonContainer';buttonContainer.colSpan=3;for(var i=0;i<this.Buttons.length;i++)
{button=document.createElement("INPUT");button.type='button';button.onclick=(this.Buttons[i].onClick==null)?closeOnClick:closeOnClick+';'+this.Buttons[i].onClick;button.id=this.ID+'_close_'+i;button.className='ModalDialogueButton';button.value=this.Buttons[i].Text;if(i>0)
buttonContainer.innerHTML+='&nbsp;';buttonContainer.appendChild(button);}
dialogueContainer.innerHTML=dialogue.outerHTML;if(this.Draggable)
makeDraggable(dialogueContainer,250);__ModalDialogue_toggle(this.ID,this.BackdropID);return dialogueContainer;}
__ModalDialogue_toggle=function(id,backdropID)
{var md=$getControl(id),background=$getControl(backdropID);if(!md)return;var mdVis=md.style.visibility;md.style.visibility=(mdVis==null||mdVis=='')?'visible':(mdVis=='visible')?'hidden':'visible';if(background)
{backVis=background.style.visibility;background.style.visibility=(backVis==null||backVis=='')?'visible':(backVis=='visible')?'hidden':'visible';}
else
return;for(var i=0;i<document.forms.length;i++)
document.forms[i].disabled=!document.forms[i].disabled;return;}
function Button(text,onclick)
{this.Text=text;this.onClick=onclick;}
ModalDialogue_Show=function()
{try
{var md=new ModalDialogue('Pop-up blocker is enabled!','This site requires the use of pop ups. <br /><br />In order to use the site without a problem, you will need to disable the Pop-up blocker before entering. This can be done by: <br />1. Click on the bar directly above this box ("Pop-up blocked. To see this pop-up or additional options click here...") <br />2. Select "Always Allow Pop-ups from This Site..."');__actual=md.Show().innerHTML;__expected='';return __actual==__expected;}
catch(err){__actual=__handle_error(err)}
return false;}

__ModalDialogue_version=1;Browser=function(){}
Browser.prototype.GetType=function()
{return navigator.appName;}
Browser.prototype.GetVersion=function()
{var rv=-1;if(navigator.appName=='Microsoft Internet Explorer')
{var ua=navigator.userAgent;var re=new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");if(re.exec(ua)!=null)
rv=parseFloat(RegExp.$1);}
return rv;}
Browser.prototype.IsSupported=function()
{if(navigator.appName!='Microsoft Internet Explorer')
return false;if(this.GetVersion<7.0)
return false;return true;}

__exception_version=1;function Exception(obj,func,desc)
{this.Object=obj;this.Function=func;this.Description=desc;}
Exception.prototype.Throw=function()
{throw new Error("WebControl Error\nObject: "+this.Object+"\nFunction: "+this.Function+"\nDescription: "+this.Description);}
Exception.prototype.Attach=function(control)
{if(control==null)
return;if(typeof control!='object')
control=$getControl(control);if(!control.parentNode)
return;if(control.className.indexOf('exception_control')<0)
control.className+=' exception_control';if($getControl(control.id+'_exc'))
return;var err=document.createElement('IMG');err.alt=this.Description;err.src='images/error.png';err.id=control.id+'_exc';control.parentNode.insertBefore(err,control);var space=document.createElement("SPAN");space.id=control.id+'_excspace';space.innerHTML='&nbsp';control.parentNode.insertBefore(space,control);}
Exception.prototype.Detach=function(control)
{if(control==null)
return;if(typeof control!='object')
control=$getControl(control);if(!control.parentNode)
return;var err=$getControl(control.id+'_exc');if(err)
{control.parentNode.removeChild(err);control.parentNode.removeChild($getControl(control.id+'_excspace'));}
if(control.className.indexOf('exception_control')>=0)
control.className=control.className.replace(' exception_control','');}
Exception.prototype.IsAttached=function(controlID)
{if(controlID==null)
return;if(typeof control=='object')
controlID=$getControl(controlID).id;var err=$getControl(controlID+'_exc');alert(controlID+'_exc'+'/'+err);if(err)
return true;return false;}

__string_version=1;String.prototype.Contains=function(value)
{if(this.search(value)>-1)return true;return false;}
String.prototype.PadZeroes=function(required_string_size,leading)
{leading=(leading==null)?true:leading;var zeroes='';for(var i=0;i<required_string_size;i++)zeroes+="0";if(leading)
return(zeroes+this).substr(0,required_string_size);else
return(this+zeroes).substr(0,required_string_size);}
String.prototype.Trim=function()
{if(this.replace(/ /g,'')=='')
return'';return this.replace(/^(\s*)([\W\w]*)(\b\s*$)/,'$2');}
String.prototype.toCurrency=function()
{var val=parseInt(this)
if(isNaN(val))return this;var return_val=this,dollars_cents=return_val.split(".");dollars_cents[0]=dollars_cents[0].toNumber();if(dollars_cents.length>1)
return_val=dollars_cents[0]+"."+dollars_cents[1].PadZeroes(2,false).substr(0,2);else
return_val=dollars_cents[0]+".00";return(val<0)?'$getControl('+return_val.replace('-','')+')':'$'+return_val;}
String.prototype.toNumber=function()
{if(this.indexOf(',')<0)
{var val=this.split('.')[0],iterations=parseInt(val.length/3),new_val='';for(var i=0;i<iterations;i++)
new_val=','+val.substr(val.length-3*(i+1),3)+new_val;new_val=val.substr(0,val.length-iterations*3)+new_val;if(val.length%3==0)new_val=new_val.substr(1);return new_val;}}
String.prototype.Escape=function()
{var re=new RegExp("\n","gi"),new_string=this.replace(re,"\\n");re=new RegExp("\r","gi");new_string=new_string.replace(re,"\\r");re=new RegExp("\"","gi");new_string=new_string.replace(re,"\\\"");re=new RegExp("'","gi");return new_string.replace(re,"\\'");}
String.prototype.RemoveControlCharacters=function()
{return this.replace(/\s/g,'');}
String.prototype.IsEmpty=function()
{if(this==undefined||this==null||this=='')
return true;return false;}
String.prototype.GetQueryParameterValue=function(key)
{return(this.match(new RegExp("[?|&]?"+key+"=([^&]*)"))[1]);}
String.prototype.insert=function(value,startPosition)
{return this.substr(0,startPosition)+value+this.substr(startPosition);}
String.prototype.count=function(value)
{if(!value||value.IsEmpty())
return 0;var occurrences=0,i=0;while(true)
{i=this.indexOf(value,i);if(i<0)break;i+=value.length;occurrences++;}
return occurrences;}
String.prototype.indexAfter=function(value,occurrences)
{if(!value||value.IsEmpty()||!occurrences||occurrences<=0)
return 0;var index=0;for(var i=0;i<occurrences;i++)
{var idx=this.indexOf(value,index);if(idx<0)
{return-1;break;}
index=idx+value.length;}
return index;}

Event=function(name)
{this.Name=name;}
Event.prototype.AppendToElement=function(element,script)
{if(this.Name==null||element==null)
return;var changeHandler=new Function(script);if(element.addEventListener)
element.addEventListener(this.Name.substr(2),changeHandler,false);else if(element.attachEvent)
element.attachEvent(this.Name,changeHandler);}
Event.prototype.AddToElement=function(element,script)
{if(this.Name==null||element==null)
return;var changeHandler=new Function(script);switch(this.Name)
{case'onmouseover':element.onmouseover=script;break;case'onmouseout':element.onmouseout=script;break;case'onchange':element.onchange=script;break;case'onclick':element.onclick=script;break;case'onblur':element.onblur=script;break;case'onfocus':element.onfocus=script;break;case'onkeyup':element.onkeyup=script;break;}
if(element.addEventListener)
element.addEventListener(this.Name.substr(2),changeHandler,false);else if(element.attachEvent)
element.attachEvent(this.Name,changeHandler);}
Event.prototype.RemoveFromElement=function(element,script)
{if(this.Name==null)
return;var handler=new Function(script);if(element.detachEvent)
element.detachEvent(this.Name,handler);else
element.removeEventListener(this.Name.substr(2),handler,false);eval('element.'+this.Name+'=null;');}
Event.prototype.ClearAllFromElement=function(element)
{if(this.Name==null)
return;var fnc=eval('element.'+this.Name);if(fnc==null)
return
if(typeof(fnc)=='string')fnc=new Function(fnc);if(element.detachEvent)
element.detachEvent(this.Name,fnc);else
element.removeEventListener(this.Name.substr(2),fnc,false);eval('element.'+this.Name+'=null;');}
Event.prototype.ReplaceOnElement=function(element,script)
{if(this.Name==null)
return;this.ClearFromElement(eventName);this.AddToElement(eventName,script);}
Event.prototype.RefreshAll=function(control)
{var control=$getControl(control);if(!control)return;if(control.onblur&&!control.onblur.IsEmpty())
new Event('onblur').AddToElement(control,control.onblur);if(control.onfocus&&!control.onfocus.IsEmpty())
new Event('onfocus').AddToElement(control,control.onfocus);if(control.onkeyup&&!control.onkeyup.IsEmpty())
new Event('onkeyup').AddToElement(control,control.onkeyup);if(control.onkeydown&&!control.onkeydown.IsEmpty())
new Event('onkeydown').AddToElement(control,control.onkeydown);if(control.onchange&&!control.onchange.IsEmpty())
new Event('onchange').AddToElement(control,control.onchange);if(control.onclick&&!control.onclick.IsEmpty())
new Event('onclick').AddToElement(control,control.onclick);if(control.onmouseout&&!control.onmouseout.IsEmpty())
new Event('onmouseout').AddToElement(control,control.onmouseout);if(control.onmouseover&&!control.onmouseover.IsEmpty())
new Event('onmouseover').AddToElement(control,control.onmouseover);if(control.onmousedown&&!control.onmousedown.IsEmpty())
new Event('onmousedown').AddToElement(control,control.onmousedown);}

Array.prototype.CurrentPosition=0;Array.prototype.Contains=function(value)
{for(var i=0;i<this.length;i++)
if(this[i]==value)
return true;return false;}
Array.prototype.GetNext=function()
{if(this.length==0)
return;this.CurrentPosition++;if(this.CurrentPosition>=this.length)
this.CurrentPosition=0;return this[this.CurrentPosition];}
Array.prototype.GetPrevious=function()
{if(this.length==0)
return;this.CurrentPosition--;if(this.CurrentPosition<0)
this.CurrentPosition=this.length-1;return this[this.CurrentPosition];}
Array.prototype.GetRandom=function()
{if(this.length==0)
return;if(this.length==1)
return this[0];var i;do
{i=Math.floor(Math.random()*this.length);}while(i==this.CurrentPosition);this.CurrentPosition=i;return this[this.CurrentPosition];}
Array.prototype.GetCurrent=function()
{if(this.length==0)
return;return this[this.CurrentPosition];}

JSONstring={compactOutput:false,includeProtos:false,includeFunctions:false,detectCirculars:true,restoreCirculars:true,make:function(arg,restore){this.restore=restore;this.mem=[];this.pathMem=[];return this.toJsonStringArray(arg).join('');},toObject:function(x){if(!this.cleaner){try{this.cleaner=new RegExp('^("(\\\\.|[^"\\\\\\n\\r])*?"|[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t])+?$')}
catch(a){this.cleaner=/^(true|false|null|\[.*\]|\{.*\}|".*"|\d+|\d+\.\d+)$/}};if(!this.cleaner.test(x)){return{}};eval("this.myObj="+x);if(!this.restoreCirculars||!alert){return this.myObj};if(this.includeFunctions){var x=this.myObj;for(var i in x){if(typeof x[i]=="string"&&!x[i].indexOf("JSONincludedFunc:")){x[i]=x[i].substring(17);eval("x[i]="+x[i])}}};this.restoreCode=[];this.make(this.myObj,true);var r=this.restoreCode.join(";")+";";eval('r=r.replace(/\\W([0-9]{1,})(\\W)/g,"[$1]$2").replace(/\\.\\;/g,";")');eval(r);return this.myObj},toJsonStringArray:function(arg,out){if(!out){this.path=[]};out=out||[];var u;switch(typeof arg){case'object':this.lastObj=arg;if(this.detectCirculars){var m=this.mem;var n=this.pathMem;for(var i=0;i<m.length;i++){if(arg===m[i]){out.push('"JSONcircRef:'+n[i]+'"');return out}};m.push(arg);n.push(this.path.join("."));};if(arg){if(arg.constructor==Array){out.push('[');for(var i=0;i<arg.length;++i){this.path.push(i);if(i>0)
out.push(',\n');this.toJsonStringArray(arg[i],out);this.path.pop();}
out.push(']');return out;}else if(typeof arg.toString!='undefined'){out.push('{');var first=true;for(var i in arg){if(!this.includeProtos&&arg[i]===arg.constructor.prototype[i]){continue};this.path.push(i);var curr=out.length;if(!first)
out.push(this.compactOutput?',':',\n');this.toJsonStringArray(i,out);out.push(':');this.toJsonStringArray(arg[i],out);if(out[out.length-1]==u)
out.splice(curr,out.length-curr);else
first=false;this.path.pop();}
out.push('}');return out;}
return out;}
out.push('null');return out;case'unknown':case'undefined':case'function':if(!this.includeFunctions){out.push(u);return out};arg="JSONincludedFunc:"+arg;out.push('"');var a=['\n','\\n','\r','\\r','"','\\"'];arg+="";for(var i=0;i<6;i+=2){arg=arg.split(a[i]).join(a[i+1])};out.push(arg);out.push('"');return out;case'string':if(this.restore&&arg.indexOf("JSONcircRef:")==0){this.restoreCode.push('this.myObj.'+this.path.join(".")+"="+arg.split("JSONcircRef:").join("this.myObj."));};out.push('"');var a=['\n','\\n','\r','\\r','"','\\"'];arg+="";for(var i=0;i<6;i+=2){arg=arg.split(a[i]).join(a[i+1])};out.push(arg);out.push('"');return out;default:out.push(String(arg));return out;}}};

Phone=function(number,required)
{this.Constructor(number,required);}
Phone.prototype.Constructor=function(number,required)
{this.Exception=null;this.AreaCode='';this.LocalCode='';this.UniqueCode='';this.Extension='';this.Value=number?number:null;this.FormattedNumber='';this.IsRequired=required?required:false;__validPhoneNonNumericsPattern=/[\(\)\.\-\x\X\ ]/g;if(number!=undefined)
this.Parse(number);}
Phone.prototype.IsValid=function(number)
{if(number==null)
if(this.Value==null)
return this.Exception==null;else
number=this.Value;this.Exception=null;if(number==""||number==null)
{if(this.IsRequired)
{this.Exception=new Exception("Phone","IsValid","No number was entered.");return false;}
return true;}
var phone=number.replace(__validPhoneNonNumericsPattern,'');if(/[^0-9]/.test(phone))
this.Exception=new Exception("Phone","IsValid","The phone number contains illegal characters.");else if(phone.length<10)
this.Exception=new Exception("Phone","IsValid","The phone number is too short. Please be sure to include the area code.");return this.Exception==null;}
Phone.prototype.Parse=function(number)
{if(this.IsValid(number))
{var phone=number.replace(__validPhoneNonNumericsPattern,'');this.AreaCode=phone.substr(0,3);this.LocalCode=phone.substr(3,3);this.UniqueCode=phone.substr(6,4);this.FormattedNumber="("+this.AreaCode+") "+this.LocalCode+" - "+this.UniqueCode;if(phone.length>10)
{this.Extension=phone.substr(10,phone.length-10);this.FormattedNumber+=' x '+this.Extension;}
return true;}
return false;}
Fax=function(number)
{this.Constructor(number);}
Fax.prototype=new Phone();Fax.prototype.IsValid=function(number)
{if(number==null)
return this.Exception==null;this.Exception=null;var phone=new Phone(number);if(phone.IsValid())
{if(phone.Extension=='')
return true;this.Exception=new Exception("Fax","IsValid","Faxes can not have extensions.");}
else
this.Exception=phone.Exception;return false;}
try
{if(__JSUnit_version>0)
{var test=function()
{var expected={"Exception":null,"AreaCode":"614","LocalCode":"459","UniqueCode":"9841","Extension":"323498","Value":"(614) 459-9841x323498","FormattedNumber":"(614) 459 - 9841 x 323498","IsRequired":false},actual=new Phone('(614) 459-9841x323498');return new JSUnitTestResult(actual,expected);}
__jsUnit.AddTest('Phone','Constructor','Tests the constructor for creating a phone object','positive',test);test=function()
{var expected=true,actual=new Phone('(614) 459-9841x234').IsValid();return new JSUnitTestResult(actual,expected);}
__jsUnit.AddTest('Phone','IsValid','Tests valid phone number','positive',test);test=function()
{var expected=false,actual=new Phone('(614) 4*&9-9841').IsValid();return new JSUnitTestResult(actual,expected);}
__jsUnit.AddTest('Phone','IsValid','Tests phone with special characters','negative',test);test=function()
{var expected=false,actual=new Phone('(614) 4zh9-9841').IsValid();return new JSUnitTestResult(actual,expected);}
__jsUnit.AddTest('Phone','IsValid','Tests phone with alpha characters','negative',test);test=function()
{var expected={"Exception":null,"AreaCode":"614","LocalCode":"459","UniqueCode":"9841","Extension":"","Value":"(614) 459-9841","FormattedNumber":"(614) 459 - 9841","IsRequired":false},actual=new Fax('(614) 459-9841');return new JSUnitTestResult(actual,expected);}
__jsUnit.AddTest('Fax','Constructor','Tests the constructor for creating a Fax object','positive',test);test=function()
{var expected=true,actual=new Fax('(614) 459-9841').IsValid();return new JSUnitTestResult(actual,expected);}
__jsUnit.AddTest('Fax','IsValid','Tests valid fax number','positive',test);test=function()
{var expected=false,actual=new Fax('(614) 459-9841x324').IsValid();return new JSUnitTestResult(actual,expected);}
__jsUnit.AddTest('Fax','IsValid','Tests invalid fax number','negative',test);}}
catch(err){}

Email=function(address)
{this.Constructor(address);}
Email.prototype.Constructor=function(address)
{this.Exception=null;this.User=null;this.Domain=null;if(address!=null)
this.IsValid(address);}
Email.prototype.IsValid=function(address)
{if(address==null)
return this.Exception==null;this.Exception==null;var addressParts=address.split('@');if(addressParts.length==2)
{this.User=addressParts[0],this.Domain=addressParts[1];var userParts=this.User.split('.');for(var i=0;i<userParts.length;i++)
{if(userParts[i]=='')
{this.Exception=new Exception("Email","IsValid","User is invalid. It can not start with, end with, or contain multiple \".\"'s");return false;}
if(/[<>()[\]\\,;:\s\"]/.test(userParts[i]))
{this.Exception=new Exception("Email","IsValid","User contains invalid characters.");return false;}}
if(/(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,})$/.test(this.Domain))
return true;var ip=new IPAddress(this.Domain);if(!ip.IsValid())
{this.Exception=new Exception("Email","IsValid",'Invalid e-mail domain: '+ip.Exception.Description);return false;}
return true;}
this.Exception=new Exception("Email","IsValid",'Invalid e-mail addess. No or too many "@"\'s present.');return false;}
IPAddress=function(address)
{this.Constructor(address);}
IPAddress.prototype.Constructor=function(address)
{this.Value=address;this.Octets=null;this.Reserved=false;this.Exception=null;if(address!=null)
this.Parse(address);}
IPAddress.prototype.Parse=function(address)
{if(this.IsValid(address))
this.Reserved=this.Octets[0]==10||(this.Octets[0]==172&&this.Octets[1]==16)||(this.Octets[0]==192&&this.Octets[1]==168)}
IPAddress.prototype.IsValid=function(address)
{if(address==null)
return this.Exception==null;this.Exception==null;var octets=address.split('.');if(octets!=null&&octets.length==4)
{for(var i=0;i<octets.length;i++)
{if(isNaN(octets[i])||octets[i]>255)
{this.Exception=new Exception("IPAddress","IsValid","One of the octets is not in a valid range of numbers (must be 0 to 255).");return false;}}
this.Octets=octets;return true;}
this.Exception=new Exception("IPAddress","IsValid","The address is not in a correct IP format.");return false;}
try
{if(__JSUnit_version>0)
{__jsUnit.AddTest('Email','IsValid','Tests for a syntactically valid e-mail address','positive',function()
{var expected={"Exception":null,"User":"george","Domain":"irth.com"},actual=new Email('george@irth.com');return new JSUnitTestResult(actual,expected);});__jsUnit.AddTest('Email','IsValid','Tests for a syntactically invalid user in the e-mail address','negative',function()
{var expected={"Exception":{"Object":"Email","Function":"IsValid","Description":"User contains invalid characters."},"User":"geo(rge","Domain":"irth.com"},actual=new Email('geo(rge@irth.com');return new JSUnitTestResult(actual,expected);});__jsUnit.AddTest('Email','IsValid','Tests for an e-mail address with an invalid ip','negative',function()
{var expected={"Exception":{"Object":"Email","Function":"IsValid","Description":"Invalid e-mail domain: One of the octets is not in a valid range of numbers (must be 0 to 255)."},"User":"george","Domain":"22.18.266.86"},actual=new Email('george@22.18.266.86');return new JSUnitTestResult(actual,expected);});__jsUnit.AddTest('Email','IsValid','Tests for an e-mail address with a valid ip','positive',function()
{var expected={"Exception":null,"User":"george","Domain":"22.18.56.86"},actual=new Email('george@22.18.56.86');return new JSUnitTestResult(actual,expected);});}}
catch(err){}

var __textbox_version=1;function TextBox(id,caption,text,watermark,mask,required)
{this.Constructor(id,caption,text,watermark,mask,required);}
TextBox.prototype.Constructor=function(id,caption,text,watermark,mask,required)
{if(!__base_version||__base_version<1)
new Exception("TextBox","Constructor","The TextBox object requires the inclusion of the base.js file.").Throw();if(!__string_version||__string_version<1)
new Exception("TextBox","Constructor","The TextBox object requires the inclusion of the string.js file.").Throw();var tb=$getControl(id+'_obj');if(tb)
tb=eval(tb.value);this.Control=$getControl(id+'_input');this.ID=id?id:__getGUID();this.Caption=caption?caption:tb?tb.Caption:'';this.Disabled=tb?tb.Disabled:false;this.Watermark=watermark?watermark:tb?tb.Watermark:'';this.Mask=mask?mask:tb?tb.Mask:'';this.IsNumeric=tb?tb.IsNumeric:false;this.IsRequired=required?required:tb?tb.IsRequired:false;this.Type='TextBox';this.Text=text?text:tb?this.Unmask($getControl(id+'_input').value):'';}
TextBox.prototype.AddEvents=function()
{var tb=$getControl(this.ID+'_input');if(!tb)return;if(tb.onblur&&!tb.onblur.IsEmpty())
new Event('onblur').AddToElement(tb,tb.onblur);if(tb.onfocus&&!tb.onfocus.IsEmpty())
new Event('onfocus').AddToElement(tb,tb.onfocus);if(tb.onkeyup&&!tb.onkeyup.IsEmpty())
new Event('onkeyup').AddToElement(tb,tb.onkeyup);if(tb.onkeydown&&!tb.onkeydown.IsEmpty())
new Event('onkeydown').AddToElement(tb,tb.onkeydown);}
TextBox.prototype.Render=function()
{var textbox=document.createElement("table"),row=textbox.insertRow(),caption=row.insertCell(),text=row.insertCell(),inp=document.createElement("<INPUT TYPE='text'>"),obj=document.createElement("<INPUT Type='hidden'>");textbox.id=this.ID;obj.id=this.ID+'_obj';obj.value='('+JSONstring.make(this)+')';inp.id=this.ID+'_input';inp.className="textbox_text";inp.value=this.Text;if(this.IsValid)
inp.onblur='new '+this.Type+'(\''+this.ID+'\').IsValid();';if(!this.Watermark.IsEmpty())
{if(this.Text.IsEmpty())
{inp.value=this.Watermark;inp.className="textbox_watermark";}
inp.onfocus='textbox_RemoveWatermark(\''+this.ID+'\');';inp.onblur+='textbox_SetWatermark(\''+this.ID+'\');';}
if(!this.Mask.IsEmpty()&&this.Mask.indexOf('#')>-1)
{if(this.Text.IsEmpty()&&this.Watermark.IsEmpty())
inp.value=this.Mask.replace(/#/g,' ');inp.onkeyup='textbox_Mask(\''+this.ID+'\',event);';inp.onkeydown='if(textbox_IsMasked(\''+this.ID+'\',event)) return false;';if(inp.value!=this.Watermark)
inp.value=this.ApplyMask();}
if(this.IsNumeric)
inp.onkeydown!='if(!textbox_KeyIsNumeric(event)) return false;';caption.className='textbox_caption';caption.innerHTML=this.Caption;text.appendChild(inp);text.appendChild(obj);textbox.disabled=this.Disabled;return textbox;}
TextBox.prototype.GetCursorPosition=function()
{if(!this.Control)
return 0;var currentRange=document.selection.createRange(),workRange=currentRange.duplicate();this.Control.select();var entireRange=document.selection.createRange(),cursorPosition=0;while(workRange.compareEndPoints('StartToStart',entireRange)>0)
{workRange.moveStart("character",-1);cursorPosition++;}
currentRange.select();return cursorPosition;}
TextBox.prototype.SetCursorPosition=function(position)
{if(!this.Control)
return;if(this.Control.createTextRange)
{var range=this.Control.createTextRange();range.move('character',position);range.select();}
else
{if(this.Control.selectionStart)
{this.Control.focus();this.Control.setSelectionRange(position,position);}
else
this.Control.focus();}}
TextBox.prototype.Unmask=function(text)
{if(!text)
{if(this.Text)
text=this.Text
else
return'';}
if(this.Watermark==text)
return'';if(!this.Mask||this.Mask.IsEmpty())
return text;var last='',unmasked=text,maskChars=this.Mask.replace(/#/g,'');for(var i=0;i<maskChars.length;i++)
{if(last==unmasked)
return text;last=unmasked;var maskChar=maskChars.substr(i,1);if(/[\(\)\\\*\+\?\^\$\|]/.test(maskChar))
maskChar='\\'+maskChar;var re=new RegExp(maskChar);unmasked=unmasked.replace(re,'');}
return unmasked.Trim().replace(/ /g,'');}
TextBox.prototype.ApplyMask=function()
{if(!this.Mask||this.Mask.IsEmpty()||this.Mask.indexOf('#')<0)
return;var textPosition=0
masked='';for(var i=0;i<this.Mask.length;i++)
{var maskChar=this.Mask.substr(i,1),textChar=this.Text.substr(textPosition,1);if(maskChar=='#')
{if(this.Text.length>textPosition)
masked+=textChar;else
masked+=' ';textPosition++;}
else
masked+=maskChar;}
if(this.Text.length>textPosition)
masked+=this.Text.substr(textPosition);return masked.Trim();}
TextBox.prototype.IsValid=function()
{if(this.Control)
new Exception().Detach(this.Control);if(this.IsRequired)
if(this.Text.IsEmpty())
{if(this.Control)
new Exception(this.Type,'IsValid','This field is required.').Attach(this.Control);return false;}
return true;}
textbox_IsMasked=function(id,e)
{if(e.keyCode==8||e.keyCode==46)
{var tb=new TextBox(id);if(!tb.Control||tb.Mask.IsEmpty())return false;var maskChars=new Array(),cursor=e.keyCode==8?tb.GetCursorPosition()-1:tb.GetCursorPosition();for(var i=0;i<tb.Mask.length;i++)
if(tb.Mask.substr(i,1)!='#')
maskChars.push(i);if(maskChars.Contains(cursor))
return true;}
return false;}
textbox_KeyIsNumeric=function(e)
{if(e.keyCode<58||(e.keyCode>95&&e.keyCode<106)||(e.keyCode>34&&e.keyCode<47)||e.keyCode==8)
return true;return false;}
textbox_RemoveWatermark=function(id)
{var tb=new TextBox(id);if(!tb.Control)return;if(tb.Control.value==tb.Watermark)
{tb.Control.className="textbox_text";tb.Control.value="";if(!tb.Mask.IsEmpty())
{tb.Control.value=tb.ApplyMask();tb.SetCursorPosition(tb.Mask.indexOf('#'));}}}
textbox_SetWatermark=function(id)
{var tb=new TextBox(id);if(!tb.Control)return;if(tb.Control.value==tb.Watermark||tb.Control.value.length==0||tb.Control.value==tb.Mask.replace(/#/g,' '))
{tb.Control.className="textbox_watermark";tb.Control.value=tb.Watermark;}
else
tb.Control.className="textbox_text";}
textbox_Mask=function(id,e)
{var tb=new TextBox(id);if(!tb.Control)return;if(e)
{var key=e.keyCode;if((key>2&&key<8)||(key>12&&key<28)||(key>32&&key<38)||key==40||key==93||(key>111&&key<146))
return true;}
if(!tb.Mask||tb.Mask.IsEmpty()||tb.Mask.indexOf('#')<0)
return;var cursor=tb.GetCursorPosition(),textPosition=0,masked=tb.Text!=tb.Control.value;tb.Control.value=tb.ApplyMask();if(masked)
cursor=tb.Mask.indexOf('#',cursor);else
cursor=tb.Mask.indexAfter('#',tb.Text.length);if(cursor>-1)
tb.SetCursorPosition(cursor);else
tb.SetCursorPosition(tb.Control.value.length);}
PhoneBox=function(id,caption,text,watermark,mask,required)
{this.Constructor(id,caption,text,watermark,mask,required);this.Mask='(###) ###-####x';this.IsNumeric=true;this.Type='PhoneBox';}
PhoneBox.prototype=new TextBox();PhoneBox.prototype.IsValid=function()
{if(this.Control)
new Exception().Detach(this.Control);var phone=null,isValid=false;if(this.Text.IsEmpty())
isValid=!this.IsRequired;else
{phone=new Phone(this.Text);isValid=phone.IsValid();}
if(!isValid)
{if(this.Control)
if(phone)
phone.Exception.Attach(this.Control);else
new Exception(this.Type,'IsValid','This field is required').Attach(this.Control);return false;}
return true;}
FaxBox=function(id,caption,text,watermark,mask,required)
{this.Constructor(id,caption,text,watermark,mask,required);this.Mask='(###) ###-####';this.IsNumeric=true;this.Type='FaxBox';}
FaxBox.prototype=new TextBox();FaxBox.prototype.IsValid=function()
{if(this.Control)
new Exception().Detach(this.Control);var fax=null,isValid=false;if(this.Text.IsEmpty())
isValid=!this.IsRequired;else
{fax=new Fax(this.Text);isValid=fax.IsValid();}
if(!isValid)
{if(this.Control)
if(fax)
fax.Exception.Attach(this.Control);else
new Exception(this.Type,'IsValid','This field is required').Attach(this.Control);return false;}
return true;}
EmailBox=function(id,caption,text,watermark,mask,required)
{this.Constructor(id,caption,text,watermark,mask,required);this.Type='EmailBox';}
EmailBox.prototype=new TextBox();EmailBox.prototype.IsValid=function()
{if(this.Control)
new Exception().Detach(this.Control);var email=null;if(this.Text.IsEmpty())
isValid=!this.IsRequired;else
{email=new Email(this.Text);isValid=email.IsValid();}
if(!isValid)
{if(this.Control)
if(email)
email.Exception.Attach(this.Control);else
new Exception(this.Type,'IsValid','This field is required').Attach(this.Control);return false;}
return true;}
try
{if(__JSUnit_version>0)
{__jsUnit.AddTest('TextBox','Render','Tests the Render function of the textbox object.','positive',function()
{var tb=new TextBox(null,'Test','Freakin junk','Enter a value'),actual=tb.Render().outerHTML.replace(/[\r\n]/g,''),expected='<TABLE id=mytest><TBODY><TR><TD class=textbox_caption>Test</TD><TD><INPUT id=mytest_input onblur="var validate=function()&#13;&#10;{&#9;&#13;&#10;&#9;if(this.IsRequired)&#13;&#10;&#9;&#9;if(this.Text.IsEmpty())&#13;&#10;&#9;&#9;{&#13;&#10;&#9;&#9;&#9;if(this.Control)&#13;&#10;&#9;&#9;&#9;&#9;new Exception(\'TextBox\',\'IsValid\',\'This field is required.\').Attach(this.ID+\'_input\');&#13;&#10;&#9;&#9;&#9;return false;&#13;&#10;&#9;&#9;}&#13;&#10;&#13;&#10;&#9;if(this.Control)&#13;&#10;&#9;&#9;new Exception().Detach(this.ID+\'_input\');&#13;&#10;&#9;return true;&#13;&#10;};validate(this,false);textbox_SetWatermark(\'mytest\');" onfocus="textbox_RemoveWatermark(\'mytest\');" value="Freakin junk"><INPUT id=mytest_obj type=hidden value=\'({"Control":null,&#13;&#10;"ID":"mytest",&#13;&#10;"Caption":"Test",&#13;&#10;"Disabled":false,&#13;&#10;"Watermark":"Enter a value",&#13;&#10;"Mask":"",&#13;&#10;"IsNumeric":false,&#13;&#10;"IsRequired":false,&#13;&#10;"Text":"Freakin junk"})\'></TD></TR></TBODY></TABLE>';return new JSUnitTestResult(actual,expected,true,tb.ID);});__jsUnit.AddTest('PhoneBox','Render','Tests the Render function of the PhoneBox object.','positive',function()
{var tb=new PhoneBox(null,'Test','','Enter a value'),actual=tb.Render().outerHTML.replace(/[\r\n]/g,''),expected='<TABLE><TBODY><TR><TD class=textbox_caption>Test</TD><TD><INPUT class=textbox_text id=mytest_input onblur="textbox_SetWatermark(\'mytest_input\',\'Enter a value\');" onfocus="textbox_RemoveWatermark(\'mytest_input\',\'Enter a value\');" alt="Freakin junk" value="Freakin junk"></TD></TR></TBODY></TABLE>';return new JSUnitTestResult(actual,expected,true,tb.ID);});}}
catch(err){}

var __dropdownbox_version=1;function DropDownBox(id,caption,options,required)
{this.Constructor(id,caption,options,required);}
DropDownBox.prototype.Constructor=function(id,caption,options,required)
{if(!__base_version||__base_version<1)
new Exception("DropDownBox","Constructor","The DropDownBox object requires the inclusion of the base.js file.").Throw();if(!__string_version||__string_version<1)
new Exception("DropDownBox","Constructor","The DropDownBox object requires the inclusion of the string.js file.").Throw();var ddb=$getControl(id+'_obj');if(ddb)
ddb=eval(ddb.value);this.ID=id?id:__getGUID();this.Control=this.ID+'_box';this.Caption=caption?caption:ddb?ddb.Caption:'';this.Disabled=ddb?ddb.Disabled:false;this.IsRequired=required?required:ddb?ddb.IsRequired:false;this.Type='DropDownBox';this.Sort=ddb?ddb.Sort:true;this.Options=options?options:ddb?ddb.Options:new Array();this.OnChange=ddb?ddb.OnChange:null;}
DropDownBox.prototype.Clear=function()
{var dd=$getControl(this.Control);if(!dd)return;var parent=dd.parentNode;var clone=dd.cloneNode(false);parent.replaceChild(clone,dd);this.Control=$getControl(this.Control);}
DropDownBox.prototype.GetSelectedValue=function()
{var dd=$getControl(this.Control);if(dd&&dd.options&&dd.options.length>0)
return dd.options[dd.selectedIndex].value;return'';}
DropDownBox.prototype.Render=function()
{var dd=document.createElement("table"),row=dd.insertRow(),caption=row.insertCell(),drop=row.insertCell(),box=document.createElement("select"),obj=document.createElement("<INPUT Type='hidden'>");dd.id=this.ID;obj.id=this.ID+'_obj';obj.value='('+JSONstring.make(this)+')';box.id=this.ID+'_box';box.className="dropdownbox_box";if(this.IsValid)
box.onblur='new '+this.Type+'(\''+this.ID+'\').IsValid();';if(this.OnChange)
box.onchange=this.OnChange;if(this.Sort)
this.Options.sort(dropdownbox_sortText);var lastGroup=null
optGroup=null;for(var i=0;i<this.Options.length;i++)
{var group=this.Options[i].group;if(group&&group!=lastGroup)
{if(lastGroup&&optGroup)
box.appendChild(optGroup);optGroup=document.createElement("OPTGROUP");optGroup.label=group;lastGroup=group;}
var opt=document.createElement("OPTION");opt.value=this.Options[i].value;opt.innerHTML=this.Options[i].text;opt.title=this.Options[i].text;opt.selected=this.Options[i].selected;if(optGroup)
optGroup.appendChild(opt);else
box.appendChild(opt);}
caption.className='dropdownbox_caption';caption.innerHTML=this.Caption;drop.appendChild(box);drop.appendChild(obj);dd.disabled=this.Disabled;return dd;}
DropDownBox.prototype.AddOption=function(value,text,selected,group)
{this.Options.push({"value":value,"text":text,"selected":(selected?selected:false),"group":group});var dd=$getControl(this.Control)
if(dd)
{var opt=document.createElement("OPTION");opt.value=value;opt.innerHTML=text;opt.title=text;if(selected)opt.selected=true;dd.appendChild(opt);}}
dropdownbox_sortText=function(a,b)
{if(a.group!=b.group)return 0;if(!a.text&&!b.text)return 0;if(!a.text)return-1;if(!b.text)return 1;var aText=a.text.toLowerCase(),bText=b.text.toLowerCase();if(aText<bText)return-1;if(aText>bText)return 1;return 0;}
dropdownbox_sortGroup=function(a,b)
{if(!a.group&&!b.group)return 0;if(!a.group)return-1;if(!b.group)return 1;var aGroup=a.group.toLowerCase(),bGroup=b.group.toLowerCase();if(aGroup<bGroup)return-1;if(aGroup>bGroup)return 1;return 0;}
try
{if(__JSUnit_version>0)
{__jsUnit.AddTest('DropDownBox','Render','Tests the Render function of the dropdown object.','positive',function()
{var dd=new DropDownBox();dd.Caption='Test Drop Down';dd.AddOption(1,'Yes',true);dd.AddOption(0,'No');return new JSUnitTestResult(dd.Render().outerHTML.replace(/[\r\n]/g,''),'',true,dd.ID);});__jsUnit.AddTest('DropDownBox','Render','Tests the Render function of the dropdown constructor.','positive',function()
{var dd=new DropDownBox('test','Test Drop Down',[{"value":"Yes","text":"Yes","selected":false,"group":null},{"value":"No","text":"No","selected":true,"group":null}]);return new JSUnitTestResult(dd.Render().outerHTML.replace(/[\r\n]/g,''),'',true,dd.ID);});}}
catch(err){}

LocationsControl=function(locations,id)
{this.Constructor(locations,id);}
LocationsControl.prototype.Constructor=function(locations,id)
{var obj=$getControl(id+'_obj');if(obj)
obj=eval(obj.value);this.ID=id?id:__getGUID();this.Locations=locations?locations:obj?obj.Locations:null;this.StateControl=new DropDownBox(this.ID+'_state','State');this.CountyControl=new DropDownBox(this.ID+'_county','County');}
LocationsControl.prototype.Render=function(){if(!this.Locations)
return null;var search=document.createElement('table'),row=search.insertRow(),button=document.createElement('<input type="button" />'),obj=document.createElement('<input type="hidden" />'),helpLink=document.createElement('a'),memberContactLink=document.createElement('a');search.id=this.ID;obj.id=this.ID+'_obj';obj.value='('+JSONstring.make(this)+')';for(var i=0;i<this.Locations.length;i++)
this.StateControl.AddOption(this.Locations[i].abbr,this.Locations[i].name);this.StateControl.OnChange='__locationsControl_setCounties("'+this.ID+'");';for(var i=0;i<this.Locations[0].counties.length;i++)
this.CountyControl.AddOption(this.Locations[0].counties[i].env,this.Locations[0].counties[i].name);this.CountyControl.OnChange='__locationsControl_changeCounty("'+this.ID+'");';button.id=this.ID+'_button';button.value='Get Emergency Contacts';button.onclick="__setMap();";helpLink.href=GetBaseUrl()+"/Documents/EmergencyContactHelp.pdf";helpLink.appendChild(document.createTextNode("Help"));helpLink.target="_blank";helpLink.className="link";memberContactLink.href=GetBaseUrl()+"/Centers/USAN/MemberContacts.aspx";memberContactLink.appendChild(document.createTextNode("Click here if you have a ticket number"));memberContactLink.className="link";row.insertCell().appendChild(this.StateControl.Render());row.insertCell().appendChild(this.CountyControl.Render());row.insertCell().appendChild(button);row.insertCell().appendChild(helpLink);row.insertCell().appendChild(memberContactLink);search.insertRow().insertCell().appendChild(obj);return search;}
__setMap=function()
{PageMethods.GetServiceAreaContacts(GetMap().NewDigSiteGeometryAsJson,__getServiceAreaContacts_onComplete);}
__getServiceAreaContacts_onComplete=function(result,response,method)
{if(result.substring(2,0)!="({")
{alert(result);return;}
var serviceAreas=eval(result).ServiceAreas,container=document.createElement('div'),contactTable=document.createElement('table'),header=contactTable.insertRow();header.className='datagridHeader';container.id='emergencyContactTable';contactTable.className='datagrid';contactTable.style.width='95%';contactTable.id=container.id+'_grid';header.insertCell().innerHTML='Member Utility';header.insertCell().innerHTML='Main Contact#';header.insertCell().innerHTML='Vacuum Contact#';header.insertCell().innerHTML='Emergency Contact#';header.insertCell().innerHTML='After Hours Contact#';for(var i=0;i<serviceAreas.length;i++)
{var row=contactTable.insertRow();row.className='datagridCell';row.insertCell().innerHTML=serviceAreas[i].Name;row.insertCell().innerHTML=serviceAreas[i].Main;row.insertCell().innerHTML=serviceAreas[i].Vacuum;row.insertCell().innerHTML=serviceAreas[i].Emergency;row.insertCell().innerHTML=serviceAreas[i].AfterHours;}
$getControl('MapFrame').style.visibility='hidden';$getControl('MapFrameInstructions').style.visibility='hidden';var search=$getControl('EmergencyContactSearch'),button=document.createElement('<input type="button" />'),printVersion=document.createElement('a'),spacer=document.createElement('div');spacer.innerHTML='&nbsp;';button.value='Another Search?';button.onclick="$getControl('EmergencyContactSearch').removeChild($getControl('emergencyContactTable'));$getControl('EmergencyContactLocations').style.display='block';$getControl('MapFrame').style.visibility = 'visible';$getControl('MapFrameInstructions').style.visibility = 'visible';";button.id=container.id+'_button';printVersion.innerHTML='Printer friendly version';printVersion.className='hyperlink';printVersion.onclick="__emergencyContacts_print();";printVersion.id=container.id+'_print';container.appendChild(contactTable);container.appendChild(button);container.appendChild(spacer);container.appendChild(printVersion);search.appendChild(container);new Event().RefreshAll(button.id);new Event().RefreshAll(printVersion.id);$getControl('EmergencyContactLocations').style.display='none';}
__getStates_onComplete=function(result,response,method){if(!result)return;var locations=new LocationsControl(eval(result).states,'EmergencyContactLocations');$getControl('EmergencyContactSearch').appendChild(locations.Render());var e=new Event();e.RefreshAll(locations.StateControl.Control);e.RefreshAll(locations.CountyControl.Control);e.RefreshAll(locations.ID+'_button');var mapFrame=$getControl('MapFrame');mapFrame.style.visibility='visible';mapFrame.style.width='800px';mapFrame.style.height='500px';$getControl('MapFrameInstructions').style.visibility='visible';ResizeMap();setTimeout("CheckMapEvents()",500);}
function CheckMapEvents()
{var map=GetMap();if((map!=null)&&map.IsMapDefinitionLoaded)
{var loc=new LocationsControl(null,'EmergencyContactLocations');map.ZoomToEnvelopeFromJson(loc.CountyControl.GetSelectedValue());}else
{setTimeout("CheckMapEvents()",500);}}
__locationsControl_setCounties=function(locationsID)
{var loc=new LocationsControl(null,locationsID),currentState=loc.StateControl.GetSelectedValue();loc.CountyControl.Clear();for(var i=0;i<loc.Locations.length;i++)
if(loc.Locations[i].abbr==currentState)
break;loc.Locations[i].counties.sort(function(a,b){var aText=a.name.toLowerCase(),bText=b.name.toLowerCase();if(aText<bText)return-1;if(aText>bText)return 1;return 0;});for(var j=0;j<loc.Locations[i].counties.length;j++)
loc.CountyControl.AddOption(loc.Locations[i].counties[j].env,loc.Locations[i].counties[j].name);GetMap().ZoomToEnvelopeFromJson(loc.CountyControl.GetSelectedValue());}
__locationsControl_changeCounty=function(locationsID)
{var loc=new LocationsControl(null,locationsID);GetMap().ZoomToEnvelopeFromJson(loc.CountyControl.GetSelectedValue());}
GetMap=function()
{return window.frames['MapFrame'].document.getElementById('_Map');}
__emergencyContacts_print=function()
{var win=window.open('','printwin','directories=0,location=0,menubar=0,scrollbars=0,titlebar=0,toolbar=0');win.document.write('<head><link id="stylesheet" href="'+GetBaseUrl()+'/Css/stylesheet.css" rel="stylesheet" type="text/css"/></head><body>'+$getControl('emergencyContactTable_grid').outerHTML+'</body>');win.document.close();win.document.location.reload(true);win.print();}

PasswordRequest=function(){}
PasswordRequest.prototype.Render=function(container)
{var obj='passwordRequest',firstName=new TextBox(obj+'Firstname','First Name',null,null,null,true),lastName=new TextBox(obj+'Lastname','Last Name',null,null,null,true),phone=new PhoneBox(obj+'Phone','Phone',null,null,null,true),company=new TextBox(obj+'Company','Company Name',null,null,null,true),companyFax=new FaxBox(obj+'Fax','Company Fax (optional)'),email=new EmailBox(obj+'Email','E-mail',null,null,null,true),sendButton=document.createElement('<input type="button">'),cancelButton=document.createElement('<input type="button">'),modalBack=document.createElement('div'),request=document.createElement('table');request.id='passwordRequest';request.className='passwordRequest';request.style.width='400px';modalBack.id=request.id+'_modalBack';modalBack.className='passwordRequest_background';sendButton.value='Send';sendButton.onclick='__passwordRequest_Send();';cancelButton.value='Cancel';cancelButton.onclick='$getControl(\''+modalBack.id+'\').style.visibility=\'hidden\';$getControl(\''+request.id+'\').style.visibility=\'hidden\';'
sendButton.className=cancelButton.className='passwordRequest_button';var title=request.insertRow().insertCell();title.className='passwordRequest_title';title.innerHTML='Request a New User Name and Password';request.insertRow().insertCell().appendChild(firstName.Render());request.insertRow().insertCell().appendChild(lastName.Render());request.insertRow().insertCell().appendChild(phone.Render());request.insertRow().insertCell().appendChild(company.Render());request.insertRow().insertCell().appendChild(companyFax.Render());request.insertRow().insertCell().appendChild(email.Render());var buttons=document.createElement("<table>")
row=buttons.insertRow();row.insertCell().appendChild(sendButton);row.insertCell().appendChild(cancelButton);var buttonCell=request.insertRow().insertCell();buttonCell.colSpan=2;buttonCell.appendChild(buttons);if(container)
{if(typeof container!='object')
container=$getControl(container);container.appendChild(modalBack);container.appendChild(request);firstName.AddEvents();lastName.AddEvents();phone.AddEvents();company.AddEvents();companyFax.AddEvents();email.AddEvents();new Event('onclick').AddToElement(cancelButton,cancelButton.onclick+'document.body.removeChild($getControl(\''+modalBack.id+'\'));document.body.removeChild($getControl(\''+request.id+'\'));');new Event('onclick').AddToElement(sendButton,sendButton.onclick);}
return request;}
__passwordRequest_Send=function()
{var obj='passwordRequest',first=new TextBox(obj+'Firstname'),last=new TextBox(obj+'Lastname'),phone=new PhoneBox(obj+'Phone'),company=new TextBox(obj+'Company'),fax=new FaxBox(obj+'Fax'),email=new EmailBox(obj+'Email');if(first.IsValid()&&last.IsValid()&&phone.IsValid()&&company.IsValid()&&fax.IsValid()&&email.IsValid())
PageMethods.SendPasswordRequest(first.Text,last.Text,phone.Text,company.Text,fax.Text,email.Text,"info@alberta1call.com",__passwordRequest_onComplete,__passwordRequest_onError);else
alert('Some of the fields are invalid. Hover your mouse over the error marks (X) to see what\'s wrong.');}
__passwordRequest_onComplete=function(result,response,method)
{alert('Your User Name and temporary password will be emailed to the address you provide within 3 business days');document.body.removeChild($getControl('passwordRequest'));document.body.removeChild($getControl('passwordRequest_modalBack'));}
__passwordRequest_onError=function(error,response,method)
{if(error)alert(error.get_message());}
try
{if(__JSUnit_version>0)
{__jsUnit.AddTest('PasswordRequest','Render','Display the password request box.','positive',function()
{var actual=new PasswordRequest('Your User Name and temporary password will be emailed to the address you provide within 3 business days').Render().outerHTML.replace(/[\r\n]/g,''),expected='';return new JSUnitTestResult(actual,expected,true);});}}
catch(err){}

