/**
 * TheJJGroup.js
 *
 * @author		The JJ Group
 * @date			15/04/2009
 * @version		1.0
*/
if (typeof TheJJGroup === "undefined")
{
	var TheJJGroup = {};
}

TheJJGroup.Main = function()
{
	var m_strSiteTitle = "";
	
	var m_fnCreateHomeBG = function()
	{
		var arDivs;
		var elDiv;
		var elImg;
		var i;
		
		arDivs = document.getElementById("page-home").getElementsByTagName("div");
		
		for (i = 0; i < arDivs.length; i++)
		{
			elDiv = arDivs[i];
			
			if (elDiv.className == "container")
			{
				elImg = document.createElement("img");
				elImg.className = "bg";
				elImg.src = "content/img/bg-home.jpg";
				
				elDiv.appendChild(elImg);
				break;
			}
		}
	}

	var m_fnSetupNav = function()
	{
		var arLinks = document.getElementsByTagName("a");
		var iHashPos = -1;
		var i;

		for (i = 0; i < arLinks.length; i++)
		{
			iHashPos = arLinks[i].href.indexOf("#");
			
			if ((iHashPos === -1) || (iHashPos === arLinks[i].href.length - 1))
			{
				continue;
			}
		
			arLinks[i].pageName = arLinks[i].href.substring(iHashPos + 1)

			arLinks[i].onclick = function()
			{
				TheJJGroup.PageController.show(this.pageName);
				return false;
			}
			arLinks[i].onmouseover = arLinks[i].onfocus = function()
			{
				TheJJGroup.PageController.highlight(this.pageName);
				return false;
			}
			arLinks[i].onmouseout = arLinks[i].onblur = function()
			{
				TheJJGroup.PageController.clearHighlight(this.pageName);
				return false;
			}

			TheJJGroup.PageController.associateLink(arLinks[i]);
		}
	}
	
	var m_fnSetupOverlays = function()
	{
		var arEls;
		var arSecondaryEls;
		var arLinks;
		var i, j;
		
		arLinks = [];
		
		// links from footer
		/*arEls = document.getElementById("footer").getElementsByTagName("a");
		
		for (i = 0; i < arEls.length; i++)
		{
			arLinks.push(arEls[i]);
		}*/
		
		// secondary links from header
		arSecondaryEls = document.getElementById("header").getElementsByTagName("p");
		
		for (i = 0; i < arSecondaryEls.length; i++)
		{
			if (arSecondaryEls[i].className === "secondary")
			{
				arEls = arSecondaryEls[i].getElementsByTagName("a");
		
				for (j = 0; j < arEls.length; j++)
				{
					arLinks.push(arEls[i]);
				}
			}
		}

		for (i = 0; i < arLinks.length; i++)
		{
			arLinks[i].onclick = function()
			{
				var strClass = null;
				
				if (this.href.indexOf("contact.html") > -1)
				{
					strClass = "contact";
				}
			
				TheJJGroup.Overlay.createFromLink(this, strClass);
				return false;
			}
		}
	}

	return {

		init : function()
		{
			var strStartPage;
			var strLocation;
			var strTitleDivide;
			
			strTitleDivide = " - ";
			strStartPage = "home";
			m_strSiteTitle = document.title;
			
			if (m_strSiteTitle.indexOf(strTitleDivide) > -1)
			{
				m_strSiteTitle = m_strSiteTitle.substring(0, m_strSiteTitle.indexOf(strTitleDivide));
			}
			
			TheJJGroup.CaseStudy.setupStudies();
			TheJJGroup.Wow.setupGroups();

			TheJJGroup.PageController.setupPages();
			
			m_fnCreateHomeBG();
			m_fnSetupNav();
			m_fnSetupOverlays();

			strLocation = document.location.hash;

			if (strLocation)
			{
				strStartPage = strLocation.substring(strLocation.indexOf("#") + 1);
			}

			TheJJGroup.PageController.show(strStartPage);
			
			// flash replacement
			swfobject.embedSWF("content/flash/clients.swf", "fl-clients", 848, 483, "9.0.0", false, false, {wmode: "opaque"});
			swfobject.embedSWF("content/flash/lift-the-lid.swf", "fl-lift-the-lid", 848, 483, "9.0.0", false, false, {wmode: "opaque"});
			
			TheJJGroup.Overlay.preload();

			document.getElementsByTagName("html")[0].className += " loaded";
		},

		setTitle : function(strTitle)
		{
			document.title = m_strSiteTitle + " - " + strTitle;
		},
		
		recordPageHit : function(strPage)
		{
			if ((typeof pageTracker !== "object") || (!pageTracker._trackPageview))
			{
				return;
			}
			
			pageTracker._trackPageview("js-page/" + strPage);
		},
		
		updateLinks : function(el, bInline)
		{
			var arLinks;
			var elLink;
			var i;
			
			if (!el)
			{
				el = document;
			}
			
			arLinks = el.getElementsByTagName("a");
			
			for (i = 0; i < arLinks.length; i++)
			{
				elLink = arLinks[i];
				
				switch (elLink.rel)
				{
					case "external":
						elLink.rel = null;
						elLink.target = "_blank";
						break;
				}
			}
		},

		onResize : function()
		{
			TheJJGroup.PageController.resize();
		}

	}
}();

/**
 * TheJJGroup.CaseStudy.js
 *
 * @author		The JJ Group
 * @date			27/05/2009
 * @version		1.0
*/
if (typeof TheJJGroup === "undefined")
{
	var TheJJGroup = {};
}

TheJJGroup.CaseStudy = function()
{
	var ANIM_DURATION = 1;
	var FADE_DURATION = 0.5;

	var m_iStudiesPerPage = 3;
	var m_iCurrentPage = 0;
	var m_iTotalPages = 1;
	var m_elPage = null;
	var m_elContainer = null;
	var m_elList = null;
	
	var m_iPageWidth = 846;
	var m_btnPrevious = null;
	var m_btnNext = null;
	var m_arPageBtns = [];
	var m_twAnimation;
	
	var m_fnCreateCarousel = function()
	{
		var oSlider;
		var arStudies;
		var elControlContainer;
		var btnPage;
		var iCenterOffset;
		var i;
		
		arStudies = m_elContainer.getElementsByTagName("li");
		
		iCenterOffset = 10; // frames aren't perfect, so need a slight offset
		
		m_iTotalPages = Math.ceil(arStudies.length / m_iStudiesPerPage);
		m_elList.style.width = (m_iTotalPages * m_iPageWidth) + "px";
		
		elControlContainer = document.createElement("div");
		elControlContainer.className = "paging";
		m_elContainer.appendChild(elControlContainer);
		
		// create the prev control
		m_btnPrevious = document.createElement("a");
		m_btnPrevious.href = "javascript:TheJJGroup.CaseStudy.previousPage()";
		m_btnPrevious.className = "content-slide-previous";
		m_btnPrevious.appendChild(document.createTextNode("Previous"));
		elControlContainer.appendChild(m_btnPrevious);
		
		// create the page controls
		for (i = 0; i < m_iTotalPages; i++)
		{
			btnPage = document.createElement("a");
			btnPage.page = i;
			btnPage.className = "content-slide-pager";
			
			btnPage.href = "javascript:TheJJGroup.CaseStudy.goToPage(" + i + ")";
			btnPage.appendChild(document.createTextNode("Page " + (i + 1)));
			elControlContainer.appendChild(btnPage);
			
			m_arPageBtns.push(btnPage);
		}
		
		// create the next control
		m_btnNext = document.createElement("a");
		m_btnNext.href = "javascript:TheJJGroup.CaseStudy.nextPage()";
		m_btnNext.className = "content-slide-next";
		m_btnNext.appendChild(document.createTextNode("Next"));
		elControlContainer.appendChild(m_btnNext);
		
		// center the controls
		elControlContainer.style.left = Math.floor((m_iPageWidth / 2) - (elControlContainer.offsetWidth / 2) + iCenterOffset) + "px";
		
		// start in the center
		TheJJGroup.CaseStudy.goToPage(Math.ceil(m_iTotalPages / 2) - 1);
	}
	
	var m_fnChangePage = function(iPage)
	{
		var iCurrentPos;
		var i;
		
		if (iPage === m_iCurrentPage)
		{
			return;
		}
		
		if (m_twAnimation)
		{
			m_twAnimation.stop();
		}
		
		if (iPage >= m_iTotalPages - 1)
		{
			iPage = m_iTotalPages - 1;
			
			TheJJGroup.Util.addClassName(m_btnNext, "disabled");
		}
		else
		{
			TheJJGroup.Util.removeClassName(m_btnNext, "disabled");
		}
		
		if (iPage <= 0)
		{
			iPage = 0;
			
			TheJJGroup.Util.addClassName(m_btnPrevious, "disabled");
		}
		else
		{
			TheJJGroup.Util.removeClassName(m_btnPrevious, "disabled");
		}
		
		iCurrentPos = parseInt(m_elList.style.marginLeft);
		
		if (isNaN(iCurrentPos))
		{
			iCurrentPos = 0;
		}
		
		m_iCurrentPage = iPage;
		
		for (i = 0; i < m_arPageBtns.length; i++)
		{
			if (i == m_iCurrentPage)
			{
				TheJJGroup.Util.addClassName(m_arPageBtns[i], "active");
			}
			else
			{
				TheJJGroup.Util.removeClassName(m_arPageBtns[i], "active");
			}
		} 
		
		m_twAnimation = new Tween(
			m_elList.style,
			"marginLeft",
			TheJJGroup.Tween.exponentialEaseOut,
			iCurrentPos,
			-(m_iPageWidth * iPage),
			ANIM_DURATION,
			"px"
		);
		
		m_twAnimation.start();
	}
	
	var m_fnThumbFade = function(elLink, iAmount)
	{
		var elSpan;
		var elStrong;
		var elEm;
	
		if (elLink.anim)
		{
			elLink.anim.stop();
			elLink.anim = null;
		}
		
		elSpan = elLink.getElementsByTagName("span")[0];
		elStrong = elSpan.getElementsByTagName("strong")[0];
		
		try
		{
			elEm = elSpan.getElementsByTagName("em")[0];
		}
		catch(ex)
		{
			elEm = null;
		}
		
		elLink.anim = new OpacityTween(
			elStrong,
			Tween.regularEaseOut,
			TheJJGroup.Util.getOpacity(elStrong),
			iAmount,
			FADE_DURATION
		);
		
		if (elEm)
		{
			elLink.anim.addListener(TheJJGroup.CaseStudy);
		}
		
		elLink.anim.start();
	}

	return {
		
		setupStudies : function()
		{
			var arContainers;
			var arLinks;
			var elLink;
			var i;
			
			m_elPage = document.getElementById("value");
			m_elContainer = document.getElementById("case-studies");
			m_elList = m_elContainer.getElementsByTagName("ul")[0];
			
			if (!m_elPage || !m_elContainer)
			{
				return;
			}
			
			m_fnCreateCarousel();
			
			arLinks = m_elContainer.getElementsByTagName("a");
			
			for (i = 0; i < arLinks.length; i++)
			{
				elLink = arLinks[i];
				
				if (elLink.className.indexOf("content-slide") > -1)
				{
					continue;
				}
			
				elLink.id = "case-study-link-" + i;
				elLink.oldHref = elLink.href;
				elLink.href = "javascript:TheJJGroup.CaseStudy.showStudy('" + elLink.href + "');";
				elLink.onmouseover = function()
				{
					TheJJGroup.CaseStudy.onStudyThumbOver(this);
				}
				elLink.onmouseout = function()
				{
					TheJJGroup.CaseStudy.onStudyThumbOut(this);
				}
			}
		},
		
		previousPage : function()
		{
			this.goToPage(m_iCurrentPage - 1);
		},
		
		nextPage : function()
		{
			this.goToPage(m_iCurrentPage + 1);
		},
		
		goToPage : function(iPage)
		{
			m_fnChangePage(iPage);
		},
		
		onStudyThumbOver : function(elLink)
		{
			m_fnThumbFade(elLink, 100);
		},
		
		onStudyThumbOut : function(elLink)
		{
			m_fnThumbFade(elLink, 0);
		},
		
		onMotionChanged : function(e)
		{
			TheJJGroup.Util.setOpacity(e.target.targetObject.parentNode.getElementsByTagName("em")[0], TheJJGroup.Util.getOpacity(e.target.targetObject));
		},
		
		showStudy : function(strLink)
		{
			TheJJGroup.Overlay.createFromLink(strLink, "case-study", TheJJGroup.CaseStudy.studyInit);
		},
		
		studyInit : function(elOverlay)
		{
			var arDivs;
			var arStudyElements;
			var elDiv;
			var oSlider;
			var i;
			
			arDivs = elOverlay.getElementsByTagName("div");
			arStudyElements = [];
			
			for (i = 0; i < arDivs.length; i++)
			{
				elDiv = arDivs[i];
				
				switch (elDiv.className)
				{
					case "details":
					case "work-example":
						arStudyElements.push(elDiv);
						break;
					
					case "page-overlay":
						elOverlay = elDiv;
				}
			}
			
			oSlider = new TheJJGroup.ContentSlider();
			
			oSlider.create(elOverlay, 508, arStudyElements);
		}
		
	}
}();

/**
 * TheJJGroup.ContentSlider.js
 *
 * @author		The JJ Group
 * @date			28/05/2009
 * @version		1.0
*/
if (typeof TheJJGroup === "undefined")
{
	var TheJJGroup = {};
}

TheJJGroup.ContentSlider = function()
{
	var ANIM_DURATION = 1;
	
	var m_iSlideShowIval = null;
	var m_twAnimation = null;

	var m_iSlideWidth = 0;
	var m_iCurrentSlide = 0;
	var m_iTotalSlides = 0;
	
	var m_elMask = null;
	var m_elSlider = null;
	var m_btnPrevious = null;
	var m_btnNext = null;

	var m_fnChangeSlide = function(iSlide)
	{
		var iCurrentPos;
		
		if (iSlide === m_iCurrentSlide)
		{
			return;
		}
		
		if (m_twAnimation)
		{
			m_twAnimation.stop();
		}
		
		if (iSlide >= m_iTotalSlides - 1)
		{
			iSlide = m_iTotalSlides - 1;
			
			TheJJGroup.Util.addClassName(m_btnNext, "hidden");
		}
		else
		{
			TheJJGroup.Util.removeClassName(m_btnNext, "hidden");
		}
		
		if (iSlide <= 0)
		{
			iSlide = 0;
			
			TheJJGroup.Util.addClassName(m_btnPrevious, "hidden");
		}
		else
		{
			TheJJGroup.Util.removeClassName(m_btnPrevious, "hidden");
		}
		
		iCurrentPos = parseInt(m_elSlider.style.marginLeft);
		
		if (isNaN(iCurrentPos))
		{
			iCurrentPos = 0;
		}
		
		m_iCurrentSlide = iSlide;
		
		m_twAnimation = new Tween(
			m_elSlider.style,
			"marginLeft",
			TheJJGroup.Tween.exponentialEaseOut,
			iCurrentPos,
			-(m_iSlideWidth * iSlide),
			ANIM_DURATION,
			"px"
		);
		//alert("changing from " + iCurrentPos + " to -" + (m_iSlideWidth * iSlide));
		m_twAnimation.start();
	}

	return {
	
		id : null,
	
		create : function(elContainer, iWidth, arElements)
		{
			var elSlide;
			var i;
			
			if (arElements.length < 2)
			{
				return;
			}
			
			this.id = TheJJGroup.ContentSlider.sliders.length;
			
			TheJJGroup.ContentSlider.sliders.push(this);
			
			m_iSlideWidth = iWidth;
			m_iTotalSlides = arElements.length;
			
			// create the controls
			// Note: mouse events won't fire for some reason so have to use the javascript link protocol
			m_btnPrevious = document.createElement("a");
			m_btnPrevious.href = "javascript:TheJJGroup.ContentSlider.previousSlide(" + this.id + ")";
			m_btnPrevious.id = "content-slide-previous-" + this.id;
			m_btnPrevious.className = "content-slide-previous hidden";
			m_btnPrevious.appendChild(document.createTextNode("Previous"));
			elContainer.appendChild(m_btnPrevious);
			
			m_btnNext = document.createElement("a");
			m_btnNext.href = "javascript:TheJJGroup.ContentSlider.nextSlide(" + this.id + ")";
			m_btnNext.id = "content-slide-next-" + this.id;
			m_btnNext.className = "content-slide-next";
			m_btnNext.appendChild(document.createTextNode("Next"));
			elContainer.appendChild(m_btnNext);
			
			// create the container that will mask the slider
			m_elMask = document.createElement("div");
			m_elMask.className = "content-slider-mask";
			m_elMask.style.width = iWidth + "px";
			elContainer.appendChild(m_elMask);
			
			// create the container for the slides
			m_elSlider = document.createElement("div");
			m_elSlider.className = "content-slider";
			m_elSlider.style.width = (iWidth * m_iTotalSlides) + "px";
			m_elMask.appendChild(m_elSlider);
			
			// create the slides
			for (i = 0; i < arElements.length; i++)
			{
				elSlide = document.createElement("div");
				elSlide.id = "content-slide-" + i;
				elSlide.className = "content-slide";
				elSlide.style.width = iWidth + "px";
				m_elSlider.appendChild(elSlide);
				
				elSlide.appendChild(arElements[i].cloneNode(true));
			}
			
			// remove the original content
			for (i = 0; i < arElements.length; i++)
			{
				arElements[i].parentNode.removeChild(arElements[i]);
			}
		},
		
		nextSlide : function()
		{
			m_fnChangeSlide(m_iCurrentSlide + 1);
		},
		
		previousSlide : function()
		{
			m_fnChangeSlide(m_iCurrentSlide - 1);
		}
		
	}
};

TheJJGroup.ContentSlider.sliders = [];

TheJJGroup.ContentSlider.nextSlide = function(id)
{
	var i;
	
	for (i = 0; i < this.sliders.length; i++)
	{
		if (this.sliders[i].id === id)
		{
			this.sliders[i].nextSlide();
			return;
		}
	}
}

TheJJGroup.ContentSlider.previousSlide = function(id)
{
	var i;
	
	for (i = 0; i < this.sliders.length; i++)
	{
		if (this.sliders[i].id === id)
		{
			this.sliders[i].previousSlide();
			return;
		}
	}
}

/**
 * TheJJGroup.Overlay.js
 *
 * @author		The JJ Group
 * @date			11/05/2009
 * @version		1.0
*/
if (typeof TheJJGroup === "undefined")
{
	var TheJJGroup = {};
}

TheJJGroup.Overlay = function()
{
	var m_strRequestedPage = null;
	var m_fnCallBack = null;
	var m_elOverlay = null;
	var m_elOverlayMask = null;
	var m_elOverlayInner = null;
	
	var m_fnCreateOverlay = function(strClass)
	{
		var elCloseContainer, elClose;
	
		if (!m_elOverlay)
		{
			m_elOverlayMask = document.createElement("div");
			m_elOverlayMask.id = "overlay-mask";
			
			m_elOverlay = document.createElement("div");
			m_elOverlay.id = "overlay";
			
			m_elOverlayInner = document.createElement("div");
			m_elOverlayInner.className = "inner";
			m_elOverlay.appendChild(m_elOverlayInner);
			
			elCloseContainer = document.createElement("div");
			elCloseContainer.id = "close-container";
			m_elOverlayInner.appendChild(elCloseContainer);
			
			elClose = document.createElement("img");
			elClose.id = "btn-close";
			elClose.src = "content/img/btn-close.png";
			elClose.alt = "Close";
			elClose.onclick = function()
			{
				TheJJGroup.Overlay.close();
			}
			elCloseContainer.appendChild(elClose);
			
			document.getElementsByTagName("body")[0].appendChild(m_elOverlayMask);
			document.getElementsByTagName("body")[0].appendChild(m_elOverlay);
		}
		
		if (strClass)
		{
			m_elOverlay.className = strClass;
		}
	}
	
	var m_fnCreateAjaxForms = function()
	{
		var arForms;
		var elForm;
		var elFormElement;
		var i, j;
		
		arForms = m_elOverlay.getElementsByTagName("form");
		
		for (i = 0; i < arForms.length; i++)
		{
			elForm = arForms[i];
			
			elForm.onsubmit = function()
			{
				var strParams = "type=xml";
				
				for (j = 0; j < this.elements.length; j++)
				{
					elFormElement = this.elements[j];
					
					strParams += "&" + elFormElement.name + "=" + encodeURI(elFormElement.value);
				}
			
				JJ.Components.HttpGateway.execute(
					this.action,
					TheJJGroup.Overlay.onFormCallback,
					TheJJGroup.Overlay.onFormCallbackError,
					"post",
					strParams
				);
				
				return false;
			}
		}
	}

	return {
	
		preload : function()
		{
			var img1, img2;
			
			img1 = new Image();
			img1.src = "content/img/bg-contact.png";
			
			img2 = new Image();
			img2.src = "content/img/bg-overlay.png";
		},
	
		createFromLink : function(link, strClass, fnCallBack)
		{
			var strUrl;
			var strTrackUrl;
			
			if (typeof link === "string")
			{
				m_strRequestedPage = link;
			}
			else
			{
				m_strRequestedPage = link.href;
			}
			
			strUrl = m_strRequestedPage.replace(".html", ".xhtml");
			strTrackUrl = m_strRequestedPage.replace(window.location.protocol + "//" + window.location.host, "");
			
			if (strTrackUrl.indexOf("/") == 0)
			{
				strTrackUrl = strTrackUrl.substr(1);
			}
			
			TheJJGroup.Main.recordPageHit(strTrackUrl);
			
			m_fnCreateOverlay(strClass);
			
			if (typeof fnCallBack === "function")
			{
				m_fnCallBack = fnCallBack;
			}
			else
			{
				m_fnCallBack = null;
			}
			
			JJ.Components.HttpGateway.execute(strUrl, TheJJGroup.Overlay.onCallback, TheJJGroup.Overlay.onCallbackError);
		},
		
		close : function()
		{
			if (!m_elOverlay)
			{
				return;
			}
			
			m_elOverlay.parentNode.removeChild(m_elOverlay);
			m_elOverlay = null;
			
			m_elOverlayMask.parentNode.removeChild(m_elOverlayMask);
			m_elOverlayMask = null;
		},
		
		onCallback : function(xml)
		{
			m_elOverlayInner.appendChild(JJ.Components.HtmlGenerator.parseXml(xml));
			m_fnCreateAjaxForms();
			
			TheJJGroup.Main.updateLinks(m_elOverlayInner, true);
			
			if (typeof m_fnCallBack === "function")
			{
				m_fnCallBack(m_elOverlayInner);
			}
		},
		
		onCallbackError : function()
		{
			document.location.href = m_strRequestedPage;
		},
		
		onFormCallback : function(xml)
		{
			alert(xml.firstChild.firstChild.nodeValue);
		},
		
		onFormCallbackError : function()
		{
			alert("error");
		}
	
	}
}();

/**
 * TheJJGroup.Page.js
 *
 * @author		The JJ Group
 * @date			15/04/2009
 * @version		1.0
*/
if (typeof TheJJGroup === "undefined")
{
	var TheJJGroup = {};
}

TheJJGroup.Page = function()
{
	var m_public = this;
	var m_iHeight = 0;
	var m_twColour = null;
	var m_strColourOff = "ffffff";
	var m_iHighlightDuration = 0.5;
	
	var m_fnMoveContentToContainer = function()
	{
		var node;
		m_public.container = document.createElement("div");
		m_public.container.className = "container";
		
		for (var i = m_public.el.childNodes.length - 1; i > -1; i--)
		{
			node = m_public.el.childNodes.item(i);
			m_public.container.appendChild(m_public.el.removeChild(node));
		}
		
		m_public.el.appendChild(m_public.container);
	}
	
	var m_fnCreateTab = function()
	{
		var elTab;
		
		elTab = document.createElement("div");
		elTab.className = "tab";
		elTab.page = m_public;
		elTab.onclick = function()
		{
			TheJJGroup.PageController.show(this.page);
		}
		elTab.onmouseover = function()
		{
			TheJJGroup.PageController.highlight(this.page);
		}
		elTab.onmouseout = function()
		{
			TheJJGroup.PageController.clearHighlight(this.page);
		}
		
		m_public.tab = elTab;
		m_public.el.insertBefore(elTab, m_public.container);
	}
	
	var m_fnToggleLinkHighlight = function(elLink, bEnable)
	{
		var strClassName;
		var strColour;
		
		if (bEnable)
		{
			strClassName = "active";
			strColour = m_public.colour;
		}
		else
		{
			strClassName = "";
			strColour = m_strColourOff;
		}
	
		elLink.className = strClassName;
		elLink.style.backgroundColor = "#" + strColour;
		
		if (elLink.twColour)
		{
			elLink.twColour.fforward();
			elLink.twColour.stop();
		}
		
		elLink.twColour = new ColorTween(
			elLink.style,
			"backgroundColor",
			TheJJGroup.Tween.exponentialEaseOut,
			TheJJGroup.Util.getColor(elLink.style.backgroundColor),
			strColour,
			m_iHighlightDuration
		);
		
		elLink.twColour.start();
	}

	return {
		title : null,
		id : null,
		pos: null,
		el : null,
		container : null,
		tab : null,
		colour : null,
		links : [],
		height : null,
		
		init : function(el, pos)
		{
			var arEls;
			var i;
			
			m_public = this;
			
			this.el = el;
			this.id = el.id;
			this.pos = pos;
			this.colour = TheJJGroup.PageController.COLOURS[this.id];
			
			el.id = "page-" + el.id;
			
			this.title = el.getElementsByTagName("h2")[0].firstChild.nodeValue;
			this.height = el.offsetHeight;
			
			el.style.width = TheJJGroup.PageController.TAB_WIDTH + "px";
			
			m_fnMoveContentToContainer();
			m_fnCreateTab();
		},
		
		addLink : function(elLink)
		{
			this.links.push(elLink);
		},
		
		highlight : function()
		{
			if (TheJJGroup.PageController.activePage == this)
			{
				return;
			}
		
			if (m_twColour != null)
			{
				m_twColour.fforward();
				m_twColour.stop();
			}
			
			for (var i = 0; i < this.links.length; i++)
			{
				m_fnToggleLinkHighlight(this.links[i], true);
			}
			
			m_twColour = new ColorTween(
				this.tab.style,
				"backgroundColor",
				TheJJGroup.Tween.exponentialEaseOut,
				TheJJGroup.Util.getColor(this.tab.style.backgroundColor),
				this.colour,
				m_iHighlightDuration
			);
			
			m_twColour.start();
		},
		
		clearHighlight : function()
		{
			if (TheJJGroup.PageController.activePage == this)
			{
				return;
			}
			
			if (m_twColour != null)
			{
				m_twColour.fforward();
				m_twColour.stop();
			}
			
			for (var i = 0; i < this.links.length; i++)
			{
				m_fnToggleLinkHighlight(this.links[i], false);
			}
			
			m_twColour = new ColorTween(
				this.tab.style,
				"backgroundColor",
				TheJJGroup.Tween.exponentialEaseOut,
				TheJJGroup.Util.getColor(this.tab.style.backgroundColor),
				m_strColourOff,
				m_iHighlightDuration
			);
			
			m_twColour.start();
		}
	}
}

/**
 * TheJJGroup.PageController.js
 *
 * @author		The JJ Group
 * @date			15/04/2009
 * @version		1.0
*/
if (typeof TheJJGroup === "undefined")
{
	var TheJJGroup = {};
}

TheJJGroup.PageController = function()
{
	var m_twAnimation = null;
	var m_arPages = [];
	
	var m_fnFindPage = function(strId)
	{
		var i;
		
		for (i = 0; i < m_arPages.length; i++)
		{
			if (m_arPages[i].id === strId)
			{
				return m_arPages[i];
			}
		}
		
		return null;
	}
	
	var m_fnGetPage = function(page)
	{
		if (typeof page === "string")
		{
			return m_fnFindPage(page);
		}
		else
		{
			return page;
		}
		
		return null;
	}

	return {
	
		PAGE_PREFIX : "page-",
		ANIM_DURATION : 0.5,
		PAGE_WIDTH : 849,
		TAB_WIDTH : 24,
		COLOURS : {
							home : "4c1bd3",
							ideas : "cbec0f",
							clients : "fc9950",
							value : "45cbfd",
							liftthelid : "ff328e",
							wow : "fde519"
							},
		
		activePage : null,
	
		setupPages : function()
		{
			var arEls;
			var el;
			var oPage;
			var iPos;
			var i;
			
			arEls = document.getElementsByTagName("div");
			iPos = 0;
		
			for (i = 0; i < arEls.length; i++)
			{
				el = arEls[i];
			
				if (!el.className)
				{
					continue;
				}
			
				if (el.className.indexOf("page") == 0)
				{
					iPos++;
					
					oPage = new TheJJGroup.Page();
					oPage.init(el, iPos);
					
					m_arPages.push(oPage);
				}
			}
		},
		
		associateLink : function(elLink)
		{
			var oPage;
			
			oPage = m_fnGetPage(elLink.pageName);
			
			if (oPage === null)
			{
				return;
			}
			
			oPage.addLink(elLink);
		},
		
		highlight : function(page)
		{
			var oPage;
			
			oPage = m_fnGetPage(page);
			
			if (oPage === null)
			{
				return;
			}
			
			oPage.highlight();
		},
		
		clearHighlight : function(page)
		{
			var oPage;
			
			oPage = m_fnGetPage(page);
			
			if (oPage === null)
			{
				return;
			}
			
			oPage.clearHighlight();
		},
	
		show : function(page)
		{
			var oPage;
			
			oPage = m_fnGetPage(page);
			
			if (oPage === null)
			{
				return;
			}
			
			if (m_twAnimation != null)
			{
				m_twAnimation.fforward();
				m_twAnimation.stop();
			}
			
			this.highlight(oPage);
			
			if (this.activePage != null)
			{
				if (oPage.id == this.activePage.id)
				{
					m_twAnimation = null;
					return;
				}
			}
			
			if ((document.location.hash != "") || (oPage.id != "home"))
			{
				document.location.hash = oPage.id;
			}
			
			document.getElementsByTagName("html")[0].scrollTop = 0;
			
			TheJJGroup.Main.setTitle(oPage.title);
			TheJJGroup.Main.recordPageHit(oPage.id);
			
			m_twAnimation = new Tween(
				oPage.el.style,
				"width",
				TheJJGroup.Tween.exponentialEaseOut,
				parseInt(oPage.el.style.width),
				this.PAGE_WIDTH + this.TAB_WIDTH,
				this.ANIM_DURATION,
				"px"
			);
			
			m_twAnimation.addListener(this);
			m_twAnimation.start();
			
			this.closingPage = this.activePage;
			this.activePage = oPage;
			
			if (this.closingPage != null)
			{
				this.clearHighlight(this.closingPage);
			}
		},
		
		resize : function()
		{
			var elH;
			var elF;
			var elM;
			var h;
			
			if (this.activePage == null)
			{
				return;
			}
			
			// WebKit based browser seem to have issue with the height of #main being changed
			if (navigator.userAgent.toLowerCase().indexOf("webkit") > -1)
			{
				return;
			}
			
			elH = document.getElementById("header");
			elF = document.getElementById("footer");
			elM = document.getElementById("main");
			h = elF.offsetTop - (elH.offsetTop + elH.offsetHeight) + 1;
			
			elM.style.height = Math.max(h, this.activePage.height) + "px";
			
			if (this.activePage)
			{
				elM.className = "main-" + this.activePage.id;
			}
		},
		
		onMotionChanged : function(e)
		{
			if (this.closingPage != null)
			{
				this.closingPage.el.style.width = (this.PAGE_WIDTH - parseInt(e.target.obj[e.target.prop]) + (this.TAB_WIDTH*2)) + "px";
			}
		},
		
		onMotionStopped : function(e)
		{
			this.onMotionFinished(e);
		},
		
		onMotionFinished : function(e)
		{
			this.closingPage = null;
			this.onMotionChanged(e);
			
			if (this.activePage)
			{
				TheJJGroup.Main.updateLinks(this.activePage.el);
			}
		}
	
	}
}();

/**
 * TheJJGroup.Tween.js
 *
 * @author		The JJ Group
 * @date			15/04/2009
 * @version		1.0
*/
if (typeof TheJJGroup === "undefined")
{
	var TheJJGroup = {};
}

TheJJGroup.Tween = {};

TheJJGroup.Tween.exponentialEaseIn = function(t,b,c,d)
{
	return t == 0 ? b : c * Math.pow(2, 10 * (t / d - 1)) + b;
}

TheJJGroup.Tween.exponentialEaseOut = function(t,b,c,d)
{
	return t == d ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
}

TheJJGroup.Tween.exponentialEaseInOut = function(t,b,c,d)
{
	if (t == 0)
	{
		return b;
	}

	if (t == d)
	{
		return b + c;
	}

	if ((t /= d / 2) < 1)
	{
		return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
	}

	return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
}

TheJJGroup.Tween.quadraticEaseIn = function(t,b,c,d)
{
	return c * (t /= d) * t + b;
}

TheJJGroup.Tween.quadraticEaseOut = function(t,b,c,d)
{
	return -c * (t /= d) * (t - 2) + b;
}

TheJJGroup.Tween.quadraticEaseInOut = function(t,b,c,d)
{
	if ((t /= d / 2) < 1)
	{
		return c / 2 * t * t + b;
	}

	return -c / 2 * ((--t) * (t - 2) - 1) + b;
}

/**
 * TheJJGroup.Util.js
 *
 * @author		The JJ Group
 * @date			15/04/2009
 * @version		1.0
*/
if (typeof TheJJGroup === "undefined")
{
	var TheJJGroup = {};
}

TheJJGroup.Util = function()
{
	return {
		hexDigit : ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"],
		evtHash : [],

		dec2hex : function(dec)
		{
			return (this.hexDigit[dec >> 4] + this.hexDigit[dec & 15]);
		},

		getColor : function(strValue)
		{
			var arParts;
			var r, g, b;

			if (strValue.indexOf("rgb(") == 0)
			{
				strValue = strValue.substring(4, strValue.length);
				strValue = strValue.substring(0, strValue.length - 1);

				arParts = strValue.split(",");
				r = arParts[0].replace(" ", "");
				g = arParts[1].replace(" ", "");
				b = arParts[2].replace(" ", "");

				return (this.dec2hex(r) + this.dec2hex(g) + this.dec2hex(b));
			}
			else if (strValue.indexOf("#") == 0)
			{
				strValue = strValue.substring(1, strValue.length);
			}

			switch (strValue.length)
			{
				case 3:
					return strValue.substr(0, 1) + strValue.substr(0, 1) +
						strValue.substr(1, 1) + strValue.substr(1, 1) +
						strValue.substr(2, 1) + strValue.substr(2, 1);
				case 6:
					return strValue;
			}

			return "ffffff";
		},
		
		getOpacity : function(el)
		{
			var iOpacity;
		
			if (el.filters)
			{
				iOpacity = el.filters.alpha["opacity"];
			}
			else if (el.style.opacity)
			{
				iOpacity = parseFloat(el.style.opacity) * 100;
			}
			else if (el.style["-moz-opacity"])
			{
				iOpacity = parseFloat(el.style["-moz-opacity"]) * 100;
			}
			
			iOpacity = parseFloat(iOpacity);
			
			if (isNaN(iOpacity))
			{
				iOpacity = 0;
			}
			
			return iOpacity;
		},
		
		setOpacity : function(el, iAmount)
		{
			if (el.filters)
			{
				el.filters.alpha["opacity"] = iAmount;
			}
			else
			{
				el.style["opacity"] = iAmount / 100;
				el.style["-moz-opacity"] = iAmount / 100;
			}
		},

		findInArray : function(array, value)
		{
			var i;

			for (i = 0; i < array.length; i++)
			{
				if (array[i] === value)
				{
					return i;
				}
			}

			return -1;
		},

		addClassName : function(el, strClass)
		{
			var arClasses;
			var iPos;

			if (!el)
			{
				return;
			}

			if (!el.className)
			{
				el.className = strClass;
				return;
			}

			this.removeClassName(el, strClass);

			arClasses = el.className.split(" ");
			arClasses.push(strClass);

			el.className = arClasses.join(" ");
		},

		removeClassName : function(el, strClass)
		{
			if (!el || !el.className)
			{
				return;
			}

			arClasses = el.className.split(" ");

			iPos = this.findInArray(arClasses, strClass);

			if (iPos > -1)
			{
				arClasses.splice(iPos, 1);
			}

			el.className = arClasses.join(" ");
		}
	}
}();

/**
 * TheJJGroup.Wow.js
 *
 * @author		The JJ Group
 * @date			28/05/2009
 * @version		1.0
*/
if (typeof TheJJGroup === "undefined")
{
	var TheJJGroup = {};
}

TheJJGroup.Wow = function()
{
	return {
		
		setupGroups : function()
		{
			var arDivs;
			var arGroupElements;
			var elContainer;
			var elDiv;
			var oSlider;
			var i;
			
			elContainer = document.getElementById("wow");
			
			arDivs = elContainer.getElementsByTagName("div");
			arGroupElements = [];
			
			for (i = 0; i < arDivs.length; i++)
			{
				elDiv = arDivs[i];
				
				switch (elDiv.className)
				{
					case "group":
						arGroupElements.push(elDiv);
						break;
					
					case "inner":
						elContainer = elDiv;
				}
			}
			
			oSlider = new TheJJGroup.ContentSlider();
			oSlider.create(elContainer, 773, arGroupElements);
		}
		
	}
}();

/**
 * HtmlGenerator component
 *
 * Parses well formed HTML strings into a DOM tree
 *
 * @author		Ed Broome
 * @date			27/04/2008
 * @version		1.0
*/

// register namespaces
if (typeof JJ == "undefined")
{
	var JJ = {};
	JJ.Components = {};
}
else if (typeof JJ.Components == "undefined")
{
	JJ.Components = {};
}

/**
 * HtmlGenerator class
 *
 * Parses well formed HTML strings into a DOM tree
*/
JJ.Components.HtmlGenerator = function()
{
	var m_fnParseXmlToDom = function(node)
	{
		var strName;
		var arAttributes = [];
		var objNode;
		var objChild;
		var i;
		var j;

		strName = node.nodeName;
		arAttributes = node.attributes;

		objNode = document.createElement(strName);

		for(i = 0; i < arAttributes.length; i++)
		{
			if(arAttributes[i].nodeName != "class")
			{
				objNode.setAttribute(arAttributes[i].nodeName, arAttributes[i].value);
			}
			else
			{
				objNode.className = arAttributes[i].value;
			}
		}

		for(objChild = node.firstChild; objChild != null; objChild = objChild.nextSibling)
		{
			switch(objChild.nodeType)
			{
				case 1:
					objNode.appendChild(m_fnParseXmlToDom(objChild));
					break;
				case 3: // text
					objNode.appendChild(document.createTextNode((objChild.hasChildNodes() ? objChild.firstChild.nodeValue : objChild.nodeValue)));
					break;
			}
		}

		return objNode;
	}

	return {
		parse : function(strHtml)
		{
			var objDoc;
			var objParser;

			if (document.implementation && document.implementation.createDocument)
			{
				objParser = new DOMParser();
				objDoc = objParser.parseFromString(strHtml,"text/xml");
			}
			else
			{
				objDoc = new ActiveXObject("Microsoft.XMLDOM");
				objDoc.async = false;
				objDoc.loadXML(strHtml);
			}
			return m_fnParseXmlToDom(objDoc.firstChild);
		},
		parseXml : function(objXml)
		{
			var objNode;

			objNode = m_fnParseXmlToDom(objXml.documentElement);
			return objNode;

		}
	}

}();

/**
 * HttpGateway component
 *
 * Acts as an asynchronous xml gateway
 *
 * @author		Ed Broome
 * @date			10/04/2008
 * @version		1.0
*/

// register namespaces
if (typeof JJ == "undefined")
{
	var JJ = {};
	JJ.Components = {};
}
else if (typeof JJ.Components == "undefined")
{
	JJ.Components = {};
}

/**
 * HttpGateway class
 *
 * Acts as an asynchronous xml gateway
*/

JJ.Components.HttpGateway = function()
{

	var m_static = JJ.Components.HttpGateway;

	var m_arQueue = [];
	var m_bExecuting = false;

	var m_arEvents = [];

	var m_fnHookEvent = function(event, func, callee, params)
	{
		m_arEvents[m_arEvents.length] = {name:event, obj:{name:arguments[0], fn:arguments[1], scope:arguments[2], arguments:arguments[3]}};
	};

	// {name:arguments[0], fn:arguments[1], scope:arguments[2]};
	var m_fnFireEvent = function(name)
	{
		var i;
		var strEventName;
		var fnEventCallback;
		var objScope;
		var obj;

		obj = null;

		for(i = 0; i < m_arEvents.length; i++)
		{
			if(m_arEvents[i].name == name)
			{
				obj = m_arEvents[i].obj;

				if(obj != null)
				{
					if(typeof obj.name != "string")
					{
						return;
					}

					if(typeof obj.fn != "function")
					{
						return;
					}

					strEventName = obj.name;
					fnEventCallback = obj.fn;
					objScope = null;

					if(typeof obj.scope == "object")
					{
						objScope = obj.scope;
					}

					fnEventCallback.apply((objScope == null ? this : objScope), [obj.arguments]);
				}

			}
		}

	}

	return {

		m_objGateway : null,
		m_fnCallBack : null,
		m_fnCallBackError : null,

		execute : function(Url, CallBack, CallBackError, RequestType, Parameters)
		{
			m_arQueue[m_arQueue.length] = new JJ.Components.HttpGateway.QueueItem(Url, CallBack, CallBackError, RequestType, Parameters);

			if (!m_bExecuting)
			{
				m_fnFireEvent("beforerequest");
				// load the first queue item
				JJ.Components.HttpGateway.start();
			}
		},

		start : function()
		{
			var objItem;

			m_fnCallBack = null;
			m_fnCallBackError = null;

			// exit if there are no more items to execute
			if (m_arQueue.length == 0)
			{
				m_fnFireEvent("requestscomplete");
				m_bExecuting = false;
				return;
			}

			m_bExecuting = true;

			objItem = m_arQueue.shift();
			
			if (objItem.Url())
			{
				// forced reset of object
				JJ.Components.HttpGateway.m_objGateway = null;
				/*@cc_on @*/
				/*@if (@_jscript_version >= 5)
				try
				{
					JJ.Components.HttpGateway.m_objGateway = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch (e)
				{
					try
					{
						JJ.Components.HttpGateway.m_objGateway = new ActiveXObject("Microsoft.XMLHTTP");
					}
					catch (E)
					{
						JJ.Components.HttpGateway.m_objGateway = false;
					}
				}
				@end @*/

				if (!JJ.Components.HttpGateway.m_objGateway && typeof(XMLHttpRequest) != 'undefined')
				{
					JJ.Components.HttpGateway.m_objGateway = new XMLHttpRequest();
				}

				m_fnCallBack = objItem.CallBack;
				m_fnCallBackError = objItem.CallBackError;

				JJ.Components.HttpGateway.m_objGateway.onreadystatechange = JJ.Components.HttpGateway.callback;
				JJ.Components.HttpGateway.m_objGateway.open(objItem.RequestType().toUpperCase(), objItem.Url());
				
				if (objItem.RequestType().toUpperCase() == "POST")
				{
					JJ.Components.HttpGateway.m_objGateway.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
					
					if (objItem.Parameters() != "")
					{
						JJ.Components.HttpGateway.m_objGateway.setRequestHeader("Content-length", objItem.Parameters().length);
					}
				}
				else
				{
					JJ.Components.HttpGateway.m_objGateway.setRequestHeader('Content-Type', 'text/xml');
					JJ.Components.HttpGateway.m_objGateway.setRequestHeader("MessageType", "CALL");				
				}
				
				if (objItem.Parameters() != "")
				{
					JJ.Components.HttpGateway.m_objGateway.send(objItem.Parameters());
				}
				else
				{
					JJ.Components.HttpGateway.m_objGateway.send("");
				}
			}
			else
			{
				m_fnCallBack = objItem.CallBack;
				m_fnCallBackError = objItem.CallBackError;
				JJ.Components.HttpGateway.callback();
			};

		},

		on : function(event, func, callee, params)
		{
			m_fnHookEvent(event, func, callee, params);
		},

		callback : function()
		{
			if (JJ.Components.HttpGateway.m_objGateway.readyState == 4)
			{
				// try block to prevent an issue where the page unloads beofre the gateway has completed, causing an exception in FF
				try
				{
					switch(JJ.Components.HttpGateway.m_objGateway.status)
					{
						case 200:
							if (m_fnCallBack)
							{
								m_fnCallBack(JJ.Components.HttpGateway.m_objGateway.responseXML);
							}
							//m_fnFireEvent("requestscomplete");
							break;
						case 404:
						case 500:
							if (m_fnCallBackError)
							{
								m_fnCallBackError();
							}
							break;
					}
					JJ.Components.HttpGateway.start();
				}
				catch(e)
				{
					//alert(e)
				}
			}
		}

	}
}();


JJ.Components.HttpGateway.QueueItem = function(Url, CallBack, CallBackError, RequestType, Parameters)
{
	var m_strParameters = "";
	var m_strRequestType = "get";
	
	if (typeof RequestType == "string")
	{
		m_strRequestType = RequestType;
	}
	
	if (typeof Parameters == "string")
	{
		m_strParameters = Parameters;
	}
			
	var m_strUrl = Url;
	var m_fnCallBack = CallBack;
	var m_fnCallBackError = null;
	if(typeof CallBackError == "function")
	{
		m_fnCallBackError = CallBackError;
	}
	return {
		RequestType : function()
		{
			return m_strRequestType;
		},
		Parameters : function()
		{
			return m_strParameters;
		},
		Url : function()
		{
			return m_strUrl;
		},
		CallBack : function(xml)
		{
			m_fnCallBack(xml);
		},
		CallBackError : function()
		{
			m_fnCallBackError();
		}
	};
}



/**********************************************************************
TERMS OF USE - EASING EQUATIONS
Open source under the BSD License.
Copyright (c) 2001 Robert Penner
JavaScript version copyright (C) 2006 by Philippe Maegerman
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

   * Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
   * Neither the name of the author nor the names of contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

*****************************************/
function Delegate() {}
Delegate.create = function (o, f) {
	var a = new Array() ;
	var l = arguments.length ;
	for(var i = 2 ; i < l ; i++) a[i - 2] = arguments[i] ;
	return function() {
		var aP = [].concat(arguments, a) ;
		f.apply(o, aP);
	}
}

Tween = function(obj, prop, func, begin, finish, duration, suffixe){
	this.init(obj, prop, func, begin, finish, duration, suffixe)
}
var t = Tween.prototype;

t.obj = new Object();
t.prop='';
t.func = function (t, b, c, d) { return c*t/d + b; };
t.begin = 0;
t.change = 0;
t.prevTime = 0;
t.prevPos = 0;
t.looping = false;
t._duration = 0;
t._time = 0;
t._pos = 0;
t._position = 0;
t._startTime = 0;
t._finish = 0;
t.name = '';
t.suffixe = '';
t._listeners = new Array();	
t.setTime = function(t){
	this.prevTime = this._time;
	if (t > this.getDuration()) {
		if (this.looping) {
			this.rewind (t - this._duration);
			this.update();
			this.broadcastMessage('onMotionLooped',{target:this,type:'onMotionLooped'});
		} else {
			this._time = this._duration;
			this.update();
			this.stop();
			this.broadcastMessage('onMotionFinished',{target:this,type:'onMotionFinished'});
		}
	} else if (t < 0) {
		this.rewind();
		this.update();
	} else {
		this._time = t;
		this.update();
	}
}
t.getTime = function(){
	return this._time;
}
t.setDuration = function(d){
	this._duration = (d == null || d <= 0) ? 100000 : d;
}
t.getDuration = function(){
	return this._duration;
}
t.setPosition = function(p){
	this.prevPos = this._pos;
	var a = this.suffixe != '' ? this.suffixe : '';
	this.obj[this.prop] = Math.round(p) + a;
	this._pos = p;
	this.broadcastMessage('onMotionChanged',{target:this,type:'onMotionChanged'});
}
t.getPosition = function(t){
	if (t == undefined) t = this._time;
	return this.func(t, this.begin, this.change, this._duration);
};
t.setFinish = function(f){
	this.change = f - this.begin;
};
t.geFinish = function(){
	return this.begin + this.change;
};
t.init = function(obj, prop, func, begin, finish, duration, suffixe){
	if (!arguments.length) return;
	this._listeners = new Array();
	this.addListener(this);
	if(suffixe) this.suffixe = suffixe;
	this.obj = obj;
	this.prop = prop;
	this.begin = begin;
	this._pos = begin;
	this.setDuration(duration);
	if (func!=null && func!='') {
		this.func = func;
	}
	this.setFinish(finish);
}
t.start = function(){
	this.rewind();
	this.startEnterFrame();
	this.broadcastMessage('onMotionStarted',{target:this,type:'onMotionStarted'});
	//alert('in');
}
t.rewind = function(t){
	this.stop();
	this._time = (t == undefined) ? 0 : t;
	this.fixTime();
	this.update();
}
t.fforward = function(){
	this._time = this._duration;
	this.fixTime();
	this.update();
}
t.update = function(){
	this.setPosition(this.getPosition(this._time));
	}
t.startEnterFrame = function(){
	this.stopEnterFrame();
	this.isPlaying = true;
	this.onEnterFrame();
}
t.onEnterFrame = function(){
	if(this.isPlaying) {
		this.nextFrame();
		setTimeout(Delegate.create(this, this.onEnterFrame), 0);
	}
}
t.nextFrame = function(){
	this.setTime((this.getTimer() - this._startTime) / 1000);
	}
t.stop = function(){
	this.stopEnterFrame();
	this.broadcastMessage('onMotionStopped',{target:this,type:'onMotionStopped'});
}
t.stopEnterFrame = function(){
	this.isPlaying = false;
}

t.continueTo = function(finish, duration){
	this.begin = this._pos;
	this.setFinish(finish);
	if (this._duration != undefined)
		this.setDuration(duration);
	this.start();
}
t.resume = function(){
	this.fixTime();
	this.startEnterFrame();
	this.broadcastMessage('onMotionResumed',{target:this,type:'onMotionResumed'});
}
t.yoyo = function (){
	this.continueTo(this.begin,this._time);
}

t.addListener = function(o){
	this.removeListener (o);
	return this._listeners.push(o);
}
t.removeListener = function(o){
	var a = this._listeners;	
	var i = a.length;
	while (i--) {
		if (a[i] == o) {
			a.splice (i, 1);
			return true;
		}
	}
	return false;
}
t.broadcastMessage = function(){
	var arr = new Array();
	for(var i = 0; i < arguments.length; i++){
		arr.push(arguments[i])
	}
	var e = arr.shift();
	var a = this._listeners;
	var l = a.length;
	for (var i=0; i<l; i++){
		if(a[i][e])
		a[i][e].apply(a[i], arr);
	}
}
t.fixTime = function(){
	this._startTime = this.getTimer() - this._time * 1000;
}
t.getTimer = function(){
	return new Date().getTime() - this._time;
}
Tween.backEaseIn = function(t,b,c,d,a,p){
	if (s == undefined) var s = 1.70158;
	return c*(t/=d)*t*((s+1)*t - s) + b;
}
Tween.backEaseOut = function(t,b,c,d,a,p){
	if (s == undefined) var s = 1.70158;
	return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
}
Tween.backEaseInOut = function(t,b,c,d,a,p){
	if (s == undefined) var s = 1.70158; 
	if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
	return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
}
Tween.elasticEaseIn = function(t,b,c,d,a,p){
		if (t==0) return b;  
		if ((t/=d)==1) return b+c;  
		if (!p) p=d*.3;
		if (!a || a < Math.abs(c)) {
			a=c; var s=p/4;
		}
		else 
			var s = p/(2*Math.PI) * Math.asin (c/a);
		
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	
}
Tween.elasticEaseOut = function (t,b,c,d,a,p){
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (!a || a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return (a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b);
	}
Tween.elasticEaseInOut = function (t,b,c,d,a,p){
	if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) var p=d*(.3*1.5);
	if (!a || a < Math.abs(c)) {var a=c; var s=p/4; }
	else var s = p/(2*Math.PI) * Math.asin (c/a);
	if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
}

Tween.bounceEaseOut = function(t,b,c,d){
	if ((t/=d) < (1/2.75)) {
		return c*(7.5625*t*t) + b;
	} else if (t < (2/2.75)) {
		return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
	} else if (t < (2.5/2.75)) {
		return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
	} else {
		return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
	}
}
Tween.bounceEaseIn = function(t,b,c,d){
	return c - Tween.bounceEaseOut (d-t, 0, c, d) + b;
	}
Tween.bounceEaseInOut = function(t,b,c,d){
	if (t < d/2) return Tween.bounceEaseIn (t*2, 0, c, d) * .5 + b;
	else return Tween.bounceEaseOut (t*2-d, 0, c, d) * .5 + c*.5 + b;
	}

Tween.strongEaseInOut = function(t,b,c,d){
	return c*(t/=d)*t*t*t*t + b;
	}

Tween.regularEaseIn = function(t,b,c,d){
	return c*(t/=d)*t + b;
	}
Tween.regularEaseOut = function(t,b,c,d){
	return -c *(t/=d)*(t-2) + b;
	}

Tween.regularEaseInOut = function(t,b,c,d){
	if ((t/=d/2) < 1) return c/2*t*t + b;
	return -c/2 * ((--t)*(t-2) - 1) + b;
	}
Tween.strongEaseIn = function(t,b,c,d){
	return c*(t/=d)*t*t*t*t + b;
	}
Tween.strongEaseOut = function(t,b,c,d){
	return c*((t=t/d-1)*t*t*t*t + 1) + b;
	}

Tween.strongEaseInOut = function(t,b,c,d){
	if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
	return c/2*((t-=2)*t*t*t*t + 2) + b;
	}

/**********************************************************************
TERMS OF USE - EASING EQUATIONS
Open source under the BSD License.
Copyright (c) 2001 Robert Penner
JavaScript version copyright (C) 2006 by Philippe Maegerman
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

   * Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
   * Neither the name of the author nor the names of contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

*****************************************/
ColorTween.prototype = new Tween();
ColorTween.prototype.constructor = Tween;
ColorTween.superclass = Tween.prototype;

function ColorTween(obj,prop,func,fromColor,toColor,duration){
	this.targetObject = obj;
	this.targetProperty = prop;	
	this.fromColor = fromColor;
	this.toColor = toColor;
	this.init(new Object(),'x',func,0,100,duration);
	this.listenerObj = new Object();
	this.listenerObj.onMotionChanged = Delegate.create(this,this.onColorChanged);
	this.addListener(this.listenerObj);
}
var o = ColorTween.prototype;
o.targetObject = {};
o.targetProperty = {};
o.fromColor = '';
o.toColor = '';
o.currentColor = '';
o.listenerObj = {};
o.onColorChanged = function(){
	this.currentColor = this.getColor(this.fromColor,this.toColor,this._pos);
	this.targetObject[this.targetProperty] = this.currentColor;
}

/***********************************************
*
* Function    : getColor
*
* Parameters  :    start - the start color (in the form "RRGGBB" e.g. "FF00AC")
*            end - the end color (in the form "RRGGBB" e.g. "FF00AC")
*            percent - the percent (0-100) of the fade between start & end
*
* returns      : color in the form "#RRGGBB" e.g. "#FA13CE"
*
* Description : This is a utility function. Given a start and end color and
*            a percentage fade it returns a color in between the 2 colors
*
* Author      : www.JavaScript-FX.com
*
*************************************************/ 
o.getColor = function(start, end, percent)
{
	var r1=this.hex2dec(start.slice(0,2));
    var g1=this.hex2dec(start.slice(2,4));
    var b1=this.hex2dec(start.slice(4,6));

    var r2=this.hex2dec(end.slice(0,2));
    var g2=this.hex2dec(end.slice(2,4));
    var b2=this.hex2dec(end.slice(4,6));

    var pc = percent/100;

    r= Math.floor(r1+(pc*(r2-r1)) + .5);
    g= Math.floor(g1+(pc*(g2-g1)) + .5);
    b= Math.floor(b1+(pc*(b2-b1)) + .5);

    return("#" + this.dec2hex(r) + this.dec2hex(g) + this.dec2hex(b));
}
/*** These are the simplest HEX/DEC conversion routines I could come up with ***/
/*** I have seen a lot of fade routines that seem to make this a             ***/
/*** very complex task. I am sure somene else must've had this idea          ***/
/************************************************/  

o.dec2hex = function(dec){return(this.hexDigit[dec>>4]+this.hexDigit[dec&15]);}
o.hexDigit=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");
o.hex2dec = function(hex){return(parseInt(hex,16))};

/**********************************************************************
TERMS OF USE - EASING EQUATIONS
Open source under the BSD License.
Copyright (c) 2001 Robert Penner
JavaScript version copyright (C) 2006 by Philippe Maegerman
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

   * Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
   * Neither the name of the author nor the names of contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

*****************************************/
OpacityTween.prototype = new Tween();
OpacityTween.prototype.constructor = Tween;
OpacityTween.superclass = Tween.prototype;

function OpacityTween(obj,func,fromOpacity,toOpacity,duration){
	this.targetObject = obj;
	this.init(new Object(),'x',func,fromOpacity,toOpacity,duration);
}
var o = OpacityTween.prototype;
o.targetObject = {};
o.onMotionChanged = function(evt){
	var v = evt.target._pos;
	var t = this.targetObject;
	t.style['opacity'] = v / 100;
	t.style['-moz-opacity'] = v / 100;
	if(t.filters) t.filters.alpha['opacity'] = v;
}

/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();

