
/*-----------------------------------------------------
	OPEN A DEBUG WINDOW -- remove in production ***
	minified trace.js
-------------------------------------------------------*/
function trace(b){var c="trace";var d="clearTrace";if(!document.getElementById(c)){var e=document.createElement('div');e.id=c;e.style.position="fixed";e.style.zIndex="9000";e.style.top="10px";e.style.left="10px";e.style.opacity=".8";e.style.filter="alpha(opacity=80)";e.style.width="300px";e.style.minHeight="20px";e.style.maxHeight="300px";e.style.overflow="auto";e.style.backgroundColor="#000000";e.style.border="5px solid #f1f1f1";e.style.MozBorderRadius="10px";e.style.color="#f1f1f1";e.style.textAlign="left";e.style.padding="15px";document.body.appendChild(e);var a=document.createElement('a');a.id=d;a.className="clear";a.style.display="block";a.style.margin="0 0 5px";a.style.cursor="pointer";e.appendChild(a)}var f=document.getElementById(c);f.innerHTML+="<hr>\n";f.innerHTML+="<code>"+b+"</code>";var g=document.getElementById(d);g.innerHTML="close";g.onclick=function(){document.body.removeChild(f)}}
/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright Â© 2008 George McGinley Smith
 * 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. 
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, 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;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, 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;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (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;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (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;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { 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;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) 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;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, 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;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright Â© 2001 Robert Penner
 * 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. 
 *
 */

/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

/*	jCarouselLite - jQuery plugin to navigate images/any
	content in a carousel style widget.
	make a carousel from lists $(elem).jCarouselLite();
------------------------------------------------------------*/
(function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},o||{});return this.each(function(){var b=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var c=$(this),ul=$("ul",c),tLi=$("li",ul),tl=tLi.size(),v=o.visible;if(o.circular){ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());o.start+=v}var f=$("li",ul),itemLength=f.size(),curr=o.start;c.css("visibility","visible");f.css({overflow:"hidden",float:o.vertical?"none":"left"});ul.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});c.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var g=o.vertical?height(f):width(f);var h=g*itemLength;var j=g*v;f.css({width:f.width(),height:f.height()});ul.css(sizeCss,h+"px").css(animCss,-(curr*g));c.css(sizeCss,j+"px");if(o.btnPrev)$(o.btnPrev).click(function(){return go(curr-o.scroll)});if(o.btnNext)$(o.btnNext).click(function(){return go(curr+o.scroll)});if(o.btnGo)$.each(o.btnGo,function(i,a){$(a).click(function(){return go(o.circular?o.visible+i:i)})});if(o.mouseWheel&&c.mousewheel)c.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll)});if(o.auto)setInterval(function(){go(curr+o.scroll)},o.auto+o.speed);function vis(){return f.slice(curr).slice(0,v)};function go(a){if(!b){if(o.beforeStart)o.beforeStart.call(this,vis());if(o.circular){if(a<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*g)+"px");curr=a==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll}else if(a>=itemLength-v+1){ul.css(animCss,-((v)*g)+"px");curr=a==itemLength-v+1?v+1:v+o.scroll}else curr=a}else{if(a<0||a>itemLength-v)return;else curr=a}b=true;ul.animate(animCss=="left"?{left:-(curr*g)}:{top:-(curr*g)},o.speed,o.easing,function(){if(o.afterEnd)o.afterEnd.call(this,vis());b=false});if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled")}}return false}})};function css(a,b){return parseInt($.css(a[0],b))||0};function width(a){return a[0].offsetWidth+css(a,'marginLeft')+css(a,'marginRight')};function height(a){return a[0].offsetHeight+css(a,'marginTop')+css(a,'marginBottom')}})(jQuery);

/*!
 * jQuery.overscroll JavaScript Plugin v1.2.0
 * http://azoffdesign.com/plugins/js/overscroll
 *
 * Intended for use with the latest jQuery
 * http://code.jquery.com/jquery-latest.min.js
 *
 * Copyright 2010, Jonathan Azoff
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Date: Sunday, February 28 2010
 *
 * Changelog:
 *
 * 1.2.0
 *   - Updated license to match the jQuery license (thanks Jesse)
 *   - Added vertical scroll wheel support (thanks Pwakman)
 *   - Added support to ignore proprietary drag events (thanks Raphael)
 *   - Added "smart" click support for clickable elements (thanks Mark)
 * 1.1.2
 *   - Added the correct click handling to the scroll operation (thanks Evilc)
 * 1.1.1
 *   - Made scroll a bit smoother (thanks Nick)
 * 1.1.0
 *   - Optimized scrolling-internals so that it is both smoother and more memory efficient 
 *     (relies entirely on event model now). 
 *   - Added the ability to scroll horizontally (if the overscrolled element has wider children).
 * 1.0.3
 *   - Extended the easing object, as opposed to the $ object (thanks Andre)
 * 1.0.2
 *   - Fixed timer to actually return milliseconds (thanks Don)
 * 1.0.1
 *   - Fixed bug with interactive elements and made scrolling smoother (thanks Paul and Aktar)
 *
 * Notes:
 * 
 * In order to get the most out of this plugin, make sure to only apply it to parent elements 
 * that are smaller than the collective width and/or height then their children. This way,
 * you can see the actual scroll effect as you pan the element.
 *
 * You MUST have two cursors to get the hand to show up, open, and close during the panning 
 * process. You can put the cursors wherever you want, just make sure to reference them in 
 * the code below. I have provided initial static linkages to these cursors for your 
 * convenience (see below).
 *
 */
 
(function($, o){

	// create overscroll
	o = $.fn.overscroll = function() {
		this.each(o.init);
	}
	
	$.extend(o, {
		
		// overscroll icons
		icons: {
			open: "",
			closed: ""
		},
		
		// main initialization function
		init: function(data, target, size) {
			data = {};
			
			target = $(this)
				.css({"cursor":"url("+o.icons.open+"), default", "overflow": "hidden"})
				.bind("mousewheel DOMMouseScroll", data, o.wheel)
				.bind("select mousedown", data, o.start)
				.bind("mouseup mouseleave", data, o.stop)
				.bind("click", o.click)
				// disable proprietary drag handlers
				.bind("ondragstart drag", function(){return false;});
				
			data.target = target;	
		},
		
		// handles click events
		click: function(event) {
			
			if (typeof event.target.clickable === "undefined") {
				
				event.target.clickable = o.clickableRegExp.test(event.target.tagName);
			
			}
			
			return event.target.clickable;
			
		},
		
		// handles mouse wheel scroll events
		wheel: function(event, delta) {
			
			if ( event.wheelDelta ) delta = event.wheelDelta/12000;
			if ( event.detail     ) delta = -event.detail/3;
			
			event.data.target.stop(true, true).animate({
				scrollTop: this.scrollTop - (delta * o.constants.wheelDeltaMod)
			},{ 
				queue: false, 
				duration: o.constants.scrollDuration, 
				easing: "cubicEaseOut" 
			});
			
			return false;
			
		},
		
		// starts the drag operation and binds the mouse move handler
		start: function(event) {
			
			event.data.target
				.css("cursor", "url("+o.icons.closed+"), default")
				.bind("mousemove", event.data, o.drag)
				.stop(true, true);
			
			event.data.position = { 
				x: event.pageX,
				y: event.pageY
			};
			
			event.data.capture = {};
			
			return false;
		},
		
		// ends the drag operation and unbinds the mouse move handler
		stop: function(event) {

			if( typeof event.data.position !== "undefined" ) {
				
				event.data.target
					.css("cursor", "url("+o.icons.open+"), default")
					.unbind("mousemove", o.drag);
					
				var border = false,
					clicked = (typeof event.data.capture.time === "undefined");
				
				if ( !clicked ) {	
					var dt = (o.time() - event.data.capture.time);
					var dx = o.constants.scrollDeltaMod * (event.pageX - event.data.capture.x);
					var dy = o.constants.scrollDeltaMod * (event.pageY - event.data.capture.y);
					event.data.target.stop(true, true).animate({
						scrollLeft: this.scrollLeft - dx,
						scrollTop: this.scrollTop - dy
					},{ 
						queue: false, 
						duration: o.constants.scrollDuration, 
						easing: "cubicEaseOut"
					});
				}
				
				event.data.capture = event.data.position = undefined;
			}
			
			return clicked;
		},
		
		// updates the current scroll location during a mouse move
		drag: function(event) {
			this.scrollLeft -= (event.pageX - event.data.position.x);
			this.scrollTop -= (event.pageY - event.data.position.y);
			event.data.position.x = event.pageX;
			event.data.position.y = event.pageY;
			
			if (typeof event.data.capture.index === "undefined" || --event.data.capture.index==0 ) {
				event.data.capture = {
					x: event.pageX,
					y: event.pageY,
					time: o.time(),
					index: o.constants.captureThreshold
				}
			}

			return true;
		},
		
		time: function() {
			return (new Date()).getTime();
		},
		
		// determines what elements are clickable
		clickableRegExp: (/input|textarea|select|a/i),
		
		constants: {
			scrollDuration: 800,
			captureThreshold: 4,
			wheelDeltaMod: -200,
			scrollDeltaMod: 4.7
		}
		
	});

	// jQuery adapted Penner animation
	//    created by Jamie Lemon
	$.extend( $.easing, {
		
		cubicEaseOut: function(p, n, firstNum, diff) {
			var c = firstNum + diff;
			return c*((p=p/1-1)*p*p + 1) + firstNum;
		}
		
	});

})(jQuery);

/**
 * @author Alexander Farkas
 * v. 1.21
 */


(function($) {
	if(!document.defaultView || !document.defaultView.getComputedStyle){ // IE6-IE8
		var oldCurCSS = jQuery.curCSS;
		jQuery.curCSS = function(elem, name, force){
			if(name === 'background-position'){
				name = 'backgroundPosition';
			}
			if(name !== 'backgroundPosition' || !elem.currentStyle || elem.currentStyle[ name ]){
				return oldCurCSS.apply(this, arguments);
			}
			var style = elem.style;
			if ( !force && style && style[ name ] ){
				return style[ name ];
			}
			return oldCurCSS(elem, 'backgroundPositionX', force) +' '+ oldCurCSS(elem, 'backgroundPositionY', force);
		};
	}
	
	var oldAnim = $.fn.animate;
	$.fn.animate = function(prop){
		if('background-position' in prop){
			prop.backgroundPosition = prop['background-position'];
			delete prop['background-position'];
		}
		if('backgroundPosition' in prop){
			prop.backgroundPosition = '('+ prop.backgroundPosition;
		}
		return oldAnim.apply(this, arguments);
	};
	
	function toArray(strg){
		strg = strg.replace(/left|top/g,'0px');
		strg = strg.replace(/right|bottom/g,'100%');
		strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
		var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
		return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
	}
	
	$.fx.step. backgroundPosition = function(fx) {
		if (!fx.bgPosReady) {
			var start = $.curCSS(fx.elem,'backgroundPosition');
			
			if(!start){//FF2 no inline-style fallback
				start = '0px 0px';
			}
			
			start = toArray(start);
			
			fx.start = [start[0],start[2]];
			
			var end = toArray(fx.options.curAnim.backgroundPosition);
			fx.end = [end[0],end[2]];
			
			fx.unit = [end[1],end[3]];
			fx.bgPosReady = true;
		}
		//return;
		var nowPosX = [];
		nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
		nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];           
		fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];

	};
})(jQuery);

//
// homemade jquery plugins
//
(function($){
	/*-------------------------------
		CENTER OBJECT ON SCREEN
		attach an element to center on screen $(elem).centerOnScreen();
	---------------------------------*/
	$.fn.centerOnScreen = function(){
		var $this = this[0];
		var yScroll = self.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
		var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
		var windowWidth  = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
		$this.style.top  = (yScroll+((windowHeight - $this.offsetHeight)/2)) + "px";
		$this.style.left = ((windowWidth/2) - ($this.offsetWidth/2)) + "px";
	}
	/*-------------------------------
		GET OBJECT'S COORDINATES ON SCREEN
		$(elem).getCoordinates().x to return x value;
		$(elem).getCoordinates().y to return y value;
	---------------------------------*/
	$.fn.getCoordinates = function () {
		var obj = this[0];
		x = y = 0;
		if (obj.offsetParent) {
			x = obj.offsetLeft;
			y = obj.offsetTop;
			while (obj = obj.offsetParent) {
				x += obj.offsetLeft;
				y += obj.offsetTop;
			}
		}
		return {x:x,y:y};
	}
	
	/*-------------------------------
		NBOX OVERLAY
		Be sure to style #coverMe in your css with opacity settings to your liking
	---------------------------------*/
	$.fn.nBoxHide = function(target){
		if(!this || !this[0]){return false};
		$(this).click(function(){
			target.remove();
			$("#coverMe").fadeOut(function(){
				$(this).remove();
				if($.browser.msie && Number($.browser.version)<7){$("select").show()};
				$("#wordBalloon").fadeOut();
			});
		});
	}
	$.fn.nBox = function(o){
		var a		= this;
		var thisId	= a.attr("id");
		var o		= o					||{};
		var b		= o.width;
		var oTop 	= o.top 			|| "";
		var oLeft 	= o.left 			|| "";
		var cOs 	= o.CenterOnScreen 	|| "yes";
		$("body").prepend("<div id='coverMe'></div>");
		var c		= $("body").height() || window.innerHeight||document.body.clientHeight||document.documentElement.clientHeight;
		var d		= (document.height>c)?document.height:c;
		var e		= "100%";
		$("#coverMe").height(d).width(e).fadeIn();
		a.fadeIn();
		a.centerOnScreen();
		if(oTop!="" && oLeft!=""){
			a.css({width:b,top:oTop+"%",left:oLeft+"%"});
		} else {
			a.css({width:b});
		}
		if($.browser.msie && Number($.browser.version)<7){$("select").hide()};
		$("#"+thisId+" a.iClose").nBoxHide($(this));
		$("#"+thisId+" .btnCancel").nBoxHide($(this));
		$("#coverMe").nBoxHide($(this));
		// make sure new modals appear over an existing modal
		if ($(".modal").css("display") != "none") {
			var lastModal = ($(".modal").length)-2;
			lastModalZIndex = parseInt($(".modal:eq("+lastModal+")").css("z-index"));
			$(this).css("z-index", lastModalZIndex+1)
		}
	}
	
	/*-------------------------------
		Layout Switcher
	---------------------------------*/
	$.fn.switchLayout = function(o){
		if(!this){return false};
		var $this = this;
		this.startWith = o.initLayout || "grid";
		$this.before("<div class='layoutSwitchCtrl'><a class='iGrid'>grid view</a><a class='iRow'>row view</a></div>");
		$this.addClass($this.startWith);
		$this.prev().children("a:contains("+this.startWith+")").toggleClass("selected");
		$(".iGrid").click(function(){
			$this.removeClass("row");
			$this.addClass("grid");
			$(this).parent().children("a").removeClass("selected");
			$(this).toggleClass("selected");
			return false;
		})
		$(".iRow").click(function(){
			$this.removeClass("grid");
			$this.addClass("row");
			$(this).parent().children("a").removeClass("selected");
			$(this).toggleClass("selected");
			return false;
		})
	}
	
	// popUp layer to show documents in iframe
	$.fn.popUpFrame = function(o){
		if(!this || !this[0]){return false};
		var $this = this; 		// As an object
		var thisElem = this[0]; // As an Element
		var o = o || {};
			o.source = thisElem.href;
			o.width = o.width || "500px";
			o.height = o.height || "400px";
			o.iframe = o.iframe || "yes";
			o.HTMLcontent = o.HTMLcontent || "";
		$(this).click(function(){
			if(!document.getElementById("popUpIframe") && o.iframe=="yes"){
				$('<div id="popUpIframe" class="nBox"><a href="#close" title="Close" class="iClose icon single">Close</a><iframe src="'+o.source+'" frameborder="0"></iframe></div>').appendTo(document.body);
			} else if(!document.getElementById("popUpIframe") && o.iframe=="no" && o.HTMLcontent && o.source){
				$('<div id="popUpIframe" class="nBox"><a href="#close" title="Close" class="iClose icon single">Close</a><div id="HTMLcontent" class="static-page"></div></div>').appendTo(document.body);
				$("#HTMLcontent").load(o.source+" "+o.HTMLcontent);
			}
			$("#popUpIframe").css({height:o.height,width:o.width});
			if(o.nBox){
				$("#popUpIframe").nBox();
			} else {
				$("#popUpIframe").centerOnScreen()
				$("#popUpIframe").fadeIn();
			}
			$("#popUpIframe a.iClose,#coverMe").click(function(){$("#popUpIframe").remove()});
			return false;
		});
	}

	// Social Networking Buttons
	$.fn.socialNetworking = function(o){
		if(!this || !this[0]){return false};
		var $this = this; 		// As an object
		var thisElem = this[0]; // As an Element
		var thisUrl = window.location;
		var o = o || {};
			o.url = o.url || null;
			o.title = o.title || null;
		if(o.title){var docTitle="&"+o.title+"="+document.title}else{var docTitle=""}
		$this.click(function(){
			window.location = o.url+thisUrl+docTitle;
			return false;
		});
	}
	
	//collapsableShade
	$.fn.collapsableShade = function(o){
		if(!this || !this[0]){return false};
		$(this).bind('click',function(){
			var me = $(this);
			if(me.next().hasClass('sel')){
				//Do nothing
			} else {
				$("table.collapsableShade tr.sel").find('.charts').animate({height:'0'},400);
				$("table.collapsableShade tr").removeClass('sel');
				me.next().find('.charts').animate({height:'135'}, 400);
				me.next().addClass('sel');
			}
		})
	}
	
	/*-------------------------------
		Make Tabs Control
	---------------------------------*/
	$.fn.makeTabsController = function(o){
		if(!this){return false};
		var $this = this;
		$this.whichTabContent = o.tabViewId;
		$this.whichTabContentWidth = $("#"+$this.whichTabContent).width();
		$this.speed = o.speed || "slow";
		switch (o.animationType){
			case "hide":
				$("#"+$this.whichTabContent).children(":visible").hide();
				$("#"+$this.whichTabContent+" :first").show();
				$this.children("li").click(function(){
					var thisID = $(this).children().attr("id");
					document.getElementById(thisID).checked = "checked";
						thisID = thisID.split("-select")[0];
					var current = $this.attr("class");
					if(current==thisID){return false};
					$("#"+current).hide();
					$this.attr("class",thisID);
					$("#"+thisID).show();
					return false;
				}); break;
			case "slide":
				$("#"+$this.whichTabContent+" :first").animate({left:"0"},$this.speed);
				$this.children("li").children("a").click(function(){
					var thisID = this.href.split("#")[1];
					var current = $this.attr("class");
					if(current==thisID){return false};
					$("#"+current).animate({left:"-"+$this.whichTabContentWidth},$this.speed,function(){
						$("#"+current).css({left:$this.whichTabContentWidth});
					});
					$this.attr("class",thisID);
					$("#"+thisID).animate({left:"0"},$this.speed);
					if(this.nodeName=="A"){
						return false;
					}
				}); break;
			default:
				$("#"+$this.whichTabContent).children().css({left:"0"});
				$("#"+$this.whichTabContent+" :first").fadeIn();
				$this.children("li").children("a").click(function(){
					var thisID = this.href.split("#")[1];
					var current = $this.attr("class");
					if(current==thisID){return false};
					$("#"+current).fadeOut($this.speed);
					$this.attr("class",thisID);
					$("#"+thisID).fadeIn($this.speed);
					return false;
				}); break;
		}
	}

	// Reset text fields
	$.fn.resetText = function(o){
		if(!this || !this[0]){return false};
		function reset(obj,option){
			var placeholder = $(obj).attr('temptext');
			if($(obj).val() == '' || $(obj).val() == placeholder){
				(option == 'replace')?$(obj).val(placeholder):$(obj).val('');
			}
		}
		$(this).bind('focus',function(){
			reset(this);
		});
		$(this).bind('blur',function(){
			reset(this,'replace');
		});
		reset(this[0],'replace');
	}
	$.fn.safeSlideDown = function(speed, callback) {
		if(!speed) speed = "normal";
		if(!callback) callback = null;
	
		if($.browser.msie && $.browser.version <= 7.0) { 
			return $(this).fadeIn(speed, callback); 
		} else { 
			return $(this).slideDown(speed, callback); 
		}  
	}
	
	// Feature switcher
	$.fn.switchFeatures = function(o){
		if(!this || !this[0]){return false};
		var $this = this; 		// As an object
		var features = [];
		for(var i=0; i<$("#Home #supporting_images li a").length; i++){
			features.push( $("#Home #supporting_images li a").attr('href').split("#")[1] );
		}
		$("#info .info").hide();
		$('#feature_'+features[0]+'_info').fadeIn();
		Global.prevImage = '/img/work/'+features[0]+'-Large-Highlight.jpg';
		$("#Home #supporting_images li a:eq(0)").addClass('sel');
		$this.click(function(){
			if($(this).hasClass('sel')){
				return false;
			} else {
			var id = $(this).attr('href').split("#")[1];
				// old Image
				$("#work_hero").css('background-position','50% 0');
				$("#work_hero").css('background-image','url('+Global.prevImage+')');
				$("#work_hero").animate({backgroundPosition:'50% -360px'},{queue:false, duration:500,easing:"easeInOutCubic"})
				// New Image
				$("#work_hero2").css('background-position','50% 360px');
				$("#work_hero2").css('background-image','url(/img/work/'+id+'-Large-Highlight.jpg)');
				$("#work_hero2").animate({backgroundPosition:'50% 0'},{queue:false, duration:500,easing:"easeInOutCubic"})
				// Info Fade
				$("#info .info").fadeOut();
				$('#feature_'+id+'_info').fadeIn();
				$('#video_player').remove();
				Global.video = $(this).attr('video');
				Global.movieSize = $(this).attr('movieSize');
				if(Global.video){ $("#play_video").show(); } else { $("#play_video").hide(); }
				Global.prevImage = '/img/work/'+id+'-Large-Highlight.jpg';
				$("#Home #supporting_images li a").removeClass('sel');
				$(this).addClass('sel');
				return false;
			}
		})
	}
	
	// Work Feature switcher
	$.fn.switchWorkFeatures = function(o){
		if(!this || !this[0]){return false};
		var $this = this; 		// As an object
		$("#breadcrumb").hide();
		Global.prevImage = '/img/work/'+$("#Work #supporting_images li a:eq(0)").attr('href').split("#")[1];
		$("#Work #supporting_images li a:eq(0)").addClass('sel');
		$this.click(function(){
			if($("#work_info").is(":visible")){
				$("#breadcrumb").fadeIn();
				$("#work_info").slideUp();
			}
			var adtype = $(this).attr('adtype');
			$("#adtype").html('/ '+adtype);
			if($(this).hasClass('sel')){
				return false;
			} else {
				var src = $(this).attr('href').split("#")[1];
				$("#work_hero").css('background-position','50% 0');
				$("#work_hero").css('background-image','url('+Global.prevImage+')');
				$("#work_hero").animate({backgroundPosition:'50% -360px'},{queue:false, duration:500,easing:"easeInOutCubic"})
				// New Image
				$("#work_hero2").css('background-position','50% 360px');
				$("#work_hero2").css('background-image','url(/img/work/'+src+')');
				$("#work_hero2").animate({backgroundPosition:'50% 0'},{queue:false, duration:500,easing:"easeInOutCubic"})
				$('#video_player').remove();
				Global.video = $(this).attr('video');
				Global.movieSize = $(this).attr('movieSize');
				if(Global.video){ $("#play_video").show(); } else { $("#play_video").hide(); }
				Global.prevImage = '/img/work/'+src;
				$("#Work #supporting_images li a").removeClass('sel');
				$(this).addClass('sel');
				return false;
			}
		})
	}
	
	// Show Bio Box
	$.fn.showBioBox = function(o){
		if(!this || !this[0]){return false};
		$(this).hover(function(){
			$(this).children(".name-overlay").animate({top:'0'},{queue:false, duration:300,easing:"linear"});
		},function(){
			$(this).children(".name-overlay").animate({top:'-50'},{queue:false, duration:300,easing:"linear"});
		});
		$(this).children(".name-overlay").click(function(){
			var id = $(this).attr('href');
			var coord = $(this).parent().offset();
			$(".bio_box").fadeOut();
			if($(id).is(':visible')){
				$(id).fadeOut();
			} else {
				if( coord.left <= 3 ){
					$(id).css('left', 0 );
				} else if( coord.left >= ($('body').width() - 330) ) {
					$(id).css('left', ($('body').width() - 325) );
				} else {
					$(id).css('left', coord.left - ($(this).width()/2) );
				}
				$(id).fadeIn();
				$(id).css('top', coord.top - ($(this).height() + 90) );
				$(id).animate({top:coord.top - ( $(this).height() + 190 )},{queue:false, duration:500});
			}
			return false;
		});
	}
	
	// Play Video
	$.playVideo = function(o){
		$("body").append('<div id="video_player"></div>');
		$("#video_player").html('<a href="#close" class="close" onclick="$(\'#video_player\').remove();return false;">X</a>'+
			'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="735" height="360" id="flash_video" align="middle">'+
				'<param name="allowScriptAccess" value="sameDomain" />'+
				'<param name="allowFullScreen" value="true" />'+
				'<param name="scale" value="noscale" />'+
				'<param name="wmode" value="transparent" />'+
				'<param name="movie" value="/videos/player.swf?movieSize='+Global.movieSize+'&movie='+Global.video+'" />'+
				'<param name="quality" value="high" />'+
				'<param name="bgcolor" value="#000000" />'+
				'<embed src="/videos/player.swf?movieSize='+Global.movieSize+'&movie='+Global.video+'"'+
					'wmode="transparent"'+
					'quality="high" '+
					'bgcolor="#000000" '+
					'width="735" '+
					'height="360" '+
					'name="flash_video" '+
					'align="middle" '+
					'allowScriptAccess="sameDomain" '+
					'allowFullScreen="true" '+
					'type="application/x-shockwave-flash" '+
					'pluginspage="http://www.adobe.com/go/getflashplayer" />'+
			'</object>');
		return false;
	}

})(jQuery);

