<!--Slideshow JS -->
/**
 *	jquery.slideShow (1.0.6)
 * 	by Marcel Eichner (www.marceleichner.de)
 * 	<love@ephigenia.de>
 *
 *	This simple slideshow plugin will provide your effect gallery with
 * 	some simple features:
 *
 *	- auto slideshow with repeat and a lot of options
 *	- callback for slide changing (gotoSlide) and slide Clicks (onSlideClick)
 *	- different option variables to configure
 *	- change of slide through clicking numbers, next, prev etc and mouse
 *	  movement over the slides
 *	- text over images possible
 *	- random start slide via { start: 'rnd' }
 *	- start/stop slideshow and read playing status
 *	
 *	learn more about this plugin and other projects at:
 *	http://code.marceleichner.de/project/jquery.slideShow/
 *
 *	Copyright (c) 2009 Marcel Eichner (www.marceleichner.de)
 *	Licensed under the MIT license:
 *	http://www.opensource.org/licenses/mit-license.php
 *
 *	NOTE: This script requires jQuery to work.  Download jQuery at www.jquery.com
 */
(function($){
	
	$.fn.slideShow = function(options) {
		
		// multiple elements
		if (this.length > 1) {
			this.each(function() { $(this).slideShow(options)});
			return this;
		}

		// private vars
		this.defaults = {
			start: 			0,		// start index, set to 'random' or 'rnd' to random start
			interval: 		7,		// interval, autoplay, set to false for no auto-play, in seconds
			repeat: 		true,	// repeat at the end
			transition: {
				mode: 'fade',
				speed: 1000
			},
			slideSize: 		'auto',	// size for slides (used for mouseover and stuff)
			hoverNavigation:false,	// enable mouse to change images 
			slideClick: 	false,	// insert callback method for slide clicks
			gotoSlide: 		false	// slide change callback
		};
		this.options = $.extend({}, this.defaults, options);
		
		// internal vars
		this.numSlides = this.find('.slide').length;
		if (this.options.start == 'random' || this.options.start == 'rnd') {
			this.current = Math.floor(Math.random() * this.numSlides) + 1;
		} else {
			this.current = this.options.start;
		}
		if (this.current >= this.numSlides) {
			this.current = this.numSlides - 1;
		}
		this.last = false;
		this.elm = $(this);
		this.interval = false;
		this.mouse = {
			x: 0,		// store mouse x relative position on element
			y: 0,		// store mouse y relative position on element
			over: false	// store mouse over boolena value
		};
		
		// init slideshow
		this.init = function() {
			
			// set slide container to correct width and height
			if (this.find('.slides').length) {
				// auto-detect slide size
				if (this.options.slideSize == 'auto') {
					this.options.slideSize = {
						width: this.find('.slide:first img').width(),
						height: this.find('.slide:first img').height()
					};
				}
				// don't set size of slides and slide container if not needed
				if (this.options.slideSize != 'none' && this.options.slideSize != false) {
					this.find('.slides, .slide').css({
						height: this.options.slideSize.height + 'px',
						width: this.options.slideSize.width + 'px',
						overflow: 'hidden'
					});
				}
			}
			
			// set slides to be positioned absolute
			this.find('.slide').css('position','absolute');
			// hide slides if not hidden allready
			this.find('.slide:not(:eq(' + this.current + '))').hide();
			
			// navigation shortcuts
			this.find('.first, .next, .prev, .last, .navigation, .slide, .page, .slides').data('slideShow', this);
			this.find('.first').click(this.first);
			this.find('.next').click(this.next);
			this.find('.prev').click(this.previous);
			this.find('.last').click(this.last);
			
			// init pagínation buttons if available
			this.find('.navigation .page:eq(' + this.current + ')').addClass('selected');
			this.find('.page').click(function() {
				if (!(slideShow = $(this).data('slideShow'))) {
					var slideShow = this;
				}
				// determine position in navigation
				var index = $(this).html();
				if (!(index = parseInt($(this).html()-1))) {
					var index = $(this).parents('.navigation').find('.page').index($(this));
				}
				slideShow.gotoSlide(index);
			});
			
			// init mouse move handler
			this.find('.slide').mousemove(function(event) {
				var slideShow = $(this).data('slideShow');
				// calculate mouse relative position and store it
				slideShow.mouse.x = Math.abs(event.clientX - $(this).position().left);
				slideShow.mouse.y = Math.abs(event.clientY - $(this).position().top);
				if (slideShow.mouse.x > slideShow.options.slideSize.width) slideShow.mouse.x = slideShow.options.slideSize.width;
				if (slideShow.mouse.y > slideShow.options.slideSize.height) slideShow.mouse.y = slideShow.options.slideSize.height;
				// use mouse vor navigation, calculate new page from mouse position
				if (slideShow.options.hoverNavigation) {
					var index = Math.round((slideShow.numSlides - 1) * slideShow.mouse.x / slideShow.options.slideSize.width);
					slideShow.gotoSlide(index, true);
				}
			});
			
			// mouse enter handler
			this.find('.slide').mouseenter(function() {
				var slideShow = $(this).data('slideShow');
				slideShow.mouse.over = true;
				slideShow.stopAuto();
			});
			
			// mouse leave handler
			this.find('.slide').mouseleave(function() {
				var slideShow = $(this).data('slideShow');
				slideShow.mouse.over = false;
				slideShow.auto();
			});
			
			// on click handler
			if (typeof(this.options.slideClick) == 'function') {
				this.find('.slide').click(function() {
					var slideShow = $(this).data('slideShow');
					slideShow.options.slideClick(slideShow);
				});
			}

			g = this.current;
			this.current = -1;
			this.gotoSlide(g);
			// start interval for auto animation
			if (this.options.interval > 0) {
				this.auto();
			}
			return this;
		};
		
		// public methods
		this.auto = function() {
			if (!(slideShow = $(this).data('slideShow'))) {
				var slideShow = this;
			}
			if (!slideShow.interval && slideShow.options.interval > 0.001) {
				slideShow.interval = window.setInterval(function() {
					slideShow.next();
				}, slideShow.options.interval * 1000);
			}
			return this;
		}
		// check if slideshow is running
		this.isPlaying = function() {
			if (!(slideShow = $(this).data('slideShow'))) {
				var slideShow = this;
			}
			return slideShow.interval;
		}
		// stop/play slideshow automatic 
		this.togglePlayback = function() {
			if (!(slideShow = $(this).data('slideShow'))) {
				var slideShow = this;
			}
			if (slideShow.isPlaying()) {
				slideShow.stopAuto();
			} else {
				slideShow.auto();
			}
		},
		// stop automatic slideshow
		this.stopAuto = function() {
			if (!(slideShow = $(this).data('slideShow'))) {
				var slideShow = this;
			}
			if (slideShow.interval) {
				window.clearInterval(slideShow.interval);
				slideShow.interval = false;
			}
			return this;
		}
		// goto first slide
		this.first = function(elm) {
			if (!(slideShow = $(this).data('slideShow'))) {
				var slideShow = this;
			}
			return slideShow.gotoSlide(0);
		};
		// goto last slide
		this.next = function() {
			if (!(slideShow = $(this).data('slideShow'))) {
				var slideShow = this;
			}
			return slideShow.gotoSlide(slideShow.current + 1);
		};
		this.previous = function() {
			if (!(slideShow = $(this).data('slideShow'))) {
				var slideShow = this;
			}
			return slideShow.gotoSlide(slideShow.current - 1);
		};
		this.last = function() {
			if (!(slideShow = $(this).data('slideShow'))) {
				var slideShow = this;
			}
			return slideShow.gotoSlide(slideShow.numSlides);
		};
		this.gotoSlide = function(index, noanimation) {
			if (index < 0) {
				index = this.numSlides - 1;
			}
			if (index >= this.numSlides) {
				index = 0;
			}
			if (index === this.current) return this;
			// get slide elements
			var oldSlide = this.find('.slide:eq(' + this.current +')');
			var newSlide = this.find('.slide:eq(' + index +')');
			// callbacks for animation finished
			oldFinished = function () {
				$(this).removeClass('selected');
				if (!(slideShow = $(this).data('slideShow'))) {
					var slideShow = this;
				}
				slideShow.elm.find('.navigation .page:eq(' + slideShow.current + ')').addClass('selected');
				if (!slideShow.mouse.over) {
					slideShow.auto();
				}
			}
			newFinished = function() {
				if (!(slideShow = $(this).data('slideShow'))) {
					var slideShow = this;
				}
				slideShow.elm.find('.navigation .page:not(:eq(' + slideShow.current + '))').removeClass('selected');
				$(this).addClass('selected');
			}
			// get slideshow
			if (!(slideShow = $(this).data('slideShow'))) {
				var slideShow = this;
			}
			slideShow.stopAuto();
			// call callback
			if (typeof(this.options.gotoSlide) == 'function') {
				this.options.gotoSlide(slideShow, index);
			}
			// start transition
			if (noanimation) {
				oldSlide.hide(1, oldFinished);
				newSlide.show(1, newFinished);
			} else {
				if (typeof(this.options.transition.mode) == 'function') {
					this.call(this.options.transition.mode, newSlide, oldSlide);
				} else {
					switch(this.options.transition.mode) {
						default:
						case 'fade':
							oldSlide.fadeOut(this.options.transition.speed, oldFinished);
							newSlide.fadeIn(this.options.transition.speed, newFinished);
							break;
					}
				}
			}
			this.last = this.current;
			this.current = index;
			return this;
		};
		
		return this.init();
	}
	
})(jQuery);

<!--Right Navication JS -->
// Right Navigation Menu //
function initMenu() {
  $('#rightnav #menu ul').hide();
  $('#rightnav #menu ul:first').show();
  $('#rightnav #menu li a').click(
    function() {
      var checkElement = $(this).next();
      if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
        return false;
        }
      if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
        $('#menu ul:visible').slideUp('normal');
        checkElement.slideDown('normal');
        return false;
        }
      }
    );
  }
$(document).ready(function() {initMenu();});


<!--Text Size JS -->
/*
 * jFontSizer Plugin
 * Written by fluidByte - http://www.fluidbyte.net
*/

jQuery.fn.jfontsizer = function(o) {

	// Cookie functions
	function setCookie(c_name,value,expiredays){
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+
	((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
	}
	
	function getCookie(c_name){
	if (document.cookie.length>0){
	  c_start=document.cookie.indexOf(c_name + "=");
	  if (c_start!=-1){
	    c_start=c_start + c_name.length+1;
	    c_end=document.cookie.indexOf(";",c_start);
	    if (c_end==-1) c_end=document.cookie.length;
	    return unescape(document.cookie.substring(c_start,c_end));
	    }
	  }
	return "";
	}

    
	// Defaults
	var o = jQuery.extend( {
		applyTo: '#main, #highlights, .slide',
		changesmall: '2',
		changelarge: '2',
		expire: 30
	},o);
	
	var s = '';
	var m = '';
	var l = '';
	
	// Current
	var c = 'fs_med';
	
	// Check cookie  
	if (getCookie('fsizer') != "") {
		var c = getCookie('fsizer');
		switch (c) {
			case 'fs_sml':
				s = 'fsactive';
			$(o.applyTo).css('font-size','.'+(10-o.changesmall)+'em');
				break;
			case 'fs_med':
				m = 'fsactive';
			$(o.applyTo).css('font-size','');
				break;
			case 'fs_lrg':
				l = 'fsactive';
			$(o.applyTo).css('font-size','1.'+o.changelarge+'em');
				break;
		}
	}
	else {
		m = "fsactive";
	}
	
	// Create font-chooser box
	$(this).html('<a id="fs_sml" class="'+s+'" title="Decrease Text Size">A-</a><a id="fs_med" class="'+m+'" title="Normal Text Size">A</a><a id="fs_lrg" class="'+l+'" title="Increase Text Size">A+</a>');
	
	
	$('.fsizer a').click(function(){
	
		var t = $(this).attr('id');
		
		setCookie('fsizer',t,o.expire);
		
		$('.fsizer a').removeClass('fsactive');
		$(this).addClass('fsactive');
		
		var f = $(o.applyTo).css('font-size');	
		
		switch(t){
			case 'fs_sml':
				$(o.applyTo).css('font-size','.'+(10-o.changesmall)+'em');
				break;
			case 'fs_med':
			    $(o.applyTo).css('font-size','');
				break;
			case 'fs_lrg':
				$(o.applyTo).css('font-size','1.'+o.changelarge+'em');
				break;
		}	
	});
};


<!-- Swap Image JS -->
/*
 * Metadata - jQuery plugin for parsing metadata from elements
 * Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 * Revision: $Id: jquery.metadata.js 3620 2007-10-10 20:55:38Z pmclanahan $
 */
(function($){$.extend({metadata:{defaults:{type:'class',name:'metadata',cre:/({.*})/,single:'metadata'},setType:function(type,name){this.defaults.type=type;this.defaults.name=name;},get:function(elem,opts){var settings=$.extend({},this.defaults,opts);if(!settings.single.length)settings.single='metadata';var data=$.data(elem,settings.single);if(data)return data;data="{}";if(settings.type=="class"){var m=settings.cre.exec(elem.className);if(m)data=m[1];}else if(settings.type=="elem"){if(!elem.getElementsByTagName)return;var e=elem.getElementsByTagName(settings.name);if(e.length)data=$.trim(e[0].innerHTML);}else if(elem.getAttribute!=undefined){var attr=elem.getAttribute(settings.name);if(attr)data=attr;}if(data.indexOf('{')<0)data="{"+data+"}";data=eval("("+data+")");$.data(elem,settings.single,data);return data;}}});$.fn.metadata=function(opts){return $.metadata.get(this[0],opts);};})(jQuery);

/**
 * swapImage - jQuery plugin for swapping image
 * Copyright (c) 2010 tszming (tszming@gmail.com)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */
(function(a){a.swapImage=function(c,b,e,f,d){a.swapImage.files={};a.swapImage.data={};a.swapImage.uuid=0;a.swapImage.init=function(){var h=++a.swapImage.uuid;a(this).attr("swapImageId",h);var g=a(this).metadata();a.swapImage.data[h]=a.swapImage.data[h]||{};if(typeof g.src!="undefined"){a.swapImage.data[h]["src"]=g.src;a.swapImage.files[g.src]=false}a.each(a.grep([[g.sin,"sin"],[g.sout,"sout"]],function(i){return(typeof i[0]!="undefined"&&i[0].length>0)}),function(){var k=this[0];var o=this[1];for(var m=0;m<k.length;m++){var j=g[o][m].indexOf(":");var n=g[o][m].substring(0,j);var l=g[o][m].substring(j+1);a.swapImage.data[h][o]=a.swapImage.data[h][o]||[];if(j>1){a.swapImage.data[h][o].push([n,l]);a.swapImage.files[l]=false}else{a.swapImage.data[h][o].push([l])}}})};a.swapImage.preload=function(){a.each(a.swapImage.files,function(i,h){if(h==false){a.swapImage.files[i]=true;var g=new Image();g.src=i}})};a.swapImage.swapIn=function(){a.swapImage.swap(this,"sin")};a.swapImage.swapOut=function(){a.swapImage.swap(this,"sout")};a.swapImage.swap=function(j,g){var k=a(j).attr("swapImageId");if(typeof a.swapImage.data[k][g]!="undefined"){for(var h=0;h<a.swapImage.data[k][g].length;h++){if(a.swapImage.data[k][g][h].length>1){a(a.swapImage.data[k][g][h][0]).attr("src",a.swapImage.data[k][g][h][1])}else{a(a.swapImage.data[k][g][h][0]).each(a.swapImage._swap)}}}else{a.swapImage._swap.call(j)}};a.swapImage._swap=function(i){var j=a(this).attr("swapImageId");var h=a.swapImage.data[j];if(typeof h.src!="undefined"){var g=h.src;h.src=this.src;this.src=g}};a(document).ready(function(){if(typeof e=="undefined"){e=true}if(typeof b=="undefined"){b=true}a(c).each(a.swapImage.init);if(typeof f=="undefined"&&typeof f=="undefined"){f="mouseenter";d="mouseleave"}if(e){if(typeof d!="undefined"){a(c).bind(f,a.swapImage.swapIn).bind(d,a.swapImage.swapOut)}else{a(c).bind(f,a.swapImage.swapIn)}}else{a(c).one(f,a.swapImage.swapIn)}if(b){a(c).each(a.swapImage.preload)}})}})(jQuery);



<!-- AJAX -->
// AJAX Get Requests
// JavaScript Document
function createRequestObject() {
    var tmpXmlHttpObject;
    
    //depending on what the browser supports, use the right way to create the XMLHttpRequest object
    if (window.XMLHttpRequest) { 
        // Mozilla, Safari would use this method ...
        tmpXmlHttpObject = new XMLHttpRequest();
	
    } else if (window.ActiveXObject) { 
        // IE would use this method ...
        tmpXmlHttpObject = new ActiveXObject("Microsoft.XMLHTTP");
    }
    
    return tmpXmlHttpObject;
}

//call the above function to create the XMLHttpRequest object
var http = createRequestObject();

function makeGetRequest(getID, page, setID) {
  //make a connection to the server ... specifying that you intend to make a GET request 
  //to the server. Specifiy the page name and the URL parameters to send
//	alert('here');
	var absoluteLink = "";
	var params = "";
	pageLink = absoluteLink + '/core/index_pages/' + page + '.html' + params;
		
	if( http.readyState == 0 || http.readyState == 4 )
	{
	    http.open('get', pageLink);
	
		//assign a handler for the response
		if( setID == 'contentSection' )
			http.onreadystatechange = processResponseForContentSection;
	}
	
    //actually send the request to the server
    http.send(null);
}

function processResponseForContentSection() {
    //check if the response has been received from the server
    if(http.readyState == 4){
	
        //read and assign the response from the server
        var response = http.responseText;
		
        //do additional parsing of the response, if needed
		
        //in this case simply assign the response to the contents of the <div> on the page. 
        document.getElementById('contentSection').innerHTML = response;
		
        //If the server returned an error message like a 404 error, that message would be shown within the div tag!!. 
        //So it may be worth doing some basic error before setting the contents of the <div>
    }
}




<!-- Tabs JS -->
// Change the Tabs and populate page into content div
// This function controls the tab buttons
function changeContentTabs( tab )
{
	var content = document.getElementById("tab1");
	var content2 = document.getElementById("tab2");
	var content3 = document.getElementById("tab3");
	
	if( tab == '1') 
	{
		makeGetRequest('','quicklinks','contentSection');
		content.className = 'selected';
		content2.className = '';
		content3.className = '';
		//document.forms[0].nexttab.value='1';
	}
	else if( tab == '2')
	{
		makeGetRequest('','news','contentSection');
		content2.className = 'selected';
		content.className = '';
		content3.className = '';
		//document.forms[0].nexttab.value='2';
	}
	else if( tab == '3')
	{
		makeGetRequest('','iwantto','contentSection');
		content3.className = 'selected';
		content.className = '';
		content2.className = '';
	}
}


//This function controls the tab buttons for find an agency and find a person
function changeFindTabs( tab )
{
	var content = document.getElementById("tab1");
	var content2 = document.getElementById("tab2");
	
	if( tab == '1') 
	{
		makeGetRequest('','find_agency','contentSection');
		content.className = 'selected';
		content2.className = '';
	}
	else if( tab == '2')
	{
		makeGetRequest('','find_person','contentSection');
		content.className = '';
		content2.className = 'selected';
	}
}
