
////////////////////////////////////////////fade.js///////////////////////////////////////

function show() 
{
	var map_div = document.getElementById('map');
	var status = map_div.style.display;
		
	//var map_inst_div = document.getElementById('map_inst');
	//var status2 = map_inst_div.style.display;
	
	//var results_div = document.getElementById('results');
//	var status3 = results_div.style.display;
	
	if (status == "none") 
	{
		map_div.style.display = "block";
		//results_div.style.display = "block";
		//map_inst_div.style.display = "none";
	}
}


///////////////////////////////moo.fx.js////////////////////////////////////////////////
/*
moo.fx, simple effects library built with prototype.js (http://prototype.conio.net).
by Valerio Proietti (http://mad4milk.net) MIT-style LICENSE.
for more info (http://moofx.mad4milk.net).
Sunday, March 05, 2006
v 1.2.3
*/

var fx = new Object();
//base
fx.Base = function(){};
fx.Base.prototype = {
	setOptions: function(options) {
	this.options = {
		duration: 500,
		onComplete: '',
		transition: fx.sinoidal
	}
	Object.extend(this.options, options || {});
	},

	step: function() {
		var time  = (new Date).getTime();
		if (time >= this.options.duration+this.startTime) {
			this.now = this.to;
			clearInterval (this.timer);
			this.timer = null;
			if (this.options.onComplete) setTimeout(this.options.onComplete.bind(this), 10);
		}
		else {
			var Tpos = (time - this.startTime) / (this.options.duration);
			this.now = this.options.transition(Tpos) * (this.to-this.from) + this.from;
		}
		this.increase();
	},

	custom: function(from, to) {
		if (this.timer != null) return;
		this.from = from;
		this.to = to;
		this.startTime = (new Date).getTime();
		this.timer = setInterval (this.step.bind(this), 13);
	},

	hide: function() {
		this.now = 0;
		this.increase();
	},

	clearTimer: function() {
		clearInterval(this.timer);
		this.timer = null;
	}
}

//stretchers
fx.Layout = Class.create();
fx.Layout.prototype = Object.extend(new fx.Base(), {
	initialize: function(el, options) {
		this.el = $(el);
		this.el.style.overflow = "hidden";
		this.iniWidth = this.el.offsetWidth;
		this.iniHeight = this.el.offsetHeight;
		this.setOptions(options);
	}
});

fx.Height = Class.create();
Object.extend(Object.extend(fx.Height.prototype, fx.Layout.prototype), {	
	increase: function() {
		this.el.style.height = this.now + "px";
	},

	toggle: function() {
		if (this.el.offsetHeight > 0) this.custom(this.el.offsetHeight, 0);
		else this.custom(0, this.el.scrollHeight);
	}
});

fx.Width = Class.create();
Object.extend(Object.extend(fx.Width.prototype, fx.Layout.prototype), {	
	increase: function() {
		this.el.style.width = this.now + "px";
	},

	toggle: function(){
		if (this.el.offsetWidth > 0) this.custom(this.el.offsetWidth, 0);
		else this.custom(0, this.iniWidth);
	}
});

//fader
fx.Opacity = Class.create();
fx.Opacity.prototype = Object.extend(new fx.Base(), {
	initialize: function(el, options) {
		this.el = $(el);
		this.now = 1;
		this.increase();
		this.setOptions(options);
	},

	increase: function() {
		if (this.now == 1 && (/Firefox/.test(navigator.userAgent))) this.now = 0.9999;
		this.setOpacity(this.now);
	},
	
	setOpacity: function(opacity) {
		if (opacity == 0 && this.el.style.visibility != "hidden") this.el.style.visibility = "hidden";
		else if (this.el.style.visibility != "visible") this.el.style.visibility = "visible";
		if (window.ActiveXObject) this.el.style.filter = "alpha(opacity=" + opacity*100 + ")";
		this.el.style.opacity = opacity;
	},

	toggle: function() {
		if (this.now > 0) this.custom(1, 0);
		else this.custom(0, 1);
	}
});

//transitions
fx.sinoidal = function(pos){
	return ((-Math.cos(pos*Math.PI)/2) + 0.5);
	//this transition is from script.aculo.us
}
fx.linear = function(pos){
	return pos;
}
fx.cubic = function(pos){
	return Math.pow(pos, 3);
}
fx.circ = function(pos){
	return Math.sqrt(pos);
}

///////////////////////////////////moo.fx.pack.js///////////////////////////////////////
/*

moo.fx pack, effects extensions for moo.fx.

by Valerio Proietti (http://mad4milk.net) MIT-style LICENSE

for more info visit (http://moofx.mad4milk.net).

Wednesday, November 16, 2005

v1.1

*/



//text size modify, now works with pixels too.

fx.Text = Class.create();

fx.Text.prototype = Object.extend(new fx.Base(), {

	initialize: function(el, options) {

		this.el = $(el);

		this.setOptions(options);

		if (!this.options.unit) this.options.unit = "em";

	},



	increase: function() {

		this.el.style.fontSize = this.now + this.options.unit;

	}

});



//composition effect, calls Width and Height alltogheter

fx.Resize = Class.create();

fx.Resize.prototype = {

	initialize: function(el, options) {

		this.h = new fx.Height(el, options); 

		if (options) options.onComplete = null;

		this.w = new fx.Width(el, options);

		this.el = $(el);

	},



	toggle: function(){

		this.h.toggle();

		this.w.toggle();

	},



	modify: function(hto, wto) {

		this.h.custom(this.el.offsetHeight, this.el.offsetHeight + hto);

		this.w.custom(this.el.offsetWidth, this.el.offsetWidth + wto);

	},



	custom: function(hto, wto) {

		this.h.custom(this.el.offsetHeight, hto);

		this.w.custom(this.el.offsetWidth, wto);

	},



	hide: function(){

		this.h.hide();

		this.w.hide();

	}

}



//composition effect, calls Opacity and (Width and/or Height) alltogheter

fx.FadeSize = Class.create();

fx.FadeSize.prototype = {

	initialize: function(el, options) {

		this.el = $(el);

		this.el.o = new fx.Opacity(el, options);

		if (options) options.onComplete = null;

		this.el.h = new fx.Height(el, options);

		this.el.w = new fx.Width(el, options);

	},



	toggle: function() {

		this.el.o.toggle();

		for (var i = 0; arg = arguments[i]; i++) {

			if (arg == 'height') this.el.h.toggle();

			if (arg == 'width') this.el.w.toggle();

		}

	},



	hide: function(){

		this.el.o.hide();

		for (var i = 0; arg = arguments[i]; i++) {

			if (arg == 'height') this.el.h.hide();

			if (arg == 'width') this.el.w.hide();

		}

	}

}



//intended to work with arrays.

var Multi = new Object();

Multi = function(){};

Multi.prototype = {

	initialize: function(elements, options){

		this.options = options;

		this.el = elements;

		for (i=0;el=this.el[i];i++){

			this.effect($(el));

		}

	}

}



//Fadesize with arrays

fx.MultiFadeSize = Class.create();

fx.MultiFadeSize.prototype = Object.extend(new Multi(), {

	effect: function(el){

		el.fs = new fx.FadeSize(el, this.options);

	},



	showThisHideOpen: function(elm, delay, mode){

		for (i=0;el=$(this.el[i]);i++){

			if (el.offsetHeight > 0 && el != elm && el.h.timer == null && elm.h.timer == null){

				el.fs.toggle(mode);

				setTimeout(function(){elm.fs.toggle(mode);}.bind(elm), delay);

			}

		}

	},



	hide: function(el, mode){

		el.fs.hide(mode);

	}

});



var Remember = new Object();

Remember = function(){};

Remember.prototype = {

	initialize: function(el, options){

		this.el = $(el);

		this.days = 365;

		this.options = options;

		this.effect();

		var cookie = this.readCookie();

		if (cookie) {

			this.fx.now = cookie;

			this.fx.increase();

		}

	},



	//cookie functions based on code by Peter-Paul Koch

	setCookie: function(value) {

		var date = new Date();

		date.setTime(date.getTime()+(this.days*24*60*60*1000));

		var expires = "; expires="+date.toGMTString();

		document.cookie = this.el+this.el.id+this.prefix+"="+value+expires+"; path=/";

	},



	readCookie: function() {

		var nameEQ = this.el+this.el.id+this.prefix + "=";

		var ca = document.cookie.split(';');

		for(var i=0;c=ca[i];i++) {

			while (c.charAt(0)==' ') c = c.substring(1,c.length);

			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);

		}

		return false;

	},



	custom: function(from, to){

		if (this.fx.now != to) {

			this.setCookie(to);

			this.fx.custom(from, to);

		}

	}

}



fx.RememberHeight = Class.create();

fx.RememberHeight.prototype = Object.extend(new Remember(), {

	effect: function(){

		this.fx = new fx.Height(this.el, this.options);

		this.prefix = 'height';

	},

	

	toggle: function(){

		if (this.el.offsetHeight == 0) this.setCookie(this.el.scrollHeight);

		else this.setCookie(0);

		this.fx.toggle();

	},

	

	resize: function(to){

		this.setCookie(this.el.offsetHeight+to);

		this.fx.custom(this.el.offsetHeight,this.el.offsetHeight+to);

	},



	hide: function(){

		if (!this.readCookie()) {

			this.fx.hide();

		}

	}

});



fx.RememberText = Class.create();

fx.RememberText.prototype = Object.extend(new Remember(), {

	effect: function(){

		this.fx = new fx.Text(this.el, this.options);

		this.prefix = 'text';

	}

});



//smooth scroll

fx.Scroll = Class.create();

fx.Scroll.prototype = Object.extend(new fx.Base(), {

	initialize: function(options) {

		this.setOptions(options);

	},



	scrollTo: function(el){

		var dest = Position.cumulativeOffset($(el))[1];

		var client = window.innerHeight || document.documentElement.clientHeight;

		var full = document.documentElement.scrollHeight;

		var top = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;

		if (dest+client > full) this.custom(top, dest - client + (full-dest));

		else this.custom(top, dest);

	},



	increase: function(){

		window.scrollTo(0, this.now);

	}

});



//Easing Equations (c) 2003 Robert Penner, all rights reserved.

//This work is subject to the terms in http://www.robertpenner.com/easing_terms_of_use.html.



//expo

fx.expoIn = function(pos){

	return Math.pow(2, 10 * (pos - 1));

}

fx.expoOut = function(pos){

	return (-Math.pow(2, -10 * pos) + 1);

}



//quad

fx.quadIn = function(pos){

	return Math.pow(pos, 2);

}

fx.quadOut = function(pos){

	return -(pos)*(pos-2);

}



//circ

fx.circOut = function(pos){

	return Math.sqrt(1 - Math.pow(pos-1,2));

}

fx.circIn = function(pos){

	return -(Math.sqrt(1 - Math.pow(pos, 2)) - 1);

}



//back

fx.backIn = function(pos){

	return (pos)*pos*((2.7)*pos - 1.7);

}

fx.backOut = function(pos){

	return ((pos-1)*(pos-1)*((2.7)*(pos-1) + 1.7) + 1);

}



//sine

fx.sineOut = function(pos){

	return Math.sin(pos * (Math.PI/2));

}

fx.sineIn = function(pos){

	return -Math.cos(pos * (Math.PI/2)) + 1;

}

fx.sineInOut = function(pos){

	return -(Math.cos(Math.PI*pos) - 1)/2;

}
/*
moo.fx, simple effects library built with prototype.js (http://prototype.conio.net).
by Valerio Proietti (http://mad4milk.net) MIT-style LICENSE.
for more info (http://moofx.mad4milk.net).
Sunday, March 05, 2006
v 1.2.3
*/


///////////////////////////////////////////sortable.js///////////////////////////////////
addEvent(window, "load", sortables_init);

var SORT_COLUMN_INDEX;

function sortables_init() {
    // Find all tables with class sortable and make them sortable
    if (!document.getElementsByTagName) return;
    tbls = document.getElementsByTagName("table");
    for (ti=0;ti<tbls.length;ti++) {
        thisTbl = tbls[ti];
        if (((' '+thisTbl.className+' ').indexOf("sortable") != -1) && (thisTbl.id)) {
            //initTable(thisTbl.id);
            ts_makeSortable(thisTbl);
        }
    }
}

function ts_makeSortable(table) {
    if (table.rows && table.rows.length > 0) {
        var firstRow = table.rows[0];
    }
    if (!firstRow) return;
    
    // We have a first row: assume it's the header, and make its contents clickable links
    for (var i=0;i<firstRow.cells.length;i++) {
        var cell = firstRow.cells[i];
        var txt = ts_getInnerText(cell);
        cell.innerHTML = '<a href="#" class="sortheader" '+ 
        'onclick="ts_resortTable(this, '+i+');return false;">' + 
        txt+'<span class="sortarrow">&nbsp;&nbsp;&nbsp;</span></a>';
    }
}

function ts_getInnerText(el) {
	if (typeof el == "string") return el;
	if (typeof el == "undefined") { return el };
	if (el.innerText) return el.innerText;	//Not needed but it is faster
	var str = "";
	
	var cs = el.childNodes;
	var l = cs.length;
	for (var i = 0; i < l; i++) {
		switch (cs[i].nodeType) {
			case 1: //ELEMENT_NODE
				str += ts_getInnerText(cs[i]);
				break;
			case 3:	//TEXT_NODE
				str += cs[i].nodeValue;
				break;
		}
	}
	return str;
}

function ts_resortTable(lnk,clid) {
    // get the span
    var span;
    for (var ci=0;ci<lnk.childNodes.length;ci++) {
        if (lnk.childNodes[ci].tagName && lnk.childNodes[ci].tagName.toLowerCase() == 'span') span = lnk.childNodes[ci];
    }
    var spantext = ts_getInnerText(span);
    var td = lnk.parentNode;
    var column = clid || td.cellIndex;
    var table = getParent(td,'TABLE');
    
    // Work out a type for the column
    if (table.rows.length <= 1) return;
    var itm = ts_getInnerText(table.rows[1].cells[column]);
    sortfn = ts_sort_caseinsensitive;
    if (itm.match(/^\d\d[\/-]\d\d[\/-]\d\d\d\d$/)) sortfn = ts_sort_date;
    if (itm.match(/^\d\d[\/-]\d\d[\/-]\d\d$/)) sortfn = ts_sort_date;
    if (itm.match(/^[£$]/)) sortfn = ts_sort_currency;
    if (itm.match(/^[\d\.]+$/)) sortfn = ts_sort_numeric;
    SORT_COLUMN_INDEX = column;
    var firstRow = new Array();
    var newRows = new Array();
    for (i=0;i<table.rows[0].length;i++) { firstRow[i] = table.rows[0][i]; }
    for (j=1;j<table.rows.length;j++) { newRows[j-1] = table.rows[j]; }

    newRows.sort(sortfn);

    if (span.getAttribute("sortdir") == 'down') {
        ARROW = '&nbsp;&nbsp;&uarr;';
        newRows.reverse();
        span.setAttribute('sortdir','up');
    } else {
        ARROW = '&nbsp;&nbsp;&darr;';
        span.setAttribute('sortdir','down');
    }
    
    // We appendChild rows that already exist to the tbody, so it moves them rather than creating new ones
    // don't do sortbottom rows
    for (i=0;i<newRows.length;i++) { if (!newRows[i].className || (newRows[i].className && (newRows[i].className.indexOf('sortbottom') == -1))) table.tBodies[0].appendChild(newRows[i]);}
    // do sortbottom rows only
    for (i=0;i<newRows.length;i++) { if (newRows[i].className && (newRows[i].className.indexOf('sortbottom') != -1)) table.tBodies[0].appendChild(newRows[i]);}
    
    // Delete any other arrows there may be showing
    var allspans = document.getElementsByTagName("span");
    for (var ci=0;ci<allspans.length;ci++) {
        if (allspans[ci].className == 'sortarrow') {
            if (getParent(allspans[ci],"table") == getParent(lnk,"table")) { // in the same table as us?
                allspans[ci].innerHTML = '&nbsp;&nbsp;&nbsp;';
            }
        }
    }
        
    span.innerHTML = ARROW;
}

function getParent(el, pTagName) {
	if (el == null) return null;
	else if (el.nodeType == 1 && el.tagName.toLowerCase() == pTagName.toLowerCase())	// Gecko bug, supposed to be uppercase
		return el;
	else
		return getParent(el.parentNode, pTagName);
}
function ts_sort_date(a,b) {
    // y2k notes: two digit years less than 50 are treated as 20XX, greater than 50 are treated as 19XX
    aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]);
    bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]);
    if (aa.length == 10) {
        dt1 = aa.substr(6,4)+aa.substr(3,2)+aa.substr(0,2);
    } else {
        yr = aa.substr(6,2);
        if (parseInt(yr) < 50) { yr = '20'+yr; } else { yr = '19'+yr; }
        dt1 = yr+aa.substr(3,2)+aa.substr(0,2);
    }
    if (bb.length == 10) {
        dt2 = bb.substr(6,4)+bb.substr(3,2)+bb.substr(0,2);
    } else {
        yr = bb.substr(6,2);
        if (parseInt(yr) < 50) { yr = '20'+yr; } else { yr = '19'+yr; }
        dt2 = yr+bb.substr(3,2)+bb.substr(0,2);
    }
    if (dt1==dt2) return 0;
    if (dt1<dt2) return -1;
    return 1;
}

function ts_sort_currency(a,b) { 
    aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]).replace(/[^0-9.]/g,'');
    bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]).replace(/[^0-9.]/g,'');
    return parseFloat(aa) - parseFloat(bb);
}

function ts_sort_numeric(a,b) { 
    aa = parseFloat(ts_getInnerText(a.cells[SORT_COLUMN_INDEX]));
    if (isNaN(aa)) aa = 0;
    bb = parseFloat(ts_getInnerText(b.cells[SORT_COLUMN_INDEX])); 
    if (isNaN(bb)) bb = 0;
    return aa-bb;
}

function ts_sort_caseinsensitive(a,b) {
    aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]).toLowerCase();
    bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]).toLowerCase();
    if (aa==bb) return 0;
    if (aa<bb) return -1;
    return 1;
}

function ts_sort_default(a,b) {
    aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]);
    bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]);
    if (aa==bb) return 0;
    if (aa<bb) return -1;
    return 1;
}

/////////////////////////////////////////////scroll.js//////////////////////////////
var ScrollLinks = null;
document.observe("dom:loaded", function() {

ScrollLinks = {

	currentHash:false,

	start: function(){
		this.scroll = new fx.Scroll({duration: 1500, transition: fx.sineOut, onComplete: function(){this.end();}.bind(this)});

		


	},



	go: function(link){
		

	},



	end: function(){

	}
};
ScrollLinks.start();
if(typeof(startup) == 'function')
{
	startup();
}
});
