﻿var checkFlash = swfobject.hasFlashPlayerVersion("8");

/***** JQUERY SWFOBJECT *****/

if(checkFlash){
    (function(F,C){var D=function(H){var G,I=[];for(G in H){if(/string|number/.test(typeof H[G])&&H[G]!==""){I.push(G+'="'+H[G]+'"')}}return I[A]("")},E=function(I){var G,K,J=[],H;if(typeof I=="object"){for(G in I){if(typeof I[G]=="object"){H=[];for(K in I[G]){H.push([K,"=",encodeURIComponent(I[G][K])][A](""))}I[G]=H[A]("&amp;")}if(I[G]){J.push(['<param name="',G,'" value="',I[G],'" />'][A](""))}}I=J[A]("")}return I},B=false,A="join";F[C]=(function(){try{var G="0,0,0",H=navigator.plugins["Shockwave Flash"]||ActiveXObject;G=H.description||(function(){try{return(new H("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version")}catch(J){}}())}catch(I){}G=G.match(/^[A-Za-z\s]*?(\d+)[\.|,](\d+)(?:\s+[d|r]|,)(\d+)/);return{available:G[1]>0,activeX:H&&!H.name,version:{major:G[1]*1,minor:G[2]*1,release:G[3]*1},hasVersion:function(K){var N=this.version,L="major",M="minor",J="release";K=(/string|number/.test(typeof K))?K.toString().split("."):K||[0,0,0];K=[K[L]||K[0]||N[L],K[M]||K[1]||N[M],K[J]||K[2]||N[J]];return(K[0]<N[L])||(K[0]==N[L]&&K[1]<N[M])||(K[0]==N[L]&&K[1]==N[M]&&K[2]<=N[J])},expressInstall:"expressInstall.swf",create:function(J){if(!F[C].available||B||!typeof J=="object"||!J.swf){return false}if(J.hasVersion&&!F[C].hasVersion(J.hasVersion)){J={swf:J.expressInstall||F[C].expressInstall,attrs:{id:J.id||"SWFObjectExprInst",name:J.name,height:Math.max(J.height||137),width:Math.max(J.width||214)},params:{flashvars:{MMredirectURL:location.href,MMplayerType:(F[C].activeX)?"ActiveX":"PlugIn",MMdoctitle:document.title.slice(0,47)+" - Flash Player Installation"}}};B=true}else{J=F.extend(true,{attrs:{id:J.id,name:J.name,height:J.height||180,width:J.width||320},params:{wmode:J.wmode||"opaque",flashvars:J.flashvars}},J)}if(F[C].activeX){J.attrs.classid=J.attrs.classid||"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";J.params.movie=J.params.movie||J.swf}else{J.attrs.type=J.attrs.classid||"application/x-shockwave-flash";J.attrs.data=J.attrs.data||J.swf}return["<object ",D(J.attrs),">",E(J.params),"</object>"][A]("")}}}());F.fn[C]=function(G){if(typeof G=="object"){this.each(function(){var I=document.createElement(C);var H=F[C].create(G);if(H){I.innerHTML=H;if(I.childNodes[0]){this.appendChild(I.childNodes[0])}}})}else{if(typeof G=="function"){this.find("object").andSelf().filter("object").each(function(){var I=this,H="jsInteractionTimeoutMs";I[H]=I[H]||0;if(I[H]<660){if(I.clientWidth||I.clientHeight){G.call(this)}else{setTimeout(function(){F(I)[C](G)},I[H]+66)}}})}}return this}}(jQuery,"flash"));
}

/***** WICKEDWEB LIGHTBOX v1.1 | COPYRIGHT WICKEDWEB 2010 *****/

function setCSS(css){
	try{
		document.getElementsByTagName("head")[0].appendChild(css);
	}catch(e){
		setTimeout(function(){setCSS(css)}, 100);
	}
}
var css = document.createElement("link");
css.setAttribute("href","/css/wwightbox.css");
css.setAttribute("rel","stylesheet");
css.setAttribute("type","text/css");
setCSS(css);
css = null;

String.prototype.endsWith = function (b){
    return (this.match(b + "$") == b);
};

function querySt(value, string){
	valueArray = string.split('?').join('&').split('&amp;').join('&').split('&');
	for(i=0; i<valueArray.length; i++){
		result = valueArray[i].split('=');
		if(result[0] == value){
			return result[1];
		}
	}
}

function repositionLightBox(){
	if(($j('#lightBoxInner').outerHeight() + 40) > $j(window).height()){
		$j('#lightBoxContent').css('top', ($j(window).scrollTop() + 20) + 'px').css('position', 'absolute').css('margin-top', 0);
	}
	else{
		$j('#lightBoxContent').css('top', '50%').css('position', 'fixed').css('margin-top', -($j('#lightBoxInner').outerHeight() / 2));
	}
}

function animateLightBox(){
	var mTop = -($j('#lightBoxInner').outerHeight() / 2);
	var mLft = -($j('#lightBoxInner').outerWidth() / 2);
	if(($j('#lightBoxInner').outerHeight() + 40) > $j(window).height()){
		$j('#lightBoxContent').css('top', ($j(window).scrollTop() + 20) + 'px').css('position', 'absolute').css('margin-top', 0);
		mTop = 0;
	}
	else{
		$j('#lightBoxContent').css('top', '50%').css('position', 'fixed');
	}
	$j('#lightBoxContent').stop().animate({ 
		width: $j('#lightBoxInner').outerWidth(),
		height: $j('#lightBoxInner').outerHeight(),
		marginTop: mTop,
		marginLeft: mLft,
		opacity: 1
	}, 600, function(){
		repositionLightBox();
		$j('#lightBoxContent').css('filter', '');
		$j('#lightBoxInner').css('visibility', 'visible');
		$j('#lightBoxInner').stop().fadeTo(500, 1, function(){
			$j('#lightBoxContent, #lightBoxInner').css('filter', '');
		});
	});
}

function animateVideo(width, height){
	$j('#lightBoxContent').width(width).height(height).css('marginTop', (-((height + ($j('#lightBoxContent').outerHeight() - $j('#lightBoxContent').height())) / 2))).css('marginLeft', (-((width + ($j('#lightBoxContent').outerWidth() - $j('#lightBoxContent').width())) / 2)));
	$j('#lightBoxInner, #videoContent').width(width).height(height);
}

function setVideo(width, height){
	animateVideo(width, height);
}

function requestVideo(){
	$j('#lightBoxInner').flash(function(){
		this.SetVariable('fileSrc', window.videoURL);
	});
}

function detectContent(boxID){
	$j('#lightBoxInner').empty();
	$j('#lightBoxInner').width('auto').height('auto');
	$j('#lightBoxContent').css('overflow', 'hidden').width($j('#lightBoxContent').width()).height($j('#lightBoxContent').height()).css('margin', (-($j('#lightBoxContent').outerHeight() / 2)) + 'px 0 0 ' + (-($j('#lightBoxContent').outerWidth() / 2)) + 'px');
	myTitle = querySt('title', boxID);
	myDesc = querySt('desc', boxID);
	myWidth = querySt('width', boxID);
	myHeight = querySt('height', boxID);
	myZoom = querySt('zoom', boxID);
	if(myWidth !== undefined){
		$j('#lightBoxInner').width(parseInt(myWidth));
	}
	if(myHeight !== undefined){
		$j('#lightBoxInner').height(parseInt(myHeight));
	}
	if(myTitle !== undefined){
		$j('#lightBoxInner').append('<h1>' + myTitle + '</h1>')
	}
	if(myDesc !== undefined){
		$j('#lightBoxInner').append(myDesc);
	}
	if(boxID.indexOf('?') > -1){
		boxID = boxID.slice(0, boxID.indexOf('?'));
	}
	
	r = document.location.href.toString().replace(document.location.hash.toString(), '');
    if(boxID.indexOf('?') > -1){
        q = boxID.slice(boxID.indexOf('?'));
        boxID = boxID.slice(0, boxID.indexOf('?'))
    }
    if(boxID.indexOf(r) === 0){
        boxID = boxID.replace(r, '');
    }
    if(boxID.indexOf('#') === 0){
		$j(boxID).clone(true).appendTo('#lightBoxInner').show();
		animateLightBox();
    }
	else if(boxID.endsWith('.html') || boxID.endsWith('.htm') || boxID.endsWith('.php') || boxID.endsWith('.aspx')){
		if($j('#lightBoxContent:visible').size() <= 0){
			animateLightBox();
		}
		$j('#lightBoxInner').load(boxID, function(){
			animateLightBox();
		});	
	}
	else if(boxID.endsWith('.jpg') || boxID.endsWith('.gif') || boxID.endsWith('.png') || boxID.endsWith('.bmp') || boxID.endsWith('.tiff')){
		if($j('#lightBoxContent:visible').size() <= 0){
			animateLightBox();
		}		
		var img = "img" + boxID.slice(boxID.lastIndexOf("/") + 1, boxID.lastIndexOf("."));
		eval[img] = new Image();
		eval[img].onload = function(evt){
			$j('#lightBoxInner').fadeTo(0, 0, function(){
				$j('#lightBoxInner').append(eval[img]);
				animateLightBox();
			});
		};
		eval[img].src = boxID;
	}
	else if(boxID.endsWith('.swf')){
		if(checkFlash){
		    if(myWidth == undefined){
			    myWidth = 900;
		    }
		    if(myHeight == undefined){
			    myHeight = 500;
		    }
			flashFile = $j.flash.create({swf:boxID, expressInstaller:'flash/expressInstall.swf', params:{AllowScriptAccess:'always'}, height: myHeight, width: myWidth});
			$j('#lightBoxInner').append(flashFile);
		}
		else{
			$j("#lightBoxInner").append('<p>Sorry you need the Flash plugin installed to view this content. Please <a href="http://get.adobe.com/flashplayer/">click here</a> to get Flash.</p>');
		}
		animateLightBox();
	}
	else if(boxID.endsWith('.flv')){
		if(checkFlash){
			window.videoURL = boxID;
			$j('#lightBoxContent').stop().show().fadeTo(0, 1, function(){
				$j('#lightBoxInner').addClass('videoFlash');
				$j('#lightBoxInner').html(videoFlash);
				$j('#lightBoxInner').css('visibility', 'visible');
				$j('#lightBoxInner').stop().fadeTo(0, 1);
				animateVideo(200, 174);
			});
		}
		else{
			$j("#lightBoxInner").append('<p>Sorry you need the Flash plugin installed to view this content. Please <a href="http://get.adobe.com/flashplayer/">click here</a> to get Flash.</p>');
			animateLightBox();
		}
	}
	else if(boxID.endsWith('.pdf')){
		if(myWidth == undefined){
			myWidth = 920;
		}
		if(myHeight == undefined){
			myHeight = 500;
		}
		if(boxID.indexOf('http://') == -1){
		    boxID = [document.location.protocol, '//', document.location.host].join('') + boxID + '#toolbar=0';
		}
		if(myZoom !== undefined){
			boxID += '&zoom=' + myZoom;
		}
		$j('#lightBoxInner').width(myWidth).height(myHeight).append('<iframe src="' + boxID + '" width="' +  myWidth + '" height="' +  myHeight + '" frameborder="0"></iframe>');
		animateLightBox();
	}
}

function showLightBox(boxID){
	$j('#lightBoxInner').css('visibility', 'hidden');
	if($j('#lightBoxContent:visible').size() > 0){
		detectContent(boxID);
	}
	else{
		$j('#lightBox').stop().show().fadeTo(0, 0).fadeTo(500, 0.75, function(){
			$j('#lightBoxContent').stop().show().fadeTo(0, 0, function(){
				detectContent(boxID);
			});
		});
	}
}

function openLightBox(boxID){
	if($j('#lightBoxContent:visible').size() > 0){
		$j('#lightBoxInner').stop().fadeTo(500, 0, function(){
			showLightBox(boxID);
		});
	}
	else{
		$j('#lightBoxInner').fadeTo(0, 0, function(){
			showLightBox(boxID);
		});
	}
}

function closeLightBox(){
    $j('#lightBoxInner iframe[src*=".pdf"]').remove();
	$j('#lightBoxContent').stop().fadeTo(500, 0, function(){
		$j('#lightBox').stop().fadeTo(500, 0, function(){
			$j('#lightBoxContent').hide().width('100px').height('100px');
			$j('#lightBox').hide();
			$j('#lightBoxInner').empty();
		});
	});
}

function initWWightBox(){
	$j('body').append('<div id="lightBox" class="closeLightBox"></div><div id="lightBoxContent"><div id="lightBoxTop"><a href="Close" title="Close" class="closeLightBox" id="closeLightBoxBtn"></a></div><div id="lightBoxMid"><div id="lightBoxInner"></div></div></div>');
	$j('.videoBox').each(function(){
		var imageSrc = $j(this).find('img').attr('src');
		$j(this).find('img').attr('src', '/laf/play_icon.png');
		$j(this).find('img').css('background', 'url(' + imageSrc + ') 0 0 no-repeat');
	});
	$j(window).resize(function(){
		repositionLightBox();
	});
	var boxID = querySt('lightbox', document.location.href);
	var myWidth = querySt('width', document.location.href);
	var myHeight = querySt('height', document.location.href);
	var myZoom = querySt('zoom', document.location.href);
	if(boxID !== undefined){
		if(myWidth !== undefined){
			boxID += '?width=' + myWidth;
		}
		if(myHeight !== undefined){
			boxID += '?height=' + myHeight;
		}
		if(myZoom !== undefined){
			boxID += '?zoom=' + myZoom;
		}
		openLightBox(boxID);
        var docLoc = document.location.href.toString();
        var u = unescape(docLoc.replace(/^.*?(\.com)(.*?)\/?$/, '$2'));
		if(boxID.indexOf('/files/oil_and_gas_presentation.swf') > -1){
		    pageTracker._trackEvent('Presentation View Oil and Gas', u, 'Did you know');
		}
	}
	if(document.location.href.indexOf('www.echarris.com') == (document.location.href.length - 16) || document.location.href.indexOf('www.echarris.com/') == (document.location.href.length - 17) || document.location.href.indexOf('/default.aspx') == (document.location.href.length - 13)){
		//openLightBox('/files/home_video2.swf?width=640&height=380');
	}
	if(document.location.href.indexOf('local_government__communities/overview.aspx') > -1){
		openLightBox('/pdf/Local_Governement_Interactive_Doc.pdf?width=868&height=614');
	}
}

$j('.lightBox').live('click', function(e){
	$j('#lightBoxInner').removeClass('videoFlash');
	openLightBox($j(this).attr('href'));
	return false;
});

$j('.closeLightBox').live('click', function(){
	closeLightBox()
	return false;
});

$j('.videoBox').live('click', function(e){
	openLightBox($j(this).attr('href'));
	return false;
});

$j(document).keypress(function(event){
	if($j('#lightBoxContent:visible').size() > 0 && event.keyCode == '27'){
		event.preventDefault();
		closeLightBox();
	}
});

if(checkFlash){
    videoFlash = $j.flash.create({swf:'flash/player.swf', expressInstaller:'flash/expressInstall.swf', params:{AllowScriptAccess:'always'}, height: '100%', width: '100%'});
}


/**********/

function globalFuncs(){
    //	base url - used for JS based file paths
	var basePath = "";
	//	setup the scroller
	initialise();
	$j('li.headlink').hover(
    	function(){ $j('ul', this).css('display', 'block');},
		function(){ $j('ul', this).css('display', 'none');}
	);		
	$j('#top_nav .headlink').hover(
		function(){$j(this).addClass('over');},
		function(){$j(this).removeClass('over');}
	);
	$j('#main_nav .headlink').hover(
		function(){$j(this).addClass('over_main');},
		function(){$j(this).removeClass('over_main');}
	);
	$j('#footer .headlink').hover(
		function(){$j(this).addClass('over_footer');},
		function(){$j(this).removeClass('over_footer');}
	);
}

function homeHeights(){
    if($j('#homeLeft').size() > 0){
        var extraHeight = 0;
	    if($j('#homeLeft').outerHeight() < $j('#homeRight').outerHeight()){
	       extraHeight = $j('#homeRight').outerHeight() - $j('#homeLeft').outerHeight()
	    }
	    var btHeight = 0;
	    $j('#base_nav .baseText').each(function(){
		    if($j(this).height() > btHeight){
			    btHeight = $j(this).height();
		    }
	    });
	    $j('#base_nav .baseText').height(btHeight + extraHeight);
	}
}

function whoWeAre(){
    if($j('.whoWeAre').size() > 0){
        $j('.whoWeAre').prepend('<div id="whoWeAreLinks"></div>');
	    $j('.whoWeAre').append('<div id="whoWeAreBlock1"><div id="whoWeAreBlock2"><div id="whoWeAreBlock3"><div id="whoWeAreBlock4"></div></div></div></div>');
	    $j('.whoSection').appendTo('#whoWeAreBlock4').not(':first').hide();
	    $j('.whoSection').find('p:first').css('marginTop', '0px');
	    $j('.whoSection').find('p:last').css('marginBottom', '0px');
	    $j('.whoWeAre h4').appendTo('#whoWeAreLinks');
        $j('.whoWeAre h4, .whoWeAre h4 *').mouseup(function(){
	        $j(this).parent().find(".on object").flash(function(){this.SetVariable("Colour","#333333")});
		    $j(this).find("object").flash(function(){this.SetVariable("Colour","#FFFFFF")});
		    $j('.whoWeAre h4').removeClass('on')
		    $j(this).addClass('on');
		    $j.nextSection = $j('.whoSection:eq(' + $j(this).index() + ')')
		    $j('#whoWeAreBlock4').stop().animate({
			    width: 0,
			    height: 0
		    }, 500, function(){
			    $j('#whoWeAreBlock4 .whoSection:visible').hide();
			    $j($j.nextSection).show();
			    $j('#whoWeAreBlock4').animate({
				    width: 308,
				    height: $j($j.nextSection).height()
			    }, 500);
		    });
	    }).first().addClass('on');
	    $j('.whoWeAre object').livequery(function(){
	        $j('<div class="mask"></div>').insertAfter(this);
	    });
	}
}

function trackClicks(){
	var a = unescape($j(this).attr('href'));
	var docLoc = document.location.href.toString();
	var u = unescape(docLoc.replace(/^.*?(\.com)(.*?)\/?$/, '$2'));
    $j('a').live('click', function(){        
        if(a.toLowerCase().indexOf('.pdf') == (a.length - 4)){
            var n = a.replace(/.*?(\/pdf\/(.*?))_.*/i, '$1');
            var l = 0;
            if($j(this).parents('#main_content').size() == 1){
	            l = 1;
            }
            else if($j(this).parents('#right_column').size() == 1){
	            l = 2;
            }
            pageTracker._trackEvent('PDF Download', u, n, l);
            //alert('PDF Download, ' + u + ', ' + n + ', ' + l);
        }
        else if(a.toLowerCase().indexOf(document.location.hostname) <= -1){
            var e = a.replace(/.*?\.(.*?)\..*/i, '$1');
            pageTracker._trackEvent('Site Exit', u, e);
            //alert('Site Exit, ' + u + ', ' + e);
        }
    });
    $j('.lightBox[href*="did_you_know.swf"]').click(function(){
        pageTracker._trackEvent('Presentation View', u, 'Did you know');
    });
    $j('.lightBox[href*="did_you_know_march.swf"]').click(function(){
        pageTracker._trackEvent('Presentation View March', u, 'Did you know');
    });
    $j('.lightBox[href*="oil_and_gas_presentation.swf"]').click(function(){
        pageTracker._trackEvent('Presentation View Oil and Gas', u, 'Did you know');
    });
    $j('.lightBox[href*="public_presentation.swf"]').click(function(){
        pageTracker._trackEvent('Presentation View Public', u, 'Did you know');
    });
    $j('.videoBox[href*="MERGER_2.flv"]').click(function(){
        pageTracker._trackEvent('Who We Are Video', u, 'Merger Video');
    });
    $j('.lightBox[href*="MARK_HOWARD.flv"]').click(function(){
        pageTracker._trackEvent('Mark Howard Video', u);
    });
}

function homeVideo(){
    var docLoc = document.location.href.toString();
    var u = unescape(docLoc.replace(/^.*?(\.com)(.*?)\/?$/, '$2'));
    pageTracker._trackEvent('Home Video', u, 'Home Video Click');
    setTimeout(function(){
        document.location = "/who_we_are.aspx"
    },100);
}

function shareThis(){ 
    $j.getScript('http://w.sharethis.com/widget/?tabs=web%2Cpost%2Cemail&amp;charset=utf-8&amp;style=default&amp;publisher=3861a89c-0dcf-4ff2-83f4-c48dbe6e3a4a&amp;headerbg=%23383F44&amp;inactivebg=%23DFDFDF&amp;inactivefg=%23323333&amp;linkfg=%23323333&amp;offsetLeft=-355&amp;offsetTop=-405&amp;button=false&amp;tracking=google', function(data){
		SHARETHIS.onReady();
		var object = SHARETHIS.addEntry({
		title:'share',
		summary: 'Sharing is good for the soul.'},
		{button:false});
		$j('<li><span id="share"><a title="ShareThis via email, AIM, social bookmarking and networking sites, etc." href="#">Share</a></span></li>').insertAfter('#footer .right li:first');
		var element = document.getElementById("share");
		object.attachButton(element);
    });
}

function poll(){
	$j('.poll table table td[title]').each(function(){
		$j(this).css('width', $j(this).attr('title'));
	});
}

function clientSuccess(){
	$j('.client_Success .client_Stories, .insights .insight').css('height', 'auto');
	$j('.client_Success .client_Stories:odd, .insights .insight:odd').each(function(){
	    var Height1 = $j(this).height();
	    var Height2 = $j(this).prev().height();
		if(Height1 < Height2){
			$j(this).height(Height2);
			$j(this).prev().height(Height2);
		}
		else{
			$j(this).prev().height(Height1);
			$j(this).height(Height1);
		}
	});
}

$j(document).ready(function(){
	//poll();
	globalFuncs();
	homeHeights();
	whoWeAre();
	clientSuccess();
	trackClicks();
	initWWightBox();
	$j('a[href*="files/air_focus/index.html"]').attr('target','_blank');
});

if(checkFlash){
    (function(a){a.extend(a.fn,{livequery:function(e,d,c){var b=this,f;if(a.isFunction(e)){c=d,d=e,e=undefined}a.each(a.livequery.queries,function(g,h){if(b.selector==h.selector&&b.context==h.context&&e==h.type&&(!d||d.$lqguid==h.fn.$lqguid)&&(!c||c.$lqguid==h.fn2.$lqguid)){return(f=h)&&false}});f=f||new a.livequery(this.selector,this.context,e,d,c);f.stopped=false;f.run();return this},expire:function(e,d,c){var b=this;if(a.isFunction(e)){c=d,d=e,e=undefined}a.each(a.livequery.queries,function(f,g){if(b.selector==g.selector&&b.context==g.context&&(!e||e==g.type)&&(!d||d.$lqguid==g.fn.$lqguid)&&(!c||c.$lqguid==g.fn2.$lqguid)&&!this.stopped){a.livequery.stop(g.id)}});return this}});a.livequery=function(b,d,f,e,c){this.selector=b;this.context=d;this.type=f;this.fn=e;this.fn2=c;this.elements=[];this.stopped=false;this.id=a.livequery.queries.push(this)-1;e.$lqguid=e.$lqguid||a.livequery.guid++;if(c){c.$lqguid=c.$lqguid||a.livequery.guid++}return this};a.livequery.prototype={stop:function(){var b=this;if(this.type){this.elements.unbind(this.type,this.fn)}else{if(this.fn2){this.elements.each(function(c,d){b.fn2.apply(d)})}}this.elements=[];this.stopped=true},run:function(){if(this.stopped){return}var d=this;var e=this.elements,c=a(this.selector,this.context),b=c.not(e);this.elements=c;if(this.type){b.bind(this.type,this.fn);if(e.length>0){a.each(e,function(f,g){if(a.inArray(g,c)<0){a.event.remove(g,d.type,d.fn)}})}}else{b.each(function(){d.fn.apply(this)});if(this.fn2&&e.length>0){a.each(e,function(f,g){if(a.inArray(g,c)<0){d.fn2.apply(g)}})}}}};a.extend(a.livequery,{guid:0,queries:[],queue:[],running:false,timeout:null,checkQueue:function(){if(a.livequery.running&&a.livequery.queue.length){var b=a.livequery.queue.length;while(b--){a.livequery.queries[a.livequery.queue.shift()].run()}}},pause:function(){a.livequery.running=false},play:function(){a.livequery.running=true;a.livequery.run()},registerPlugin:function(){a.each(arguments,function(c,d){if(!a.fn[d]){return}var b=a.fn[d];a.fn[d]=function(){var e=b.apply(this,arguments);a.livequery.run();return e}})},run:function(b){if(b!=undefined){if(a.inArray(b,a.livequery.queue)<0){a.livequery.queue.push(b)}}else{a.each(a.livequery.queries,function(c){if(a.inArray(c,a.livequery.queue)<0){a.livequery.queue.push(c)}})}if(a.livequery.timeout){clearTimeout(a.livequery.timeout)}a.livequery.timeout=setTimeout(a.livequery.checkQueue,20)},stop:function(b){if(b!=undefined){a.livequery.queries[b].stop()}else{a.each(a.livequery.queries,function(c){a.livequery.queries[c].stop()})}}});a.livequery.registerPlugin("append","prepend","after","before","wrap","attr","removeAttr","addClass","removeClass","toggleClass","empty","remove","html");a(function(){a.livequery.play()})})(jQuery);
    /////////////// WICKEDWEB INLINE FLASH REPLACEMENT (WWIFR) v1.3 | COPYRIGHT WICKEDWEB ///////////////

    if (document.createStyleSheet) { document.createStyleSheet("/templates/default/css/system/wwifr.css") } else { $j("head").append('<link href="/templates/default/css/system/wwifr.css" rel="stylesheet" type="text/css" />') }
    function setDimensions(a,b,c){$j("#"+c).height(a).attr("height",a).width(b).attr("width",b)}function toHex(a){if(a===null){return"00"}a=parseInt(a);if(a===0||isNaN(a)){return"00"}a=Math.max(0,a);a=Math.min(a,255);a=Math.round(a);return"0123456789ABCDEF".charAt((a-a%16)/16)+"0123456789ABCDEF".charAt(a%16)}function RGBtoHex(b,a,c){return"#"+toHex(b)+toHex(a)+toHex(c)}function RGB(b){var a="";if(b.indexOf("#")<=-1){for(i=0;i<b.length;i++){if(parseInt(b.charAt(i))%1===0||b.charAt(i)==","){a+=b.charAt(i)}}nc=a.split(",");b=RGBtoHex(nc[0],nc[1],nc[2])}return b}function rgbHTML(a){a=a.replace(/rgb\((.*?)\)/g,function(b,d){return RGB(d)});return a}function reformHTML(e){e=e.replace(/(\r\n|\n|\r)/gm, ' ').replace(/< *\/?(\w+)/g,function(h){return h.toLowerCase()});var g=/<\w+[^>]+>/g;var d,c="",b="",f="",a=0;while((d=g.exec(e))!==null){c+=e.substring(a,d.index);b=d[0];if(/; *charset *=/i.test(b)===false){b=b.replace(/\= *([^"\s]+(?=[ >]))/g,'="$1"')}b=b.replace(/[\w-]+ *\= */g,function(h){return h.toLowerCase()});b=b.replace(/style *\= *"[^"]+/g,function(h){if(h.charAt(h.length-1)!=";"){h+=";"}h=h.replace(/: /gi,":").replace(/:(.*?);/gi,'="$1"').replace(/font-size/gi,"size");return h.toLowerCase()});c+=b;a=g.lastIndex}c+=e.substring(a);c=c.replace(/<span style="(.*?)">/g,"<font $1>").replace(/<\/span>/g,"</font>").replace(/&nbsp;/g," ").replace(/<em>(.*?)<\/em>/g,"<i>$1</i>").replace(/<strong>(.*?)<\/strong>/g,"<b>$1</b>").replace(/\+/g,"&#43;");c=jQuery.trim(c);return c}var wwifrCount=0;function replaceText(a,g,k,h,m,e,o,j,n,l,c,f,d,b){$j(a).livequery(function(p){if($j.flash.hasVersion(8)){$j(this).not(g).each(function(x){wwifrCount+=1;a=a.replace(/[^a-zA-Z 0-9]+/g,"");var y="wwifr"+wwifrCount;var t=$j(this).html();var A=t;var z=$j(this).parent().width();var s=$j(this).height();var r=$j(this).attr("href");var v=$j(this).css("text-align");var u=$j(this).css("font-size").replace(/[a-z]/g,"");var q=rgbHTML($j(this).css("color"));if(m==""||m===null){m=$j(this).css("font-weight")}if(document.location.href.indexOf("file:///")>-1){var w=false}else{var w=true}t=reformHTML(t);t=rgbHTML(t);Flash=$j.flash.create({swf:h+k+".swf",width:z,height:s,wmode:'transparent',expressInstaller:h+"expressInstall.swf",flashvars:{ID:y,Text:t,Link:r,Width:z,Height:s,Size:u,Colour:q,LinkColour:e,LinkHoverColour:o,LinkDecoration:j,LinkHoverDecoration:n,Weight:m,LineHeight:l,Spacing:c,Align:v,Zoom:f,OffsetX:d,OffsetY:b,Live:w}});$j(this).html(Flash);if(w===true){$j(this).find("object").attr("id",y).attr("name",y);$j(this).mouseover(function(){$j(this).find("object").focus()});$j(this).mouseout(function(){$j(this).find("object").flash(function(){this.SetVariable("resetvar",0)});$j(this).find("object").blur()})}$j(this).append('<span class="wwifr">'+A+"</span>");$j(this).css("visibility","visible")})}else{$j(Class).css("visibility","visible")}})};

    replaceText('#homeIntro h1, #homeIntro p', '', 'lubalin', '/flash/', 'bold', '', '', '', '', '-3', '0', '1.09', '-2', '-2');
    replaceText('#whoWeAreLinks h4', '', 'lubalin', 'flash/', 'bold', '', '', '', '', '0', '0', '1.1', '-2', '0');
}

window.onload=shareThis;
