/*
 * Really easy field validation with Prototype
 * http://tetlaw.id.au/view/blog/really-easy-field-validation-with-prototype
 * Andrew Tetlaw
 * Version 1.5.3 (2006-07-15)
 * 
 * Copyright (c) 2006 Andrew Tetlaw
 * http://www.opensource.org/licenses/mit-license.php
 */
Validator = new Class({
	initialize: function(className, error, test, options) {
		this.options = Object.extend({}, options || {});
		this._test = test ? test : function(v,elm){ return true };
		this.error = error ? error : 'Validation failed.';
		this.className = className;
	},
	test : function(v, elm) {
		return this._test(v,elm);
	}
});

var Validation = new Class({
	initialize : function(form, options){
		this.options = Object.extend({
			onSubmit : true,
			stopOnFirst : false,
			immediate : false,
			focusOnError : false,
			useTitles : false,
			onFormValidate : function(result, form) {},
			onElementValidate : function(result, elm) {}
		}, options || {});
		this.form = $(form);
		//Garbage.collect(this.form)
		if(this.options.onSubmit) this.form.addEvent('submit',this.onSubmit.bind(this));
		if(this.options.immediate) {
			var useTitles = this.options.useTitles;
			var callback = this.options.onElementValidate;
			this.form.getElementsBySelector("input, select, textarea").each(function(input) {
				input.addEvent('blur', function(ev) { Validation.validate(new Event(ev).target,{useTitle : useTitles, onElementValidate : callback}); });
			});
		}
	},
	onSubmit :  function(ev){
		if(!this.validate()) new Event(ev).stop();
	},
	validate : function() {
		var result = false;
		var useTitles = this.options.useTitles;
		var callback = this.options.onElementValidate;
		this.form.getElementsBySelector("input, select, textarea").each(function(elm) { return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback}); });
		if(this.options.stopOnFirst) {
			result = this.form.getElementsBySelector("input, select, textarea").all(function(elm) { return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback}); });
		} else {
			result = this.form.getElementsBySelector("input, select, textarea").every(function(elm) { return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback}); });
		}
		if(!result && this.options.focusOnError) {
			this.form.getElement('.validation-failed').focus()
		}
		this.options.onFormValidate(result, this.form);
		return result;
		
	},
	reset : function() {
		this.form.getElementsBySelector("input, select, textarea").each(Validation.reset);
	}
});
Validation = Object.extend(Validation, {
	validate : function(elm, options){
		options = Object.extend({
			useTitle : false,
			onElementValidate : function(result, elm) {}
		}, options || {});
		elm = $(elm);
		//Garbage.collect(elm);
		var cn = elm.className.split(" ");
		return result = cn.every(function(value) {
			var test = Validation.test(value,elm,options.useTitle);
			options.onElementValidate(test, elm);
			return test;
		});
	},
	test : function(name, elm, useTitle) {
		var v = Validation.get(name);
		var prop = '__advice'+name.camelCase();
		if(Validation.isVisible(elm) && !v.test($(elm).getValue(), elm)) {
			if(!elm[prop]) {
				var advice = Validation.getAdvice(name, elm);
				if(!$pick(advice, false)) {
					var errorMsg = useTitle ? ((elm && elm.title) ? elm.title : v.error) : v.error;
					advice = new Element('div').addClass('validation-advice').setProperty(
						'id','advice-'+name+'-'+Validation.getElmID(elm)).setStyle('display','none').appendText(errorMsg);
					switch (elm.type.toLowerCase()) {
						case 'checkbox':
						case 'radio':
							var p = $(elm.parentNode);
							if(p) {
								p.adopt(advice);
							} else {
								advice.injectAfter($(elm));
							}
							break;
						default:
							 if($(elm).getAttribute("id") == "parent_dayphone") {
									advice.injectAfter($(elm).getNext().getNext());
								}   else {
									advice.injectAfter($(elm));
								}
				    }
					advice = $('advice-' + name + '-' + Validation.getElmID(elm));
				}
				try {
					$(advice).setStyles({
						'display':'block',
						'visibility':'hidden'
					}).effect('opacity').start(0,1)
				} catch(e){
					$(advice).setStyle('display','block');
				}
			}
			elm[prop] = true;
			elm.removeClass('validation-passed');
			elm.addClass('validation-failed');
			return false;
		} else {
			var advice = Validation.getAdvice(name, elm);
			if(advice) advice.setStyle('display','none');
			elm[prop] = '';
			elm.removeClass('validation-failed');
			elm.addClass('validation-passed');
			return true;
		}
	},
	isVisible : function(elm) {
		while(elm.tagName != 'BODY') {
			if($(elm).getStyle('display') == "none") return false;
			elm = elm.parentNode;
		}
		return true;
	},
	getAdvice : function(name, elm) {
		var returnVal = false;
		try{
			returnVal = $('advice-' + name + '-' + Validation.getElmID(elm))
		} catch(e){}
		if(!returnVal){
			try{
				returnVal = $('advice-' + Validation.getElmID(elm))
			} catch(e){}
		}
		return returnVal;
	},
	getElmID : function(elm) {
		return elm.id ? elm.id : elm.name;
	},
	reset : function(elm) {
		elm = $(elm);
		var cn = elm.className.split(" ");
		cn.each(function(value) {
			var prop = '__advice'+value.camelCase();
			if(elm[prop]) {
				var advice = Validation.getAdvice(value, elm);
				advice.setStyle('display','none');
				elm[prop] = '';
			}
			elm.removeClassName('validation-failed');
			elm.removeClassName('validation-passed');
		});
	},
	add : function(className, error, test, options) {
		var nv = {};
		nv[className] = new Validator(className, error, test, options);
		Validation.methods = Object.extend(Validation.methods, nv);
	},
	addAllThese : function(validators) {
		var nv = {};
		$A(validators).each(function(value) {
				nv[value[0]] = new Validator(value[0], value[1], value[2], (value.length > 3 ? value[3] : {}));
			});
		Validation.methods = Object.extend(Validation.methods, nv);
	},
	get : function(name) {
		return Validation.methods[name] ? Validation.methods[name] : new Validator();
	},
	methods : {}
});

Validation.add('IsEmpty', '', function(v) {
	return  ((v == null) || (v.length == 0)); // || /^\s+$/.test(v));
});

Validation.addAllThese([
	['required', 'This is a required field.', function(v, elm) {
			if(elm.type.toLowerCase() == "checkbox"){
				return elm.checked;
			} else if(elm.type.toLowerCase() == "radio") {
				var returnval = false;
				$each($$("input[name="+elm.name+"]"), function(value, key){
					if(value.checked){
						returnval = true;
					} 
				});
				return returnval;
				
			} else {
				return !Validation.get('IsEmpty').test(v);
			}
			}],
	['validate-number', 'Please enter a valid number in this field.', function(v) {
				return Validation.get('IsEmpty').test(v) || (!isNaN(v) && !/^\s+$/.test(v));
			}],
	['validate-digits', 'Please use numbers only in this field. please avoid spaces or other characters such as dots or commas.', function(v) {
				return Validation.get('IsEmpty').test(v) ||  !/[^\d]/.test(v);
			}],
	['validate-alpha', 'Please use letters only (a-z) in this field.', function (v) {
				return Validation.get('IsEmpty').test(v) ||  /^[a-zA-Z]+$/.test(v)
			}],
	['validate-alphanum', 'Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.', function(v) {
				return Validation.get('IsEmpty').test(v) ||  !/\W/.test(v)
			}],
	['validate-date', 'Please enter a valid date.', function(v) {
				var test = new Date(v);
				return Validation.get('IsEmpty').test(v) || !isNaN(test);
			}],
	['validate-email', 'Please enter a valid email address. For example fred@domain.com .', function (v) {
				return Validation.get('IsEmpty').test(v) || /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(v)
			}],
	['validate-url', 'Please enter a valid URL.', function (v) {
				return Validation.get('IsEmpty').test(v) || /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(v)
			}],
	['validate-date-au', 'Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.', function(v) {
				if(Validation.get('IsEmpty').test(v)) return true;
				var regex = /^(\d{2})\/(\d{2})\/(\d{4})$/;
				if(!regex.test(v)) return false;
				var d = new Date(v.replace(regex, '$2/$1/$3'));
				return ( parseInt(RegExp.$2, 10) == (1+d.getMonth()) ) && 
							(parseInt(RegExp.$1, 10) == d.getDate()) && 
							(parseInt(RegExp.$3, 10) == d.getFullYear() );
			}],
	['validate-currency-dollar', 'Please enter a valid $ amount. For example $100.00 .', function(v) {
				// [$]1[##][,###]+[.##]
				// [$]1###+[.##]
				// [$]0.##
				// [$].##
				return Validation.get('IsEmpty').test(v) ||  /^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/.test(v)
			}],
	['validate-one-required', 'Please select one of the above options.', function (v,elm) {
						var p = elm.getParent()
						var options = p.getElementsByTagName('INPUT');
						var returnval = false;
						$A(options).each(function(el){
							if(typeof el.getValue() == "string"){returnval = true;}
						})
						return returnval;
			 }]
]);

var TABLEHELPERS = 
{
    // Give table row striping by class name. 
    stripeTable : function(classname) {
        var even = false;
        var evenColor = arguments[1] ? arguments[1] : "#fff";
        var oddColor = arguments[2] ? arguments[2] : "#F2F4F5";
        var tables = document.getElementsByClassName(classname);                                
        if (! tables) { return; }
        for(var g = 0; g < tables.length; g++){
            table = tables[g];    
            var tbodies = table.getElementsByTagName("tbody");
            for (var h = 0; h < tbodies.length; h++) {
                var trs = tbodies[h].getElementsByTagName("tr");
                for (var i = 0; i < trs.length; i++) {
                    var tds = trs[i].getElementsByTagName("td");
                    for (var j = 0; j < tds.length; j++) {
                        var mytd = tds[j];
                        mytd.style.backgroundColor = even ? evenColor : oddColor;
                    }
                    even =  ! even;
                }
            }
        }
    },
    
    
    // Make rows highlight on roll over and makes table row 'selected' on click.
    // Also looks for input tag (e.g. check box) and selects that
    selectableTable : function(tableid) {
        if(!$(tableid)) return false;
        var table = $(tableid);
        var trs = table.getElementsByTagName('tr');
        for(var i = 0; i < trs.length; i++){
            trs[i].onmouseover = function(){
                this.className += ' highlighted';
            }
            trs[i].onmouseout = function(){
                NAV.checkClass(this, 'highlighted', true);
            }
            trs[i].onclick = function(){
                var inputs = this.getElementsByTagName('input')
                if(inputs[0].checked){
                    inputs[0].checked = false;
                     NAV.checkClass(this, 'selected', true)
                } else {
                    inputs[0].checked = true;
                    this.className += ' selected'
                }
                
            }
            
            var trinput = trs[i].getElementsByTagName('input')[0];
            if(trinput){
                trinput.onclick = function(e){
                    /* Cancel Event Propogation*/
                    if (!e) var e = window.event;
                    e.cancelBubble = true;
                    if (e.stopPropagation) e.stopPropagation();
                    
                    if(!this.checked){
                        NAV.checkClass(this.parentNode.parentNode, 'selected', true);
                    }  else {
                        this.parentNode.parentNode.className += ' selected';
                    }
                }
            }
        }    
    }
} 

var GALLERY =
{
	reelwidth : 0,
	scrollwidth: 438,
	scrollend : 38,
	scrollpos : 38,
	marginchange : Object,
	mainimage : Object, 
	imgholder : Image,
	numimages: 0,
	init : function(divid){
		
		new Fx.Style('marginleft', {transition: Fx.Transitions.Elastic.easeOut});   
		
		GALLERY.marginchange = new Fx.Style('reel', 'margin-left', {duration:1000});
		GALLERY.numimages = $ES("#reel li").length;
		GALLERY.marginchange.addEvent("onComplete", function(){
		
		})
		GALLERY.mainimage = $E("#gallery .mainimage");
	
		$ES("#reel a").each(function(a){a.onclick = GALLERY.loadimage;})
		
		/* reset interface, we know JS is going to work*/
		$("gallery").setStyles({
			minHeight: "460px",
			paddingBottom: "83px"
			
		})
	   
		$("photocount").setStyle("display", "inline")
		$("photocount").setText("Photo 1 of "+GALLERY.numimages)
		
		$E("#gallery .reelholder").setStyles({
			position: 'absolute',
			overflow: 'hidden',
			marginTop: '462px'
		})
		$("reel").setStyles({
			position: 'absolute',
			height: '73px',
			width: ((GALLERY.numimages * 73)) > 527 ?  (GALLERY.numimages * 73)+"px"  : "527px"
		})  
		$E("#gallery .photoholder").setStyle("display", "block")
		$E("#gallery .controls").setStyle("display", "block")   
		//$E("#gallery .controls").setOpacity(1)
		GALLERY.reelwidth = Number($("reel").getStyle("width").replace(/px/, "")) - GALLERY.scrollwidth - 91;
		
		$("scrollleft").className = "inactive"
		
		if(GALLERY.numimages > 7){
			$("scrollleft").onclick = function(){
				this.blur()
				GALLERY.scrollBack()
				return false;
			}
			
			$("scrollright").onclick = function(){
				this.blur()
				GALLERY.scrollForward()
				return false;        
			}   
		}else {
			$("scrollright").className = "inactive"	
		}
	},
	
	scrollBack : function(){
		$("scrollright").className = ""
		if(((GALLERY.scrollpos + GALLERY.scrollwidth) > GALLERY.scrollend) || (GALLERY.scrollpos + GALLERY.scrollwidth) == GALLERY.scrollend){
			$("scrollleft").className = "inactive"
			GALLERY.marginchange.start(GALLERY.scrollpos, GALLERY.scrollend);
			GALLERY.scrollpos = GALLERY.scrollend
			
		}   else {
			GALLERY.marginchange.start(GALLERY.scrollpos, GALLERY.scrollpos + GALLERY.scrollwidth);
			GALLERY.scrollpos = GALLERY.scrollpos + GALLERY.scrollwidth
		}
	},
	
	scrollForward : function(){
		$("scrollleft").className = ""
		if((GALLERY.scrollpos - GALLERY.scrollwidth) < (GALLERY.scrollend - GALLERY.reelwidth)){
			GALLERY.marginchange.start(GALLERY.scrollpos, GALLERY.scrollend - GALLERY.reelwidth);
			GALLERY.scrollpos = GALLERY.scrollend - GALLERY.reelwidth;
			$("scrollright").className = "inactive"
		} else {
			GALLERY.marginchange.start(GALLERY.scrollpos, GALLERY.scrollpos - GALLERY.scrollwidth);
			GALLERY.scrollpos = GALLERY.scrollpos - GALLERY.scrollwidth		
		}
	},
	
	loadimage : function(){
		GALLERY.mainimage.setProperty("src", this.href)
		var li = this.getParent()
		var x = 1;
		while(li = li.getPrevious()){x++;}
		$("photocount").setText("Photo "+x+" of "+GALLERY.numimages)
		return false;                              
	}
}

var HELPERS =
{      
	
	// Container for image preloads //
	popupprefs : [],
	linkPopups : function(popupClass, popupOptions)
	{
		if(typeof popupClass.href == "string"){
			var ops = popupOptions;
			popupClass.onclick = function(){
				var mywin=open(this.href, 'ARCC', ops);
				this.blur();
				return false;
			}
		} else {
			HELPERS.popupprefs[popupClass] = popupOptions
			$ES('a').each(function(pl){
				if(pl.hasClass(popupClass)){
					pl.onclick = HELPERS.launchPopup;
				}
			})
		}
	},

	launchPopup : function(){
		var  i, prefs;
		prefs = "";
		// cycle through class names and match to popupprefs
		// this enables multiple classes to be applied to an anchor
		this.className.split(' ').each(function(cn){
			if(typeof HELPERS.popupprefs[cn] == "string"){
				prefs = HELPERS.popupprefs[cn];
			}
		})
		mywin=open(this.href, 'Actuate', prefs);
		this.blur();
		return false;
	},
	
    // Make link change display of another element from block to none (and vice versa)
    linkDropDown : function(linkid, dropdownid){
        if(!$(linkid) || !$(dropdownid)) return false;
        $(dropdownid).onclick = function(e){
            /* Cancel Event Propogation*/
            if (!e) var e = window.event;
            e.cancelBubble = true;
            if (e.stopPropagation) e.stopPropagation();
        }
        $(linkid).onclick = function(e){         
            /* Cancel Event Propogation*/
            if (!e) var e = window.event;
            e.cancelBubble = true;
            if (e.stopPropagation) e.stopPropagation();
            
            var dropdowns = document.getElementsByClassName($(dropdownid).className);
            for(var i = 0; i < dropdowns.length; i++){
                if(dropdowns[i].getAttribute("id") != dropdownid)
                dropdowns[i].style.display = "none";
            }
            $(dropdownid).style.display = $(dropdownid).style.display == "block" ? "none" : "block";
            
            this.blur();
           
            document.onclick = function(){
                 $(dropdownid).style.display = "none";
                 document.onclick = null;             
             }   
             return false;
        }                    
    },
    
    // Smart Text Input (e.g. search fields)
    memorizeTextInput : function(id, starttext){
        var input = $(id);
        if(!input) return false;              
		if(typeof starttext != "undefined")
		input.value = starttext;
        input.oldval = input.value;
        input.onfocus = function(){
			if(this.value == this.oldval)
            this.value = "";
        }
        input.onblur = function(){
            if(this.value == "")
            this.value = this.oldval;
        }
    },
    
    // Click button to move elements from one multi select to another
    selectTransfer : function(controlid, fromselectid, toselectid){
        if(!$(controlid) || !$(fromselectid) || ! $(toselectid)) return false;
        $(controlid).onclick = function(){
            var fromselect = $(fromselectid);
            var toselect = $(toselectid)
            var length = fromselect.options.length;
            for(var i = 0; i < length; i++){
                if(fromselect.options[i].selected){
                    toselect.appendChild(fromselect.options[i]);
                    --length;
                    --i;
                }
            }            
            this.blur();
            return false;
        }
    },
    
    pause : function(millis) 
    {
        date = new Date();
        var curDate = null;
        do { var curDate = new Date(); } 
        while(curDate-date < millis);
    }
};     
 

// domFunction (will load things faster than addEvent can)
// http://brothercake.com/site/resources/scripts/domready/
function domFunction(f, a)
{ var n = 0; var t = setInterval(function()
{ var c = true; n++; if(typeof document.getElementsByTagName != 'undefined' && (document.getElementsByTagName('body')[0] != null || document.body != null))
{ c = false; if(typeof a == 'object')
{ for(var i in a)
{ if
( (a[i] == 'id' && document.getElementById(i) == null) || (a[i] == 'tag' && document.getElementsByTagName(i).length < 1)
)
{ c = true; break;}
}
}
if(!c) { f(); clearInterval(t);}
}
if(n >= 60)
{ clearInterval(t);}
}, 250);};
        

var hpflash = new domFunction(function(){
	if(!$("homepageflash")) return;
	var so = new SWFObject("swfs/hp/arcc-hero-v11.swf", "homepageswf", "726", "406", "8", "#FFFFFF");
	so.addParam("wmode", "transparent")
	so.addVariable("xmlPath", "/swfs/data/builds.xml");
	so.write("homepageflash");
	
	//body background image

  //  document.getElementsByTagName("body")[0].style.backgroundImage = String("/images/homepagebg/bg"+(Math.floor(Math.random()*7)+1)+".jpg");
	document.getElementsByTagName("body")[0].className += " bg" + (Math.floor(Math.random()*7)+1);

	
}, "homepageflash") 



function  animateVideo(){
	var adjustwidth = $('sydney').effect('width', {duration: 1000, transition: Fx.Transitions.linear, onComplete: function(){
		$("videoplayer").updatePlayer();
	}});
	adjustwidth.start(128, 288);
	var adjusttext = $('sydneytext').effect('width', {duration: 1000, transition: Fx.Transitions.linear});    
	adjusttext.start(450, 290);
		
	var adjustheight = $('sydney').effect('height', {duration: 1000, transition: Fx.Transitions.linear});
	adjustheight.start(72, 162);

}
 
function loadVideo(vidid){
	$("flashvidplayer").loadById(vidid)
	
}
       
var printpage = new domFunction(function(){
	if(!$("printpage")) return;
	$("printpage").onclick = function(){
		window.print();
		return false;
	}
}, "printpage");     


var bookmarkpage = new domFunction(function(){
	if(!$("bookmarkpage")) return;
	$("bookmarkpage").onclick = function(){
 		if(window.external && document.all){
			window.external.AddFavorite(document.location.href, document.title);
		} else if (window.sidebar){
			window.sidebar.addPanel(document.title, document.location.href, document.location.href);		
		 } else {
			alert("Press CTRL+D to bookmark this page."); 
		}
		return false;
	}
}, "bookmarkpage");

var vidlibrary = new domFunction(function(){
	if(!$("videolibrary")) return;
	$("videolo")
	$ES("a", "videolibrary").each(function(el){
		
		el.onclick = function(){
		   var hrefarray = this.href.split("/")
			loadVideo(hrefarray[hrefarray.length-1])
			this.blur()
			return false;
		}
	})
}, "videolibrary")

var validateEmail = new domFunction(function(){
	if(!$("emailalert")) return;
    var valid = new Validation('emailalert', {immediate: true});
	
},"emailalert")


function addTripDate(linkid){
   $("addtrip").onclick = function(){
		var i = 1;
		while ($("startmonth_"+i)){
			i++;
		}
		i--;
		
		var start = $("startmonth_"+i).parentNode ;
		
		if(typeof start.nextSibling.innerHTML != "undefined"){
			var end = start.nextSibling;
		} else {
			var end = start.getNext();  
		}
		
		var newstartinit = start.cloneNode(true)
		var newendinit = end.cloneNode(true)
		
		var newstart = $("dates").appendChild(newstartinit)
		var newend = $("dates").appendChild(newendinit)


		var newstartselects = newstart.getElementsByTagName("select")
		for(var z = 0; z < 3; z++){
			var id = newstartselects[z].getAttribute("id")
			id = id.replace(/\d+/, i+1)
			newstartselects[z].setAttribute("id", id)
			newstartselects[z].setAttribute("name", id)
			if(z == 0)
			newstart.getElementsByTagName("label")[0].htmlFor = id;
		}  
		
		var newendselects = newend.getElementsByTagName("select")
		for(var z = 0; z < 3; z++){
			var id = newendselects[z].getAttribute("id")
			id = id.replace(/\d+/, i+1)
			newendselects[z].setAttribute("id", id)
			newendselects[z].setAttribute("name", id)
			if(z == 0)
			newend.getElementsByTagName("label")[0].htmlFor = id;
		}
		
		return false;
	}
}

var finding = false;
var findatrip = new domFunction(function(){
	if(!$("nav")) return;
	$E("a", "nav").onmouseover = $("findtripdropdown").onmouseover = function(){
		$("findtripdropdown").addClass("activated")
		this.addClass("hover")
		finding = true;
	}
	$E("a", "nav").onmouseout = $("findtripdropdown").onmouseout = function(){
		finding = false;
		var n = setTimeout(function(){if(!finding){$("findtripdropdown").removeClass("activated");$E("a", "nav").removeClass("hover")}}, 300)
	}
}, "nav"); 
                     
var morelinks = new domFunction(function(){
	if(!$("content")) return;
	$ES("p.leadin a", "content").each(function(anchor){
		var targetid = String(anchor).split("#")[1];
		anchor.setStyle("display", "inline") 
		anchor.onclick = function(){               
			this.setStyle("display", "none")
			$(targetid).setStyle("display", "block")
			return false
		}
		$(targetid).setStyle("display", "none")
	}) 
	// Use the content handle for gallery popup links too
	HELPERS.linkPopups('gallerypopup', 'width=645,height=590,toolbar=no,copyhistory=now,scrollbars=yes,resizable=no,directories=no,menubar=no,status=no,location=no');
	
}, "content")

var abouttext = new domFunction(function(){
	if(!$("about")) return;
	$E("a.aboutlink", "about").onclick = function(){
		$E("span", "about").toggleClass("showinfo");		
		return false
	}
}, "about")

var emailaddress = new domFunction(function(){
	if(!$("emailaddress")) return;
	HELPERS.memorizeTextInput("emailaddress", "Email Address");
}, "actionbar")  
      
var adddate = new domFunction(function(){
	if(!$("addtrip")) return;
	addTripDate("addtrip");
	
}, "addtrip") 

var imgpopups = new domFunction(function(){
	if (!$("editimagelist")) return
	HELPERS.linkPopups('imgedit', 'width=645,height=600,toolbar=no,copyhistory=now,scrollbars=yes,resizable=no,directories=no,menubar=no,status=no,location=no');
}, "editimagelist")


var gallery = new domFunction(function(){
	if (!$("gallery")) return;
	if (!$("gallery")) return;
	GALLERY.init("gallery");
} , "gallery")


var interstate = {
	src: '/swfs/interstate.swf'
	,ratios: [6,1.24,7,1.21,8,1.18,10,1.16,11,1.13,12,1.12,13,1.11,15,1.1,17,1.09,19,1.08,22,1.07,26,1.06,32,1.05,41,1.04,58,1.03,97,1.02,1.01]
}; 

var felttiproman = {
	src: '/swfs/felttiproman.swf'
	,ratios: [6,1.24,7,1.21,8,1.18,10,1.16,11,1.13,12,1.12,13,1.11,15,1.1,17,1.09,19,1.08,22,1.07,26,1.06,32,1.05,41,1.04,58,1.03,97,1.02,1.01]
};
//sIFR.delayCSS  = true;
 // sIFR.domains = ['novemberborn.net'] // Don't check for domains in this demo

sIFR.activate(interstate, felttiproman);

//sIFR.debug.ratios(felttiproman, {selector: '#content blockquote p.color'});

/* sIFR setup */
/* sifr section colours*/	
var textcolor = "#71645a";
var getsifrcolor = new domFunction(function(){
	if(!$("wrapper")) return false;
	if($$("body")[0].className != ""){
		switch($$("body")[0].className)
		{
		case ("globalaction"):
			textcolor = "#84a55c";
			break;
		case ("service"):
			textcolor = "#cc9014";
			break;
		case ("bluewater"):
			textcolor = "#70a0aa";
			break;
		case ("language"):
			textcolor = "#9f8788";
			break;
		case ("leadership"):
			textcolor = "#807b64";
			break;
		}
		
	}
	sIFR.replace(felttiproman, {
		selector: '#content blockquote p.color'
		,css: ['.sIFR-root {leading: 8; text-align:center; color:'+textcolor+';}']
		,wmode: 'transparent'
	})
	sIFR.replace(interstate, {
		selector: '#content h2'
		,css: ['.sIFR-root {color:'+textcolor+';} a{color: #bd6601; text-decoration:none} a:hover{color:#bd6601}']
		,wmode: 'transparent'
	})
	sIFR.replace(interstate, {
		selector: '#slideshows h3'
		,css: ['.sIFR-root {color:'+textcolor+';} a{color: #bd6601; text-decoration:none} a:hover{color:#bd6601}']
		,wmode: 'transparent'
	})
}, "wrapper");
 


sIFR.replace(interstate, {
	selector: '.triplist h2, h2.colored'
	,css: ['.sIFR-root {color:#FFFFFF;}']
	,wmode: 'transparent'
})

sIFR.replace(interstate, {
	selector: '#content h1'
	,css: ['.sIFR-root {color:#71645a;} a {color:#BD6601; text-decoration:none} a:hover {color: #BD6601; text-decoration:underline}'] 
	,wmode: 'transparent'
})  
sIFR.replace(interstate, {
	selector: '#form h2'
	,css: ['.sIFR-root {color:#71645a;}']
	,wmode: 'transparent'
})
sIFR.replace(interstate, {
	selector: '#header h2'
	,css: ['.sIFR-root {text-transform:uppercase; color:#71645a; font-weight:bold}']
	,wmode: 'transparent'
})  

sIFR.replace(interstate, {
	selector: 'h2#header'
	,css: ['.sIFR-root {text-align:center; text-transform:uppercase; color:#71645a; font-weight:bold}']
	,wmode: 'transparent'
}) 

sIFR.replace(interstate, {
	selector: '#overview h1, #overview.dynamic .information>h2'
	,css: ['.sIFR-root {color:#FFFFFF;}']
	,wmode: 'transparent'
})   

sIFR.replace(felttiproman, {
	selector: '#overview.static .information>h2'
	,css: ['.sIFR-root {color:#FFFFFF;}']
	,wmode: 'transparent'
})  