// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
//           (c) 2005 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


var Prototype={
Version:'1.4.0_pre4',
emptyFunction:function(){},
K:function(x){return x}}
var Class={
create:function(){
return function(){
this.initialize.apply(this,arguments);}}}
var Abstract=new Object();
Object.extend=function(destination,source){
for(property in source){
destination[property]=source[property];}
return destination;}
Function.prototype.bind=function(object){
var __method=this;
return function(){
return __method.apply(object,arguments);}}
Function.prototype.bindAsEventListener=function(object){
var __method=this;
return function(event){
return __method.call(object,event||window.event);}}
var Try={
these:function(){
var returnValue;
for(var i=0;i<arguments.length;i++){
var lambda=arguments[i];
try{
returnValue=lambda();
break;}catch(e){}}
return returnValue;}}
Object.extend(String.prototype,{
stripTags:function(){
return this.replace(/<\/?[^>]+>/gi,'');},
unescapeHTML:function(){
var div=document.createElement('div');
div.innerHTML=this.stripTags();
return div.childNodes[0].nodeValue;}});
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;}
var Ajax={
getTransport:function(){
return Try.these(
function(){return new ActiveXObject('Msxml2.XMLHTTP')},
function(){return new ActiveXObject('Microsoft.XMLHTTP')},
function(){return new XMLHttpRequest()})||false;}}
Ajax.Base=function(){};
Ajax.Base.prototype={
setOptions:function(options){
this.options={
method:'post',
asynchronous:true,
parameters:''}
Object.extend(this.options,options||{});},
responseIsSuccess:function(){
return this.transport.status==undefined||this.transport.status==0||(this.transport.status>=200&&this.transport.status<300);},
responseIsFailure:function(){
return !this.responseIsSuccess();}}
Ajax.Request=Class.create();
Ajax.Request.Events=['Uninitialized','Loading','Loaded','Interactive','Complete'];
Ajax.Request.prototype=Object.extend(new Ajax.Base(),{
initialize:function(url,options){
this.transport=Ajax.getTransport();
this.setOptions(options);
this.request(url);},
request:function(url){
var parameters=this.options.parameters||'';
if(parameters.length>0)parameters+='&_=';
try{
if(this.options.method=='get')
url+='?'+parameters;
this.transport.open(this.options.method,url,
this.options.asynchronous);
if(this.options.asynchronous){
this.transport.onreadystatechange=this.onStateChange.bind(this);
setTimeout((function(){this.respondToReadyState(1)}).bind(this),10);}
this.setRequestHeaders();
var body=this.options.postBody?this.options.postBody:parameters;
this.transport.send(this.options.method=='post'?body:null);}catch(e){}},
setRequestHeaders:function(){
var requestHeaders=['X-Requested-With','XMLHttpRequest',
'X-Prototype-Version',Prototype.Version];
if(this.options.method=='post'){
requestHeaders.push('Content-type',
'application/x-www-form-urlencoded');
if(this.transport.overrideMimeType)
requestHeaders.push('Connection','close');}
if(this.options.requestHeaders)
requestHeaders.push.apply(requestHeaders,this.options.requestHeaders);
for(var i=0;i<requestHeaders.length;i+=2)
this.transport.setRequestHeader(requestHeaders[i],requestHeaders[i+1]);},
onStateChange:function(){
var readyState=this.transport.readyState;
if(readyState!=1)
this.respondToReadyState(this.transport.readyState);},
respondToReadyState:function(readyState){
var event=Ajax.Request.Events[readyState];
if(event=='Complete')(this.options['on'+this.transport.status]||this.options['on'+(this.responseIsSuccess()?'Success':'Failure')]||Prototype.emptyFunction)(this.transport);(this.options['on'+event]||Prototype.emptyFunction)(this.transport);
if(event=='Complete')
this.transport.onreadystatechange=Prototype.emptyFunction;}});
if(!window.Element){
var Element=new Object();}
Object.extend(Element,{
toggle:function(){
for(var i=0;i<arguments.length;i++){
var element=$(arguments[i]);
element.style.display=(element.style.display=='none'?'':'none');}},
hide:function(){
for(var i=0;i<arguments.length;i++){
var element=$(arguments[i]);
element.style.display='none';}},
show:function(){
for(var i=0;i<arguments.length;i++){
var element=$(arguments[i]);
element.style.display='';}},
remove:function(element){
element=$(element);
element.parentNode.removeChild(element);},
getHeight:function(element){
element=$(element);
return element.offsetHeight;},
hasClassName:function(element,className){
element=$(element);
if(!element)
return;
var a=element.className.split(' ');
for(var i=0;i<a.length;i++){
if(a[i]==className)
return true;}
return false;},
addClassName:function(element,className){
element=$(element);
Element.removeClassName(element,className);
element.className+=' '+className;},
removeClassName:function(element,className){
element=$(element);
if(!element)
return;
var newClassName='';
var a=element.className.split(' ');
for(var i=0;i<a.length;i++){
if(a[i]!=className){
if(i>0)
newClassName+=' ';
newClassName+=a[i];}}
element.className=newClassName;},
cleanWhitespace:function(element){
var element=$(element);
for(var i=0;i<element.childNodes.length;i++){
var node=element.childNodes[i];
if(node.nodeType==3&&!/\S/.test(node.nodeValue))
Element.remove(node);}}});
if(!window.Event){
var Event=new Object();}
Object.extend(Event,{
KEY_BACKSPACE:8,
KEY_TAB:9,
KEY_RETURN:13,
KEY_ESC:27,
KEY_LEFT:37,
KEY_UP:38,
KEY_RIGHT:39,
KEY_DOWN:40,
KEY_DELETE:46,
element:function(event){
return event.target||event.srcElement;},
isLeftClick:function(event){
return(((event.which)&&(event.which==1))||((event.button)&&(event.button==1)));},
pointerX:function(event){
return event.pageX||(event.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));},
pointerY:function(event){
return event.pageY||(event.clientY+(document.documentElement.scrollTop||document.body.scrollTop));},
stop:function(event){
if(event.preventDefault){
event.preventDefault();
event.stopPropagation();}else{
event.returnValue=false;}},
findElement:function(event,tagName){
var element=Event.element(event);
while(element.parentNode&&(!element.tagName||(element.tagName.toUpperCase()!=tagName.toUpperCase())))
element=element.parentNode;
return element;},
observers:false,
_observeAndCache:function(element,name,observer,useCapture){
if(!this.observers)this.observers=[];
if(element.addEventListener){
this.observers.push([element,name,observer,useCapture]);
element.addEventListener(name,observer,useCapture);}else if(element.attachEvent){
this.observers.push([element,name,observer,useCapture]);
element.attachEvent('on'+name,observer);}},
unloadCache:function(){
if(!Event.observers)return;
for(var i=0;i<Event.observers.length;i++){
Event.stopObserving.apply(this,Event.observers[i]);
Event.observers[i][0]=null;}
Event.observers=false;},
observe:function(element,name,observer,useCapture){
var element=$(element);
useCapture=useCapture||false;
if(name=='keypress'&&((/Konqueror|Safari|KHTML/.test(navigator.userAgent))||element.attachEvent))
name='keydown';
this._observeAndCache(element,name,observer,useCapture);},
stopObserving:function(element,name,observer,useCapture){
element=(typeof element)=='string'?$(element):element;
useCapture=useCapture||false;
if(name=='keypress'&&((/Konqueror|Safari|KHTML/.test(navigator.userAgent))||element.detachEvent))
name='keydown';
if(element.removeEventListener){
element.removeEventListener(name,observer,useCapture);}else if(element.detachEvent){
element.detachEvent('on'+name,observer);}}});
Event.observe(window,'unload',Event.unloadCache,false);
var Position={
cumulativeOffset:function(element){
var valueT=0,valueL=0;
do{
valueT+=element.offsetTop||0;
valueL+=element.offsetLeft||0;
element=element.offsetParent;}while(element);
return[valueL,valueT];},
clone:function(source,target){
source=$(source);
target=$(target);
target.style.position='absolute';
var offsets=this.cumulativeOffset(source);
target.style.top=offsets[1]+'px';
target.style.left=offsets[0]+'px';
target.style.width=source.offsetWidth+'px';
target.style.height=source.offsetHeight+'px';}}
Effect={}
Effect.Transitions={}
Effect.Base=function(){};
Effect.Base.prototype={
setOptions:function(options){
this.options=Object.extend({
transition:Effect.Transitions.sinoidal,
duration:1.0,
fps:25.0,
sync:false,
from:0.0,
to:1.0},options||{});},
start:function(options){
this.setOptions(options||{});
this.currentFrame=0;
this.startOn=new Date().getTime();
this.finishOn=this.startOn+(this.options.duration*1000);
if(this.options.beforeStart)this.options.beforeStart(this);
if(!this.options.sync)this.loop();},
loop:function(){
var timePos=new Date().getTime();
if(timePos>=this.finishOn){
this.render(this.options.to);
if(this.finish)this.finish();
if(this.options.afterFinish)this.options.afterFinish(this);
return;}
var pos=(timePos-this.startOn)/(this.finishOn-this.startOn);
var frame=Math.round(pos*this.options.fps*this.options.duration);
if(frame>this.currentFrame){
this.render(pos);
this.currentFrame=frame;}
this.timeout=setTimeout(this.loop.bind(this),10);},
render:function(pos){
if(this.options.transition)pos=this.options.transition(pos);
pos*=(this.options.to-this.options.from);
pos+=this.options.from;
if(this.options.beforeUpdate)this.options.beforeUpdate(this);
if(this.update)this.update(pos);
if(this.options.afterUpdate)this.options.afterUpdate(this);},
cancel:function(){
if(this.timeout)clearTimeout(this.timeout);}}
Abstract.Insertion=function(adjacency){
this.adjacency=adjacency;}
Abstract.Insertion.prototype={
initialize:function(element,content){
this.element=$(element);
this.content=content;
if(this.adjacency&&this.element.insertAdjacentHTML){
this.element.insertAdjacentHTML(this.adjacency,this.content);}else{
this.range=this.element.ownerDocument.createRange();
if(this.initializeRange)this.initializeRange();
this.fragment=this.range.createContextualFragment(this.content);
this.insertContent();}}}
var Insertion=new Object();
Insertion.After=Class.create();
Insertion.After.prototype=Object.extend(new Abstract.Insertion('afterEnd'),{
initializeRange:function(){
this.range.setStartAfter(this.element);},
insertContent:function(){
this.element.parentNode.insertBefore(this.fragment,
this.element.nextSibling);}});
Effect.Fade=function(element){
options=Object.extend({
from:1.0,
to:0.0,
afterFinish:function(effect){Element.hide(effect.element);
effect.setOpacity(1);}},arguments[1]||{});
new Effect.Opacity(element,options);}
Effect.Appear=function(element){
options=Object.extend({
from:0.0,
to:1.0,
beforeStart:function(effect){effect.setOpacity(0);
Element.show(effect.element);},
afterUpdate:function(effect){Element.show(effect.element);}},arguments[1]||{});
new Effect.Opacity(element,options);}
Effect.Opacity=Class.create();
Object.extend(Object.extend(Effect.Opacity.prototype,Effect.Base.prototype),{
initialize:function(element){
this.element=$(element);
options=Object.extend({
from:0.0,
to:1.0},arguments[1]||{});
this.start(options);},
update:function(position){
this.setOpacity(position);},
setOpacity:function(opacity){
opacity=(opacity==1)?0.99999:opacity;
this.element.style.opacity=opacity;
this.element.style.filter="alpha(opacity:"+opacity*100+")";}});
Element.collectTextNodesIgnoreClass=function(element,ignoreclass){
var children=$(element).childNodes;
var text="";
var classtest=new RegExp("^([^ ]+ )*"+ignoreclass+"( [^ ]+)*$","i");
for(var i=0;i<children.length;i++){
if(children[i].nodeType==3){
text+=children[i].nodeValue;}else{
if((!children[i].className.match(classtest))&&children[i].hasChildNodes())
text+=Element.collectTextNodesIgnoreClass(children[i],ignoreclass);}}
return text;}
var Autocompleter={}
Autocompleter.Base=function(){};
Autocompleter.Base.prototype={
base_initialize:function(element,update,options){
this.element=$(element);
this.update=$(update);
this.has_focus=false;
this.changed=false;
this.active=false;
this.index=0;
this.entry_count=0;
if(this.setOptions)
this.setOptions(options);
else
this.options={}
this.options.tokens=this.options.tokens||new Array();
this.options.frequency=this.options.frequency||0.8;
this.options.min_chars=this.options.min_chars||2;
this.options.onShow=this.options.onShow||
function(element,update){
if(!update.style.position||update.style.position=='absolute'){
update.style.position='absolute';
var offsets=Position.cumulativeOffset(element);
var safariFixWidth=(navigator.appVersion.indexOf('AppleWebKit')>0)?document.getElementById('page').offsetLeft+6:0;
update.style.left=offsets[0]+safariFixWidth+'px';
update.style.top=(offsets[1]+element.offsetHeight)+'px';
update.style.width=element.offsetWidth+'px';}
new Effect.Appear(update,{duration:0.15});};
this.options.onHide=this.options.onHide||
function(element,update){new Effect.Fade(update,{duration:0.15})};
if(this.options.indicator)
this.indicator=$(this.options.indicator);
if(typeof(this.options.tokens)=='string')
this.options.tokens=new Array(this.options.tokens);
this.observer=null;
Element.hide(this.update);
Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this));
Event.observe(this.element,"keypress",this.onKeyPress.bindAsEventListener(this));},
show:function(){
if(this.update.style.display=='none'){
this.options.onShow(this.element,this.update);
if(this.update.scrollHeight>this.update.clientHeight){
this.update.scrollTop=0;}}
if(!this.iefix&&(navigator.appVersion.indexOf('MSIE')>0)&&this.update.style.position=='absolute'){
new Insertion.After(this.update,
'<iframe id="'+this.update.id+'_iefix" '+
'style="display:none;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=50);" '+
'src="javascript:false;" frameborder="1" scrolling="yes" height="20"> </iframe>');
this.iefix=$(this.update.id+'_iefix');}
if(this.iefix){
Position.clone(this.update,this.iefix);
this.iefix.style.zIndex=1;
this.update.style.zIndex=2;}},
hide:function(){
if(this.update.style.display=='')this.options.onHide(this.element,this.update);
if(this.iefix)Element.hide(this.iefix);
this.removeCloseButton();},
startIndicator:function(){
if(this.indicator)Element.show(this.indicator);},
stopIndicator:function(){
if(this.indicator)Element.hide(this.indicator);},
onKeyPress:function(event){
if(this.active)
switch(event.keyCode){
case Event.KEY_TAB:
case Event.KEY_RETURN:
this.select_entry();
Event.stop(event);
case Event.KEY_ESC:
this.hide();
this.active=false;
return;
case Event.KEY_LEFT:
case Event.KEY_RIGHT:
return;
case Event.KEY_UP:
this.mark_previous();
this.renderKey();
if(navigator.appVersion.indexOf('AppleWebKit')>0)Event.stop(event);
return;
case Event.KEY_DOWN:
this.mark_next();
this.renderKey();
if(navigator.appVersion.indexOf('AppleWebKit')>0)Event.stop(event);
return;}
else
if(event.keyCode==Event.KEY_TAB||event.keyCode==Event.KEY_RETURN)
return;
this.changed=true;
this.has_focus=true;
if(this.observer)clearTimeout(this.observer);
this.observer=
setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000);},
onHover:function(event){
var element=Event.findElement(event,'LI');
if(this.index!=element.autocompleteIndex){
this.index=element.autocompleteIndex;
this.render();}
Event.stop(event);},
onClick:function(event){
var element=Event.findElement(event,'LI');
this.index=element.autocompleteIndex;
this.select_entry();
Event.stop(event);
if(navigator.appVersion.indexOf('AppleWebKit')>0&&this.update.scrollHeight>this.update.clientHeight&&this.safariBlurEventFired){
this.safariBlurEventFired=false;
var scrollbarWidth=this.update.offsetWidth-this.update.clientWidth;
var offsets=Position.cumulativeOffset(this.update);
var scrollLeft=offsets[0]+this.update.clientWidth;
var scrollRight=scrollLeft+scrollbarWidth;
var scrollTop=offsets[1];
var scrollBottom=scrollTop+this.update.clientHeight;
var xClick=event.clientX;
var yClick=event.clientY;
if(xClick>=scrollLeft&&xClick<scrollRight&&yClick>=scrollTop&&yClick<scrollBottom){
this.hasFocus=true;
this.active=true;}
else{
setTimeout(this.hide.bind(this),250);
this.hasFocus=false;
this.active=false;}}},
onBlur:function(event){
if(navigator.appVersion.match(/\bMSIE\b/)&&!window.opera&&this.update.style.display!='none'){
var verticalScrollbarWidth=this.update.offsetWidth-this.update.clientWidth-
this.update.clientLeft-(parseInt(this.update.currentStyle['borderRightWidth'])||0);
if(verticalScrollbarWidth){
var x=event.clientX,y=event.clientY,parent=this.update.offsetParent,
sbLeft=this.update.offsetLeft+this.update.clientLeft+this.update.clientWidth,
sbTop=this.update.offsetTop+this.update.clientTop,
sbRight=sbLeft+verticalScrollbarWidth,
sbBottom=sbTop+this.update.clientHeight;
while(parent){
var offs=parent.offsetLeft+parent.clientLeft,scrollOffs=offs-parent.scrollLeft;
sbLeft=(sbLeft+=scrollOffs)<offs?offs:sbLeft;
sbRight=(sbRight+=scrollOffs)<offs?offs:sbRight;
offs=parent.offsetTop+parent.clientTop;scrollOffs=offs-parent.scrollTop;
sbTop=(sbTop+=scrollOffs)<offs?offs:sbTop;
sbBottom=(sbBottom+=scrollOffs)<offs?offs:sbBottom;
parent=parent.offsetParent;}
if(x>=sbLeft&&x<sbRight&&y>=sbTop&&y<sbBottom){
this.element.setActive();
return;}
if(this.update.scrollWidth>this.update.clientWidth){
var horz_scrollbarLeft=this.update.offsetLeft;
var horz_scrollbarRight=this.update.offsetLeft+this.update.offsetWidth;
var horz_scrollbarTop=this.update.offsetTop+this.update.clientHeight;
var horz_scrollbarBottom=this.update.offsetTop+this.update.offsetHeight;
if(x>=horz_scrollbarLeft&&x<horz_scrollbarRight&&y>=horz_scrollbarTop&&y<horz_scrollbarBottom){
this.element.setActive();
return;}}}}
if(navigator.appVersion.indexOf('AppleWebKit')>0){
if(this.update.scrollHeight>this.update.clientHeight){
this.safariBlurEventFired=true;
return;}}
setTimeout(this.hide.bind(this),250);
this.hasFocus=false;
this.active=false;},
addCloseButton:function(){
var closeButtonDiv=document.createElement("div");
closeButtonDiv.id='closeButtonDiv';
Event.observe(closeButtonDiv,"click",this.onClick.bindAsEventListener(this));
closeButtonDiv.className="auto_complete_close";
closeButtonDiv.innerHTML="<a href=\"#\">Close</a>";
var theWidth=this.update.clientWidth;
var offsets=Position.cumulativeOffset(this.update);
var leftPosition=offsets[0];
var scrollTop=offsets[1]+200;
closeButtonDiv.style.width=theWidth+'px';
closeButtonDiv.style.left=leftPosition+'px';
closeButtonDiv.style.top=scrollTop+'px';
this.update.parentNode.appendChild(closeButtonDiv);},
removeCloseButton:function(){
if(document.getElementById('closeButtonDiv')!=null){
this.update.parentNode.removeChild(document.getElementById('closeButtonDiv'));}},
render:function(){
if(this.entry_count>0){
for(var i=0;i<this.entry_count;i++){
this.index==i?Element.addClassName(this.get_entry(i),"selected"):
Element.removeClassName(this.get_entry(i),"selected");}
if(this.has_focus){
this.show();
this.active=true;}}else this.hide();
if(navigator.appVersion.indexOf('AppleWebKit')>0&&document.getElementById('closeButtonDiv')==null&&this.update.scrollHeight>this.update.clientHeight){
this.addCloseButton();}},
renderKey:function(){
if(this.entry_count>0){
for(var i=0;i<this.entry_count;i++)
this.index==i?
Element.addClassName(this.get_entry(i),"selected"):
Element.removeClassName(this.get_entry(i),"selected");
if(this.has_focus){
if(this.get_current_entry().scrollIntoView)
this.get_current_entry().scrollIntoView(false);
this.show();
this.active=true;}}else this.hide();},
mark_previous:function(){
if(this.index>0){
this.index--}
else{
this.index=this.entry_count-1}},
mark_next:function(){
if(this.index<this.entry_count-1){
this.index++}
else{
this.index=0;}},
get_entry:function(index){
return this.update.firstChild.childNodes[index];},
get_current_entry:function(){
return this.get_entry(this.index);},
select_entry:function(){
this.active=false;
value=Element.collectTextNodesIgnoreClass(this.get_current_entry(),'informal').unescapeHTML();
this.updateElement(value);
this.element.focus();},
updateElement:function(value){
var last_token_pos=this.findLastToken();
if(last_token_pos!=-1){
var new_value=this.element.value.substr(0,last_token_pos+1);
var whitespace=this.element.value.substr(last_token_pos+1).match(/^\s+/);
if(whitespace)
new_value+=whitespace[0];
this.element.value=new_value+value;}else{
this.element.value=value;}},
updateChoices:function(choices){
if(!this.changed&&this.has_focus){
this.update.innerHTML=choices;
Element.cleanWhitespace(this.update);
Element.cleanWhitespace(this.update.firstChild);
if(this.update.firstChild&&this.update.firstChild.childNodes){
this.entry_count=
this.update.firstChild.childNodes.length;
for(var i=0;i<this.entry_count;i++){
entry=this.get_entry(i);
entry.autocompleteIndex=i;
this.addObservers(entry);}}else{
this.entry_count=0;}
this.stopIndicator();
this.index=0;
this.render();}},
addObservers:function(element){
Event.observe(element,"mouseover",this.onHover.bindAsEventListener(this));
Event.observe(element,"click",this.onClick.bindAsEventListener(this));},
onObserverEvent:function(){
this.changed=false;
if(this.getEntry().length>=this.options.min_chars){
this.startIndicator();
this.getUpdatedChoices();}else{
this.active=false;
this.hide();}},
getEntry:function(){
var token_pos=this.findLastToken();
if(token_pos!=-1)
var ret=this.element.value.substr(token_pos+1).replace(/^\s+/,'').replace(/\s+$/,'');
else
var ret=this.element.value;
return/\n/.test(ret)?'':ret;},
findLastToken:function(){
var last_token_pos=-1;
for(var i=0;i<this.options.tokens.length;i++){
var this_token_pos=this.element.value.lastIndexOf(this.options.tokens[i]);
if(this_token_pos>last_token_pos)
last_token_pos=this_token_pos;}
return last_token_pos;}}
Ajax.Autocompleter=Class.create();
Ajax.Autocompleter.prototype=Object.extend(new Autocompleter.Base(),
Object.extend(new Ajax.Base(),{
initialize:function(element,update,url,options){
this.base_initialize(element,update,options);
this.options.asynchronous=true;
this.options.onComplete=this.onComplete.bind(this);
this.options.method='post';
this.url=url;},
getUpdatedChoices:function(){
entry=encodeURIComponent(this.element.name)+'='+
encodeURIComponent(this.getEntry());
this.options.parameters=this.options.callback?
this.options.callback(this.element,entry):entry;
new Ajax.Request(this.url,this.options);},
onComplete:function(request){
this.updateChoices(request.responseText);}}));
Autocompleter.Local=Class.create();
Autocompleter.Local.prototype=Object.extend(new Autocompleter.Base(),{
initialize:function(element,update,array,options){
this.base_initialize(element,update,options);
this.options.array=array;},
getUpdatedChoices:function(){
this.updateChoices(this.options.selector(this));},
setOptions:function(options){
this.options=Object.extend({
choices:10,
partial_search:true,
partial_chars:2,
ignore_case:true,
full_search:false,
selector:function(instance){
var ret=new Array();
var partial=new Array();
var entry=instance.getEntry();
var count=0;
for(var i=0;i<instance.options.array.length&&
ret.length<instance.options.choices;i++){
var elem=instance.options.array[i];
var found_pos=instance.options.ignore_case?
elem.toLowerCase().indexOf(entry.toLowerCase()):
elem.indexOf(entry);
if(found_pos==0&&elem.length==entry.length)
continue;
else if(found_pos==0)
ret.push("<li><strong>"+elem.substr(0,entry.length)+"</strong>"+
elem.substr(entry.length)+"</li>");
else if(entry.length>=instance.options.partial_chars&&
instance.options.partial_search&&found_pos!=-1){
if(!instance.options.full_search&&!/\s/.test(elem.substr(found_pos-1,1)))
continue;
partial.push("<li>"+elem.substr(0,found_pos)+"<strong>"+
elem.substr(found_pos,entry.length)+"</strong>"+elem.substr(
found_pos+entry.length)+"</li>")}}
if(partial.length)
ret=ret.concat(partial.slice(0,instance.options.choices-ret.length))
return "<ul>"+ret.join('')+"</ul>";}},options||{});}});
Ajax.RAAutocompleter=Class.create();
Ajax.RAAutocompleter.prototype=Object.extend(new Autocompleter.Base(),
Object.extend(new Ajax.Base(),{
initialize:function(element,update,url,options,additionalAlias){
this.base_initialize(element,update,options);
this.options.asynchronous=true;
this.options.onComplete=this.onComplete.bind(this);
this.options.method='post';
this.url=url;
this.additionalAlias=additionalAlias;},
getUpdatedChoices:function(){
var textValue=encodeURIComponent(this.getEntry());
entry=encodeURIComponent(this.element.name)+'='+textValue;
if(this.additionalAlias['alias'])
entry+="&"+this.additionalAlias['alias']+"="+textValue;
if(this.additionalAlias['paramAliases']){
var paramAliases=this.additionalAlias['paramAliases'];
for(i=0;i<paramAliases.length;i++){
var element=$(paramAliases[i]['element']);
entry+=("&"+paramAliases[i]['alias']+"="+element.value);}}
this.options.parameters=this.options.callback?
this.options.callback(this.element,entry):entry;
new Ajax.Request(this.url,this.options);},
onComplete:function(request){
try{
this.updateChoices(request.responseText);
var newHeight=this.update.firstChild.offsetHeight>200?200:this.update.firstChild.offsetHeight;
if(this.entry_count>0)
this.update.style.height=(newHeight)+'px';
else
this.update.style.display='none';}
catch(e){
this.update.style.display='none';}},
select_entry:function(){
try{
this.active=false;
var state=this.getAttriuteValue('state');
var nameWithState=this.getAttriuteValue('duplicated');
value=Element.collectTextNodesIgnoreClass(this.get_current_entry(),'informal').unescapeHTML();
if(nameWithState=='true')
value=value.substring(0,value.length-state.length-1);
this.updateElement(value);
$('pstate').value=state;
window.setTimeout(changeState($('pstate').options[$('pstate').selectedIndex].value),0);
this.element.focus();}catch(e){}},
getAttriuteValue:function(attrName){
var node=this.get_current_entry();
if(node.attributes){
for(var j=0;j<node.attributes.length;j++){
if(node.attributes[j].nodeName.toLowerCase()==attrName)
return node.attributes[j].nodeValue;}}
return "";}}));
Ajax.DropdownGroup=Class.create();
Ajax.DropdownGroup.prototype={
initialize:function(){
this.originalOnChange=null;},
register:function(groupName,dropdown){
var dropdowns=this[groupName];
if(!dropdowns){
dropdowns=new Array();
this[groupName]=dropdowns;
var f=$(groupName).onchange;
if(f)
this.originalOnChange=f.bind($(groupName));}
dropdowns.push(dropdown);},
onChange:function(groupName){
if(this.originalOnChange)
this.originalOnChange();
var dropdowns=this[groupName];
if(dropdowns){
for(var i=0;i<dropdowns.length;i++){
dropdowns[i].onChange();}}}};
var __DropwdownManager=new Ajax.DropdownGroup();
Ajax.Dropdown=Class.create();
Ajax.Dropdown.prototype=Object.extend(new Ajax.Base(),{
initialize:function(srcElementName,srcAlias,targetElementName,url){
this.srcElementName=srcElementName;
this.srcAlias=srcAlias;
this.targetElementName=targetElementName;
this.url=url;
this.options={}
this.options.onComplete=this.onComplete.bind(this);
this.options.asynchronous=true;
this.options.method='post';
__DropwdownManager.register(srcElementName,this);
$(srcElementName).onchange=function(){
__DropwdownManager.onChange(srcElementName);}},
onComplete:function(request){
eval(request.responseText);
showHiddenOptions($(this.srcElementName),$(this.srcElementName).value!="");},
onChange:function(){
var selectedValue=$(this.srcElementName).value;
if(selectedValue==null||selectedValue==""){
showHiddenOptions($(this.srcElementName),false);
return false;}
this.options.parameters=encodeURIComponent(this.srcAlias)+'='+encodeURIComponent(selectedValue)+
"&targetUIID="+this.targetElementName;
new Ajax.Request(this.url,this.options);}});
Ajax.DynamicHTML=Class.create();
Ajax.DynamicHTML.prototype=Object.extend(new Ajax.Base(),{
initialize:function(url){
this.url=url;
this.options={}
this.options.onComplete=this.onComplete.bind(this);
this.options.asynchronous=true;
this.options.method='post';},
onComplete:function(request){
eval(request.responseText);},
submit:function(p){
this.options.parameters=p;
new Ajax.Request(this.url,this.options);}});
function browserInfo(){
var browserName="Unknown";
var browserCode="Unknown";
var browserAgent="Unknown";
var browserPlatForm="Unknown";
var browserVersion="-1";
if(navigator){
browserName=navigator.appName;
browserCode=navigator.appCodeName;
browserAgent=navigator.userAgent;
browserPlatForm=navigator.platform;
browserVersion=navigator.appVersion;}
new Ajax.Request("/ajax/browserInfo?name="+browserName+"&version="+browserVersion+"&code="+browserCode+"&agent="+browserAgent+"&platform="+browserPlatForm,{});}
function makeHttpRequest(url,callback_function,return_xml,alertError){
var http_request,response,i;
var activex_ids=[
'MSXML2.XMLHTTP.3.0',
'MSXML2.XMLHTTP',
'Microsoft.XMLHTTP'];
if(window.XMLHttpRequest){
http_request=new XMLHttpRequest();
if(http_request.overrideMimeType){
http_request.overrideMimeType('text/xml');}}else if(window.ActiveXObject){
for(i=0;i<activex_ids.length;i++){
try{
http_request=new ActiveXObject(activex_ids[i]);}catch(e){}}}
if(!http_request){
if(alertError){
alert('Unfortunatelly you browser doesn\'t support this feature.');}
return false;}
http_request.onreadystatechange=function(){
if(http_request.readyState!==4){
return false;}
if(http_request.status!==200){
if(alertError){
alert('There was a problem with the request.(Code: '+http_request.status+')');}
return false;}
if(return_xml){
response=http_request.responseXML;}else{
response=http_request.responseText;
if(response=="signin"){
document.location='/memberSignInDisplay.do?topTabIndex=MyAccount';
return false;}}
callback_function(response);};
http_request.open('GET',url,true);
http_request.send(null);}
function logoff(){
if(document.all){
if(window.screenTop>9999){
window.location.href="/memberLogging.do";}else{}}}/*
dates.js
2005-10-24*/
dashExpr=new RegExp("-","g");
defaultMaxWindowMonths=12;
function asDoubleDigit(value){
return(String(value).length==1)?"0"+value:value;}
function updateDefaultMaximumWindow(stateDropdown){
var currentStateCode=stateDropdown.options[stateDropdown.selectedIndex].value;
var currentMaximumWindowMonths=document.getElementById("currentMaximumWindow");
var stateDefaultMaxWindowMapping=document.getElementById("stateDefaultMaxWindow");
currentMaximumWindowMonths.value=defaultMaxWindowMonths;
if(currentMaximumWindowMonths!=null&&stateDefaultMaxWindowMapping!=null){
theMappings=stateDefaultMaxWindowMapping.value;
if(theMappings.indexOf(currentStateCode)>-1&&currentStateCode!=""){
var stateMappings=theMappings.split(";");
for(i=0;i<stateMappings.length;i++){
if(stateMappings[i].indexOf(currentStateCode)>-1){
result=stateMappings[i].split(":");
currentMaximumWindowMonths.value=result[1];}}}
else{
currentMaximumWindowMonths.value=defaultMaxWindowMonths;}}}
function readDate(inputDate){
today=new Date();
today.setHours(-1);
if(!isNaN(inputDate)){
if((inputDate>1000)&&(inputDate<9999)){
inputDate="Jan 1 ,"+inputDate;}}else{
inputDate=inputDate.replace(dashExpr,"/");}
theDate=new Date(inputDate);
theDate=forceYearWithinWindow(theDate);
if(isNaN(theDate))theDate=forceToNextYear(new Date(inputDate+", "+today.getFullYear()),today);
if(isNaN(theDate))theDate=new Date(inputDate+" 1");
if(isNaN(theDate))theDate=forceToNextYear(new Date(inputDate+", "+today.getFullYear()+" 1"),today);
if(isNaN(theDate))theDate=null;
return theDate;}
function forceYearWithinWindow(theDate,yearsBeforeThisYear,yearsAfterThisYear){
if(yearsBeforeThisYear==null)yearsBeforeThisYear=50;
if(yearsAfterThisYear==null)yearsAfterThisYear=50;
thisYear=new Date().getFullYear();
theYear=theDate.getFullYear();
if(theYear<thisYear){
if(thisYear-theYear>yearsBeforeThisYear){
theYear+=100;
if(theYear-thisYear>yearsAfterThisYear){
theYear=thisYear-yearsBeforeThisYear;}}}else{
if(theYear-thisYear>yearsAfterThisYear){
theYear=1*thisYear+yearsAfterThisYear;}}
theDate.setFullYear(theYear);
return theDate;}
function forceToNextYear(theDate,minimumDate){
if(!isNaN(theDate)&&(theDate<minimumDate))theDate.setFullYear(theDate.getFullYear()+1);
return theDate;}
function forceWithinDateWindow(theDate,minimumDate,maximumDate){
if((theDate.valueOf()<minimumDate.valueOf())||(isNaN(theDate))){
theDate=new Date(minimumDate);}else if(theDate.valueOf()>maximumDate.valueOf()){
theDate=new Date(maximumDate);}
return theDate;}
function toISODate(theDate){
if(theDate!=null)return theDate.getFullYear()+"-"+asDoubleDigit(theDate.getMonth()+1)+"-"+asDoubleDigit(theDate.getDate());
else return "";}
function toDateString(theDate){
if(theDate!=null)return theDate.toDateString();
else return "";}
function reformatDate(inputDate){
return toDateString(readDate(inputDate))}
function orderDateInElements(startEleId,endDateEle){
resStartDate=readDate(startDateEle.getAttribute("value"));
resEndDate=readDate(endDateEle.getAttribute("value"));
if((resEndDate<resStartDate)&&(resEndDate!=null)){
startDateEle.setAttribute("value",toDateString(resEndDate));
endDateEle.setAttribute("value",toDateString(resStartDate));}}
function setNights(nightsEle,startDateEle,endDateEle){
startDate=readDate(startDateEle.getAttribute("value"));
endDate=readDate(endDateEle.getAttribute("value"));
nights=(endDate-startDate)/(1000*60*60*24);
if(nights>0)nightsEle.setAttribute("value",nights);}
function updateNights(nightsEle,startDateEle,endDateEle){
if((startDateEle!=null)&&(endDateEle!=null)&&(nightsEle!=null)){
nights=1*(nightsEle.getAttribute("value"));
startDate=readDate(startDateEle.getAttribute("value"));
startDate.setDate(1*(startDate.getDate())+nights);
endDateEle.setAttribute("value",toDateString(startDate));}}
function setDisplayDateText(){
document.getElementById('displayDate').innerText=new Date().toDateString();}
function fireEvent(theObject,eventAttribute){
try{
theObject.fireEvent(eventAttribute);}catch(e){
try{
eval("theObject."+eventAttribute+"()");}catch(e){}}}
function setDefaultEndDate(arvDateId,endDateId,lengthOfStayId){
var arvDate=document.getElementById(arvDateId);
if(arvDate.value=="")return;
var endDate=document.getElementById(endDateId);
var lengthOfStay=document.getElementById(lengthOfStayId);
if(endDate.value==""){
nights=1*lengthOfStay.value;
if(nights==0){nights=14;}
startDate=readDate(arvDate.value);
var newEndDate=new Date(startDate);
newEndDate.setDate(1*(newEndDate.getDate())+nights);
endDate.value=toDateString(newEndDate);}}/*
File:page_init.js;
Description:standard onload init;
References:none;*/
function init(){
try{
addPopupIframe("popupCalendar","/htm/pop_calendar.html",true);}catch(e){}}
function initSiteSarch(){
activeKeyAttrPopup=false;
try{
addPopupIframe("popupCalendar","/htm/pop_calendar.html",true);
addPopupIframe("popupKeyAttr","/htm/pop_keyattributes.html",false);}catch(e){}}
function initHome(){
try{
init();
refreshHiddenOptions(document.getElementById("homesearchform"));}catch(e){}}
function initCampsiteDetail(){
try{
init();
fireEvent(window.document.booksiteform.arrivaldate,'onchange');}catch(e){}}
function initKoaCampsiteDetail(){
try{
init();
fireEvent(window.document.koaCampsiteDetailsForm.arrivalDate,'onchange');
fireEvent(window.document.koaCampsiteDetailsForm.equipmentType,'onchange');}catch(e){}}
function checkForJS(name){
var form=document.getElementById(name);
form.jssupport.value="true";}
function initTourDetails(){
try{
init();
fireEvent(window.document.tourAvailForm.tourDate,'onchange');}catch(e){}}
function updatePermitPricingTable(personTypeQtyField){
if(isNaN(personTypeQtyField.value)){
personTypeQtyField.value="";
return;}
calculateTotalPriceAndQty();}
function calculateTotalPriceAndQty(){
var theTable=document.getElementById('formSection');
var totalMoney=0;
var totalPricePerPersonType=0;
var totalNumberOfPeople=0;
var personTypeId;
var entryDateInput="";
var exitDateInputValue="";
var stayLenght="";
var theCell;
var groupSizePerPersonPerStay=false;
var countEntryDateRows=0;
var rates=null;
var dayOfEntryDate=null;
if(theTable&&theTable.rows){
for(ndex=0;ndex<theTable.rows.length;ndex++){
if(theTable.rows[ndex].id=="entryRowId"){
groupSizePerPersonPerStay=true;
countEntryDateRows++;
var stayLenghtField;
for(j=0;j<theTable.rows[ndex].cells.length;j++){
theCell=theTable.rows[ndex].cells[j];
if(getChildByID(theCell,'entrydateid'))
entryDateInput=getChildByID(theCell,'entrydateid').value;
if(getChildByID(theCell,'#ofdaysid')){
stayLenghtField=getChildByID(theCell,'#ofdaysid');
stayLenght=stayLenghtField.value;}}
var staylenghtInput=stayLenght.replace(/^\s+|\s+$/g,'');
if(isNaN(staylenghtInput)){
stayLenghtField.value="";
return;}
var entryDate=readDate(entryDateInput);
if(entryDate&&staylenghtInput!=""){
entryDate.setDate(entryDate.getDate()+Number(staylenghtInput)-1);
exitDateInputValue=toDateString(entryDate);
entryDate=readDate(entryDateInput);}else{
exitDateInputValue="";}
var allRowDivs=theTable.rows[ndex].getElementsByTagName('DIV');
for(i=0;i<allRowDivs.length;i++){
if(allRowDivs[i].id=='exitDateDivId'){
allRowDivs[i].innerHTML=exitDateInputValue;}
if(allRowDivs[i].id=='removebuttondiv'){
allRowDivs[i].style.display=(countEntryDateRows>1)?"":"none";}}}
if(theTable.rows[ndex].className=="personTypeInfo"){
var userEnteredQty=0;
for(j=0;j<theTable.rows[ndex].cells.length;j++){
theCell=theTable.rows[ndex].cells[j];
if(theCell.className=="personQty"){
userEnteredQty=getChildByID(theCell,'qtyPersonsId').value;
totalNumberOfPeople+=userEnteredQty*1;
if(getChildByID(theCell,'personPricing')){
var	personTypePricing=getChildByID(theCell,'personPricing').value;
personTypeId=getChildByID(theCell,'personTypeId').value;
var floatTotalPPPT=0;
if(groupSizePerPersonPerStay==true){
if(entryDate!=null){
var dayOfEntryDate=entryDate.getDay();
rates=getChildByID(theCell,'personPricingPerStay').value.split(",");
for(i=0;i<Number(staylenghtInput);i++){
floatTotalPPPT+=rates[((dayOfEntryDate+i)%7)]*userEnteredQty;}}}else{
floatTotalPPPT=personTypePricing*userEnteredQty;}
totalPricePerPersonType=Math.round(floatTotalPPPT*100)/100;
totalMoney+=totalPricePerPersonType;}}
if(groupSizePerPersonPerStay==true&&theCell.id=='ratePerPerson'&&rates!=null){
var allCellDivs=theCell.getElementsByTagName('DIV');
var multiRate=false;
if(Number(staylenghtInput)>1){
var rateForTheFirstDay=rates[0];
for(m=0;m<rates.length;m++){
if(multiRate==false&&rateForTheFirstDay!=rates[m]){
multiRate=true;
allCellDivs[0].innerHTML="Multi";}}}
if(multiRate!=true)
allCellDivs[0].innerHTML="$"+addDecimals(rates[((dayOfEntryDate)%7)],2);}
if(theCell.id=='totalPerPerson'){
if(getChildByID(theCell,'totalPricePerPersonType'+personTypeId))
getChildByID(theCell,'totalPricePerPersonType'+personTypeId).value="$"+addDecimals(totalPricePerPersonType,2);}}}}
document.getElementById('totalGroupSize').innerHTML=totalNumberOfPeople;
if(document.getElementById('calcTotal'))
document.getElementById('calcTotal').innerHTML="$"+addDecimals(totalMoney,2);
changeTotalGroupSizeStatus();}}
function getChildByID(theNode,theId){
var theChild=null;
var inputTypeChildren=theNode.getElementsByTagName("input")
for(i=0;i<inputTypeChildren.length;i++){
if(inputTypeChildren[i].id==theId){
theChild=inputTypeChildren[i];
break;}}
return theChild;}
function changeTotalGroupSizeStatus(){
var maxGroupSizeAllowed=document.getElementById('maxSizeTotalAllowed').value;
var enteredTotal=document.getElementById('totalGroupSize').innerHTML-=0;;
if(maxGroupSizeAllowed>0&&enteredTotal>maxGroupSizeAllowed){
document.getElementById('totalQuantity').className="overMaxGroupSize";
document.getElementById('personTypeError').innerHTML="Your Group Size exceeds the maximum group size allowed. Please change your Group Size."
document.getElementById('personTypeError').className="msg error";}
else if(enteredTotal>0){
document.getElementById('totalQuantity').className="totalQuantity";
document.getElementById('personTypeError').innerHTML="";
document.getElementById('personTypeError').className="";}}
function updateWaterCraftQtyTable(watercraftTypeQtyField){
if(isNaN(watercraftTypeQtyField.value)){
watercraftTypeQtyField.value="";
return;}
calculateTotalWaterCraftQty();}
function calculateTotalWaterCraftQty(){
var theTable=document.getElementById('watercraftFormSection');
var totalNumberOfWaterCrafts=0;
if(theTable&&theTable.rows){
for(ndex=0;ndex<theTable.rows.length;ndex++){
if(theTable.rows[ndex].className=="personTypeInfo"){
var userEnteredQty=0;
for(j=0;j<theTable.rows[ndex].cells.length;j++){
var theCell=theTable.rows[ndex].cells[j];
if(theCell.className=="personQty"){
userEnteredQty=getChildByID(theCell,'qtyWaterCraftsId').value;
totalNumberOfWaterCrafts+=userEnteredQty*1;}}}}
document.getElementById('totalWatercraft').innerHTML=totalNumberOfWaterCrafts;
changeTotalWatercraftStatus();
rebuildBoatGroupLeaderPanel();}}
function changeTotalWatercraftStatus(){
var maxWatercraftAllowed=document.getElementById('maxWaterCraftTotalAllowed').value;
var enteredTotal=document.getElementById('totalWatercraft').innerHTML-=0;;
if(maxWatercraftAllowed>0&&enteredTotal>maxWatercraftAllowed){
document.getElementById('totalWatercraftQuantity').className="overMaxGroupSize";
document.getElementById('watercraftTypeError').innerHTML="Your Total Number of Watercrafts exceeds the maximum watercraft number allowed. Please change your Watercraft Number."
document.getElementById('watercraftTypeError').className="msg error";}
else if(enteredTotal>0){
document.getElementById('totalWatercraftQuantity').className="totalQuantity";
document.getElementById('watercraftTypeError').innerHTML="";
document.getElementById('watercraftTypeError').className="";}}
function rebuildBoatGroupLeaderPanel(){
if(document.getElementById('watercraftTypeModel')){
var theFormTable=document.getElementById('boatLeaderInfoTable');
if(theFormTable!=null){
var entryCount=0;
var lastBoatRowIndx=0;
allTableRows=theFormTable.getElementsByTagName('TR');
for(ndex=0;ndex<allTableRows.length;ndex++){
if(allTableRows[ndex].id=='boatLeaderInfoRow'){
entryCount++;
lastBoatRowIndx=ndex;}}
var waterCraftTypeModel=document.getElementById('watercraftTypeModel').value;
var totalQty=0;
if(waterCraftTypeModel=='true'){
totalQty=document.getElementById('totalWatercraft').innerHTML-=0;}else{
totalQty=document.getElementById('numberofwatercraftid').value;}
if(totalQty==0){
for(indx=0;indx<4;indx++){
addFormRow('boatLeaderInfoTable','boatLeaderInfoRow',4);}}else{
if(totalQty-1>entryCount){
for(indx=0;indx<(totalQty-entryCount-1);indx++){
addFormRow('boatLeaderInfoTable','boatLeaderInfoRow',totalQty-1);}}
if(totalQty-1<entryCount){
var diff=entryCount-totalQty+1;
if(totalQty==1)diff--;
for(diffIndx=0;diffIndx<diff;diffIndx++){
theFormTable.deleteRow(lastBoatRowIndx-diffIndx);}}}}}}
function addFormRow(formTableId,clonedRowId,maxRows){
theFormTable=document.getElementById(formTableId);
if(theFormTable!=null){
allTableRows=theFormTable.getElementsByTagName('TR');
var originalRow=null;
var entryCount=0;
for(ndex=0;ndex<allTableRows.length;ndex++){
if(allTableRows[ndex].id==clonedRowId){
entryCount++;
originalRow=allTableRows[ndex];}}
if(isNaN(maxRows))maxRows=10;
if((originalRow!=null)&&(entryCount<maxRows)){
newRow=originalRow.cloneNode(true);
var rowInputElements=newRow.getElementsByTagName("INPUT");
for(j=0;j<rowInputElements.length;j++){
rowInputElements[j].value="";}
addedRow=theFormTable.getElementsByTagName('TBODY').item(1).appendChild(newRow);
entryCount++;}
if(formTableId=='groupMemberInfoTable'){
var allDivs=theFormTable.getElementsByTagName('DIV');
var lineNumCount=0;
for(i=0;i<allDivs.length;i++){
if(allDivs[i].id=='groupMemberInfoLineNumber'){
lineNumCount++;
allDivs[i].innerHTML=lineNumCount;}}
document.getElementById('groupMemberInfoRowCount').value=lineNumCount;
if(entryCount==maxRows){
document.getElementById('addGroupMemberLinkDiv').innerHTML="";}}
if(formTableId=='boatLeaderInfoTable'){
var allDivs=theFormTable.getElementsByTagName('DIV');
var lineNumCount=0;
for(i=0;i<allDivs.length;i++){
if(allDivs[i].id=='boatLeaderInfoLineNumber'){
lineNumCount++;
allDivs[i].innerHTML=lineNumCount;}}}}}
function addEntryDateFormRow(formTableId,maxRows){
theFormTable=document.getElementById(formTableId);
if(theFormTable!=null){
var allTableRows=theFormTable.getElementsByTagName('TR');
var originalRow=null;
var buildBlock=false;
for(ndex=0;ndex<allTableRows.length;ndex++){
if(allTableRows[ndex].className=='entryDateInfo'||allTableRows[ndex].className=='personTypeInfo'){
if(allTableRows[ndex].id=='entryRowId'){
if(buildBlock==true)break;
buildBlock=true;}
originalRow=allTableRows[ndex];
newRow=originalRow.cloneNode(true);
var rowInputElements=newRow.getElementsByTagName("INPUT");
for(j=0;j<rowInputElements.length;j++){
if(rowInputElements[j].type!='hidden'){
rowInputElements[j].value="";}}
if(newRow.id=='entryRowId'){
var allRowDivs=newRow.getElementsByTagName('DIV');
for(i=0;i<allRowDivs.length;i++){
if(allRowDivs[i].id=='exitDateDivId'){
allRowDivs[i].innerHTML="";}
if(allRowDivs[i].id=='removebuttondiv'){
allRowDivs[i].style.display="";}}}
addedRow=theFormTable.getElementsByTagName('TBODY').item(0).appendChild(newRow);}}}}
function removeEntryDateRow(nodeElem,rowsToRemove){
var theFormTable=document.getElementById('formSection');
var buttonParent=nodeElem.parentNode;
var buttonGrandParent=buttonParent.parentNode.parentNode;
if(buttonGrandParent.id=='entryRowId'){
var i=buttonGrandParent.rowIndex;
var ndex=0;
while(ndex<rowsToRemove){
theFormTable.deleteRow(i);
ndex++;}}
calculateTotalPriceAndQty();
return false;}
function initTourStates(){
updateNumberOfTickets(document.getElementById('numberOfTicketsSearched'));}
var FLAT_BY_RANGE_KEY="F";
var VARIABLE_BY_RANGE_KEY="V";
function updatePricingTable(ticketTypeQtyField){
if(isNaN(ticketTypeQtyField.value)){
ticketTypeQtyField.value="";
return;}
updatePricingTable();}
function updatePricingTable(){
var theTable=document.getElementById('tourPricing');
var pricing=new Array();
var counter=0;
var debug="";
var regularPricing=false;
var groupPricing=false;
var totalNumberOfTickets=getTotalNumberOfTicketsRequested();
var totalMoney=0;
if(theTable&&theTable.rows){
for(ndex=0;ndex<theTable.rows.length;ndex++){
if(theTable.rows[ndex].className=="ticketTypeInfo"){
var userEnteredQty;
for(j=0;j<theTable.rows[ndex].cells.length;j++){
var theCell=theTable.rows[ndex].cells[j];
if(theCell.className=="ticketQty"){
userEnteredQty=getFirstChildByID(theCell,'qtyTickets').value;
userEnteredQty-=0;
theList=getFirstChildByID(theCell,'tickPricing').value
var	ticketTypePricing=parsePricing(theList);
totalMoney+=(ticketTypePricing.calculate(userEnteredQty,totalNumberOfTickets))}}}}
document.getElementById('totalNumberOfTickets').innerHTML=totalNumberOfTickets;
document.getElementById('calcTotal').innerHTML="$"+addDecimals(totalMoney,2);
changeTotalCellStatus();}}
function getTotalNumberOfTicketsRequested(){
var theTable=document.getElementById('tourPricing');
var totalNumberOfTickets=0;
if(theTable){
for(ndex=0;ndex<theTable.rows.length;ndex++){
if(theTable.rows[ndex].className=="ticketTypeInfo"){
var userEnteredQty;
for(j=0;j<theTable.rows[ndex].cells.length;j++){
var theCell=theTable.rows[ndex].cells[j];
if(theCell.className=="ticketQty"){
userEnteredQty=getFirstChildByID(theCell,'qtyTickets').value;
userEnteredQty-=0;
totalNumberOfTickets+=userEnteredQty;}}}}}
return totalNumberOfTickets;}
function TicketTypePricing(aGroupBaseNumber){
this.regularPricing=new Array();
this.groupPricing=new Array();
this.groupBaseNumber=aGroupBaseNumber;
this.debug=method_debug;
this.calculate=method_calculate;
this.currentRange=null;}
function method_debug(){
var output="test  ";
output+="\n groupBaseNumber "+this.groupBaseNumber;
if(this.regularPricing!=null){
output+="\n REGULAR PRICING RANGES ";
output+="\n aRangeType "+this.regularPricing['feeUnit'];
for(i=0;i<this.regularPricing.length;i++){
output+="\n rangeLowerLimit : "+this.regularPricing[i]['rangeLowerLimit'];
output+=" rangePrice : "+this.regularPricing[i]['rangePrice'];}}
if(this.groupPricing!=null){
output+=" GROUP PRICING RANGES ";
output+="\n aRangeType "+this.groupPricing['feeUnit'];
for(i=0;i<this.groupPricing.length;i++){
output+="\n rangeLowerLimit : "+this.groupPricing[i]['rangeLowerLimit'];
output+=" rangePrice : "+this.groupPricing[i]['rangePrice'];}}
if(this.currentRange!=null){
output+="\n currentRange price "+this.currentRange['rangePrice'];
output+="\n currentRange lower limit "+this.currentRange['rangeLowerLimit'];}
alert(output);}
function method_calculate(numberOfTicketsForTicketType,totalNumberOfTickets){
if(this.groupBaseNumber<=totalNumberOfTickets&&this.groupPricing!=null){
return calculatePrice(this.groupPricing,numberOfTicketsForTicketType);}
else{
return calculatePrice(this.regularPricing,numberOfTicketsForTicketType);}}
function calculatePrice(pricingList,quantityRequested){
if(quantityRequested==0){
return 0;}
var priceRange=null;
var result=null;
for(i=0;i<pricingList.length;i++){
var thisRange=pricingList[i];
var nextRange=pricingList[i+1];
if(nextRange==null||(i==0&&quantityRequested<thisRange['rangeLowerLimit'])){
priceRange=thisRange;
break;}
else if(thisRange['rangeLowerLimit']<=quantityRequested&&quantityRequested<nextRange['rangeLowerLimit']){
priceRange=thisRange;
break;}}
this.currentRange=priceRange;
if(priceRange==null){
return null;}
else{
if(pricingList['feeUnit']==FLAT_BY_RANGE_KEY){
return priceRange['rangePrice'];}
else{
return roundResult(priceRange['rangePrice']*quantityRequested);}}}
function roundResult(result){
result=result*100;
result=Math.round(result);
return result/100;}
function parsePricingRange(delimitedPricingList,thePriceArray){
delimitedList=trimDelimitedList(delimitedPricingList.substring(2,delimitedPricingList.length));
var ticketRangeIndicator=delimitedPricingList.substring(0,1);
var pricingResults=new Array();
thePriceArray['feeUnit']=ticketRangeIndicator;
var result=delimitedList.split(";");
for(i=0;i<result.length;i++){
var pricingResults=new Array();
var pricingInstance=result[i].split("~");
pricingResults['rangeLowerLimit']=pricingInstance[0]-=0;
pricingResults['rangePrice']=pricingInstance[1]-=0;
thePriceArray[i]=pricingResults;}
return thePriceArray;}
function getGroupBaseRange(){
return document.getElementById('baseNumTickets').innerHTML-=0;}
function parsePricing(pricingInfo){
var rateTypeList=pricingInfo.split(";|");
regularRateDelimitedList=rateTypeList[0];
groupRateDelimitedList=rateTypeList[1];
var ticketTypePricing=new TicketTypePricing(getGroupBaseRange());
var regularPriceArray=new Array();
var groupPriceArray=new Array();
ticketTypePricing.regularPricing=parsePricingRange(trimDelimitedList(regularRateDelimitedList),regularPriceArray);
if(groupRateDelimitedList!=null&&groupRateDelimitedList.length>0){
ticketTypePricing.groupPricing=parsePricingRange(trimDelimitedList(groupRateDelimitedList),groupPriceArray);}
else{
ticketTypePricing.groupPricing=null;}
return ticketTypePricing;}
function trimDelimitedList(theList){
if(theList.substring(0,1)=="|"){
theList=theList.substring(1,theList.length);}
if(theList.substring(theList.length-1)==";"){
return theList.substring(0,theList.length-1);}
return theList;}
function changeTotalCellStatus(){
var minNumberOfTicketsAllowed=document.getElementById('minimumNumberOfTickets').innerHTML-=0;
var maxNumberOfTicketsAllowed=document.getElementById('maximumNumberOfTickets').innerHTML-=0;
var enteredTotal=getCalculatedTotal();
fewestAvailable=getFewestAvailable();
if(fewestAvailable>-1&&enteredTotal>fewestAvailable||(enteredTotal>maxNumberOfTicketsAllowed)||(enteredTotal<minNumberOfTicketsAllowed)){
document.getElementById('totalTicketQtyAmount').className="tooMany";}
else{
document.getElementById('totalTicketQtyAmount').className="";}}
function getFewestAvailable(){
var selects=getAllTimeCombos();
var fewestAvailable=-1;
var numberAvailable=-1;
var firstPass=true;
for(nDex=0;nDex<selects.length;nDex++){
if(selects[nDex].selectedIndex>0){
numberAvailable=getNumberAvailable(selects[nDex]);
numberAvailable-=0;
if(firstPass){
fewestAvailable=numberAvailable;
firstPass=false;}
if(numberAvailable<fewestAvailable){
fewestAvailable=numberAvailable;}}}
return fewestAvailable;}
function updateAllComboStatus(totalNumberOfTickets){
var selects=getAllTimeCombos();
for(test=0;test<selects.length;test++){
updateCellStatus(selects[test],totalNumberOfTickets);}}
function getAllTimeCombos(){
return getElementsByClassName(document,"select","timeSelect");}
function calculate(pricing){
var total=0;
var groupSize=10;
var totalNumberOfTickets=calculateTotalTicketQty(pricing);
var useGroupPricing=(totalNumberOfTickets>=groupSize);
var pricingType=null;
if(useGroupPricing&&pricing["groupPricing"]){
pricingType="groupPrice";}
else if(pricing["regularPricing"]){
pricingType="regularPrice";}
else if(pricing["groupPricing"]){
pricingType="groupPrice";}
if(pricingType!=null){
total=calculateByPricingType(pricing,pricingType)}
document.getElementById('totalNumberOfTickets').innerHTML=totalNumberOfTickets;
document.getElementById('calcTotal').innerHTML="$"+addDecimals(total,2);}
function calculateByPricingType(pricing,pricingType){
var total=0;
for(i=0;i<pricing.length;i++){
total+=pricing[i]['quantity']*pricing[i][pricingType];}
return total;}
function calculateTotalTicketQty(pricing){
var result=0;
for(i=0;i<pricing.length;i++){
result+=pricing[i]['quantity'];}
return result;}
function updateSelect(tourId,cellId){
theCombo=getTourTimeCombo(tourId);
var theCell=document.getElementById(cellId);
var initialSelectedIndex=theCombo.selectedIndex;
var initialSelectedValue=theCombo.options[initialSelectedIndex].value
if(initialSelectedValue==cellId){
theCombo.selectedIndex=0;
appendClassName(theCell,"_slct",false);}
else{
theCombo.selectedIndex=getSelectedIndex(theCombo,cellId);
appendClassName(theCell,"_slct",true);}
if(initialSelectedIndex>0){
appendClassName(document.getElementById(initialSelectedValue),"_slct",false);}
changeTotalCellStatus();
return false;}
function updateNumberOfTickets(ticketField){
if(ticketField==null)return;
var numTx=ticketField.value;
if(isNaN(numTx)){
ticketField.value="";
return;}
var selects=getElementsByClassName(document,"select","timeSelect");
if(selects.length==0)return;
for(theIndex=0;theIndex<selects.length;theIndex++){
updateCellStatus(selects[theIndex],numTx);}
var maxNumberOfTicketsAllowed=document.getElementById('maximumNumberOfTickets').innerHTML;
maxNumberOfTicketsAllowed-=0;
if(maxNumberOfTicketsAllowed<numTx){
appendClassName(ticketField," error",true);}
else{
appendClassName(ticketField," error",false);}}
function updateButtons(targetSelectBox){
var idx=targetSelectBox.options.length;
if(idx>0){
for(i=0;i<idx;i++){
appendClassName(document.getElementById(targetSelectBox.options[i].value),"_slct",false);}}
var theCell=null;
if(targetSelectBox.selectedIndex>0){
var theCell=document.getElementById(targetSelectBox.options[targetSelectBox.selectedIndex].value);
appendClassName(document.getElementById(targetSelectBox.options[targetSelectBox.selectedIndex].value),"_slct",true);}
changeTotalCellStatus();}
function getNumberAvailable(theCombo){
return extractQtyAvailableFromOptionValue(theCombo.options[theCombo.selectedIndex].value);}
function extractQtyAvailableFromOptionValue(theValue){
if(theValue!="-1"&&theValue.length>0){
return theValue.substring(theValue.indexOf("-")+1,theValue.length);}}
function unFormatCurrencyAmount(anAmount){
var result=anAmount.replace("$","");
result-=0;
return result;}
function updateCellStatus(theCombo,theNumberOfTickets){
for(i=1;i<theCombo.options.length;i++){
var theCell=document.getElementById(theCombo.options[i].value);
if(theCell!=null){
updateCell(theCell,theCombo.options[i].value,theNumberOfTickets);}}
if(theCombo.selectedIndex>0){
selectedCell=document.getElementById(theCombo.options[theCombo.selectedIndex].value);
appendClassName(selectedCell,"_slct",true);}
return;}
function updateCell(theCell,theComboValue,requestedNumberOfTickets){
var numberOfAvailableTickets=extractQtyAvailableFromOptionValue(theComboValue);
numberOfAvailableTickets-=0;
var openTimeRange=theCell.className.indexOf('Open')>0?"Open":"";
if(requestedNumberOfTickets>numberOfAvailableTickets){
theCell.className="tourCell"+openTimeRange+"NotAvailable";}
else{
theCell.className="tourCell"+openTimeRange+"Available";}
return;}
function getSearchedTotal(){
return document.getElementById('numberOfTicketsSearched').value-=0;}
function getCalculatedTotal(){
return document.getElementById('totalNumberOfTickets').innerHTML-=0}
function updateComboStatus(theCombo){
var newClassName="validTime";
messageContainer=theCombo.parentNode;
messageText=getFirstChildByTagName(messageContainer,"SPAN","span")
var totalNumberRequired=getSearchedTotal();
var totalNumberAvailable=getNumberAvailable(theCombo);
var message;
if(totalNumberRequired>totalNumberAvailable){
var plural=totalNumberAvailable>1?"s":"";
newClassName="invalidTime";
message=totalNumberAvailable+" ticket"+plural+" available";}
else{
newClassName="validTime";
message="";}
if(theCombo.selectedIndex>0){
resetComboIndicator(messageContainer,messageText);
appendClassName(messageContainer,newClassName,true);
messageText.innerHTML=message;}
else{
resetComboIndicator(messageContainer,messageText);}
return;}
function resetComboIndicator(messageContainer,messageText){
appendClassName(messageContainer,"validTime",false);
appendClassName(messageContainer,"invalidTime",false);
messageText.innerHTML="";}
function getTourTimeCombo(tourId){
return document.getElementById(tourId+"timeSelect");}
function getSelectedIndex(targetSelectBox,theValue){
var idx=targetSelectBox.options.length;
if(idx>0){
for(i=0;i<idx;i++){
if(targetSelectBox.options[i].value==theValue){
return i;}}}}
function getElementsByClassName(oElm,strTagName,strClassName){
var arrElements=(strTagName=="*"&&oElm.all)?oElm.all:oElm.getElementsByTagName(strTagName);
var arrReturnElements=new Array();
strClassName=strClassName.replace(/\-/g,"\\-");
var oRegExp=new RegExp("(^|\\s)"+strClassName+"(\\s|$)");
var oElement;
for(var i=0;i<arrElements.length;i++){
oElement=arrElements[i];
if(oRegExp.test(oElement.className)){
arrReturnElements.push(oElement);}}
return(arrReturnElements)}
function appendClassName(theNode,theClassName,doAdd){
if(theNode!=null){
existingClassName=theNode.className;
theNode.className=appendWord(existingClassName,theClassName,doAdd);}
return((theNode!=null)&&(existingClassName!=theNode.className));}
function appendWord(thePhrase,theWord,doAdd){
matchWordRegExpr=new RegExp("\\s?\\b"+theWord+"\\b");
if(thePhrase==null)thePhrase="";
if(doAdd==true){
if(!matchWordRegExpr.test(thePhrase)){
thePhrase+=theWord;}}
else{
thePhrase=thePhrase.replace(theWord,"");}
return thePhrase;}
function getFirstChildByTagName(theNode,byTagName,orTagName){
var theFirstChild=null;
var theChildren=theNode.childNodes;
for(nDex=0;nDex<theChildren.length;nDex++){
if((theChildren[nDex].tagName==byTagName)||(theChildren[nDex].tagName==orTagName)){
theFirstChild=theChildren[nDex];
break;}}
return theFirstChild;}
function getFirstChildByID(theNode,theId){
var theChild=null;
var theChildren=theNode.childNodes;
for(nDex=0;nDex<theChildren.length;nDex++){
if(theChildren[nDex].id==theId){
theChild=theChildren[nDex];
break;}}
return theChild;}
DECIMAL_SEPARATOR=".";
function addDecimals(numberValue,decimalrequired){
numberValue=new String(numberValue);
var tmpDecimalPortion="";
var tmpWholeNumberPortion="";
if(numberValue==null||numberValue=="")
return numberValue;
if(decimalrequired==null||typeof(decimalrequired)=="string"){
decimalrequired=1;}
if(numberValue.lastIndexOf(DECIMAL_SEPARATOR)>-1){
var numberLength=numberValue.length;
var decimalPlacePos=numberValue.lastIndexOf(DECIMAL_SEPARATOR);
tmpDecimalPortion=numberValue.substring(decimalPlacePos,numberLength);
tmpWholeNumberPortion=numberValue.substring(0,decimalPlacePos);
var decimalPortion="";
if((tmpDecimalPortion.length-1)>decimalrequired){
decimalPortion=tmpDecimalPortion.substring(0,decimalrequired+1);}
else if((tmpDecimalPortion.length-1)<decimalrequired){
var dec="";
for(var i=0;i<(decimalrequired-(tmpDecimalPortion.length-1));i++){
dec+="0";}
decimalPortion=tmpDecimalPortion+dec;}
else{
decimalPortion=tmpDecimalPortion;}
return tmpWholeNumberPortion+decimalPortion;}
else{
var dec=".";
if(decimalrequired>0){
for(var i=0;i<decimalrequired;i++){
dec+="0";}}
return numberValue+dec;}}/*
File:utils_css.js;
Description:some useful code;
References:utils_dom;*/
function addClassName(theNode,theClassName,doAdd){
if(theNode!=null){
existingClassName=theNode.className;
theNode.className=addWord(existingClassName,theClassName,doAdd);}
return((theNode!=null)&&(existingClassName!=theNode.className));}
function addWord(thePhrase,theWord,doAdd){
matchWordRegExpr=new RegExp("\\s?\\b"+theWord+"\\b");
if(thePhrase==null)thePhrase="";
if(doAdd!=false){
if(!matchWordRegExpr.test(thePhrase)){
addSpace=(thePhrase>"")?" ":"";
thePhrase+=addSpace+theWord;}}else{
thePhrase=thePhrase.replace(matchWordRegExpr,"");}
return thePhrase;}
function hasClassName(theNode,theClassName){
if(theNode!=null){
existingClassName=theNode.className;
return hasThisWord(existingClassName,theClassName);}
return false;}
function hasThisWord(thePhrase,theWord){
matchWordRegExpr=new RegExp("\\b"+theWord+"\\b");
return matchWordRegExpr.test(thePhrase);}/*
File:domutils.js;
Description:some useful code;
References:none;*/
function getParentByTagName(theNode,byTagName,orTagName){
var theParent=theNode.parentNode;
if(theParent!=null){
if((theParent.tagName!=byTagName)&&(theParent.tagName!=orTagName))theParent=getParentByTagName(theParent,byTagName,orTagName);}
return theParent;}
function getFirstChildByTagName(theNode,byTagName,orTagName){
var theFirstChild=null;
var theChildren=theNode.childNodes;
for(nDex=0;nDex<theChildren.length;nDex++){
if((theChildren[nDex].tagName==byTagName)||(theChildren[nDex].tagName==orTagName)){
theFirstChild=theChildren[nDex];
break;}}
return theFirstChild;}
function getNextSiblingByTagName(theNode,byTagName,orTagName){
if(orTagName==null)orTagName=byTagName;
var theNextSibling=theNode.nextSibling;
if(theNextSibling!=null){
if((theNextSibling.tagName!=byTagName)&&(theNextSibling.tagName!=orTagName))theNextSibling=getNextSiblingByTagName(theNextSibling,byTagName,orTagName);}
return theNextSibling;}
function getParentByClassName(theNode,byClassName){
var theParent=theNode.parentNode;
if(theParent!=null){
if(!hasWord(theParent.className,byClassName))
theParent=getParentByClassName(theParent,byClassName);}
return theParent;}
function hasWord(thePhrase,theWord){
matchWordRegExpr=new RegExp("\\b"+theWord+"\\b");
return matchWordRegExpr.test(thePhrase);}
function getElementsByTagNameAndAttribute(theTagName,theAttributeName,theAttributeValue){}
function getActualLeft(theNode){
actualLeft=document.body.offsetLeft;
if(theNode.offsetParent){
while(theNode.offsetParent){
actualLeft+=theNode.offsetLeft;
theNode=theNode.offsetParent;}}else if(theNode.x)actualLeft+=theNode.x;
return actualLeft;}
function getActualRight(theNode){
actualRight=theNode.offsetWidth;
actualRight+=getActualLeft(theNode);
return actualRight;}
function getActualTop(theNode){
actualTop=document.body.offsetTop;
if(theNode.offsetParent){
var node=theNode;
while(node.offsetParent){
actualTop+=node.offsetTop;
node=node.offsetParent;}
if(theNode.parentNode){
while(theNode.offsetParent){
actualTop-=theNode.scrollTop;
theNode=theNode.parentNode;}}}else if(theNode.y)actualTop+=theNode.y;
return actualTop;}
function getActualBottom(theNode){
actualBottom=theNode.offsetHeight;
actualBottom+=getActualTop(theNode);
return actualBottom;}
function openFull(el){
var theNextSibling=getNextSiblingByTagName(el,'DIV');
theNextSibling.style.display=='none'?theNextSibling.style.display='block':theNextSibling.style.display='none';
return false;}
function expandAll(fl){
var elAr=document.getElementsByTagName("DIV");
for(var i=1;i<elAr.length;i++){
if(elAr[i].style.display=='none'||elAr[i].block_fl){
elAr[i].block_fl=true;
if(fl)
elAr[i].style.display="";
else
elAr[i].style.display="none";}}}
function getWindowSize(){
var myWidth=0,myHeight=0;
if(typeof(window.innerWidth)=='number'){
myWidth=window.innerWidth;
myHeight=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){
myWidth=document.documentElement.clientWidth;
myHeight=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){
myWidth=document.body.clientWidth;
myHeight=document.body.clientHeight;}
return[myWidth,myHeight];}
function getScrollXY(){
var scrOfX=0,scrOfY=0;
if(typeof(window.pageYOffset)=='number'){
scrOfY=window.pageYOffset;
scrOfX=window.pageXOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){
scrOfY=document.body.scrollTop;
scrOfX=document.body.scrollLeft;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){
scrOfY=document.documentElement.scrollTop;
scrOfX=document.documentElement.scrollLeft;}
return[scrOfX,scrOfY];}
function log(message){
if(!log.window_||log.window_.closed){
var win=window.open("",null,"width=400,height=200,"+
"scrollbars=yes,resizable=yes,status=no,"+
"location=no,menubar=no,toolbar=no");
if(!win)return;
var doc=win.document;
doc.write("<html><head><title>Debug Log</title></head>"+
"<body></body></html>");
doc.close();
log.window_=win;}
var logLine=log.window_.document.createElement("div");
logLine.appendChild(log.window_.document.createTextNode(message));
log.window_.document.body.appendChild(logLine);}
function redeemVoucher(contractCode,voucherNum,redeemed){
form=document.checkoutCartForm;
form.voucherNumberHid.value=voucherNum;
form.redeemContract.value=contractCode;
form.redeemOperation.value=redeemed?"VR":"VU";
form.submit();}
function redeemGiftCard(contractCode,contractIndex){
form=document.checkoutCartForm;
form.redeemContract.value=contractCode;
form.redeemContractIndex.value=contractIndex;
form.redeemOperation.value="GR";
document.getElementById('giftCardSectionExpandedFlag_'+contractIndex).value="true";
form.submit();}
function undoGiftCard(contractCode,giftCardNum){
form=document.checkoutCartForm;
form.giftCardNumberHid.value=giftCardNum;
form.redeemContract.value=contractCode;
form.redeemOperation.value="GU";
form.submit();}
function undoAllRedeems(contractCode){
form=document.checkoutCartForm;
form.redeemContract.value=contractCode;
form.redeemOperation.value="UA";
form.submit();}
function addInputRowFocusAndBlur(theContainer,textTypeOnly){
inputCollection=theContainer.getElementsByTagName("INPUT");
for(iDex=0;iDex<inputCollection.length;iDex++){
if((textTypeOnly==true)&&(inputCollection[iDex].type!="text")){}else{
inputCollection[iDex].onfocus=new Function("doRowFocus(this)");
inputCollection[iDex].onblur=new Function("doRowFocus(this,false)");
inputCollection[iDex].onmouseover=new Function("this.title=this.value");}}}
function addRowMouseOverandOut(theContainer){
rowCollection=theContainer.getElementsByTagName("TR");
for(rDex=0;rDex<rowCollection.length;rDex++){
rowCollection[rDex].onmouseover=new Function("doRowMouseOver(this,true)");
rowCollection[rDex].onmouseout=new Function("doRowMouseOver(this,false)");}}
function doRowFocus(srcInput,doAdd){
doAdd=!(doAdd==false);
theRow=getParentByTagName(srcInput,"TR");
addClassName(theRow,"focus",doAdd);}
function doRowMouseOver(theRow,doAdd){
doAdd=!(doAdd==false);
addClassName(theRow,"hover",doAdd);}
function selectRow(callingChkBox){
doAdd=callingChkBox.checked;
theRow=getParentByTagName(callingChkBox,"TR");
if(addClassName(theRow,"slct",doAdd))
changeSelectedCounter(callingChkBox.checked);}
function disableChildInputs(theNode,enable){
if(theNode!=null){
theNode.style.visibility=(enable!=true)?"hidden":"visible";
theInputs=theNode.getElementsByTagName("INPUT");
for(inDex=0;inDex<theInputs.length;inDex++){
theInputs.item(inDex).disabled=(enable!=true);}}}
function checkboxRowMaster(theCheckbox){
checked=theCheckbox.checked;
theRow=getParentByTagName(theCheckbox,"TR");
rowInputs=theRow.getElementsByTagName("INPUT");
for(inDex=0;inDex<rowInputs.length;inDex++){
if(rowInputs.item(inDex).checked!=null){
rowInputs.item(inDex).checked=checked;}}}
function checkboxColMaster(theCheckbox,doRowSelect,wholeTable){
checked=theCheckbox.checked;
theColCells=getColumnCellsBySibling(theCheckbox,!(wholeTable==false));
for(cDex=0;cDex<theColCells.length;cDex++){
childCheckBox=theColCells[cDex].getElementsByTagName("INPUT")[0];
if((childCheckBox!=null)&&(childCheckBox.type=="checkbox")){
childCheckBox.checked=checked;
if(doRowSelect&&(childCheckBox!==theCheckbox))selectRow(childCheckBox);}}}
function clearInstruction(theElement){
matchInstRegExpr=new RegExp("\\[[^\\]]*\\]");
theElement.value=theElement.value.replace(matchInstRegExpr,"")}
function changeSelectedCounter(increment,init){
theCounter=document.getElementById("rowsSelected");
output=document.getElementById("rowsSelectedText");
if(theCounter&&output){
if(init){
rowsSelected=parseInt(theCounter.value,10);}else if(increment){
rowsSelected++;}else if(!increment){
rowsSelected--;}
theCounter.value=rowsSelected;
output.innerHTML=String(rowsSelected);}}
function confirmAction(message,link){
if(confirm(message)==true){
window.location=link;}}
var submitted=false;
function submitAndWait(btnElement,formName,elementNameToHide,title,isLink){
if(submitted)
return false;
submitted=true;
if(!isLink)
btnElement.disabled=true;
var elementToHide=$(elementNameToHide);
elementToHide.style.display="none";
var progressContent="<h2>"+title+"</h2>";
progressContent=progressContent+"<div id=\"progressbar\">";
for(var i=0;i<10;i++)
progressContent=progressContent+"<div>&nbsp;</div>";
for(var i=3;i>=0;i--)
progressContent=progressContent+"<div class=\"blip"+i+"\">&nbsp;</div>"
progressContent=progressContent+"</div>";
progressContent=progressContent+"<br/> <div class=\"partial\">"+
" Results will include \"<img border=\"0\" src=\"/images/icon_full.gif\" width=\"22\" height=\"22\">Exact\""+
" and \"<img border=\"0\" src=\"/images/icon_partial.gif\" width=\"22\" height=\"22\">Possible\" matches."+
" </div>";
progressDiv=document.createElement("DIV");
progressDiv.className="component";
progressDiv.innerHTML=progressContent;
if(elementToHide.nextSibling)
elementToHide.parentNode.insertBefore(progressDiv,elementToHide.nextSibling);
else
elementToHide.parentNode.appendChild(progressDiv);
updateProgressFeedback(progressDiv);
window.setTimeout("submitMyForm('"+formName+"',"+isLink+")",100);}
function updateProgressFeedback(progressDiv){
try{
var container=$('progressbar');
var theCycleObjects=container.getElementsByTagName("div");
container.insertBefore(theCycleObjects[theCycleObjects.length-1],theCycleObjects[0]);
window.setTimeout("updateProgressFeedback(progressDiv)",100);}
catch(ex){}}
var progressSubmited=0;
function submitMyForm(formName,isLink){
if(progressSubmited>0)
return;
progressSubmited++;
if(isLink){
var form=document.createElement("FORM");
form.action=formName;
form.name="dummyForm";
form.method="POST";
progressDiv.appendChild(form);
form.submit();}
else{
$(formName).submit();}}
function cycleChildren(theContainerID,childTag,msecSpeed){
theContainer=$(theContainerID);
theCycleObjects=theContainer.getElementsByTagName(childTag);
theContainer.insertBefore(theCycleObjects[theCycleObjects.length-1],theCycleObjects[0]);
window.setTimeout('cycleChildren("'+theContainerID+'","'+childTag+'",'+msecSpeed+')',msecSpeed);}
function showProgressPopup(theContainerID,formName){
theContainer=$(theContainerID);
theContainer.style.display="";
cycleChildren('progressbar','DIV',100);
window.setTimeout("submitMyForm('"+formName+"',"+false+")",100);
return false;}
var testProgressBarImage=new Image(205,48);
testProgressBarImage.src="/images/progress_bar.gif";
var partialImage=new Image(22,22);
partialImage.src="/images/icon_partial.gif";
var fullImage=new Image(22,22);
fullImage.src="/images/icon_full.gif";
var animationStarted=false;
function showProgressBar(theContainerID,title,message,elementToHide){
if(!animationStarted){
animationStarted=true;
theContainer=$(theContainerID);
progressContent=getProgressContent(title,false);
if(message)
progressContent=progressContent+message;
theContainer.innerHTML=progressContent;
theContainer.style.display="";
if(elementToHide!=null){
hideContainer=$(elementToHide);
if(document.getElementById(elementToHide)){
hideContainer.style.display="none";}}
animate('progressBar');}}
function showShortProgressBar(theContainerID,title,message,elementToHide){
if(!animationStarted){
animationStarted=true;
theContainer=$(theContainerID);
progressContent=getProgressContent(title,true);
if(message)
progressContent=progressContent+message;
theContainer.innerHTML=progressContent;
theContainer.style.display="";
if(elementToHide!=null){
hideContainer=$(elementToHide);
if(document.getElementById(elementToHide)){
hideContainer.style.display="none";}}
animate('progressBar');}}
function getProgressContent(title,isShort){
progressContent="<h2>"+title+"</h2>";
progressContent=progressContent+"<div id='progressBar'>";
if(!isShort){
progressContent=progressContent+"<div>&nbsp;</div>";
progressContent=progressContent+"<div>&nbsp;</div>";}
progressContent=progressContent+"<div>&nbsp;</div>";
progressContent=progressContent+"<div>&nbsp;</div>";
progressContent=progressContent+"<div>&nbsp;</div>";
progressContent=progressContent+"<div>&nbsp;</div>";
progressContent=progressContent+"<div>&nbsp;</div>";
progressContent=progressContent+"<div>&nbsp;</div>";
progressContent=progressContent+"<div>&nbsp;</div>";
progressContent=progressContent+"<div>&nbsp;</div>";
progressContent=progressContent+"<div style='background-color:#d9f5d9'>&nbsp;</div>";
progressContent=progressContent+"<div style='background-color:#b3ebb3'>&nbsp;</div>";
progressContent=progressContent+"<div style='background-color:#65d565'>&nbsp;</div>";
progressContent=progressContent+"<div style='background-color:#19c119'>&nbsp;</div>";
progressContent=progressContent+"</div>";
return progressContent;}
function showInlineProgressBar(theContainerID,title,elementToHide){
if(!animationStarted){
animationStarted=true;
theContainer=$(theContainerID);
theContainer.style.display="";
document.getElementById('pBarTitle').innerHTML=title;
if(elementToHide!=null){
hideContainer=$(elementToHide);
if(document.getElementById(elementToHide)){
hideContainer.style.display="none";}}
animate('inlineProgressBar');}}
function animate(elementID){
animationStarted=true;
var theElement=document.getElementById(elementID);
var theChildDivs=theElement.getElementsByTagName("DIV");
var storedColor=theChildDivs[theChildDivs.length-1].style.backgroundColor;
for(chilDex=theChildDivs.length-1;chilDex>0;chilDex--){
theChildDivs[chilDex].style.backgroundColor=theChildDivs[chilDex-1].style.backgroundColor;}
theChildDivs[0].style.backgroundColor=storedColor;
window.setTimeout("animate('"+elementID+"')",60);}
function copyCardInfo(cardDropdownId,currentIndx){
if(i<=1){
alert("No credit card information to copy from.");
return;}
var previousDropdown=$(cardDropdownId+(currentIndx-1))
var currentDropdown=$(cardDropdownId+currentIndx);
if(previousDropdown.value==null||previousDropdown.value==''){
alert("No credit card information to copy from.");
return;}
var selectedIndex=-1;
for(var i=0;i<currentDropdown.options.length;i++){
if(currentDropdown.options[i].value==previousDropdown.value){
selectedIndex=i;
break;}}
if(selectedIndex<0){
alert("Credit card type to copy from is not supported.");
return;}
if($('fname_'+currentIndx).type=='hidden'){
if(trim($('fname_'+(currentIndx-1)).value.toLowerCase())!=trim($('fname_'+currentIndx).value.toLowerCase())||
trim($('lname_'+(currentIndx-1)).value.toLowerCase())!=trim($('lname_'+currentIndx).value.toLowerCase())){
alert('This payment requires the cardholder name to be the same as the user name. Cannot copy card info.');
return;}}
currentDropdown.selectedIndex=selectedIndex;
$('cardnum_'+currentIndx).value=$('cardnum_'+(currentIndx-1)).value;
$('expmonth_'+currentIndx).value=$('expmonth_'+(currentIndx-1)).value;
$('expyear_'+currentIndx).value=$('expyear_'+(currentIndx-1)).value;
$('fname_'+currentIndx).value=$('fname_'+(currentIndx-1)).value;
$('lname_'+currentIndx).value=$('lname_'+(currentIndx-1)).value;
$('seccode_'+currentIndx).value=$('seccode_'+(currentIndx-1)).value;
if($('postalCodeApplicableFlag_'+currentIndx).value=="true"&&$('postalCodeApplicableFlag_'+currentIndx-1).value=="true"){
$('pCodeReq_'+currentIndx).checked=$('pCodeReq_'+(currentIndx-1)).checked;
$('ccPostCode_'+currentIndx).value=$('ccPostCode_'+(currentIndx-1)).value;
$('ccPostCodeValue_'+currentIndx).value=$('ccPostCodeValue_'+(currentIndx-1)).value;}}
function swipeCard(index){
var splitExp="%|B|/|\\^|\\?|;";
var cardData=window.showModalDialog("/htm/cardSwipe.htm","","dialogHeight: 200px; dialogWidth: 300px; edge: Raised; center: Yes; help: No; resizable: No; status: No;");
if(cardData==null)return;
cardData=cardData.substring(2);
var ccData=cardData.split(new RegExp(splitExp));
removeEmptyStrings(ccData);
var cardType=determineCreditCardType(ccData[0]);
if(cardType!="VISA"&&cardType!="MAST"&&cardType!="AMEX"&&cardType!="DISC"){
alert('The swiped Credit Card type is not an accepted payment type. Please try another credit card.');
return;}
document.getElementById("cardTypeId_"+index).value=cardType;
document.getElementById("cardnum_"+index).value=ccData[0];
document.getElementById("expmonth_"+index).value=ccData[3].substring(2,4);
document.getElementById("expyear_"+index).value=ccData[3].substring(0,2);
document.getElementById("lname_"+index).value=ccData[1];
document.getElementById("fname_"+index).value=ccData[2];
document.getElementById("swiped_"+index).value="true";
document.getElementById("swipeData_"+index).value=ccData[4];}
function removeEmptyStrings(strArray){
var i;
for(i=0;i<strArray.length;i++){
if(strArray[i]==""){
strArray.splice(i--,1);}}}
function determineCreditCardType(cardNumber){
if(cardNumber.length<13)return "ERR1";
var first1=cardNumber.substring(0,1)-0;
var first2=cardNumber.substring(0,2)-0;
var first3=cardNumber.substring(0,3)-0;
var first4=cardNumber.substring(0,4)-0;
if(first2>=51&&first2<=56)return "MAST";
if(first2==34||first2==37)return "AMEX";
if(first2==36||first2==38)return "DINE";
if(first3>=300&&first3<=305)return "DINE";
if(first1==4)return "VISA";
if(first4==6011||first3==650)return "DISC";
return "ERR2";}
function resetSwipe(index){
if(document.getElementById("swiped_"+index)!=null){
document.getElementById("swiped_"+index).value="false";
document.getElementById("swipeData_"+index).value="";}}
function trim(str){
return str.replace(/^\s+|\s+$/g,"");}
var geo=null;
var reasons=[];
var gAResult=null;
function onLoadLandmark(){
try{
init();}catch(e){}
if(GBrowserIsCompatible()){
initializeClientGeocoder();}}
function initializeClientGeocoder(){
geo=new GClientGeocoder();
reasons[G_GEO_SUCCESS]="Success";
reasons[G_GEO_MISSING_ADDRESS]="Missing Address: The address was either missing or had no value.";
reasons[G_GEO_UNKNOWN_ADDRESS]=" does not match any location.";
reasons[G_GEO_UNAVAILABLE_ADDRESS]="Unavailable Address:  The geocode for the given address cannot be returned due to legal or contractual reasons.";
reasons[G_GEO_BAD_KEY]="Bad Key: The API key is either invalid or does not match the domain for which it was given";
reasons[G_GEO_TOO_MANY_QUERIES]="Too Many Queries: The daily geocoding quota for this site has been exceeded.";
reasons[G_GEO_SERVER_ERROR]="Server error: The geocoding request could not be successfully processed.";}
var standards=[["road","rd"],["street","st"],["avenue","ave"],["av","ave"],["drive","dr"],["saint","st"],["north","n"],["south","s"],["east","e"],["west","w"],["expressway","expy"],["parkway","pkwy"],["terrace","ter"],["turnpike","tpke"],["highway","hwy"],["lane","ln"]];
function standardize(a){
for(var i=0;i<standards.length;i++){
if(a==standards[i][0]){a=standards[i][1];}}
return a;}
function different(a,b){
var c=b.split(",");
b=c[0];
a=a.toLowerCase();
b=b.toLowerCase();
a=a.replace(/'/g,"");
b=b.replace(/'/g,"");
a=a.replace(/\W/g," ");
b=b.replace(/\W/g," ");
a=a.replace(/\s+/g," ");
b=b.replace(/\s+/g," ");
awords=a.split(" ");
bwords=b.split(" ");
var reply=false;
for(var i=0;i<bwords.length;i++){
if(standardize(awords[i])!=standardize(bwords[i])){reply=true}}
return(reply);}
function place(address,lat,lng){
document.getElementById("message").innerHTML="";
document.getElementById("message").style.display="none";
document.getElementById('landmarkName').value=address;
document.getElementById('landmarkName').focus();
document.getElementById('landmarkLat').value=lat;
document.getElementById('landmarkLong').value=lng;}
function verifyLandmarkEntry(landmark){
var numregexp=/^\d+$/;
var rgx_zipUS=/(^\d{5}$)|(^\d{5}-\d{4}$)/;
var len=landmark.length;
if(numregexp.test(landmark)){
if(len!=5){
return false;}}
var idx=landmark.search(/-/);
if(idx!=-1){
if(!rgx_zipUS.test(landmark)){
var beforeDash=landmark.substring(0,idx);
var afterDash=landmark.substring(idx+1,len);
if(numregexp.test(beforeDash)&&numregexp.test(afterDash)){
if(beforeDash.length!=5||afterDash.length!=4)return false;}}}
return true;}
var loc=false;
function showAddress(){
if(document.getElementById("message").innerHTML!=""){
document.getElementById("message").innerHTML="";}
var searchLandmark=document.getElementById("landmarkName").value;
searchLandmark=trim(searchLandmark);
if(searchLandmark==""||searchLandmark=="City or ZIP")return true;
if(!verifyLandmarkEntry(searchLandmark))return true;
loc=false;
try{
geo.getLocations(searchLandmark,getResult);}catch(ex){
alert("catched error"+ex);}
return loc;}
function getResult(result){
if(result.Status.code==G_GEO_SUCCESS){
onSuccess(result);}
else{
onFailure(result);}}
var PROGRESS_LEGEND="<br/><div class=\"partial\">"+
" Results will include <img border=\"0\" src=\"/images/icon_full.gif\" width=\"22\" height=\"22\">\"Exact\""+
" and <img border=\"0\" src=\"/images/icon_partial.gif\" width=\"22\" height=\"22\">\"Possible\" matches."+
" </div>";
function onSuccess(result){
if(result.Placemark.length>1){
document.getElementById("message").style.display="block";
document.getElementById("message").innerHTML="<div class='msg alertTitle'><h3>Did you mean:</h3></div>";
var comma=",";
var regexcomma=new RegExp(comma,"g");
var blank="";
var lineBreak="<br/>"
for(var i=0;i<result.Placemark.length;i++){
var p=result.Placemark[i].Point.coordinates;
var address=result.Placemark[i].address.replace(regexcomma,blank);
document.getElementById("message").innerHTML+="<br><a href='javascript:place(\""+address+ "\",\"" +p[1]+"\",\""+p[0]+"\");'>"+result.Placemark[i].address+"</a>";}}
else{
loc=true;
var form=document.forms[0];
document.getElementById('landmarkLat').value=result.Placemark[0].Point.coordinates[1];
document.getElementById('landmarkLong').value=result.Placemark[0].Point.coordinates[0];
document.getElementById('landmarkName').value=result.Placemark[0].address;
showProgressBar("contentProgressBar","Searching ...",PROGRESS_LEGEND,"contentArea");
form.submit();
return;}}
function onFailure(result){
var reason="Code "+result.Status.code;
var searchLandmark=document.getElementById("landmarkName").value;
if(reasons[result.Status.code]){
reason=reasons[result.Status.code]}
document.getElementById("message").innerHTML="<div class='msg error'>\""+searchLandmark+ "\""+reason+"</div>";}
String.prototype.trim=function(){
return this.replace(/^\s+|\s+$/g,"");}
String.prototype.ltrim=function(){
return this.replace(/^\s+/,"");}
String.prototype.rtrim=function(){
return this.replace(/\s+$/,"");}
function showAddressOnGoogleMap(){
if(document.getElementById("message").innerHTML!=""){
document.getElementById("message").innerHTML="";}
var searchLandmark=document.getElementById("landmarkName").value;
searchLandmark=trim(searchLandmark);
if(searchLandmark==""||searchLandmark=="City or ZIP")return false;
if(!verifyLandmarkEntry(searchLandmark))return false;
try{
geo.getLocations(searchLandmark,getGoogleMapResult);}catch(ex){
alert("catched error"+ex);}}
function place(address){
document.getElementById("message").innerHTML="";
document.getElementById("message").style.display="none";
document.getElementById('landmarkName').value=address;
document.getElementById('landmarkName').focus();}
function getGoogleMapResult(result){
if(result.Status.code==G_GEO_SUCCESS){
if(result.Placemark.length>1){
document.getElementById("message").style.display="block";
document.getElementById("message").innerHTML="<div class='msg alertTitle'><h3>Did you mean:</h3></div>";
var comma=",";
var regexcomma=new RegExp(comma,"g");
var blank="";
for(var i=0;i<result.Placemark.length;i++){
var p=result.Placemark[i].Point.coordinates;
var address=result.Placemark[i].address.replace(regexcomma,blank);
document.getElementById("message").innerHTML+="<br><a href='javascript:place(\""+address+ "\");'>"+result.Placemark[i].address+"</a>";}}
else{
var lat=result.Placemark[0].Point.coordinates[1];
var lng=result.Placemark[0].Point.coordinates[0];
changeLandmarkText((document.getElementById("landmarkName").value),lat,lng);}}
else{
onFailure(result);}}
function populateWithHomeAddress(address){
document.getElementById('landmarkName').value=address;
document.getElementById('landmarkName').focus();}
function printPDFDirect(url){
window.showModalDialog((url+"&systime="+(new Date()).getTime()),"","dialogHeight: 160px; dialogWidth: 300px; edge: Raised; center: Yes; help: No; resizable: No; status: No;");}
function printUwpPDFDirectSetup(permitNum,tagReport,contractCode,facilityId){
if(permitNum=='null'||permitNum==""||tagReport=='null'){}else{
var base="UwpPrintAction.do?ReportName="+tagReport+
"&ReservationNumber="+permitNum+
"&ContractCode="+contractCode+
"&FacilityId="+facilityId+
"&printDirect=true";
printPDFDirect(base);}}
function checkFrame(iFrameName){
var iframe=window.document.getElementById(iFrameName);
var iFrameLoaded='loading';
if(iframe==null){
alert('iframe not found');}else{
if(iframe.document==null){
if(document.addEventListener==null){
setTimeout('window.close()',5000)}else{
try{
if(document.addEventListener){
document.addEventListener("DOMContentLoaded",setTimeout('window.close()',5000),false);}else{
setTimeout('window.close()',5000)}}catch(ex){
setTimeout('window.close()',5000)}}}else{
iFrameLoaded=iframe.document.readyState;
if(iFrameLoaded!='complete'){
setTimeout('checkFrame('+iFrameName+')',5000);}else{
window.opener=self;
setTimeout('window.close()',5000);}}}}
function printUwpPDFDirectFromHidden(){
if(window.document.getElementById('PrintPermitAction')==null||window.document.getElementById('PrintPermitAction').value==null){}else{
var url=window.document.getElementById('PrintPermitAction').value;
printPDFDirect(url);}}
function printUwpPDFDirectFromHiddenList(){
if(window.document.getElementById('PrintPermitAction')==null||window.document.getElementById('PrintPermitAction').value==null){}else{
var url=window.document.getElementById('PrintPermitAction').value;
urlSingle=url.split(":");
for(var i=0;i<urlSingle.length;i++){
printPDFDirect(urlSingle[i]);}}}
function performAdminUpdate(subaction){
document.getElementById('statusUpdateAction').value=subaction;
document.forms['attractionsForm'].submit();}
function printPrecheckinForm(orderNum,contractCode){
var name="PreCheckInForm";
var params="scrollbars=yes,resizable=yes,menubar=yes,width=800,height=800";
var url="printPrecheckinForm.do?reservationNumber="+orderNum+"&contractCode="+contractCode;
window.open(url,name,params);}
function toggleSelections(sourceField,excludeFieldId,fieldGroupId){
var checked=sourceField.checked;
var excludedField=document.getElementById(excludeFieldId);
var excludeOthers=excludedField.id==sourceField.id;
if(excludeOthers&&checked){
var debug="";
for(i=0;i<document.forms[0].elements.length;i++){
var currId=document.forms[0].elements[i].id.substring(0,fieldGroupId.length);
if(currId==fieldGroupId&&sourceField.id!=document.forms[0].elements[i].id){
document.forms[0].elements[i].checked=false;}}}else if(checked){
excludedField.checked=false;}}
function randomInt(min,max){return Math.floor(Math.random()*(max-min+1)+min);}
function toggleFieldState(checkbox,associatedFieldId,backingTextFieldId){
var associatedField=document.getElementById(associatedFieldId);
var backingTextFieldId=document.getElementById(backingTextFieldId);
if(checkbox.checked){
associatedField.value="";
associatedField.readOnly=true;
addClassName(associatedField,"disabled",true);
backingTextFieldId.value="true";}else{
associatedField.readOnly=false;
addClassName(associatedField,"disabled",false);
backingTextFieldId.value="false";}}
function requestNewCaptchaImg(captchaImgId){
var captchaImg=document.getElementById(captchaImgId);
if(captchaImg){
var src=captchaImg.src;
var idx=src.indexOf("?");
if(idx>=0)
src=src.substr(0,idx);
src=src+"?p="+randomInt(1000,1000000);
captchaImg.src=src;
var inputFld=document.getElementById("securitycheckid");
if(inputFld)
inputFld.value="";}}
function showSection(sectionId,show){
document.getElementById(sectionId).style.display=show?'':'none'}
function showHiddenOptions(theNode,doShow){
if(theNode!=null){
containerForHiddenOptions=getParentByClassName(theNode,"hiddenoptions");
addClassName(containerForHiddenOptions,"hide",!doShow)
if(doShow)focusNextElement(theNode);}}
function showHiddenOptionsByList(theNode,selectedId,showList){
if(theNode!=null){
var doShow=false;
var elemShowArray=showList.split(';');
for(i=0;i<elemShowArray.length;i++){
if(selectedId==elemShowArray[i]){
doShow=true;
break;}}
containerForHiddenOptions=getParentByClassName(theNode,"hiddenoptions");
addClassName(containerForHiddenOptions,"hide",!doShow);
if(doShow)focusNextElement(theNode);}}
function showExclusiveHiddenOptions(theNode,doShow,exclusiveNodeName){
var exclusiveNode=document.getElementById(exclusiveNodeName);
showHiddenOptions(theNode,doShow);
if(document.getElementById(exclusiveNodeName)){
if(doShow){
exclusiveNode.checked=false;
showHiddenOptions(exclusiveNode,!doShow);}}}
function refreshHiddenOptions(theForm){
if(theForm!=null){
theElements=theForm.elements;
for(elDex=0;elDex<theElements.length;elDex++){
var theValue=theElements[elDex]['onclick'];
theValue=(theValue==null)?"":theValue.toString();
if(theValue.indexOf("showHiddenOptions")>-1){
showHiddenOptions(theElements[elDex],theElements[elDex].checked);}}}}
function focusNextElement(theNode){}
function isIDInList(id,idList){
var idArray=idList.split(';');
for(i=0;i<idArray.length;i++){
if(id==idArray[i])
return true;}
return false;}
function showEquipmentLenghtOrDepthKOA(dropDown,equipmentLengthUI,equipmentDepthUI,equipmentLengthIDs,equipmentDepthIDs){
var showEquipmentLength="";
if(dropDown.selectedIndex>=1){
var equipmentID=dropDown.options[dropDown.selectedIndex].value
var showEquipmentLength=isIDInList(equipmentID,equipmentLengthIDs)?"":"none";}
if($(equipmentLengthUI+'_error'))
$(equipmentLengthUI+'_error').style.display=showEquipmentLength;
$(equipmentLengthUI).style.display=showEquipmentLength;}
function showEquipmentLenghtOrDepth(equipmentID,equipmentLengthUI,equipmentDepthUI,
equipmentLengthIDs,equipmentDepthIDs){
var showEquipmentLength=isIDInList(equipmentID,equipmentLengthIDs)?"":"none";
if($(equipmentLengthUI+'_error'))
$(equipmentLengthUI+'_error').style.display=showEquipmentLength;
$(equipmentLengthUI).style.display=showEquipmentLength;}
function showEquipmentLenght(equipmentID,equipmentLengthUI,equipmentLengthIDs){
var showEquipmentLength=isIDInList(equipmentID,equipmentLengthIDs)?"":"none";
if($(equipmentLengthUI+'_error'))
$(equipmentLengthUI+'_error').style.display=showEquipmentLength;
$(equipmentLengthUI).style.display=showEquipmentLength;}
function toggleHiddenOptions(openNodeId,closeNodeId,doShow){
var openNode=document.getElementById(openNodeId);
var closeNode=document.getElementById(closeNodeId);
openNode.style.display="block";
closeNode.style.display="none";}
function showGiftCardInfo(contractIndex){
document.getElementById("giftCardInputContainer_"+contractIndex).style.display="block";
document.getElementById("giftCardSectionExpandedFlag_"+contractIndex).value="true";
var numberOfGiftCards=document.getElementById("numberOfGiftCardsRedeemed_"+contractIndex).value-=0;
if(numberOfGiftCards==0){
document.getElementById("giftCardOpenLinkContainer_"+contractIndex).style.display="none";
document.getElementById("giftCardInfo_"+contractIndex).style.display="block";}
return false;}
function redeemAnother(contractIndex){
document.getElementById("giftCardRedeemLink_"+contractIndex).style.display="none";
return showGiftCardInfo(contractIndex);}
function updatePaymentChoice(buttonValue,contractCode){
var full=buttonValue=="FULL";
var amountFullElem=document.getElementById(contractCode+"_ccAmountFull");
var amountMinimumElem=document.getElementById(contractCode+"_ccAmountMinimum");
if(amountFullElem!=null){amountFullElem.style.display=full?"":"none";}
if(amountMinimumElem!=null){amountMinimumElem.style.display=full?"none":"";}
var ccAmountCellId=full?contractCode+"_ccAmountFull":contractCode+"_ccAmountMinimum";
var amountCell=document.getElementById(ccAmountCellId);
if(amountCell!=null){
var amountStr=amountCell.innerHTML;
if(amountStr=="$0.00"){
showElementById(contractCode+"_cardPaymentType",false);
showElementById(contractCode+"_cardPaymentNumber",false);
showElementById(contractCode+"_cardPaymentSecCode",false);
showElementById(contractCode+"_cardPaymentExpDate",false);
showElementById(contractCode+"_cardPaymentName",false);}else{
showElementById(contractCode+"_cardPaymentType",true);
showElementById(contractCode+"_cardPaymentType",true);
showElementById(contractCode+"_cardPaymentNumber",true);
showElementById(contractCode+"_cardPaymentSecCode",true);
showElementById(contractCode+"_cardPaymentExpDate",true);
showElementById(contractCode+"_cardPaymentName",true);}}}
function showElementById(id,show){
var elem=document.getElementById(id);
if(elem!=null){
elem.style.display=show?"":"none";}}/*
File:utils_iframepopup.js;
Description:code for Iframe popups(useful replacement for child windows);
References:utils_dom.js;*/
function closeIframePopup(iframeId){
if(typeof(theIframe)!='undefined')
try{theIframe.contentWindow.finPop()}catch(e){};
if(typeof(iframeId)=="string")theIframe=document.getElementById(iframeId);
else theIframe=iframeId;
if(theIframe!=null){
theIframe.style.display="none";}
return false;}
function addPopupIframe(theId,theSrc,autoClosePopup){
var newIframe=document.createElement("IFRAME");
newIframe.setAttribute("id",theId);
newIframe.setAttribute("src",theSrc);
newIframe.setAttribute("scrolling","no");
newIframe.setAttribute("frameBorder","0");
newIframe.setAttribute("width","100");
newIframe.setAttribute("height","100");
newIframe.setAttribute("class","popup");
newIframe.setAttribute("className","popup");
newIframe.setAttribute("allowTransparency","yes");
newIframe.style.position="absolute";
newIframe.style.display="none";
if(autoClosePopup){
try{newIframe.ondeactivate=new Function("closeIframePopup('"+theId+"')");}catch(e){}
try{document.onfocus=new Function("closeIframePopup('"+theId+"')");}catch(e){}}
document.body.appendChild(newIframe);}
function showIframePopup(callingButton,iframeId,showUnder,offsetX,offsetY){
if(isNaN(offsetX))offsetX=0;
if(isNaN(offsetY))offsetY=0;
theIframe=document.getElementById(iframeId);
xRevealOffset=32;
if(theIframe!=null){
theIframe.contentWindow.targetInput=callingButton;
theTop=(showUnder)?getActualBottom(callingButton):getActualTop(callingButton);
theIframe.style.top=(theTop+offsetY)+"px";
theIframe.style.left=(getActualLeft(callingButton)+xRevealOffset+offsetX)+"px";
frameSizeToContent(theIframe);
try{theIframe.contentWindow.updatePop();}catch(e){}
theIframe.style.display="block";
theIframe.contentWindow.document.onactivate=new Function("activeFromIframe = true");
theIframe.contentWindow.targetInput.select();}
return false;}
function onFocusShowIframePopup(callingInput,iframeId,offsetX,offsetY){
activeFromIframe=false;
document.onactivate=new Function("if(!activeFromIframe)closeIframePopup('"+iframeId+"');activeFromIframe = false");
return showIframePopup(callingInput,iframeId,true,offsetX,offsetY);}
function frameSizeToContent(theIframe){
theIframe.style.width=theIframe.contentWindow.document.body.getElementsByTagName("DIV")[0].style.width;
theIframe.style.height=theIframe.contentWindow.document.body.getElementsByTagName("DIV")[0].style.height;}
function focusLastInput(theDoc){
theInputs=theDoc.getElementsByTagName("INPUT");
if(theInputs.length>0){
try{theInputs[theInputs.length-1].focus();}catch(e){}
try{theInputs[0].focus();}catch(e){}}}
var newChildWindow=null;
function openChildWindow(theUrl,theName,theParams){
if(theUrl==null)theUrl="about:blank";
if(theName==null)theName="New Child Window";
if(theParams==null)theParams="scrollbars=YES,resizable=YES, width=700, height=500";
try{
newChildWindow.focus();}catch(e){
newChildWindow=window.open(theUrl,theName,theParams);}
return newChildWindow;}
function photo(photoSrc){
if(!photo.window_||photo.window_.closed){
var win=window.open("",null,"width=500,height=500,"+
"scrollbars=no,resizable=1,status=no,"+
"location=no,menubar=no,toolbar=no");
if(!win)return;
photo.window_=win;}
var doc=photo.window_.document;
var htmlStr="";
htmlStr+="<html><head>";
htmlStr+="<script src='/js/_all.js' type='text/javascript'></script>";
htmlStr+="<script type='text/javascript'>";
htmlStr+="var arrTemp=self.location.href.split('?');";
htmlStr+="var picUrl = (arrTemp.length>0)?arrTemp[1]:'';";
htmlStr+="function resizeWin(){";
htmlStr+="var fFoxCorr = 0; var n = window.navigator.userAgent; if (n.indexOf('Firefox')>=0) fFoxCorr = 30;";
htmlStr+="var iWidth = 2 * getActualLeft(document.images[0]) + getActualRight(document.images[0]);";
htmlStr+="var iHeight = 4 * getActualTop(document.images[0]) + getActualBottom(document.images[0]) + fFoxCorr ;";
htmlStr+="window.resizeTo(iWidth, iHeight);";
htmlStr+="}window.onload=resizeWin;";
htmlStr+="</script> </head><body>";
htmlStr+="<img src='"+photoSrc+"'/>";
htmlStr+="</body><script type='text/javascript'>focus();</script></html>";
doc.write(htmlStr);
doc.close();
photo.window_.focus();}
function showKeyAttr(callingElem,siteId){
document.onactivate=new Function("if(!activeKeyAttrPopup)closeKeyAttr();activeKeyAttrPopup = false");
showKeyAttrPopup(callingElem,siteId,"popupKeyAttr",false,0,-5);}
function showKeyAttrPopup(callingElem,siteId,iframeId,showUnder,offsetX,offsetY){
if(isNaN(offsetX))offsetX=0;
if(isNaN(offsetY))offsetY=0;
theIframe=document.getElementById(iframeId);
xRevealOffset=-210;
if(theIframe!=null){
theIframe.contentWindow.document.getElementById('content').innerHTML="<div>Updating ...</div>";
theTop=(showUnder)?getActualBottom(callingElem):getActualTop(callingElem);
theIframe.style.top=(theTop+offsetY)+"px";
theIframe.style.left=(getActualLeft(callingElem)+xRevealOffset+offsetX)+"px";
if(theIframe.contentWindow.document.body){
frameSizeToContent(theIframe);}
theIframe.style.display="block";
theIframe.contentWindow.document.onactivate=new Function("activeKeyAttrPopup = true");
http_request=false;
makeRequest("/getKeySiteAttrs.do?siteId="+siteId);}
return false;}
function closeKeyAttr(){
closeIframePopup("popupKeyAttr");}
function makeRequest(url){
http_request=false;
if(window.XMLHttpRequest){
http_request=new XMLHttpRequest();
if(http_request.overrideMimeType){
http_request.overrideMimeType('text/html');}}else if(window.ActiveXObject){
try{
http_request=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){
try{
http_request=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
if(!http_request){
alert('Cannot create XMLHTTP instance');
return false;}
http_request.onreadystatechange=alertContents;
http_request.open('GET',url,true);
http_request.send(null);}
function alertContents(){
if(http_request.readyState==4){
if(http_request.status==200){
result=http_request.responseText;
theIframe.contentWindow.document.getElementById('content').innerHTML=result;
photo=theIframe.contentWindow.document.getElementById('sitePhoto');}else{
theIframe.contentWindow.document.getElementById('content').innerHTML="<DIV class='error'>We cannot retrieve site information at this time. Please try again later.</DIV>";}
resetPosition();}}
function resetPosition(){
if(photo&&!photo.complete)window.setTimeout("resetPosition()",500);
var content=theIframe.contentWindow.document.getElementById('content');
var frameBottom=getActualTop(theIframe)+(getActualBottom(content)-getActualTop(content)+20);
var windowPosition=getWindowSize()[1]+getScrollXY()[1];
if(windowPosition<frameBottom)
theTop-=(frameBottom-windowPosition);
theIframe.style.top=(theTop)+"px";}


