/*** NZ Herald Combined JS ***/
/**** Combined File : _029_jquery.zindexfix.js ****/
(function($) {

	/**
	 * @desc Fixes IE7 and below's inability to work out z-index's properly.
	 * @author Craig Bassett
	 * @version 1.0
	 *
	**/
	
	$.fn.zIndexFix = function() {
		
		// Defined Variables.
		var pluginElement 		= $(this); // The element the plugin was invoked on.
		
		//*** Check for CSS support ***
		var hasCSS = function()  {
			$('body').append(
				$(document.createElement('div')).attr('id','css_test').css({ width:'1px', height:'1px', display:'none' })
			);
			var _v = ($('#css_test').width() != 1) ? false : true;
			$('#css_test').remove();
			return _v;
		}
		
		//*** Determine's if our browser is IE or not.
		var isIE = function() {
			if(navigator.userAgent.match(/MSIE \d\.\d+/)) return true;
			return false;
		}

		// check for basic CSS support
		if (!hasCSS()) { return false; }
		
		// Fix IE7 and below's z-Index issues.
	    if(isIE()) {
			var zIndexNumber = 8000;
			$('div').each(function() {
				var divElement = $(this);
				if (!divElement.hasClass("clearBoth")) {
					if (divElement.attr("id") != "_nnDropIn") {
						divElement.css('zIndex', zIndexNumber);
						zIndexNumber -= 10;
					}
				}
			});
		}
		
		return this;
		
	};

})(jQuery);
/**** Combined File : _030_jquery.hoverIntent.js ****/
/**
* hoverIntent is similar to jQuery's built-in "hover" function except that
* instead of firing the onMouseOver event immediately, hoverIntent checks
* to see if the user's mouse has slowed down (beneath the sensitivity
* threshold) before firing the onMouseOver event.
* 
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* hoverIntent is currently available for use in all personal or commercial 
* projects under both MIT and GPL licenses. This means that you can choose 
* the license that best suits your project, and use it accordingly.
* 
* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions
* $("ul li").hoverIntent( showNav , hideNav );
* 
* // advanced usage receives configuration object only
* $("ul li").hoverIntent({
*	sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
*	interval: 100,   // number = milliseconds of polling interval
*	over: showNav,  // function = onMouseOver callback (required)
*	timeout: 0,   // number = milliseconds delay before onMouseOut function call
*	out: hideNav    // function = onMouseOut callback (required)
* });
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($) {
	$.fn.hoverIntent = function(f,g) {
		// default configuration options
		var cfg = {
			sensitivity: 7,
			interval: 100,
			timeout: 0
		};
		// override configuration options with user supplied object
		cfg = $.extend(cfg, g ? { over: f, out: g } : f );

		// instantiate variables
		// cX, cY = current X and Y position of mouse, updated by mousemove event
		// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
		var cX, cY, pX, pY;

		// A private function for getting mouse position
		var track = function(ev) {
			cX = ev.pageX;
			cY = ev.pageY;
		};

		// A private function for comparing current and previous mouse position
		var compare = function(ev,ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			// compare mouse positions to see if they've crossed the threshold
			if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
				$(ob).unbind("mousemove",track);
				// set hoverIntent state to true (so mouseOut can be called)
				ob.hoverIntent_s = 1;
				return cfg.over.apply(ob,[ev]);
			} else {
				// set previous coordinates for next time
				pX = cX; pY = cY;
				// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
				ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
			}
		};

		// A private function for delaying the mouseOut function
		var delay = function(ev,ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			ob.hoverIntent_s = 0;
			return cfg.out.apply(ob,[ev]);
		};

		// A private function for handling mouse 'hovering'
		var handleHover = function(e) {
			// next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
			var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
			while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
			if ( p == this ) { return false; }

			// copy objects to be passed into t (required for event object to be passed in IE)
			var ev = jQuery.extend({},e);
			var ob = this;

			// cancel hoverIntent timer if it exists
			if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }

			// else e.type == "onmouseover"
			if (e.type == "mouseover") {
				// set "previous" X and Y position based on initial entry point
				pX = ev.pageX; pY = ev.pageY;
				// update "current" X and Y position based on mousemove
				$(ob).bind("mousemove",track);
				// start polling interval (self-calling timeout) to compare mouse coordinates over time
				if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}

			// else e.type == "onmouseout"
			} else {
				// unbind expensive mousemove event
				$(ob).unbind("mousemove",track);
				// if hoverIntent state is true, then call the mouseOut function after the specified delay
				if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
			}
		};

		// bind the function to the two event listeners
		return this.mouseover(handleHover).mouseout(handleHover);
	};
})(jQuery);
/**** Combined File : _031_jquery.autocomplete.js ****/
jQuery.autocomplete = function(input, options) {
	// Create a link to self
	var me = this;

	// Create jQuery object for input element
	var $input = $(input).attr("autocomplete", "off");

	// Apply inputClass if necessary
	if (options.inputClass) $input.addClass(options.inputClass);

	// Create results
	var results = document.createElement("div");
	// Create jQuery object for results
	var $results = $(results);
	$results.hide().addClass(options.resultsClass).css("position", "absolute");
	if( options.width > 0 ) $results.css("width", options.width);

	// Add to body element
	$("body").append(results);

	input.autocompleter = me;

	var timeout = null;
	var prev = "";
	var active = -1;
	var cache = {};
	var keyb = false;
	var hasFocus = false;
	var lastKeyPressCode = null;

	// flush cache
	function flushCache(){
		cache = {};
		cache.data = {};
		cache.length = 0;
	};

	// flush cache
	flushCache();

	// if there is a data array supplied
	if( options.data != null ){
		var sFirstChar = "", stMatchSets = {}, row = [];

		// no url was specified, we need to adjust the cache length to make sure it fits the local data store
		if( typeof options.url != "string" ) options.cacheLength = 1;

		// loop through the array and create a lookup structure
		for( var i=0; i < options.data.length; i++ ){
			// if row is a string, make an array otherwise just reference the array
			row = ((typeof options.data[i] == "string") ? [options.data[i]] : options.data[i]);

			// if the length is zero, don't add to list
			if( row[0].length > 0 ){
				// get the first character
				sFirstChar = row[0].substring(0, 1).toLowerCase();
				// if no lookup array for this character exists, look it up now
				if( !stMatchSets[sFirstChar] ) stMatchSets[sFirstChar] = [];
				// if the match is a string
				stMatchSets[sFirstChar].push(row);
			}
		}

		// add the data items to the cache
		for( var k in stMatchSets ){
			// increase the cache size
			options.cacheLength++;
			// add to the cache
			addToCache(k, stMatchSets[k]);
		}
	}

	$input
	.keydown(function(e) {
		// track last key pressed
		lastKeyPressCode = e.keyCode;
		switch(e.keyCode) {
			case 38: // up
				e.preventDefault();
				moveSelect(-1);
				break;
			case 40: // down
				e.preventDefault();
				moveSelect(1);
				break;
			case 9:  // tab
			case 13: // return
				if( selectCurrent() ){
					// make sure to blur off the current field
					$input.get(0).blur();
					e.preventDefault();
				}
				else if ( options.onEnterNoSelect )
				{	
					setTimeout(function() { options.onEnterNoSelect() }, 1); 
				}
				e.preventDefault();
				break;
			default:
				active = -1;
				if (timeout) clearTimeout(timeout);
				timeout = setTimeout(function(){onChange();}, options.delay);
				break;
		}
	})
	.focus(function(){
		// track whether the field has focus, we shouldn't process any results if the field no longer has focus
		hasFocus = true;
	})
	.blur(function() {
		// track whether the field has focus
		hasFocus = false;
		hideResults();
	});

	hideResultsNow();

	function onChange() {
		// ignore if the following keys are pressed: [del] [shift] [capslock]
		if( lastKeyPressCode == 46 || (lastKeyPressCode > 8 && lastKeyPressCode < 32) ) return $results.hide();
		var v = $input.val();
		if (v == prev) return;
		prev = v;
		if (v.length >= options.minChars) {
			$input.addClass(options.loadingClass);
			requestData(v);
		} else {
			$input.removeClass(options.loadingClass);
			$results.hide();
		}
	};

 	function moveSelect(step) {

		var lis = $("li", results);
		if (!lis) return;

		active += step;

		if (active < 0) {
			active = 0;
		} else if (active >= lis.size()) {
			active = lis.size() - 1;
		}

		lis.removeClass("ac_over");

		$(lis[active]).addClass("ac_over");

		// Weird behaviour in IE
		// if (lis[active] && lis[active].scrollIntoView) {
		// 	lis[active].scrollIntoView(false);
		// }

	};

	function selectCurrent() {
		var li = $("li.ac_over", results)[0];
		if (!li) {
			var $li = $("li", results);
			if (options.selectOnly) {
				if ($li.length == 1) li = $li[0];
			} else if (options.selectFirst) {
				li = $li[0];
			}
		}
		if (li) {
			selectItem(li);
			return true;
		} else {
			return false;
		}
	};

	function selectItem(li) {
		if (!li) {
			li = document.createElement("li");
			li.extra = [];
			li.selectValue = "";
		}
		var v = $.trim(li.selectValue ? li.selectValue : li.innerHTML);
		input.lastSelected = v;
		prev = v;
		$results.html("");
		if( options.onItemSet ) 
			$input.val(options.onItemSet(v));
		else
			$input.val(v);
		hideResultsNow();
		if (options.onItemSelect) setTimeout(function() { options.onItemSelect(li) }, 1);
	};

	// selects a portion of the input string
	function createSelection(start, end){
		// get a reference to the input element
		var field = $input.get(0);
		if( field.createTextRange ){
			var selRange = field.createTextRange();
			selRange.collapse(true);
			selRange.moveStart("character", start);
			selRange.moveEnd("character", end);
			selRange.select();
		} else if( field.setSelectionRange ){
			field.setSelectionRange(start, end);
		} else {
			if( field.selectionStart ){
				field.selectionStart = start;
				field.selectionEnd = end;
			}
		}
		field.focus();
	};

	// fills in the input box w/the first match (assumed to be the best match)
	function autoFill(sValue){
		// if the last user key pressed was backspace, don't autofill
		if( lastKeyPressCode != 8 ){
			// fill in the value (keep the case the user has typed)
			$input.val($input.val() + sValue.substring(prev.length));
			// select the portion of the value not typed by the user (so the next character will erase)
			createSelection(prev.length, sValue.length);
		}
	};

	function showResults() {
		// get the position of the input field right now (in case the DOM is shifted)
		var pos = findPos(input);
		// either use the specified width, or autocalculate based on form element
		var iWidth = (options.width > 0) ? options.width : $input.width();
		// reposition
		$results.css({
			width: parseInt(iWidth) + "px",
			top: (pos.y + input.offsetHeight) + "px",
			left: pos.x + "px"
		}).show();
	};

	function hideResults() {
		if (timeout) clearTimeout(timeout);
		timeout = setTimeout(hideResultsNow, 200);
	};

	function hideResultsNow() {
		if (timeout) clearTimeout(timeout);
		$input.removeClass(options.loadingClass);
		if ($results.is(":visible")) {
			$results.hide();
		}
		if (options.mustMatch) {
			var v = $input.val();
			if (v != input.lastSelected) {
				selectItem(null);
			}
		}
	};

	function receiveData(q, data) {
		if (data) {
			$input.removeClass(options.loadingClass);
			results.innerHTML = "";

			// if the field no longer has focus or if there are no matches, do not display the drop down
			if( !hasFocus || data.length == 0 ) return hideResultsNow();

			if ($.browser.msie) {
				// we put a styled iframe behind the calendar so HTML SELECT elements don't show through
				$results.append(document.createElement('iframe'));
			}
			results.appendChild(dataToDom(data));
			// autofill in the complete box w/the first match as long as the user hasn't entered in more data
			if( options.autoFill && ($input.val().toLowerCase() == q.toLowerCase()) ) autoFill(data[0][0]);
			showResults();
		} else {
			hideResultsNow();
		}
	};

	function parseData(data) {
		if (!data) return null;
		var parsed = [];
		for (var i=0; i < data.length; i++) {
			var row = $.trim(data[i]);
			if (row) {
				parsed[parsed.length] = row.split(options.cellSeparator);
			}
		}
		return parsed;
	};

	function dataToDom(data) {
		var ul = document.createElement("ul");
		var num = data.length;

		// limited results to a max number
		if( (options.maxItemsToShow > 0) && (options.maxItemsToShow < num) ) num = options.maxItemsToShow;

		for (var i=0; i < num; i++) {
			var row = data[i];
			if (!row) continue;
			var li = document.createElement("li");
			if (options.formatItem) {
				li.innerHTML = options.formatItem(row, i, num);
				li.selectValue = row[0];
			} else {
				li.innerHTML = row[0];
				li.selectValue = row[0];
			}
			var extra = null;
			if (row.length > 1) {
				extra = [];
				for (var j=1; j < row.length; j++) {
					extra[extra.length] = row[j];
				}
			}
			li.extra = extra;
			ul.appendChild(li);
			$(li).hover(
				function() { $("li", ul).removeClass("ac_over"); $(this).addClass("ac_over"); active = $("li", ul).indexOf($(this).get(0)); },
				function() { $(this).removeClass("ac_over"); }
			).click(function(e) { e.preventDefault(); e.stopPropagation(); selectItem(this) });
		}
		return ul;
	};

	function requestData(q) {
		if (!options.matchCase) q = q.toLowerCase();
		var data = options.cacheLength ? loadFromCache(q) : null;
		// recieve the cached data
		if (data) {
			receiveData(q, data);
		// if an AJAX url has been supplied, try loading the data now
		} else if( (typeof options.url == "string") && (options.url.length > 0) ){
			$.getJSON(makeUrl(q), function(data) {
				data = parseData(data);
				addToCache(q, data);
				receiveData(q, data);
			});
		// if there's been no data found, remove the loading class
		} else {
			$input.removeClass(options.loadingClass);
		}
	};

	function makeUrl(q) {
		var url = options.url + "?q=" + encodeURI(q);
		for (var i in options.extraParams) {
			url += "&" + i + "=" + encodeURI(options.extraParams[i]);
		}
		return url;
	};

	function loadFromCache(q) {
		if (!q) return null;
		if (cache.data[q]) return cache.data[q];
		if (options.matchSubset) {
			for (var i = q.length - 1; i >= options.minChars; i--) {
				var qs = q.substr(0, i);
				var c = cache.data[qs];
				if (c) {
					var csub = [];
					for (var j = 0; j < c.length; j++) {
						var x = c[j];
						var x0 = x[0];
						if (matchSubset(x0, q)) {
							csub[csub.length] = x;
						}
					}
					return csub;
				}
			}
		}
		return null;
	};

	function matchSubset(s, sub) {
		if (!options.matchCase) s = s.toLowerCase();
		var i = s.indexOf(sub);
		if (i == -1) return false;
		return i == 0 || options.matchContains;
	};

	this.flushCache = function() {
		flushCache();
	};

	this.setExtraParams = function(p) {
		options.extraParams = p;
	};

	this.findValue = function(){
		var q = $input.val();

		if (!options.matchCase) q = q.toLowerCase();
		var data = options.cacheLength ? loadFromCache(q) : null;
		if (data) {
			findValueCallback(q, data);
		} else if( (typeof options.url == "string") && (options.url.length > 0) ){
			$.getJSON(makeUrl(q), function(data) {
				data = parseData(data);
				addToCache(q, data);
				findValueCallback(q, data);
			});
		} else {
			// no matches
			findValueCallback(q, null);
		}
	}

	function findValueCallback(q, data){
		if (data) $input.removeClass(options.loadingClass);

		var num = (data) ? data.length : 0;
		var li = null;

		for (var i=0; i < num; i++) {
			var row = data[i];

			if( row[0].toLowerCase() == q.toLowerCase() ){
				li = document.createElement("li");
				if (options.formatItem) {
					li.innerHTML = options.formatItem(row, i, num);
					li.selectValue = row[0];
				} else {
					li.innerHTML = row[0];
					li.selectValue = row[0];
				}
				var extra = null;
				if( row.length > 1 ){
					extra = [];
					for (var j=1; j < row.length; j++) {
						extra[extra.length] = row[j];
					}
				}
				li.extra = extra;
			}
		}

		if( options.onFindValue ) setTimeout(function() { options.onFindValue(li) }, 1);
	}

	function addToCache(q, data) {
		if (!data || !q || !options.cacheLength) return;
		if (!cache.length || cache.length > options.cacheLength) {
			flushCache();
			cache.length++;
		} else if (!cache[q]) {
			cache.length++;
		}
		cache.data[q] = data;
	};

	function findPos(obj) {
		var curleft = obj.offsetLeft || 0;
		var curtop = obj.offsetTop || 0;
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
		return {x:curleft,y:curtop};
	}
}

jQuery.fn.autocomplete = function(url, options, data) {
	// Make sure options exists
	options = options || {};
	// Set url as option
	options.url = url;
	// set some bulk local data
	options.data = ((typeof data == "object") && (data.constructor == Array)) ? data : null;

	// Set default values for required options
	options.inputClass = options.inputClass || "ac_input";
	options.resultsClass = options.resultsClass || "ac_results";
	options.lineSeparator = options.lineSeparator || "\n";
	options.cellSeparator = options.cellSeparator || "|";
	options.minChars = options.minChars || 1;
	options.delay = options.delay || 400;
	options.matchCase = options.matchCase || 0;
	options.matchSubset = options.matchSubset || 1;
	options.matchContains = options.matchContains || 0;
	options.cacheLength = options.cacheLength || 1;
	options.mustMatch = options.mustMatch || 0;
	options.extraParams = options.extraParams || {};
	options.loadingClass = options.loadingClass || "ac_loading";
	options.selectFirst = options.selectFirst || false;
	options.selectOnly = options.selectOnly || false;
	options.maxItemsToShow = options.maxItemsToShow || -1;
	options.autoFill = options.autoFill || false;
	options.width = parseInt(options.width, 10) || 0;

	this.each(function() {
		var input = this;
		new jQuery.autocomplete(input, options);
	});

	// Don't break the chain
	return this;
}

jQuery.fn.autocompleteArray = function(data, options) {
//	alert(data);
//	alert(options);
	return this.autocomplete(null, options, data);
}

jQuery.fn.indexOf = function(e){
	for( var i=0; i<this.length; i++ ){
		if( this[i] == e ) return i;
	}
	return -1;
};

/**** Combined File : _032_jquery.cookie.js ****/
/**
 * 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;
    }
};
/**** Combined File : _033_jquery.form.js ****/
/*
 * jQuery Form Plugin
 * version: 2.16 (17-OCT-2008)
 * @requires jQuery v1.2.2 or later
 *
 * Examples and documentation at: http://malsup.com/jquery/form/
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id$
 */
;(function($) {

/*
    Usage Note:  
    -----------
    Do not use both ajaxSubmit and ajaxForm on the same form.  These
    functions are intended to be exclusive.  Use ajaxSubmit if you want
    to bind your own submit handler to the form.  For example,

    $(document).ready(function() {
        $('#myForm').bind('submit', function() {
            $(this).ajaxSubmit({
                target: '#output'
            });
            return false; // <-- important!
        });
    });

    Use ajaxForm when you want the plugin to manage all the event binding
    for you.  For example,

    $(document).ready(function() {
        $('#myForm').ajaxForm({
            target: '#output'
        });
    });
        
    When using ajaxForm, the ajaxSubmit function will be invoked for you
    at the appropriate time.  
*/

/**
 * ajaxSubmit() provides a mechanism for immediately submitting 
 * an HTML form using AJAX.
 */
$.fn.ajaxSubmit = function(options) {
    // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
    if (!this.length) {
        log('ajaxSubmit: skipping submit process - no element selected');
        return this;
    }

    if (typeof options == 'function')
        options = { success: options };

    options = $.extend({
        url:  this.attr('action') || window.location.toString(),
        type: this.attr('method') || 'GET'
    }, options || {});

    // hook for manipulating the form data before it is extracted;
    // convenient for use with rich editors like tinyMCE or FCKEditor
    var veto = {};
    this.trigger('form-pre-serialize', [this, options, veto]);
    if (veto.veto) {
        log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
        return this;
   }

    var a = this.formToArray(options.semantic);
    if (options.data) {
        options.extraData = options.data;
        for (var n in options.data) {
          if(options.data[n] instanceof Array) {
            for (var k in options.data[n])
              a.push( { name: n, value: options.data[n][k] } )
          }  
          else
             a.push( { name: n, value: options.data[n] } );
        }
    }

    // give pre-submit callback an opportunity to abort the submit
    if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
        log('ajaxSubmit: submit aborted via beforeSubmit callback');
        return this;
    }    

    // fire vetoable 'validate' event
    this.trigger('form-submit-validate', [a, this, options, veto]);
    if (veto.veto) {
        log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
        return this;
    }    

    var q = $.param(a);

    if (options.type.toUpperCase() == 'GET') {
        options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
        options.data = null;  // data is null for 'get'
    }
    else
        options.data = q; // data is the query string for 'post'

    var $form = this, callbacks = [];
    if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
    if (options.clearForm) callbacks.push(function() { $form.clearForm(); });

    // perform a load on the target only if dataType is not provided
    if (!options.dataType && options.target) {
        var oldSuccess = options.success || function(){};
        callbacks.push(function(data) {
            $(options.target).html(data).each(oldSuccess, arguments);
        });
    }
    else if (options.success)
        callbacks.push(options.success);

    options.success = function(data, status) {
        for (var i=0, max=callbacks.length; i < max; i++)
            callbacks[i].apply(options, [data, status, $form]);
    };

    // are there files to upload?
    var files = $('input:file', this).fieldValue();
    var found = false;
    for (var j=0; j < files.length; j++)
        if (files[j])
            found = true;

    // options.iframe allows user to force iframe mode
   if (options.iframe || found) { 
       // hack to fix Safari hang (thanks to Tim Molendijk for this)
       // see:  http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
       if ($.browser.safari && options.closeKeepAlive)
           $.get(options.closeKeepAlive, fileUpload);
       else
           fileUpload();
       }
   else
       $.ajax(options);

    // fire 'notify' event
    this.trigger('form-submit-notify', [this, options]);
    return this;


    // private function for handling file uploads (hat tip to YAHOO!)
    function fileUpload() {
        var form = $form[0];
        
        if ($(':input[@name=submit]', form).length) {
            alert('Error: Form elements must not be named "submit".');
            return;
        }
        
        var opts = $.extend({}, $.ajaxSettings, options);
		var s = jQuery.extend(true, {}, $.extend(true, {}, $.ajaxSettings), opts);

        var id = 'jqFormIO' + (new Date().getTime());
        var $io = $('<iframe id="' + id + '" name="' + id + '" />');
        var io = $io[0];

        if ($.browser.msie || $.browser.opera) 
            io.src = 'javascript:false;document.write("");';
        $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });

        var xhr = { // mock object
            aborted: 0,
            responseText: null,
            responseXML: null,
            status: 0,
            statusText: 'n/a',
            getAllResponseHeaders: function() {},
            getResponseHeader: function() {},
            setRequestHeader: function() {},
            abort: function() { 
                this.aborted = 1; 
                $io.attr('src','about:blank'); // abort op in progress
            }
        };

        var g = opts.global;
        // trigger ajax global events so that activity/block indicators work like normal
        if (g && ! $.active++) $.event.trigger("ajaxStart");
        if (g) $.event.trigger("ajaxSend", [xhr, opts]);

		if (s.beforeSend && s.beforeSend(xhr, s) === false) {
			s.global && jQuery.active--;
			return;
        }
        if (xhr.aborted)
            return;
        
        var cbInvoked = 0;
        var timedOut = 0;

        // add submitting element to data if we know it
        var sub = form.clk;
        if (sub) {
            var n = sub.name;
            if (n && !sub.disabled) {
                options.extraData = options.extraData || {};
                options.extraData[n] = sub.value;
                if (sub.type == "image") {
                    options.extraData[name+'.x'] = form.clk_x;
                    options.extraData[name+'.y'] = form.clk_y;
                }
            }
        }

        // take a breath so that pending repaints get some cpu time before the upload starts
        setTimeout(function() {
            // make sure form attrs are set
            var t = $form.attr('target'), a = $form.attr('action');
            $form.attr({
                target:   id,
                method:   'POST',
                action:   opts.url
            });
            
            // ie borks in some cases when setting encoding
            if (! options.skipEncodingOverride) {
                $form.attr({
                    encoding: 'multipart/form-data',
                    enctype:  'multipart/form-data'
                });
            }

            // support timout
            if (opts.timeout)
                setTimeout(function() { timedOut = true; cb(); }, opts.timeout);

            // add "extra" data to form if provided in options
            var extraInputs = [];
            try {
                if (options.extraData)
                    for (var n in options.extraData)
                        extraInputs.push(
                            $('<input type="hidden" name="'+n+'" value="'+options.extraData[n]+'" />')
                                .appendTo(form)[0]);
            
                // add iframe to doc and submit the form
                $io.appendTo('body');
                io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
                form.submit();
            }
            finally {
                // reset attrs and remove "extra" input elements
                $form.attr('action', a);
                t ? $form.attr('target', t) : $form.removeAttr('target');
                $(extraInputs).remove();
            }
        }, 10);

        function cb() {
            if (cbInvoked++) return;
            
            io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);

            var operaHack = 0;
            var ok = true;
            try {
                if (timedOut) throw 'timeout';
                // extract the server response from the iframe
                var data, doc;

                doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
                
                if (doc.body == null && !operaHack && $.browser.opera) {
                    // In Opera 9.2.x the iframe DOM is not always traversable when
                    // the onload callback fires so we give Opera 100ms to right itself
                    operaHack = 1;
                    cbInvoked--;
                    setTimeout(cb, 100);
                    return;
                }
                
                xhr.responseText = doc.body ? doc.body.innerHTML : null;
                xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
                xhr.getResponseHeader = function(header){
                    var headers = {'content-type': opts.dataType};
                    return headers[header];
                };

                if (opts.dataType == 'json' || opts.dataType == 'script') {
                    var ta = doc.getElementsByTagName('textarea')[0];
                    xhr.responseText = ta ? ta.value : xhr.responseText;
                }
                else if (opts.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
                    xhr.responseXML = toXml(xhr.responseText);
                }
                data = $.httpData(xhr, opts.dataType);
            }
            catch(e){
                ok = false;
                $.handleError(opts, xhr, 'error', e);
            }

            // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
            if (ok) {
                opts.success(data, 'success');
                if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
            }
            if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
            if (g && ! --$.active) $.event.trigger("ajaxStop");
            if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');

            // clean up
            setTimeout(function() {
                $io.remove();
                xhr.responseXML = null;
            }, 100);
        };

        function toXml(s, doc) {
            if (window.ActiveXObject) {
                doc = new ActiveXObject('Microsoft.XMLDOM');
                doc.async = 'false';
                doc.loadXML(s);
            }
            else
                doc = (new DOMParser()).parseFromString(s, 'text/xml');
            return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
        };
    };
};

/**
 * ajaxForm() provides a mechanism for fully automating form submission.
 *
 * The advantages of using this method instead of ajaxSubmit() are:
 *
 * 1: This method will include coordinates for <input type="image" /> elements (if the element
 *    is used to submit the form).
 * 2. This method will include the submit element's name/value data (for the element that was
 *    used to submit the form).
 * 3. This method binds the submit() method to the form for you.
 *
 * The options argument for ajaxForm works exactly as it does for ajaxSubmit.  ajaxForm merely
 * passes the options argument along after properly binding events for submit elements and
 * the form itself.
 */ 
$.fn.ajaxForm = function(options) {
    return this.ajaxFormUnbind().bind('submit.form-plugin',function() {
        $(this).ajaxSubmit(options);
        return false;
    }).each(function() {
        // store options in hash
        $(":submit,input:image", this).bind('click.form-plugin',function(e) {
            var form = this.form;
            form.clk = this;
            if (this.type == 'image') {
                if (e.offsetX != undefined) {
                    form.clk_x = e.offsetX;
                    form.clk_y = e.offsetY;
                } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
                    var offset = $(this).offset();
                    form.clk_x = e.pageX - offset.left;
                    form.clk_y = e.pageY - offset.top;
                } else {
                    form.clk_x = e.pageX - this.offsetLeft;
                    form.clk_y = e.pageY - this.offsetTop;
                }
            }
            // clear form vars
            setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 10);
        });
    });
};

// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
$.fn.ajaxFormUnbind = function() {
    this.unbind('submit.form-plugin');
    return this.each(function() {
        $(":submit,input:image", this).unbind('click.form-plugin');
    });

};

/**
 * formToArray() gathers form element data into an array of objects that can
 * be passed to any of the following ajax functions: $.get, $.post, or load.
 * Each object in the array has both a 'name' and 'value' property.  An example of
 * an array for a simple login form might be:
 *
 * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
 *
 * It is this array that is passed to pre-submit callback functions provided to the
 * ajaxSubmit() and ajaxForm() methods.
 */
$.fn.formToArray = function(semantic) {
    var a = [];
    if (this.length == 0) return a;

    var form = this[0];
    var els = semantic ? form.getElementsByTagName('*') : form.elements;
    if (!els) return a;
    for(var i=0, max=els.length; i < max; i++) {
        var el = els[i];
        var n = el.name;
        if (!n) continue;

        if (semantic && form.clk && el.type == "image") {
            // handle image inputs on the fly when semantic == true
            if(!el.disabled && form.clk == el)
                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
            continue;
        }

        var v = $.fieldValue(el, true);
        if (v && v.constructor == Array) {
            for(var j=0, jmax=v.length; j < jmax; j++)
                a.push({name: n, value: v[j]});
        }
        else if (v !== null && typeof v != 'undefined')
            a.push({name: n, value: v});
    }

    if (!semantic && form.clk) {
        // input type=='image' are not found in elements array! handle them here
        var inputs = form.getElementsByTagName("input");
        for(var i=0, max=inputs.length; i < max; i++) {
            var input = inputs[i];
            var n = input.name;
            if(n && !input.disabled && input.type == "image" && form.clk == input)
                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
        }
    }
    return a;
};

/**
 * Serializes form data into a 'submittable' string. This method will return a string
 * in the format: name1=value1&amp;name2=value2
 */
$.fn.formSerialize = function(semantic) {
    //hand off to jQuery.param for proper encoding
    return $.param(this.formToArray(semantic));
};

/**
 * Serializes all field elements in the jQuery object into a query string.
 * This method will return a string in the format: name1=value1&amp;name2=value2
 */
$.fn.fieldSerialize = function(successful) {
    var a = [];
    this.each(function() {
        var n = this.name;
        if (!n) return;
        var v = $.fieldValue(this, successful);
        if (v && v.constructor == Array) {
            for (var i=0,max=v.length; i < max; i++)
                a.push({name: n, value: v[i]});
        }
        else if (v !== null && typeof v != 'undefined')
            a.push({name: this.name, value: v});
    });
    //hand off to jQuery.param for proper encoding
    return $.param(a);
};

/**
 * Returns the value(s) of the element in the matched set.  For example, consider the following form:
 *
 *  <form><fieldset>
 *      <input name="A" type="text" />
 *      <input name="A" type="text" />
 *      <input name="B" type="checkbox" value="B1" />
 *      <input name="B" type="checkbox" value="B2"/>
 *      <input name="C" type="radio" value="C1" />
 *      <input name="C" type="radio" value="C2" />
 *  </fieldset></form>
 *
 *  var v = $(':text').fieldValue();
 *  // if no values are entered into the text inputs
 *  v == ['','']
 *  // if values entered into the text inputs are 'foo' and 'bar'
 *  v == ['foo','bar']
 *
 *  var v = $(':checkbox').fieldValue();
 *  // if neither checkbox is checked
 *  v === undefined
 *  // if both checkboxes are checked
 *  v == ['B1', 'B2']
 *
 *  var v = $(':radio').fieldValue();
 *  // if neither radio is checked
 *  v === undefined
 *  // if first radio is checked
 *  v == ['C1']
 *
 * The successful argument controls whether or not the field element must be 'successful'
 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
 * The default value of the successful argument is true.  If this value is false the value(s)
 * for each element is returned.
 *
 * Note: This method *always* returns an array.  If no valid value can be determined the
 *       array will be empty, otherwise it will contain one or more values.
 */
$.fn.fieldValue = function(successful) {
    for (var val=[], i=0, max=this.length; i < max; i++) {
        var el = this[i];
        var v = $.fieldValue(el, successful);
        if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
            continue;
        v.constructor == Array ? $.merge(val, v) : val.push(v);
    }
    return val;
};

/**
 * Returns the value of the field element.
 */
$.fieldValue = function(el, successful) {
    var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
    if (typeof successful == 'undefined') successful = true;

    if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
        (t == 'checkbox' || t == 'radio') && !el.checked ||
        (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
        tag == 'select' && el.selectedIndex == -1))
            return null;

    if (tag == 'select') {
        var index = el.selectedIndex;
        if (index < 0) return null;
        var a = [], ops = el.options;
        var one = (t == 'select-one');
        var max = (one ? index+1 : ops.length);
        for(var i=(one ? index : 0); i < max; i++) {
            var op = ops[i];
            if (op.selected) {
                // extra pain for IE...
                var v = $.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;
                if (one) return v;
                a.push(v);
            }
        }
        return a;
    }
    return el.value;
};

/**
 * Clears the form data.  Takes the following actions on the form's input fields:
 *  - input text fields will have their 'value' property set to the empty string
 *  - select elements will have their 'selectedIndex' property set to -1
 *  - checkbox and radio inputs will have their 'checked' property set to false
 *  - inputs of type submit, button, reset, and hidden will *not* be effected
 *  - button elements will *not* be effected
 */
$.fn.clearForm = function() {
    return this.each(function() {
        $('input,select,textarea', this).clearFields();
    });
};

/**
 * Clears the selected form elements.
 */
$.fn.clearFields = $.fn.clearInputs = function() {
    return this.each(function() {
        var t = this.type, tag = this.tagName.toLowerCase();
        if (t == 'text' || t == 'password' || tag == 'textarea')
            this.value = '';
        else if (t == 'checkbox' || t == 'radio')
            this.checked = false;
        else if (tag == 'select')
            this.selectedIndex = -1;
    });
};

/**
 * Resets the form data.  Causes all form elements to be reset to their original value.
 */
$.fn.resetForm = function() {
    return this.each(function() {
        // guard against an input with the name of 'reset'
        // note that IE reports the reset function as an 'object'
        if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
            this.reset();
    });
};

/**
 * Enables or disables any matching elements.
 */
$.fn.enable = function(b) { 
    if (b == undefined) b = true;
    return this.each(function() { 
        this.disabled = !b 
    });
};

/**
 * Checks/unchecks any matching checkboxes or radio buttons and
 * selects/deselects and matching option elements.
 */
$.fn.selected = function(select) {
    if (select == undefined) select = true;
    return this.each(function() { 
        var t = this.type;
        if (t == 'checkbox' || t == 'radio')
            this.checked = select;
        else if (this.tagName.toLowerCase() == 'option') {
            var $sel = $(this).parent('select');
            if (select && $sel[0] && $sel[0].type == 'select-one') {
                // deselect all other options
                $sel.find('option').selected(false);
            }
            this.selected = select;
        }
    });
};

// helper fn for console logging
// set $.fn.ajaxSubmit.debug to true to enable debug logging
function log() {
    if ($.fn.ajaxSubmit.debug && window.console && window.console.log)
        window.console.log('[jquery.form] ' + Array.prototype.join.call(arguments,''));
};

})(jQuery);
/**** Combined File : _034_jquery.inlineform.js ****/
jQuery.inlineForm = function(input, target_url, result_callback)
{
	var $input = $(input);

	$.getJSON(target_url, HandleData);

	function HandleData(data)
	{
		if(!result_callback(data.status))
		{
			$input.html( data.form );

			var target_form = $input.children("form");
			target_form.ajaxForm({
				type: 'GET',
				dataType: 'json',
				success: HandleData,
				url: target_url
			});
		}
	}
}

jQuery.fn.InlineForm = function(url, result_callback)
{
	result_callback = result_callback || function(){};

	this.each(function() {
		var input = this;
		new jQuery.inlineForm(input, url, result_callback)
	});
	return this;
}

/**** Combined File : _035_jquery.scrollTo-1.4.2-min.js ****/
/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 * @author Ariel Flesler
 * @version 1.4.2
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
/**** Combined File : _036_jquery.limit-1.2.js ****/
(function($){
    $.fn.extend({limit:function(limit,element){
        var interval,f;
        var self=$(this);

        var substr = function(){ 
            var val = $(self).val();
            if(val) {
                var length = val.length;

                if(length > limit)
                    $(self).val($(self).val().substring(0,limit));

                if(typeof element!='undefined' && $(element).html() != limit-length)
                    $(element).html((limit-length<=0)?'0':limit-length);
            }
        }

        $(this).focus(function(){
            interval=window.setInterval(substr,100)
        }).blur(function(){
            clearInterval(interval);
            substr()
        });
        substr()
    }})
})(jQuery);

/**** Combined File : _037_jquery.nzhStoryImage.js ****/
(function($) {
	/**
	 * @desc Provide image animation requirements for our story pages.
	 * @author Craig Bassett
	 * @version 1.1
	 *
	**/
	
	$.fn.nzhStoryImage = function(options) {
		
		// Our options.
		options = jQuery.extend({
			smlImageSrc				: "",
			smlImageCaption			: "",
			smlImageWidth			: 220,
			smlImageHeight			: 147,
			bigImageSrc				: "",
			bigImageCaption			: "",
			bigImageWidth			: 460,
			bigImageHeight			: 230,
			fadeDelay				: 200,
			onLoad					: function() {}
		}, options);
		
		// Defined Variables.
		var pluginElement 		= $(this); // The element the plugin was invoked on.
		
		var plugin				= (function() {
			var pub = {};
			
			var enlarged = false;
			var image = pluginElement.find("img");
			var anchor = pluginElement.find("a.imageLink");
			var overlay = pluginElement.find("div.overlay");
			var overlayText = overlay.find("span.text");
			var overlayIcon = overlay.find("span.icon");
			var captionText = pluginElement.find("div.caption h2");
			
			pub.init = function() {
				anchor.click(function() {
					swapImage();
					return false;
				});
				anchor.hover(function() {
					overlay.addClass("overlayHover");
				}, function(){
					overlay.removeClass("overlayHover");
				});
			};
			
			function swapImage() {
				if (enlarged) {
					enlarged = false;
					pluginElement.fadeOut(options.fadeDelay, function(){
						pluginElement.removeClass("six").addClass("three").css("marginLeft", 12);
						image.attr("src", options.smlImageSrc);
						image.width(options.smlImageWidth);
						image.height(options.smlImageHeight);
						captionText.text(options.smlImageCaption);
						overlayText.text("Expand");
						overlayIcon.removeClass("iconShrink").addClass("iconExpand");
						pluginElement.fadeIn(options.fadeDelay);
					});
				} else {
					enlarged = true;
					pluginElement.fadeOut(options.fadeDelay, function(){
						pluginElement.removeClass("three").addClass("six").css("marginLeft", 0);
						image.attr("src", options.bigImageSrc);
						image.width(options.bigImageWidth);
						image.height(options.bigImageHeight);
						captionText.text(options.bigImageCaption);
						overlayText.text("Shrink");
						overlayIcon.removeClass("iconExpand").addClass("iconShrink");
						pluginElement.fadeIn(options.fadeDelay);
					});
				}
			};
			
			return pub;
		}());
		
		// Bind our events.
		plugin.init();
		
		return this;
	};
	
})(jQuery);


					/*
					var bigImgSrc = '#request.settings.paths.media_server##request.currentStory.stBigImage.path#/#request.currentStory.stBigImage.filename#';
					
					$(".enlargeOverlay").css({opacity: 0.9});
								
					function ExpandArticleImage() {
						
						// if the big image hasn't been loaded yet load it and give this function as the callback
						if ( !$("img.articleImageBig").attr('src')) {										
							
							$("img.articleImageBig").load(function(){ExpandArticleImage();});					
							$("img.articleImageBig").attr('src',bigImgSrc);					
							
						} else {
							
							$("##articleImageSmall").hide();
							
							$("##articleImageBig .eventBind").attr("href", "javascript: return false;");
							
							$("##articleImageBig").animate( { width:"460px" }, { queue:false, duration:500 } );
							
							$("##articleImageBig .articleImageBig").animate( { width:"460px", height:"230px" }, 500, null, function() {
								$("##articleImageBig .enlargeOverlayBig").show();
								$("##articleImageBig .eventBind").attr("href", "javascript: ContractArticleImage();");
							});
						
						}
					}
					
					function ContractArticleImage() {								
						$("##articleImageBig .eventBind").attr("href", "javascript: return false;");
						$("##articleImageBig .enlargeOverlayBig").hide();
						$("##articleImageBig .articleImageBig").animate( { width:"220px", height:"147px" }, { queue:false, duration:500 } );
						$("##articleImageBig").animate( { width:"220px" }, 500, null, function(){
							$("##articleImageBig .eventBind").attr("href", "javascript: ContractArticleImage();");
							$("##articleImageSmall").show();
							$("##articleImageBig").hide();
						}); 
					}
					
					*/

/**** Combined File : _038_jquery.jsonp-1.1.0.min.js ****/
// jquery.jsonp 1.1.0 (c)2009 Julian Aubourg | MIT License
// http://code.google.com/p/jquery-jsonp/
(function(d){var b=function(n){return n!==undefined&&n!==null},m=function(p,n,o){b(p)&&p.apply(n,o)},e=function(n){setTimeout(n,0)},f="",a="&",k="?",l="success",g="error",i=d("head"),h={},c={callback:"C",url:location.href},j=function(s){s=d.extend({},c,s);var r=s.beforeSend,A=0;s.abort=function(){A=1};if(b(r)&&(r(s,s)===false||A)){return s}var q=s.success,o=s.complete,v=s.error,C=s.dataFilter,G=s.callbackParameter,w=s.callback,D=s.cache,n=s.pageCache,t=s.url,I=s.data,x=s.timeout,z,H,F,E;t=b(t)?t:f;I=b(I)?((typeof I)=="string"?I:d.param(I)):f;b(G)&&(I+=(I==f?f:a)+escape(G)+"=?");!D&&!n&&(I+=(I==f?f:a)+"_"+(new Date()).getTime()+"=");z=t.split(k);if(I!=f){H=I.split(k);E=z.length-1;E&&(z[E]+=a+H.shift());z=z.concat(H)}F=z.length-2;F&&(z[F]+=w+z.pop());var p=z.join(k),B=function(J){b(C)&&(J=C.apply(s,[J]));m(q,s,[J,l]);m(o,s,[s,l])},y=function(J){m(v,s,[s,J]);m(o,s,[s,J])},u=h[p];if(n&&b(u)){e(function(){b(u.s)?B(u.s):y(g)});return s}e(function(){if(A){return}var J=d("<iframe />").appendTo(i),L=J[0],N=L.contentWindow||L.contentDocument,P=N.document,K,Q,R=function(S,T){n&&!b(T)&&(h[p]=f);K();y(b(T)?T:g)},M=function(T){N[T]=undefined;try{delete N[T]}catch(S){}},O=w=="E"?"X":"E";if(!b(P)){P=N;N=P.getParentNode()}P.open();N[w]=function(S){A=1;n&&(h[p]={s:S});e(function(){K();B(S)})};N[O]=function(S){(!S||S=="complete")&&!A++&&e(R)};s.abort=K=function(){clearTimeout(Q);P.open();M(O);M(w);P.write(f);P.close();J.remove()};P.write(['<html><head><script src="',p,'" onload="',O,'()" onreadystatechange="',O,'(this.readyState)"><\/script></head><body onload="',O,'()"></body></html>'].join(f));P.close();x>0&&(Q=setTimeout(function(){!A&&R(f,"timeout")},x))});return s};j.setup=function(n){d.extend(c,n)};d.jsonp=j})(jQuery);
/**** Combined File : _039_jquery.validate.min.js ****/
/*
 * jQuery validation plug-in 1.6
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
 * http://docs.jquery.com/Plugins/Validation
 *
 * Copyright (c) 2006 - 2008 J??rn Zaefferer
 *
 * $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z joern.zaefferer $
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
(function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$.data(this[0],'validator');if(validator){return validator;}validator=new $.validator(options,this[0]);$.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});if(validator.settings.submitHandler){this.find("input, button").filter(":submit").click(function(){validator.submitButton=this;});}this.submit(function(event){if(validator.settings.debug)event.preventDefault();function handle(){if(validator.settings.submitHandler){if(validator.submitButton){var hidden=$("<input type='hidden'/>").attr("name",validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);}validator.settings.submitHandler.call(validator,validator.currentForm);if(validator.submitButton){hidden.remove();}return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return validator;},valid:function(){if($(this[0]).is('form')){return this.validate().form();}else{var valid=true;var validator=$(this[0].form).validate();this.each(function(){valid&=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,'validator').settings;var staticRules=settings.rules;var existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticRules[element.name]=existingRules;if(argument.messages)settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}var filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}var data=$.validator.normalizeRules($.extend({},$.validator.metadataRules(element),$.validator.classRules(element),$.validator.attributeRules(element),$.validator.staticRules(element)),element);if(data.required){var param=data.required;delete data.required;data=$.extend({required:param},data);}return data;}});$.extend($.expr[":"],{blank:function(a){return!$.trim(""+a.value);},filled:function(a){return!!$.trim(""+a.value);},unchecked:function(a){return!a.checked;}});$.validator=function(options,form){this.settings=$.extend({},$.validator.defaults,options);this.currentForm=form;this.init();};$.validator.format=function(source,params){if(arguments.length==1)return function(){var args=$.makeArray(arguments);args.unshift(source);return $.validator.format.apply(this,args);};if(arguments.length>2&&params.constructor!=Array){params=$.makeArray(arguments).slice(1);}if(params.constructor!=Array){params=[params];}$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),n);});return source;};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,element,this.settings.errorClass,this.settings.validClass);this.errorsFor(element).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted)this.element(element);else if(element.parentNode.name in this.submitted)this.element(element.parentNode)},highlight:function(element,errorClass,validClass){$(element).addClass(errorClass).removeClass(validClass);},unhighlight:function(element,errorClass,validClass){$(element).removeClass(errorClass).addClass(validClass);}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=(this.groups={});$.each(this.settings.groups,function(key,value){$.each(value.split(/\s/),function(index,name){groups[name]=key;});});var rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var validator=$.data(this[0].form,"validator");validator.settings["on"+event.type]&&validator.settings["on"+event.type].call(validator,this[0]);}$(this.currentForm).delegate("focusin focusout keyup",":text, :password, :file, select, textarea",delegate).delegate("click",":radio, :checkbox, select, option",delegate);if(this.settings.invalidHandler)$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid())$(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentElements=this.elements());elements[i];i++){this.check(elements[i]);}return this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$(element);var result=this.check(element);if(result){delete this.invalid[element.name];}else{this.invalid[element.name]=true;}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}this.showErrors();return result;},showErrors:function(errors){if(errors){$.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}this.successList=$.grep(this.successList,function(element){return!(element.name in errors);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm)$(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj)count++;return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus();}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in rulesCache||!validator.objectLength($(this).rules()))return false;rulesCache[this.name]=true;return true;});},clean:function(selector){return $(selector)[0];},errors:function(){return $(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},check:function(element){element=this.clean(element);if(this.checkable(element)){element=this.findByName(element.name)[0];}var rules=$(element).rules();var dependencyMismatch=false;for(method in rules){var rule={method:method,parameters:rules[method]};try{var result=$.validator.methods[method].call(this,element.value.replace(/\r/g,""),element,rule.parameters);if(result=="dependency-mismatch"){dependencyMismatch=true;continue;}dependencyMismatch=false;if(result=="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+element.id
+", check the '"+rule.method+"' method",e);throw e;}}if(dependencyMismatch)return;if(this.objectLength(rules))this.successList.push(element);return true;},customMetaMessage:function(element,method){if(!$.metadata)return;var meta=this.settings.meta?$(element).metadata()[this.settings.meta]:$(element).metadata();return meta&&meta.messages&&meta.messages[method];},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor==String?m:m[method]);},findDefined:function(){for(var i=0;i<arguments.length;i++){if(arguments[i]!==undefined)return arguments[i];}return undefined;},defaultMessage:function(element,method){return this.findDefined(this.customMessage(element.name,method),this.customMetaMessage(element,method),!this.settings.ignoreTitle&&element.title||undefined,$.validator.messages[method],"<strong>Warning: No message defined for "+element.name+"</strong>");},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method),theregex=/\$?\{(\d+)\}/g;if(typeof message=="function"){message=message.call(this,rule.parameters,element);}else if(theregex.test(message)){message=jQuery.format(message.replace(theregex,'{$1}'),rule.parameters);}this.errorList.push({message:message,element:element});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper)toToggle=toToggle.add(toToggle.parent(this.settings.wrapper));return toToggle;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var error=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,error.element,this.settings.errorClass,this.settings.validClass);this.showLabel(error.element,error.message);}if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}if(this.settings.unhighlight){for(var i=0,elements=this.validElements();elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass,this.settings.validClass);}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var label=this.errorsFor(element);if(label.length){label.removeClass().addClass(this.settings.errorClass);label.attr("generated")&&label.html(message);}else{label=$("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(element),generated:true}).addClass(this.settings.errorClass).html(message||"");if(this.settings.wrapper){label=label.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}if(!this.labelContainer.append(label).length)this.settings.errorPlacement?this.settings.errorPlacement(label,$(element)):label.insertAfter(element);}if(!message&&this.settings.success){label.text("");typeof this.settings.success=="string"?label.addClass(this.settings.success):this.settings.success(label);}this.toShow=this.toShow.add(label);},errorsFor:function(element){var name=this.idOrName(element);return this.errors().filter(function(){return $(this).attr('for')==name});},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},checkable:function(element){return/radio|checkbox/i.test(element.type);},findByName:function(name){var form=this.currentForm;return $(document.getElementsByName(name)).map(function(index,element){return element.form==form&&element.name==name&&element||null;});},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case'select':return $("option:selected",element).length;case'input':if(this.checkable(element))return this.findByName(element.name).filter(':checked').length;}return value.length;},depend:function(param,element){return this.dependTypes[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param,element){return param;},"string":function(param,element){return!!$(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){return!$.validator.methods.required.call(this,$.trim(element.value),element)&&"dependency-mismatch";},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[element.name];if(valid&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();this.formSubmitted=false;}else if(!valid&&this.pendingRequest==0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=false;}},previousValue:function(element){return $.data(element,"previousValue")||$.data(element,"previousValue",{old:null,valid:true,message:this.defaultMessage(element,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){className.constructor==String?this.classRuleSettings[className]=rules:$.extend(this.classRuleSettings,className);},classRules:function(element){var rules={};var classes=$(element).attr('class');classes&&$.each(classes.split(' '),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this]);}});return rules;},attributeRules:function(element){var rules={};var $element=$(element);for(method in $.validator.methods){var value=$element.attr(method);if(value){rules[method]=value;}}if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}return rules;},metadataRules:function(element){if(!$.metadata)return{};var meta=$.data(element.form,'validator').settings.meta;return meta?$(element).metadata()[meta]:$(element).metadata();},staticRules:function(element){var rules={};var validator=$.data(element.form,'validator');if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};}return rules;},normalizeRules:function(rules,element){$.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{delete rules[prop];}}});$.each(rules,function(rule,parameter){rules[rule]=$.isFunction(parameter)?parameter(element):parameter;});$.each(['minlength','maxlength','min','max'],function(){if(rules[this]){rules[this]=Number(rules[this]);}});$.each(['rangelength','range'],function(){if(rules[this]){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}});if($.validator.autoCreateRanges){if(rules.min&&rules.max){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}if(rules.minlength&&rules.maxlength){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}if(rules.messages){delete rules.messages}return rules;},normalizeRule:function(data){if(typeof data=="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}return data;},addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message!=undefined?message:$.validator.messages[name];if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element))return"dependency-mismatch";switch(element.nodeName.toLowerCase()){case'select':var val=$(element).val();return val&&val.length>0;case'input':if(this.checkable(element))return this.getLength(value,element)>0;default:return $.trim(value).length>0;}},remote:function(value,element,param){if(this.optional(element))return"dependency-mismatch";var previous=this.previousValue(element);if(!this.settings.messages[element.name])this.settings.messages[element.name]={};previous.originalMessage=this.settings.messages[element.name].remote;this.settings.messages[element.name].remote=previous.message;param=typeof param=="string"&&{url:param}||param;if(previous.old!==value){previous.old=value;var validator=this;this.startRequest(element);var data={};data[element.name]=value;$.ajax($.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,success:function(response){validator.settings.messages[element.name].remote=previous.originalMessage;var valid=response===true;if(valid){var submitted=validator.formSubmitted;validator.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.showErrors();}else{var errors={};var message=(previous.message=response||validator.defaultMessage(element,"remote"));errors[element.name]=$.isFunction(message)?message(value):message;validator.showErrors(errors);}previous.valid=valid;validator.stopRequest(element,valid);}},param));return"pending";}else if(this.pending[element.name]){return"pending";}return previous.valid;},minlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)>=param;},maxlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)<=param;},rangelength:function(value,element,param){var length=this.getLength($.trim(value),element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){return this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},email:function(value,element){return this.optional(element)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);},url:function(value,element){return this.optional(element)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);},date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value));},dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);},number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},creditcard:function(value,element){if(this.optional(element))return"dependency-mismatch";if(/[^0-9-]+/.test(value))return false;var nCheck=0,nDigit=0,bEven=false;value=value.replace(/\D/g,"");for(var n=value.length-1;n>=0;n--){var cDigit=value.charAt(n);var nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9)nDigit-=9;}nCheck+=nDigit;bEven=!bEven;}return(nCheck%10)==0;},accept:function(value,element,param){param=typeof param=="string"?param.replace(/,/g,'|'):"png|jpe?g|gif";return this.optional(element)||value.match(new RegExp(".("+param+")$","i"));},equalTo:function(value,element,param){var target=$(param).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){$(element).valid();});return value==target.val();}}});$.format=$.validator.format;})(jQuery);;(function($){var ajax=$.ajax;var pendingRequests={};$.ajax=function(settings){settings=$.extend(settings,$.extend({},$.ajaxSettings,settings));var port=settings.port;if(settings.mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}return(pendingRequests[port]=ajax.apply(this,arguments));}return ajax.apply(this,arguments);};})(jQuery);;(function($){$.each({focus:'focusin',blur:'focusout'},function(original,fix){$.event.special[fix]={setup:function(){if($.browser.msie)return false;this.addEventListener(original,$.event.special[fix].handler,true);},teardown:function(){if($.browser.msie)return false;this.removeEventListener(original,$.event.special[fix].handler,true);},handler:function(e){arguments[0]=$.event.fix(e);arguments[0].type=fix;return $.event.handle.apply(this,arguments);}};});$.extend($.fn,{delegate:function(type,delegate,handler){return this.bind(type,function(event){var target=$(event.target);if(target.is(delegate)){return handler.apply(target,arguments);}});},triggerEvent:function(type,target){return this.triggerHandler(type,[$.event.fix({type:type,target:target})]);}})})(jQuery);
/**** Combined File : _040_sitePlugins.js ****/
// JQuery Plugin - sets default text on form elements.
jQuery.fn.inputDefault = function(options) {
	// Our options.
	options = jQuery.extend({
		defaultText				: "",
		activeClass	 			: ""
	}, options);
	
    if ($(this).val() != options.defaultText && $(this).val() == "") { 
		$(this).val(options.defaultText);
		$(this).addClass(options.defaultClass);
	} else {
		if ($(this).val() != options.defaultText && $(this).val().length > 0) {
			$(this).addClass(options.activeClass);
			$(this).removeClass(options.defaultClass);
		}
	}

    $(this).focus(function() {
        if ($(this).val() == options.defaultText) {
            $(this).addClass(options.activeClass);
            $(this).removeClass(options.defaultClass);
            $(this).val("");
        } else {
            if ($(this).val() != "") {
                $(this).addClass(options.activeClass);
            }
        }
    });

    $(this).blur(function() {
        if ($(this).val() == "") {
            $(this).removeClass(options.activeClass);
            $(this).addClass(options.defaultClass);
            $(this).val(options.defaultText);
        } else {
            if ($(this).val() != "") {
				//$(this).removeClass("fnid_defaultValue");
            }
        }
    });
    return this;
};



jQuery.fn.getValidationErrorArray = function(errorMessage,errorArray,bRequired,additionalValidationMethod,defaultText) {
	
	// Name
	
	if ($(this).length > 0) {
	
		$(this).each(function(){
		
			var valField = $(this);		
		
			// trim any white space from the field
			var t1 = valField.val();
			var t2 = t1.replace(/^\s+/, '').replace(/\s+$/, '');
			
			if (t1 != t2) 
				valField.val(t2);
			
			var additionalError = false;
			
			if (additionalValidationMethod != null) 
				additionalError = !additionalValidationMethod(valField.val());
			
			// fail if this field isn't filled in (required field)
			if (bRequired) {
			
				if (additionalError || (valField.hasClass("fnid_defaultValue")) || (valField.val() == '') || (valField == undefined)) {
					valField.addClass("error");
					errorArray.push(errorMessage);
				}
				else if(!additionalError && valField.val() == defaultText){
					valField.addClass("error");
					errorArray.push(errorMessage);
				}
				else {
					valField.removeClass("error");
				}
				
			// fail if this field fails additional validation (non required field)	
			}
			else {
				if ((!valField.hasClass("fnid_defaultValue")) && (valField.val().length > 0) && valField.val() != defaultText	) {
					if (!isEmail(valField.val())) {
						valField.addClass("error");
						errorArray.push(errorMessage);
					}
					else {
						valField.removeClass("error");
					}
				}
				else {
					valField.removeClass("error");
				}
				
			}
		
		})
		
	}
		
	return errorArray;
};


jQuery.fn.centerAgainst = function(oParent) {
	
	// Name
	var h1 = $(oParent).height();
	
	if ($(this).length > 0) {
	
		$(this).each(function(){				
		var h2 = $(this).height();
								
		if (h1 > h2) {			
			var strMargin = (h1 - h2) / 2;
			var existingMargin = $(this).css('margin-top').match(/\d+/);
			
			if (existingMargin.length) strMargin += parseInt(existingMargin);				
				
			strMargin = strMargin.toString() + 'px';
			$(this).css('margin-top', strMargin);
		}			

		
		});		
	}
		
	return this;
}; 
/**** Combined File : _041_jquery.navigation.js ****/
(function($) {
	/**
	 * @desc Provide functional and data requirements for the NZHerald Navigation.
	 * @author Craig Bassett
	 * @version 1.1
	 * @notes Revised CSS and JS to simplify rendering requirements of navigation.
	 *
	**/
	
	$.fn.nzhNav = function(options) {
		
		// Our options.
		options = jQuery.extend({
			jsonURL					: "/shareddata/navigation/navigation.js",
			navContainer 			: ".nav-container",
			fadeOutDuration 		: 150,
			fadeInDuration			: 150,
			closeTimer				: 300,
			onLoad					: function() {}
		}, options);
		
		// Defined Variables.
		var pluginElement 		= $(this); // The element the plugin was invoked on.
		var navContainer	 	= $(options.navContainer);
		var primaryNav			= navContainer.find('.primary');
		var secondaryNav		= navContainer.find('.secondary');
		var secondaryWrapper	= secondaryNav.find('.secondary-wrapper');
		
		var newsID				= "#nzhnav_news_" 	// Define the ID prefix to name our editorial items by.
		var pickID				= "#nzhnav_pick_" 	// Define the ID prefix to name our editorial pick items by.
		var subID				= "#subnav_" 		// Define the ID prefix to name our sub nav items by.
		var editorialClass		= ".editorialItem" 	// Define the class to use for picking editorial items.
		var subClass			= ".subnav"			// Define the class to use for picking subnav items.
		
		/* Check for CSS support */
		var hasCSS = function() {
			$('body').append(
				$(document.createElement('div')).attr('id','css_test').css({ width:'1px', height:'1px', display:'none' })
			);
			var _v = ($('#css_test').width() != 1) ? false : true;
			$('#css_test').remove();
			return _v;
		}
		
		var log = function() {
			log.history = log.history || [];   // store logs to an array for reference
			log.history.push(arguments);
			if(this.console){
				console.log( Array.prototype.slice.call(arguments) );
			}
		}

		var templateManager = (function(){
			var pub = {};
			var _tmplCache = {};
			
			/* Template parser */
			pub.parseTemplate = function(str, data) {
				/*
				 * <summary>
				 * Client side template parser that uses &lt;#= #&gt; and &lt;# code #&gt; expressions.
				 * and # # code blocks for template expansion.
				 * NOTE: chokes on single quotes in the document in some situations
				 *       use &amp;rsquo; for literals in text and avoid any single quote
				 *       attribute delimiters.
				 * </summary>
				 * <param name="str" type="string">The text of the template to expand</param>
				 * <param name="data" type="var"> 
				 * Any data that is to be merged. Pass an object and  
				 * that object's properties are visible as variables.  
				 * </param>  
				 * <returns type="string" />  
				 *  
				 */
			    var err = "";
			    try {
			        var func = _tmplCache[str];
			        if (!func) {
			            var strFunc =
			            "var p=[],print=function(){p.push.apply(p,arguments);};" +
			                        "with(obj){p.push('" +
	
						str.replace(/[\r\t\n]/g, " ")
						   .replace(/'(?=[^%]*%>)/g,"\t")
						   .split("'").join("\\'")
						   .split("\t").join("'")
						   .replace(/<%=(.+?)%>/g, "',$1,'")
						   .split("<%").join("');")
						   .split("%>").join("p.push('")
						   + "');}return p.join('');";
			
			            //alert(strFunc);
			            func = new Function("obj", strFunc);
			            _tmplCache[str] = func;
			        }
			        return func(data);
			    } catch (e) { err = e.message; }
			    
			    //log("Template data or template scripting error.");
				return "error";
			}
			
			
			return pub;
		}());
		
		var dataManager = (function(){
			var pub = {};
			
			var maxHeight = 0;
			
			pub.init = function(){
				getData();
			};
			
			function dataFilter(jsondata){
				if (jsondata.substring(0,2) == "//") return jsondata.substring(2,jsondata.length);
				return data;
			};
			
			function success(jsondata){
				if ((jsondata != undefined) && (jsondata.SUCCESS != undefined) && (jsondata.DATA != undefined)) {
					
					//log("data intact");
					
					$(primaryNav).find("a").each(function() {
						var element = $(this);
						var currentID = $(element).attr("id").toUpperCase();
						if (jsondata.SUCCESS) {
							if (items.hasSubnav(element)) {
								var t = "";
								var news = secondaryWrapper.find(newsID + currentID);
								var picks = secondaryWrapper.find(pickID + currentID);
								news.empty();
								picks.empty();
								if (jsondata.DATA[currentID] != undefined) {

									t = templateManager.parseTemplate($("#nzhnav_newsTmpl" + jsondata.DATA[currentID].MAIN.LAYOUT).html(), jsondata.DATA[currentID].MAIN);
									if (t != "error") {
										$(t).appendTo(news)
									} else {
										//log("template error: " + newsID + currentID);
										$("<span class='notification'>No data is available at this time. Please try again later.</span>").appendTo(news);
									}
									 
									t = templateManager.parseTemplate($("#nzhnav_pickTmpl1").html(), jsondata.DATA[currentID].EDITORIAL);
									if (t != "error") {
										$(t).appendTo(picks)
									} else {
										//log("template error: " + pickID + currentID);
										$("<span class='notification'>No data is available at this time. Please try again later.</span>").appendTo(picks);
									}
									
									//news.css({visibility: "visible"});
									//alert(news.height());
									//$(news).evenIfHidden(function(element){
									//	if (element.height() > maxHeight) maxHeight = element.height();
									//})
								} else {
									//log("nav node missing in data: " + newsID + currentID);
									$("<span class='notification'>No data is available at this time. Please try again later.</span>").appendTo(news);
									$("<span class='notification'>No data is available at this time. Please try again later.</span>").appendTo(picks);
								}
							} else {
								//log("no sub nav: " + currentID);
							}
							
						} else {
							//log("data success returned false");
							$("<span class='notification'>No data is available at this time. Please try again later.</span>").appendTo(news);
							$("<span class='notification'>No data is available at this time. Please try again later.</span>").appendTo(picks);
						}
						
						// Set our height based on the largest element.
						/*
						if (maxHeight > $(secondaryContainer).css("height").substr(0,$(secondaryContainer).css("height").length - 2)) {
							var val3 = maxHeight;
							var val2 = maxHeight + 36;
							var val1 = val2 + 16;
							
							$(secondaryNav).height(val1);
							$(secondaryWrapper).height(val2);
							$(secondaryContainer).height(val3);
						}
						*/
					});

				} else {
					//log("no data returned, or success node undefined, or data node undefined.");
				}
			};
			
			function complete() {};
			
			function error(XMLHttpRequest, message, textStatus){
				log("jQuery JSON Error: " + message);
			};

			getData = function(){
			
				$.ajax( {
					dataFilter		: dataFilter,
					url				: options.jsonURL,
					dataType		: 'json',
					cache			: false,
					timeout			: 2500,
					success			: success,
					complete		: complete,
					error			: error
				});
			}
			
			return pub;
			
		}());
		
		var device = (function(){
			var pub = {};
			
			/* Return the name of our device (if we know it and are checking for it.) */
			pub.platform = function(){
				if (navigator.userAgent.match(/ipad/i) != null) return "ipad";						// iPad.
				if (navigator.userAgent.match(/iphone/i) != null) return "iphone";					// iPhone.
				if (navigator.userAgent.match(/android/i) != null) return "android";				// Android.
				if (navigator.userAgent.match(/windows/i) != null) return "windows";				// Windows.
				if (navigator.userAgent.match(/linux/i) != null) return "linux";					// Linux.
				return "";
			};
			
			pub.browser = function(){
				if (navigator.userAgent.match(/MSIE/i) != null) return "msie";						// Internet Explorer.
				return "";
			}
			
			pub.version = function() {};
						
			return pub;
		}());
		
		var widget = (function(){
			var pub = {};
			
			var closeTimer = "";
			
			pub.init = function(){
				// Setup our Events
				$(primaryNav).find("a").each(function(){
					
					var navItem = $(this);
					
					if (items.hasSubnav($(this))) {
						$("<div id='" + newsID.substr(1) + $(this).attr("id").toUpperCase() + "' class='news navcol editorialItem'><span class='notification'>Loading...</span></div>").appendTo(secondaryWrapper);
						$("<div id='" + pickID.substr(1) + $(this).attr("id").toUpperCase() + "' class='pick navcol editorialItem'><span class='notification'>Loading...</span></div>").appendTo(secondaryWrapper);
					}
					
					if (device.platform() == 'ipad') {
						$(this).click(function(){
							if (items.hasSubnav($(this))) {
								if (items.secondaryVisible) {
									items.secondaryOff($(this));
								} else {
									items.secondaryOn($(this));
								}
								return false;
							}
						});
					} else {
						$(this).hoverIntent({ // Add the sub nav display event.
							over: function(){
								if (items.hasSubnav($(this))) {
									clearInterval(closeTimer);
									items.secondaryOn($(this));
								}
								else {
									clearInterval(closeTimer);
									items.secondaryOff();
								}
							},
							timeout: 0,
							out: function(){
							}, // Required.
							sensitivity: 20,
							interval: 300
						});
					}
				});
				
				if (device.platform() != 'ipad') {
					$(pluginElement).mouseleave(function(){ // Add the subnav hide event.
						closeTimer = setInterval(function(){
							clearInterval(closeTimer);
							items.secondaryOff();
						}, options.closeTimer);
					});
					
					$(pluginElement).mouseenter(function(){ // Avoid the nav closing on us if we move the cursor back over our navigation area.
						clearInterval(closeTimer);
					});
				}
			};
			
			return pub;
		}());
		
		var items = (function(){
			var pub = {};
			
			pub.secondaryVisible 	= false;

			/* Show editorial items */
			function showEditorialContent(element) {
				$(secondaryWrapper).find(editorialClass).hide();
				$(newsID + element.attr("id").toUpperCase()).show();
				$(pickID + element.attr("id").toUpperCase()).show();
			}
			
			/* Display the appropriate subnav */
			function showSubnav(element) {
				$(secondaryWrapper).find(subClass).hide();
				$(secondaryWrapper).find(subID + element.attr("id")).show();
			}
			
			/* Determine if we have subnav or not */
			pub.hasSubnav = function(element) {
				var thisNav = $(secondaryWrapper).find(subID + element.attr("id"));
				if (!thisNav.length) return false;
				return true;
			}
			
			/* Turn the secondary nav on */
			pub.secondaryOn = function(element) {
				showSubnav(element); 											// Turn on the appropriate sub nav.
				showEditorialContent(element)									// Turn on the appropriate editorial content.
				$(primaryNav).find("a.over").removeClass('over') 				// Remove 'over' classes.
				if (!pub.secondaryVisible && pub.hasSubnav(element)) {
					pub.secondaryVisible = true;
					if (device.browser() == "msie" || device.platform() == 'ipad') {
						$(secondaryNav).show(); element.addClass('over');
					} else {
						$(secondaryNav).fadeIn(options.fadeInDuration, function(){element.addClass('over');});
					}
				} else {
					element.addClass('over');
				}
			}

			/* Turn the secondary nav off */
			pub.secondaryOff = function(element) {
				pub.secondaryVisible = false;
				$(primaryNav).find("a.over").removeClass('over') 				// Remove 'over' classes.
				if (device.browser() == "msie" || device.platform() == 'ipad') {
					$(secondaryNav).hide();
					$(secondaryWrapper).find(editorialClass).hide();
				} else {
					$(secondaryNav).fadeOut({
						duration:	options.fadeOutDuration,
						complete: 	function(){
							$(secondaryWrapper).find(editorialClass).hide();
						}
					});
				}
			} 
			
			return pub;
		}());
		
		if (!hasCSS()) { return false; }	// Begin our DOM preperation
		widget.init();						// Init our widget.
		dataManager.init();					// Init our data.
		options.onLoad();					// Fire our onLoad event.
		return this;
	};
})(jQuery);

// Script for the footer expansion
$(document).ready(function() {
	expandID='';
	$('.footerExpandBtm').live("click", function(event){
		event.preventDefault();
		quedID=$(this).attr('href');
		$('.footerExpandSelected').removeClass('footerExpandSelected');
		if(!expandID) {
			$(this).addClass('footerExpandSelected');
			$('#footerTabsExpanded').slideDown(300, function() {
				$('html,body').animate({scrollTop:$('#nzh_footer').offset().top}, 600);
				$(quedID).show().animate({opacity:1}, 300);
				expandID=quedID;
			})
		} else if(expandID!=quedID) {
			$(this).addClass('footerExpandSelected');
			$(expandID).animate({opacity:0}, 300, function() {
				$(this).hide();
				$(quedID).show().animate({opacity:1}, 300);
			});
			expandID=quedID;
		}
	});
});
/**** Combined File : _041_jquery.weatherForecasts.js ****/
(function($) {

	/**
	 * @desc Create our weather forecast selector.
	 * @author Craig Bassett
	 * @version 1.0
	 *
	**/
	
	$.fn.weatherForecastSwapper = function(options) {
		
		// Our options.
		options = jQuery.extend({
			placeContainer 	: "#weatherTile"
		}, options);
		
		// Defined Variables.
		var pluginElement = $(this); // The element the plug-in was invoked on.
		var placeContainer = $(options.placeContainer);
		
		//*** Check for CSS support ***
		var hasCSS = function()  {
			$('body').append(
				$(document.createElement('div')).attr('id','css_test').css({ width:'1px', height:'1px', display:'none' })
			);
			var _v = ($('#css_test').width() != 1) ? false : true;
			$('#css_test').remove();
			return _v;
		}
		
		//*** Grab our meta data and parse out the values.
		var getMeta = function(data, index) {
			// Make sure we're only getting metadata, not other class data.
			// Strip out everything except for what is inside {}.
			var length = data.length;
			var startPos = data.indexOf("{", 0);
			meta = data.substring(startPos+1, length-1);
			metaArray = meta.split(",");
			return metaArray[index];
		}
		
		var swapIconClass = function(element, newclass) {
			// Take the class string - remove the original icon class and add the new one.
			
			// Grab the original class string.
			originalClass = element.attr('class');
			
			// Take a copy of the data aspect of our class.
			var length = originalClass.length;
			var startPos = originalClass.indexOf("{", 0);
			var data = originalClass.substring(startPos, length);
			
			// Generate our new string based on the information we have.
			if (element.hasClass('icon_sml')) {
				newClass = 'icon icon_sml ' + newclass + ' ' + data;
			} else {
				newClass = 'icon icon_big ' + newclass + ' ' + data;
			}
			//element.removeClass('icon_sml');
			element.attr('class', newClass);
			
			//   icon icon_sml icon_rain {icon_rain, icon_few_showers, icon_few_showers}
		}
		
		//*** Go through our places and set the new high / low values based on the index of value.
		var setValues = function(index) {
			$(placeContainer).children("div.map").children("a.forecast").each(function(){
				// Nasty - but it works for now.
				var place 	= $(this);
				var high 	= $(place).find("span.red");
				var low 	= $(place).find("span.blue");
				var icon	= $(place).find("span.icon");
				var curtemp = $(place).find("span.degrees");
				
				var newhigh	= getMeta(high.attr('class'), index);
				var newlow 	= getMeta(low.attr('class'), index);
				var newicon	= getMeta(icon.attr('class'), index);
				
				place.fadeOut(500, function(){
					high.text(newhigh);
					low.text(newlow);
					if ( index > 0 ) {
						curtemp.hide();
					} else {
						curtemp.show();
					}
					swapIconClass(icon, newicon);
					place.fadeIn(500);
				});
				
			});
		}
		
		// Manage our nav links.
		var setNav = function(link) {
			$(link).addClass('selected');
		}
		var unsetNav = function() {
			// Go through our nav items and unset them all from being on.
			$(pluginElement).find("li a").each(function(){
				$(this).removeClass('selected');
			});
		}
		
		// check for basic CSS support
		if (!hasCSS()) { return false; }
		
		// Apply our events to the navigation.
		var index = 0;
		$(pluginElement).find("li a").each(function(){
			// Define the link to work against.
			var link = $(this);
			
			// Add some data defining what index it is.
			jQuery.data(link, "index", index);
			
			// Add an event to bind our swapper.
			link.click(function(event){
				// Prevent Default
				event.preventDefault();
				
				// Action
				setValues(jQuery.data(link, "index"));
				unsetNav();
				setNav(link);
			})
			index += 1;
		});
		
		return this;
		
	};

})(jQuery);
/**** Combined File : _042_jquery.easing.1.3.js ****/
/*
 * 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. 
 *
 */
/**** Combined File : _043_jquery.newsflash.js ****/
(function($) {
	/**
	 * @desc Provides the ability to render our newsflash, and manage the cookies behind it.
	 * @author Craig Bassett
	 * @version 2.0
	 * @note now pulls data feed directly from json file rather than being passed as options.
	 *
	**/

	$.fn.newsFlash = function(options) {
		
		// Our options.
		options = jQuery.extend({
			assetPath		: "",
			cookiename		: "nzh_newsbar", // Name to use for cookies.
			jsonurl			: "", // Where does the json packet come from?
			speed			: 200, // Animation speed
			onLoad			: function() {}
		}, options);
		
		// Defined Variables.
		var pluginElement 		= $(this); // The element the plugin was invoked on.
		
		/* Check for CSS support */
		var hasCSS = function() {
			$('body').append(
				$(document.createElement('div')).attr('id','css_test').css({ width:'1px', height:'1px', display:'none' })
			);
			var _v = ($('#css_test').width() != 1) ? false : true;
			$('#css_test').remove();
			return _v;
		}

		// usage: log('inside coolFunc',this,arguments);
		// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
		window.log = function(){
		  log.history = log.history || [];   // store logs to an array for reference
		  log.history.push(arguments);
		  if(this.console){
		    console.log( Array.prototype.slice.call(arguments) );
		  }
		};

		// Cookie management.
		var cookie = (function(){
			var pub = {};

			pub.create = function (name,value,days) {
				if (days) {
					var date = new Date();
					date.setTime(date.getTime()+(days*24*60*60*1000));
					var expires = "; expires="+date.toGMTString();
				}
				else var expires = "";
				document.cookie = name+"="+value+expires+"; path=/";
			}
			
			pub.read = function (name) {
				var nameEQ = name + "=";
				var ca = document.cookie.split(';');
				for(var i=0;i < ca.length;i++) {
					var c = ca[i];
					while (c.charAt(0)==' ') c = c.substring(1,c.length);
					if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
				}
				return null;
			}
			
			pub.erase = function(name) {
				createCookie(name,"",-1);
			}

			return pub;
		}());
		
		var url = (function(){
			var pub = {};
			
			pub.params = {};
			
			pub.load = function() {
				var e,
			        a = /\+/g,  // Regex for replacing addition symbol with a space
			        r = /([^&=]+)=?([^&]*)/g,
			        d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
			        q = window.location.search.substring(1);
			
			    while (e = r.exec(q))
			       pub.params[d(e[1])] = d(e[2]);
			};
			
			return pub;
		}());
		
		// Provides our business layer aka rules to match what bar to show.
		var bll = (function(){
			var pub = {};
			pub.match = function(data){
				var barIndex = -1;
				var i = 0;
				for (i=0;i<data.length;i++) {	// Implement the business logic to determine what bar to present.
					if (data[i].type == "breaking") { return i; } // If it's breaking news.
				}
				url.load(); // Load the URL Parameters.
				for (i=0;i<data.length;i++) {	// Specific Event Bars (Based on inclusions)
					if ((data[i].type == "event") && (data[i].inclusions.length > 0)) {
						for (var j=0;j<data[i].inclusions.length;j++) {
							if ((url.params["c_id"] != undefined) && (url.params["c_id"] == data[i].inclusions[j])) {
								return i; // A match.
							}
						}
					}
				}
				for (i=0;i<data.length;i++) {	// Global Event Bars
					if ((data[i].type == "event") && (data[i].inclusions.length == 0)) { return i; }
				}
				return -1;
			}
			
			return pub;
		}());
		
		var dataman = (function(){
			var pub = {};
			
			//pub.data = getData();
			pub.load = function() {
				getData();
			};
			
			function getData(){
				$.ajax({
					dataFilter		: dataFilter,
					url				: options.jsonurl,
					dataType		: 'json',
					cache			: false,
					timeout			: 2500,
					success			: success,
					error			: error,
					complete		: complete
				});
			};
			
			function dataFilter(data) { return data };
			function success(data, textStatus, jqXHR) {
				if ((data != undefined) && (data.length > 0)) {
					var barIndex = bll.match(data);
					if (barIndex > -1) {
						var cdata = cookie.read(data[barIndex].id);	// If there's a bar defined for this page, read the users cookie value for it (if they have it).
						if (!cdata) {								// I.e., no cookie - then the bar should show. If there's a cooke, it means the user closed it.
							widget.render(data[barIndex]);
						}
					}
				}
			};
			function complete() { };
			function error(XMLHttpRequest, message, textStatus){
				window.log("jQuery JSON Error: " + message);
			};
			return pub;
		}());

		var widget = (function(){
			var pub = {};
			var newsBar	= "";
			var action	= "read more";
			pub.render = function(data) {
				newsBar = $("<div class='nzh_newsBar' id='newsbar_" + data.id + "'></div>").hide();	// Build news bar.
				
				if (data.titleimage.length > 0) {
					newsBar.append($("<img src='" + data.titleimage + "' class='title'>"));		// Build the image based Title.
				} else {
					newsBar.append($("<div class='title'>" + data.title + "</div>"));			// Build the standard Title.
				}
				
				if (data.url.length > 0) {
					if (data.url.indexOf('video.cfm') > 0) {
						action	= 'watch';
					}
					newsBar.append($("<div class='headline'><a href='" + data.url + "' onclick='s_objectID=" + data.clickmap + ";'>" + data.text + "...</a> <a href='" + data.url + "' class='more' onclick='s_objectID=" + data.clickmap + ";'>"+action+"</a></div>"));
				} else {
					newsBar.append($("<div class='headline'>" + data.text + "... <span class='details'>details soon</span></div>"));	
				}
				
				var closeLink = $("<a href='#' class='close' title='Close'></a>");				// Build the Content.
				closeLink.append($("<img src='" + options.assetPath + "images/breaking-news-cross.gif' />"));
				
				closeLink.click(function(){														// Add an event to our close link.
					cookie.create(data.id, true, 7);
					newsBar.slideUp(options.speed);
					return false;
				});
				
				newsBar.append(closeLink);
				newsBar.appendTo(pluginElement);
				newsBar.slideDown(options.speed);
			}
			pub.init = function (){
				var data = dataman.load();	// Load our data.
			}
			return pub;
		}());
		
		if (!hasCSS()) { return false; }	// Begin our DOM preperation
		widget.init();						// Init the widget.
		options.onLoad(); 					// Fire our onLoad event.
		return this;
	};

})(jQuery);
/**** Combined File : _044_jquery.weatherbox.js ****/
(function($) {
	/**
	 * @desc Present and apply events to our two weather box modules.
	 * @author Craig Bassett
	 * @version 1.1
	 *
	**/
	
	$.fn.weatherBox = function(options) {
		
		// Our options.
		options = jQuery.extend({
			onLoad					: function() {}
		}, options);
		
		// Defined Variables.
		var pluginElement 		= $(this); // The element the plugin was invoked on.
		
		var widget = (function(){
			var pub = {};

			var forecastContainer = pluginElement.find(".forecasts");
			var detailedForecastLink = pluginElement.find(".detailed-forecast-link");
			var locationSelect = pluginElement.find(".weather-select-box");
			
			// Bind any events and prep our widget.
			pub.init = function(id) {
				
				if (nzhdata.json.weather != undefined) {
					// Bind the change event to our form.
					$(locationSelect).change(function(){
						$.cookie('nzh_weatherlocation', $(this).val(), {path:'/', expires:365, domain:BaseDomain}); // Set the cookie.
						pub.changeWeather($(this).val()); return false;
					});
					
					// Load the initial weather item.
					if ($.cookie('nzh_weatherlocation') != null) {
						widget.populateForm($.cookie('nzh_weatherlocation'));
						widget.changeWeather($.cookie('nzh_weatherlocation'));
					} else {
						widget.populateForm(12); // 12 is auckland.
						widget.changeWeather(12);
					}
				}
				
			}
			
			// Populate our change form.
			pub.populateForm = function(id) {
				var optGroup1 = $('<optgroup label="North Island"></optgroup>');
				var optGroup2 = $('<optgroup label="South Island"></optgroup>');
				$.each(nzhdata.json.weather, function(){
					if (this.id > -1) {
						var option = $('<option value="' + this.id + '">' + this.name + '</option>');
						if (this.id == id) option.attr("selected", "selected");
						(this.region == "north") ? optGroup1.append(option) : optGroup2.append(option);
					}
				});
				$(locationSelect).append(optGroup1).append(optGroup2);
			};
			
			// Modify the weather item on request.
			pub.changeWeather = function(id) {
				var data = nzhdata.json.weather["_" + id];
				if (data == undefined) { // Generally because we have a cooke but its value is dud.
					data = nzhdata.json.weather["_error"];
				}
				
				// Update the detailed forecast link.
				$(detailedForecastLink).text(data.name).attr("href", data.link).show();
				
				// For each of our forecasts (max of 3) - create a weatheritem.
				var forecasts = $('<ol class="listStyleWeather"></ol>');
				var i = 0;
				$.each(data.forecasts, function(){
					if (i == 3) return false;
					var weatherItem = $('<li>\
										<div class="icon icon_' + this.cssclass + '"><!-- --></div>\
										<div class="day">' + this.cleandate + '</div>\
										<div class="forecast">' + this.shortdesc + '</div>\
										<div class="highlow">\
											<span class="high">' + this.high + '&deg;</span>\
											<span class="low">' + this.low + '&deg;</span>\
										</div>\
									</li>');
									
					forecasts.append(weatherItem); i++;
				});
				
				// Clear our loading graphic and append our new forecasts.
				$(forecastContainer).empty();
				$(forecastContainer).append(forecasts);
			}
			
			return pub;
		}());
		
		// Init the widget.
		widget.init();

		return this;
	};
})(jQuery);
/**** Combined File : _045_jquery.fancybox-1.3.4.pack.js ****/
/*
 * FancyBox - jQuery Plugin
 * Simple and fancy lightbox alternative
 *
 * Examples and documentation at: http://fancybox.net
 * 
 * Copyright (c) 2008 - 2010 Janis Skarnelis
 * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
 * 
 * Version: 1.3.4 (11/11/2010)
 * Requires: jQuery v1.3+
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */

;(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("<div/>")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');
F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)||
c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=
false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel",
function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+c+
'"></param>';P="";b.each(e.swf,function(x,H){C+='<param name="'+x+'" value="'+H+'"></param>';P+=" "+x+'="'+H+'"'});C+='<embed src="'+c+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win==
"function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('<div style="width:'+a+";height:"+c+
";overflow: "+(e.scrolling=="auto"?"auto":e.scrolling=="yes"?"scroll":"hidden")+';position:relative;"></div>');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor,
opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length?
d.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+d.titlePosition+'">'+s+"</div>":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding});
y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height==
i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents());
f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode==
37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto");
s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(b.browser.msie?'allowtransparency="true""':"")+' scrolling="'+e.scrolling+'" src="'+d.href+'"></iframe>').appendTo(j);
f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<0.5?0.5:a;f.css(c);
j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type==
"image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"),
10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)};
b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k=
0,C=a.length;k<C;k++)if(typeof a[k]=="object")b(a[k]).data("fancybox",b.extend({},g,a[k]));else a[k]=b({}).data("fancybox",b.extend({content:a[k]},g));o=jQuery.merge(o,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},g,a));else a=b({}).data("fancybox",b.extend({content:a},g));o.push(a)}if(q>o.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+
1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a<l.length){q=a;I()}else if(d.cyclic&&l.length>1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h=
true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1;
b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*0.5-
d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),t=b('<div id="fancybox-loading"><div></div></div>'),u=b('<div id="fancybox-overlay"></div>'),f=b('<div id="fancybox-wrap"></div>'));D=b('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f);
D.append(j=b('<div id="fancybox-content"></div>'),E=b('<a id="fancybox-close"></a>'),n=b('<div id="fancybox-title"></div>'),z=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()});
b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(D)}}};
b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",
easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery);
/**** Combined File : _045_jquery.player.js ****/
/**
 * @author craig.bassett
 */

(function($){

	jQuery.fn.strobePlayer = function(options) {

		// Our options.
		options = jQuery.extend({
			autoPlay				: true,								// Have our player kick off automagically.
			videoUrl				: "",								// The URL of the main video to play.
			playerVar				: "",								// The Variable name that our callback is contained with.
			advertorial				: {},								// The advertorial JSON object.
			overlays				: {},								// The overlay data.
			debug					: false,							// If true, will cause the plugin to print out event information into the console - including missing events and events fired.
			onShowOverlay			: function() {},					// Fires the onShowOverlay event.
			onLoad					: function() {},					// Fires the load event.
			onMilestone				: function(cliptype, milestone) {}	// Fires an event for each defined milestone.
		}, options);
		
		// Defined Variables.
		var pluginElement = $(this); // The element the plugin was invoked on.
		var playerElement = null;

		// usage: log('inside coolFunc',this,arguments);
		// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
		window.log = function(){
		  log.history = log.history || [];   // store logs to an array for reference
		  log.history.push(arguments);
		  if(this.console){
		    console.log( Array.prototype.slice.call(arguments) );
		  }
		};
		
		// Public / Exposed user methods.
		this.playerBridge = function(id, eventName, updatedProperties) {
			plugin.playerBridge(id, eventName, updatedProperties);
		}
		
		// Handles management of our data.
		var player = (function(){
			var pub = {};
			
			// Public properties.
			pub.readyState = null;
			pub.ready = null;
			pub.networkState = null;
			pub.seeking = null;
			pub.src = null;
			pub.buffered = null;
			pub.videoWidth = null;
			pub.videoHeight = null;
            pub.duration = 0;
            pub.currentTime = 0;
            pub.paused = null;
            pub.muted = null;
            pub.volume = null;
            pub.ended = null;
            pub.error = null;
            pub.loadedmetadata = null;
            pub.currentSrc = null;
            
            // Properties added by our plugin.
            pub.clipType = null;
            pub.adType = null;
            
			// playerElement.GetState(): READY, LOADING, PLAYING, PAUSED, BUFFERING
            
            // Public methods. Unfortunately these have no context when we have multiple clips, like our advert. :(
			pub.pause = function() { playerElement.pause(); };
			pub.play = function() { playerElement.play2(); };
			pub.stop = function() { playerElement.stop2(); };
			pub.toggleplay = function() {
				var state = playerElement.getState();
				if (state == "ready" || state == "paused") {
					pub.play();
				} else if (state == "playing") {
					pub.pause();
				}
			};
			
			// Return current time as an int, instead of float.
			pub.currentTimeFloored = function() { return Math.floor(pub.currentTime); }
			pub.durationFloored = function() { return Math.floor(pub.duration); }

			return pub;
		}());
		
		// Our events
		var events = (function(){
			var pub = {};
			var currentTimeInt = -1;
			
			// Use this for simple boolean queue requirements.
			var queue = {
				resume:					false,
				omniStartNoDuration: 	false
			};
			
			pub.trigger 			= function(eventName, eventProperties) {
				if (!eventObj[eventName]) {
					window.log(eventName + ' - Event does not exist.');
				} else {
					if (options.debug) window.log(eventName);							// Log the event name if debugging is on.
					applyProperties(eventProperties);									// Apply and given properties to the player.
					eventObj[eventName](eventProperties);								// Fire the custom event below.
				}
			}
			
			var eventObj = {
				// This is a custom ready even I manually fire on plugin init.
				ready:				function(updatedProperties) { player.ready = true; },
				
				// These are custom events we've built into the herald plugin. They should help us out a little.
				begin:				function(updatedProperties) {
					
					// Fire the onShowOverlay user exposed event.
					if (player.clipType == "overlay") options.onShowOverlay();
					//window.log('beginEvent');
					
				},
				end:				function(updatedProperties) {
				
					tracking.reset(); // Reset the tracking data.
					currentTimeInt = -1;
					//window.log('endEvent');
					
				},

				// These are OSMF / Strobe built-in events. Some have been extended into our herald plugin too.
				loadstart:			function(updatedProperties) {},
				play:				function(updatedProperties) {

					// The problem here is that this fires before the timeupdate does - so our currentTimeFloored value is, well - flawed.
					// So - we set a queue value, and have the call fire once timeUpdate has fired for seek based resumes.
					if ((!player.ended) && (player.currentTimeFloored() != player.durationFloored())) {
						if (player.seeking) {
							queue.resume = true;
						} else {
							omniture.call("resume");
						}
					}
					
				},
				pause:				function(updatedProperties) {
				
					if ((!player.ended) && (player.paused) && (!player.seeking)) {
						omniture.call("pause");
					}
					
				},
				progress:			function(updatedProperties) {},
				waiting:			function(updatedProperties) {},
				loadedmetadata:		function(updatedProperties) {
					
					player.loadedmetadata = true;
					
				},
				durationchange:		function(updatedProperties) {},
				timeupdate:			function(updatedProperties) {
					
					// Sort out our tracking call on every second.
					//window.log('err...: ' + player.loadedmetadata);
					//if ((player.loadedmetadata) && (player.currentTimeFloored() >= 0)) {
					if ((player.durationFloored() > 0) && (player.currentTimeFloored() >= 0)) {
						if (currentTimeInt < player.currentTimeFloored()) {
							currentTimeInt = player.currentTimeFloored();
							if (player.durationFloored() > 0 && player.clipType != 'overlay') { // Wont fire if our duration is not > 0 or if it's an overlay.
								//window.log('err...: ' + player.durationFloored());
								tracking.call(currentTimeInt);	
							}
						}
					}
					
					// Sort out our resume events, based on a queue.
					if (queue.resume) { omniture.call("resume"); queue.resume = false; }
					
					// Sort out our omniture start event for clips with no metadata (no known duration)
					if ((!queue.omniStartNoDuration) && (currentTimeInt > 0) && (player.durationFloored() == 0)) {
						//console.log(currentTime + ' : ' + player.durationFloored());
						omniInitMediaTrackSeconds(plugin.getClipname(), "osmf.strobe", 15, 600);
						omniture.milestones[plugin.getObjname()].active = true;
						console.log('Omni Tracking Start (No Duration) - Every 15 seconds');
						queue.omniStartNoDuration = true; // Set the queue to being fired.
					}
					
				},
				seeking:			function(updatedProperties) {},
				seeked:				function(updatedProperties) {},
				volumechange:		function(updatedProperties) {},
				complete:			function(updatedProperties) {},
				emptied:			function(updatedProperties) {}
			}
			
			function applyProperties(updatedProperties) {
				for (var propertyName in updatedProperties) {
					// Only apply properties that we've defined, log an error if we haven't defined one that should be!
					if (player[propertyName] === undefined || player[propertyName] === "undefined") {
						window.log(propertyName + ' - Property does not exist');
					} else {
						player[propertyName] = updatedProperties[propertyName]; // Set the property.
					}
				}
			}
			
			return pub;
		}());
		
		var omniture = (function(){
			var pub = {};
			
			pub.milestones = {};
			
			function init() {
				if (!pub.milestones[plugin.getObjname()]) pub.milestones[plugin.getObjname()] = {};
			}
			
			pub.call = function(type) {
				init();
				switch(type) {
					case "start":
						omniInitMediaTracking(plugin.getClipname(), player.durationFloored(), "osmf.strobe");
						//window.log('Omni Tracking Start - ' + plugin.getClipname() + ' - ' + player.durationFloored());
						pub.milestones[plugin.getObjname()].active = true;
						break;
					case "finish":
						omniMediaTrackingDone(plugin.getClipname());
						//window.log('Omni Tracking Complete - ' + plugin.getClipname());
						pub.milestones[plugin.getObjname()].active = false;
						break;
					case "pause":
						if (pub.milestones[plugin.getObjname()].active) {
							omniMediaTrackingStop(plugin.getClipname(), player.currentTimeFloored());
							//window.log('Omni Tracking Pause - ' + plugin.getClipname() + ' : ' + player.currentTimeFloored());
						}
						break;
					case "resume":
						if (pub.milestones[plugin.getObjname()].active) {
							omniMediaTrackingResume(plugin.getClipname(), player.currentTimeFloored());
							//window.log('Omni Tracking Resume - ' + plugin.getClipname() + ' : ' + player.currentTimeFloored());
						}
						break;
				}
			}
			
			return pub;
		}());
		
		
		// Tracking calls
		var tracking = (function(){
			var pub = {};
			
			var milestonesSet = false;
			var milestones = {
				start: {
					complete: false,
					adcomplete: false,
					time: -1
				},
				mid1: {
					complete: false,
					adcomplete: false,
					time: -1
				},
				mid2: {
					complete: false,
					adcomplete: false,
					time: -1
				},
				mid3: {
					complete: false,
					adcomplete: false,
					time: -1
				},
				end: {
					complete: false,
					adcomplete: false,
					time: -1
				}
			}
			
			pub.reset = function() { // For example - we need to reset for a pre-roll, then main video, then post.
				milestonesSet = false;
				for (var name in milestones) {
					milestones[name].time = -1; milestones[name].complete = false; milestones[name].adcomplete = false;
				}
			}
			
			// This should only get fired on every second increment of player.currentTimeFloored().
			pub.call = function(currentTime) {
				if (currentTime > 0) {
					// This needs to fire off an tracking calls at 0, 25, 50 75 and 100%.
					if ((!milestonesSet) && (player.durationFloored() > 0)) {								// Milestones are only set once we've traversed at least 1 seconds into the timeline. This ensures we have the correct duration etc.
						milestonesSet 		  = true;
						milestones.start.time = 1;															// We know this to be true.
						milestones.mid2.time  = Math.floor((player.durationFloored() + 1) / 2);				// Our 1/2 way point.
						milestones.end.time   = player.durationFloored() - 1;								// We know this to be true. Minus one to avoid flash issues with timing.
						milestones.mid1.time  = Math.floor((milestones.mid2.time + 1) / 2);					// Our 1/4 way point.
						milestones.mid3.time  = Math.floor(milestones.mid2.time + milestones.mid1.time);	// Our 3/4 way point.
					}

					//window.log('err...: ' + milestonesSet);
					
					for (var name in milestones) {
						if ((milestonesSet) && (currentTime >= milestones[name].time) && (!milestones[name].complete)) { // This currently means if they seek to near the end, all calls but the last would be fired.
							switch(name) {
								case "start":
									omniture.call("start");
									pub.adTrack(name);
									options.onMilestone(player.clipType, name);
									break;
								case "mid1": // 1/4
									options.onMilestone(player.clipType, name);
									break;
								case "mid2": // 1/2
									pub.adTrack(name);
									options.onMilestone(player.clipType, name);
									break;
								case "mid3": // 3/4
									options.onMilestone(player.clipType, name);
									break;
								case "end":
									pub.adTrack(name);
									omniture.call("finish");
									options.onMilestone(player.clipType, name);
									break;
							}
							milestones[name].complete = true;
						}
					}
				}
			}
			
			pub.adTrack = function(name) {
				if ((player.clipType == "ad") && (!milestones[name].adcomplete)) {
					if ((advertorial[player.adType][name]) && (advertorial[player.adType][name].length > 0)) {
						var ad_image = $("<img>", { src: advertorial[player.adType][name] });	// This fires the correct ad call.
						milestones[name].adcomplete = true;
						//window.log('adFire - ' + name + ' - ' + advertorial[player.adType][name]);
					}
				}
			}
			
			return pub;
		}());

		// Our main plugin enclosure.
		var plugin = (function(){
			var pub = {};
			
			// Private vars
			var waitTimer = false;
			var timer = null;
			var lastEvent = null;
			
			// Public functions
			pub.init = function(){ render(); }
			
			pub.playerBridge = function(id, eventName, updatedProperties){
				
				if ((eventName == "onJavaScriptBridgeCreated") && (playerElement == null)) {
					playerElement = document.getElementById(id);	// Define the player element.
					try { 
						events.trigger("ready", updatedProperties);		// Manually fire our ready event.
					} catch(err) { window.log(err); }
				} else {
					// Setup our custom event listeners.
					// Log non-existant events. This way we can easily see if we need to capture something we're missing.
					// Fire the events that DO exist.
					// Make sure that events that are the same, one after the other - are slowed to every half second.
					// Any new events should be forced.
					if (lastEvent != eventName) {
						clearTimeout(timer);
						waitTimer = false;
						try {
							events.trigger(eventName, updatedProperties);
						} catch(err) { window.log(err); }
					} else if (!waitTimer) {
						waitTimer = true;
						timer = setTimeout(function(){
							try {
								events.trigger(eventName, updatedProperties);
							} catch(err) { window.log(err); }
							waitTimer = false;
						}, 500);
					}
				}
				lastEvent = eventName;
			}
			
			// Public Utilities
			pub.getClipname = function() {
				var pn = s.pageName.replace(/^.*:video:(.*)$/,'$1');
				if (player.clipType == "ad"){ pn = pn + ':' + player.adType; }
				return pn;
			}

			pub.getObjname = function() {
				var arr = pub.getClipname().split(":")
				return arr[0];
			}
			
			// Private functions
			function render() {
				// Prepare our herald plugin data.
				
				var pluginData = {
					javascriptCallbackFunction: options.playerVar + ".playerBridge",
					adData:{ ads:[] }, // A list of individual advert's and their types.
					overlayData: {
						related: options.overlays,
						locURL:"/themes/0/modules/videoagg/flash/Overlay.swf"
					}
				}
				
				// Take our overlay data and replace any missing images with our replacement.
				for (var i=0;i<pluginData.overlayData.related.length;i++) {
					var overlay = pluginData.overlayData.related[i];
					if (overlay.image.length == 0) overlay.image = "/themes/0/modules/videoagg/images/image_default.gif";
				}
				
				// Add the pre, post and mid roll's if they exist.
				if (options["advertorial"]) {
					for (var name in options.advertorial) {
						if ((options.advertorial[name]["url"]) && (options.advertorial[name].url.length > 0)) {
							var thisAd = { locURL: options.advertorial[name].url, type: name }
							if ((options.advertorial[name]["clicktag"]) && (options.advertorial[name].clicktag.length > 0)) {
								thisAd.clickURL = options.advertorial[name].clicktag;
							} else {
								thisAd.clickURL = "";
							}
							pluginData.adData.ads.push(thisAd);
						}
					}
				}
				
				//window.log(pluginData);
				/*
	            // MINE
				var mine = {
					"javascriptCallbackFunction":"$videoPlayer.playerBridge",
					"adData":{
						"ads":[
							{
								"locURL":"http://creative.whi.co.nz/adverts/MER_15_0016_intranet.flv",
								"type":"preroll",
								"clickURL":"http://data.apn.co.nz/apnnz/adclick/FCID=3664/SITE=NZH/AREA=SEC.NATIONAL.VID/size=PREROLL/SA=8/random=6262493143/viewid=53316908371"
							},
							{
								"locURL":"http://creative.whi.co.nz/adverts/HPSi007_1_211210.flv",
								"type":"postroll",
								"clickURL":"http://www.google.com",
							}
						]
					},
					"overlayData":{
						"related":[
							{
								"views":"32 Views",
								"description":"a test",
								"image":"http://dev.apn.co.nz/live/apnmedia/webcontent/image/jpg/201119/tornado_140x7017420.jpg",
								"published":"3 days ago",
								"url":"/news/video.cfm",
								"duration":"",
								"title":"Raw video: Tornado in Albany"
							},
							{
								"views":"32 Views",
								"description":"test",
								"image":"http://dev.apn.co.nz/live/apnmedia/webcontent/image/jpg/201119/alb_140x70.jpg",
								"published":"3 days ago",
								"url":"/nz/news/video.cfm",
								"duration":"",
								"title":"Albany tornado came 'out of nowhere'"
							},
							{
								"views":"32 Views",
								"description":"test",
								"image":"http://dev.apn.co.nz/live/apnmedia/webcontent/image/jpg/201119/PD_140x7099529.jpg",
								"published":"3 days ago",
								"url":"/nz/news/video.cfm",
								"duration":"",
								"title":"Weather: Albany hit by tornado"
							},
							{
								"views":"32 Views",
								"description":"test",
								"image":"http://dev.apn.co.nz/live/apnmedia/webcontent/image/jpg/201119/tornado_140x7017420.jpg",
								"published":"3 days ago",
								"url":"/news/video.cfm",
								"duration":"",
								"title":"Raw video: Tornado in Albany"
							}
						],
						"locURL":"/themes/0/modules/videoagg/flash/Overlay.swf"
					}
				}
				
	            
	            // HIS
	            var his = {
					"javascriptCallbackFunction":"$videoPlayer.playerBridge",
					"overlayData":{
						"related":[
							{
								"views":"32 Views",
								"image":"http://www.contentlab.co.nz/dev/herald/plugins/assets/assets/image1.png",
								"url":"http://www.google.com",
								"duration":"1:23",
								"description":"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.",
								"published":"2 Hours",
								"publish_date": "20 May 2011",
								"title":"Title 1"
							},
							{
								"views":"3208 Views",
								"image":"http://www.contentlab.co.nz/dev/herald/plugins/assets/assets/image1.png",
								"url":"http://www.google.com",
								"duration":"12:12",
								"description":"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.",
								"published":"3 Months",
								"publish_date": "20 May 2011",
								"title":"Title 2"
							},
							{
								"views":"673 Views",
								"image":"http://www.contentlab.co.nz/dev/herald/plugins/assets/assets/image1.png",
								"url":"http://www.google.com",
								"duration":"8:12",
								"description":"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.",
								"published":"8 Hours",
								"publish_date": "20 May 2011",
								"title":"Title 3"
							},
							{
								"views":"1 View",
								"image":"http://www.contentlab.co.nz/dev/herald/plugins/assets/assets/image1.png",
								"url":"http://www.google.com",
								"duration":"2:54",
								"description":"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.",
								"published":"4 Days",
								"publish_date": "20 May 2011",
								"title":"Title 4"
							}
						],
						"locURL":"/themes/0/modules/videoagg/flash/Overlay.swf"
					},
					"adData":{
						"adIndicatorImagePath":"/themes/0/modules/videoagg/images/adIndicatorText.png",
                        "ads":[{
                                        "locURL":"http://creative.whi.co.nz/adverts/MER_15_0016_intranet.flv",
                                        "type":"preroll",
                                        "clickURL":"http://data.apn.co.nz/apnnz/adclick/FCID=3664/SITE=NZH/AREA=CAT.VIDEO.VID/HB=VIDEO.VIDEO.VIDEO.VIDEO.VIDEO/size=PREROLL/SA=8/random=3317241414/viewid=14419534693"
                                },
                                {
                                        "locURL":"http://creative.whi.co.nz/adverts/HPSi007_1_211210.flv",
                                        "type":"postroll",
                                        "clickURL":"http://data.apn.co.nz/apnnz/adclick/FCID=3664/SITE=NZH/AREA=CAT.VIDEO.VID/HB=VIDEO.VIDEO.VIDEO.VIDEO.VIDEO/size=PREROLL/SA=8/random=3317241414/viewid=14419534693"
                                }]
					}
				}
				*/
				
				//pluginData = escape(JSONstring.make(pluginData).replace(/\t/g, " "));
				
				// Define the properties of our player.
				var flashvars = {
					src: options.videoUrl,
					favorFlashOverHtml5Video: true,
					bufferTime: 10,						// Default bufferTime to 10 seconds.
					controlBarMode: "docked",
					controlBarAutoHide: false,
					playButtonOverlay: true,
					autoPlay: false, 					// Always set this to false. Use our plugin for autoplay features.
					herald_autoPlay: options.autoPlay, 	// This gives our plugin control over autoplay features.
					herald_initTime: 200,				// This is a coathanger jobby to resolve play init in OSMF. (ms)
					adIndicatorImagePath: "/themes/0/modules/videoagg/images/adIndicatorText.png", 	// The overlay to show while an ad is running.
	                plugin_herald: "/themes/0/modules/videoagg/flash/HeraldPlugin.swf",
					herald_data: encodeURIComponent(JSON.stringify(pluginData)),
					//herald_data: encodeURIComponent(JSONstring.make(his)),
					javascriptCallbackFunction: options.playerVar + ".playerBridge"
				};
				
				var params = {
					wmode: 'transparent',				// Unfortunately we have to use this because of our nav overlay. :( Sadness.
					allowFullScreen: true,
					allowScriptAccess: true
				};
				
				var attributes = { id: pluginElement.attr("id"), name: pluginElement.attr("id") };
				
				// Embed the player.
				swfobject.embedSWF(	"/themes/0/modules/videoagg/flash/StrobeMediaPlayback.swf",
									pluginElement.attr("id"),
									"620",
									"384",
									"10.2.0",
									"/themes/0/modules/videoagg/flash/expressInstall.swf",
									flashvars, params, attributes);
									
			}
			
			return pub;
		}());
		
		plugin.init(); // Init the plugin.
		options.onLoad();
	    return this;
	};
	
})(this.jQuery);

/**** Combined File : _046_jquery.indexcarousel.js ****/
(function($) {

	/**
	 * @desc Universal Carousel
	 * @author Craig Bassett
	 * @edited by Cameron Wright
	 * @version 1.1
	 *
	**/
	
	$.fn.carousel = function(scrollTime, itemWidth, navPosition) {

		// scrollTime is the duration betweenScrolls
		// itemWidth is the width of each slide
		// navPosition ('top', 'bottom') decides where the nav goes, null will render no nav
		
		// Defined Variables.
		var pluginElement = $(this); // The element the plugin was invoked on.
		
		// usage: log('inside coolFunc',this,arguments);
		// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
		window.log = function(){
		  log.history = log.history || [];   // store logs to an array for reference
		  log.history.push(arguments);
		  if(this.console){
		    console.log( Array.prototype.slice.call(arguments) );
		  }
		};
		
		var timer = (function() {
			var pub = {};
			
			// Private vars
			var timerActual = "";
		
			// Private functions
			var intFunc = function() {
				items.next();
				pub.start();
			}

			// Public functions
			pub.start = function(){
				timerActual = setTimeout(intFunc, scrollTime);
			};
			
			pub.stop		= function(){ 
				clearTimeout(timerActual);
			};
			
			return pub;
		}());
		
		// Carousel items
		var items = (function(){
			var pub = {};
			
			// Public vars
			pub.count = 0;

			// Return the next sibling in line, or the first.
			pub.next = function() {
				if (!plugin.carousel.is(":animated")) {
					nav.selectnext();
					if ( parseInt(plugin.carousel.css("left")) == (0 - plugin.totalwidth + itemWidth) ) {
						// Return to the first item.
						plugin.carousel.stop().animate({ 
							left: 0,
							duration: 300,
							easing:   'swing'
						});
						//plugin.carousel.css("left", 0);
					} else {
						// Move the carousel by the width of the next item.
						plugin.carousel.stop().animate({ 
							left: parseInt(plugin.carousel.css("left")) - itemWidth,
							duration: 300,
							easing:   'swing'
						});
						//plugin.carousel.css("left", parseInt(plugin.carousel.css("left")) - itemWidth);
					}
				}
			}
			
			// Return the previous sibling in line, or the last.
			pub.previous = function() {
				if (!plugin.carousel.is(":animated")) {
					nav.selectprevious();
					if (parseInt(plugin.carousel.css("left")) == 0) {
						// Return to the last item.
						plugin.carousel.stop().animate({ 
							left: (0 - plugin.totalwidth) + itemWidth,
							duration: 300,
							easing:   'swing'
						});
						//plugin.carousel.css("left", ((0 - plugin.totalwidth) + itemWidth));
					} else {
						// Move the carousel by the width of the next item.
						plugin.carousel.stop().animate({ 
							left: parseInt(plugin.carousel.css("left")) + itemWidth,
							duration: 300,
							easing:   'swing'
						});
						//plugin.carousel.css("left", parseInt(plugin.carousel.css("left")) + itemWidth);
					}
				}
			}
			
			// Go to a specific index in our items.
			pub.goto = function(index) { 
				if (!plugin.carousel.is(":animated")) {
					plugin.carousel.stop().animate({ 
						left: 0 - (index * itemWidth) + itemWidth,
						duration: 300,
						easing:   'swing'
					});
				}
			}
			
			return pub;
		}());
		
		// Navigation
		var nav = (function(){
			var pub = {};
			
			// Private functions
			function deselectall() { plugin.nav.find("a.active").removeClass("active"); }
			function selectedindex() { return plugin.nav.find("a.active").data("i"); }
			
			pub.selectnext = function() {
				var index = selectedindex(); 
				deselectall();
				if (index == items.count) {
					pub.selectbyindex(1);
				} else {
					pub.selectbyindex(index + 1);
				}
			}
			
			pub.selectprevious = function() {
				var index = selectedindex(); 
				deselectall();
				if (index == 1) {
					pub.selectbyindex(items.count);
				} else {
					pub.selectbyindex(index - 1);
				}
			}
			
			pub.selectbyelement = function(element) {
				deselectall();
				element.addClass("active");
			}
			
			pub.selectbyindex = function(index) {
				deselectall();
				plugin.nav.find("a").each(function(){
					if ($(this).data("i") == index) $(this).addClass("active");
				})
			}
			
			return pub;
		}());
		
		// Utilities
		var utils = (function(){
			var pub = {};
			
			// Return the next sibling in line, or the first.
			pub.getNextElement = function(element) {
				return $(element).is(':last-child') ?
					   $(element).siblings(':first-child') :
					   $(element).next();
			}
			
			// Return the previous sibling in line, or the last.
			pub.getPrevElement = function(element) {
				return $(element).is(':first-child') ?
					   $(element).siblings(':last-child') :
					   $(element).prev();
			}
			
			return pub;
		}());
		
		// Our main plugin enclosure.
		var plugin = (function(){
			var pub = {};
			
			//Public vars
			pub.carousel 	= $(pluginElement.find(".bucket01"));
			pub.nav       	= null;
			pub.totalwidth 	= 0;
			
			// Private functions
			function render() {
				// Add our nav elements.
				var _next =	$("<a href='#' class='previous'>&lt; Previous</a>")
								.click(function(){
									timer.stop();
									items.previous();
									return false;
							 	})
								
				var _prev =	$("<a href='#' class='next'>Next &gt;</a>")
								.click(function(){
									timer.stop();
									items.next();
									return false;
							 	})
				
				// Append the a tags to our nav.
				pub.nav = $("<div class='carouselnav'></div>");
				pub.nav.append(_next)
				pub.nav.append(_prev)
				for(var i=1;i<=items.count;i++) {
					var navitem = $("<a href='#' class='index'>" + i + "</a>");
					if (i == 1) navitem.addClass("active");
					navitem.data("i", i); 
					navitem.click(function(){
						timer.stop();
						items.goto($(this).data("i"));
						nav.selectbyelement($(this));
						return false;
					});
					pub.nav.append(navitem);
				}

				// decides if and where to add the navigation
				if(navPosition=='top') {
					pub.nav.prependTo(pluginElement);
				} else if(navPosition=='bottom') {
					pub.nav.appendTo(pluginElement);
				}

			};			
			
			// Public functions
			pub.init = function(){
				items.count = pluginElement.find(".article").length;
				pub.totalwidth = items.count * itemWidth;
				log("item count: " + items.count);
				log("totalwidth: " + pub.totalwidth);
				pub.carousel.css("width", pub.totalwidth);
				render();
				timer.start();
			}
			
			return pub;
		}());
		
		plugin.init();
		
		return this;
	};

})(jQuery);
/**** Combined File : _047_jstorage.min.js ****/
(function(f){if(!f||!(f.toJSON||Object.toJSON||window.JSON)){throw new Error("jQuery, MooTools or Prototype needs to be loaded before jStorage!")}var g={},d={jStorage:"{}"},h=null,j=0,l=f.toJSON||Object.toJSON||(window.JSON&&(JSON.encode||JSON.stringify)),e=f.evalJSON||(window.JSON&&(JSON.decode||JSON.parse))||function(m){return String(m).evalJSON()},i=false;_XMLService={isXML:function(n){var m=(n?n.ownerDocument||n:0).documentElement;return m?m.nodeName!=="HTML":false},encode:function(n){if(!this.isXML(n)){return false}try{return new XMLSerializer().serializeToString(n)}catch(m){try{return n.xml}catch(o){}}return false},decode:function(n){var m=("DOMParser" in window&&(new DOMParser()).parseFromString)||(window.ActiveXObject&&function(p){var q=new ActiveXObject("Microsoft.XMLDOM");q.async="false";q.loadXML(p);return q}),o;if(!m){return false}o=m.call("DOMParser" in window&&(new DOMParser())||window,n,"text/xml");return this.isXML(o)?o:false}};function k(){if("localStorage" in window){try{if(window.localStorage){d=window.localStorage;i="localStorage"}}catch(p){}}else{if("globalStorage" in window){try{if(window.globalStorage){d=window.globalStorage[window.location.hostname];i="globalStorage"}}catch(o){}}else{h=document.createElement("link");if(h.addBehavior){h.style.behavior="url(#default#userData)";document.getElementsByTagName("head")[0].appendChild(h);h.load("jStorage");var n="{}";try{n=h.getAttribute("jStorage")}catch(m){}d.jStorage=n;i="userDataBehavior"}else{h=null;return}}}b()}function b(){if(d.jStorage){try{g=e(String(d.jStorage))}catch(m){d.jStorage="{}"}}else{d.jStorage="{}"}j=d.jStorage?String(d.jStorage).length:0}function c(){try{d.jStorage=l(g);if(h){h.setAttribute("jStorage",d.jStorage);h.save("jStorage")}j=d.jStorage?String(d.jStorage).length:0}catch(m){}}function a(m){if(!m||(typeof m!="string"&&typeof m!="number")){throw new TypeError("Key name must be string or numeric")}return true}f.jStorage={version:"0.1.5.0",set:function(m,n){a(m);if(_XMLService.isXML(n)){n={_is_xml:true,xml:_XMLService.encode(n)}}g[m]=n;c();return n},get:function(m,n){a(m);if(m in g){if(typeof g[m]=="object"&&g[m]._is_xml&&g[m]._is_xml){return _XMLService.decode(g[m].xml)}else{return g[m]}}return typeof(n)=="undefined"?null:n},deleteKey:function(m){a(m);if(m in g){delete g[m];c();return true}return false},flush:function(){g={};c();try{window.localStorage.clear()}catch(m){}return true},storageObj:function(){function m(){}m.prototype=g;return new m()},index:function(){var m=[],n;for(n in g){if(g.hasOwnProperty(n)){m.push(n)}}return m},storageSize:function(){return j},currentBackend:function(){return i},storageAvailable:function(){return !!i},reInit:function(){var m,o;if(h&&h.addBehavior){m=document.createElement("link");h.parentNode.replaceChild(m,h);h=m;h.style.behavior="url(#default#userData)";document.getElementsByTagName("head")[0].appendChild(h);h.load("jStorage");o="{}";try{o=h.getAttribute("jStorage")}catch(n){}d.jStorage=o;i="userDataBehavior"}b()}};k()})(window.jQuery||window.$);
/**** Combined File : _050_utils.compressed.js ****/
var _POPUP_FEATURES = 'location=0,statusbar=0,menubar=0,width=800,height=750';
var TabsArray = [];
var ImageArray = [];
function raw_popup(url, target, features) {
	if (features == undefined) {
		features = _POPUP_FEATURES;
	}
	if (target == undefined) {
		target = '_blank';
	}
	var theWindow = window.open(url, target, features);
	theWindow.focus();
	return theWindow;
}
function link_popup(src, features) {
	return raw_popup(src.getAttribute('href'), src.getAttribute('target') || '_blank', features);
}
function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');

    for(var i = 0; i < hashes.length; i++)
    {		
        hash = hashes[i].split('=');
		if (hash.length > 1) {
			vars.push(hash[0]);
			vars[hash[0]] = hash[1].replace(/#.*/, '');
		}
    }

    return vars;
}

/***************Start Other Web Stories Module Codes*********************
* This function is being used for the OtherStoriesOnTheWeb pagelet on the business homepage
* It will swap the display/no display for
* all content within span/div tags identified by the id
*/
function ShowOtherWebStuff(current)
{
	for(i=0;i < TabsArray.length;i++)
	{
		if(current != TabsArray[i])
		{
			document.getElementById(TabsArray[i]).style.display = "none";
			document.getElementById(TabsArray[i]+'Tab').className = "";
		}
		else
		{
			document.getElementById(current).style.display = "block";
			document.getElementById(current+'Tab').className = "current";
			document.getElementById('BestOfTheWebImg').src = ImageArray[i];
		}
	}
}
/***************End Other Web Stories Module Codes*********************/

/******* Start Behavioural Targeting *******/
if (window.headlinesData) {
	var DocReferrer = document.referrer;
	var sQueryString = location.search.substring(1);//query string of current url - this code is not needed
	var sQueryString = '';
	var sSearchStr = '';
	var s = '';
	var aQueryString = '';
	var aTemp = false;
	var bSearchReferrer = false;
	
	//only run these codes if there is a referrer available
	//and
	//if the referrer is www.google, www.nzherald or dev.apn.co.nz
	if (DocReferrer.length &&
	(DocReferrer.indexOf('http://www.google') != -1 || DocReferrer.indexOf('http://www.nzherald') != -1 || DocReferrer.indexOf('dev.apn.co.nz') != -1) &&
	(DocReferrer.indexOf('kw1=') != -1 || DocReferrer.indexOf('q=') != -1) &&
	document.location.href.indexOf('article.cfm') != -1 //Is this an article page
) {
		if ((DocReferrer.indexOf('http://www.nzherald') != -1 || DocReferrer.indexOf('dev.apn.co.nz') != -1) && DocReferrer.indexOf('kw1=') != -1) {
			headlinesData.configName = 'internalsearch';
			bSearchReferrer = true;
		}
		else 
			if (DocReferrer.indexOf('q=') != -1) {
				headlinesData.configName = 'externalsearch';
				bSearchReferrer = true;
			}
		//if there is a query string in the referrer
		if (DocReferrer.indexOf('?') != -1) {
			aTemp = DocReferrer.split('?');
			sQueryString = aTemp[1];
			
			if (sQueryString.length != 0) {
				aQueryString = sQueryString.split('&');
				for (s in aQueryString) {
					if (aQueryString[s].indexOf('q=') != -1 || aQueryString[s].indexOf('kw1=') != -1) {
						sSearchStr = '&' + aQueryString[s];
						break;
					}
				}
			}
		}
	}	
}
/******* End Behavioural Targeting *******/

/******* OUTER HTML CODE - Jquery plugin *******/
jQuery.fn.outerHtml = function() {  return $( $('<div></div>').html(this.clone()) ).html();} 

/******* Story Headline Display Controller *******/
var defaultInterval = 100;
var numberOfIterations = 100;
function checkTimer(timer,set,onclickargs){
	if(headlinesData["set" + set].data.length){
		window.clearInterval(timer);

		//START - Modify the markup to add onclick args before it is rendered into the divs 
		var aTagReg		= new RegExp('<a[^>]*>',"gi");
		var aTags		= headlinesData["set" + set].data.match(aTagReg);
		var aTemp		= [];
		var onClickVal	=  "s_objectID='" + onclickargs + "'; ";
		var i			= 0;
		var linkReg1 	= new RegExp('onclick="',"gi");
		var replace1	= 'onclick="' + onClickVal;
		var linkReg2	= new RegExp('>',"gi");
		var replace2	= ' onclick="' + onClickVal + '">';
		
		if(aTags != null && aTags.length){
			for (i = 0;i < aTags.length;i++){
				aTemp[i] = aTags[i];
				if(aTags[i].indexOf('onclick')!= -1){
					aTags[i] = aTags[i].replace(linkReg1,replace1);
				}else{
					aTags[i] = aTags[i].replace(linkReg2,replace2);
				}
				headlinesData["set" + set].data = headlinesData["set" + set].data.replace(aTemp[i],aTags[i]);
			}
		}
		//END - Modify the markup to add onclick args before it is rendered into the divs
		
		$('#headlines-set' + set + '-ajax').html(headlinesData["set" + set].data);
		if(pageUrl.indexOf('image.cfm') == -1 && pageUrl.indexOf('video.cfm') == -1 && pageUrl.indexOf('audio.cfm') == -1 && pageUrl.indexOf('quiz.cfm') == -1 ){
			unLinkCurrentStory();
		}

	}
	if(headlinesData["set" + set].counter == numberOfIterations){
		window.clearInterval(timer);
		$("#whirly-bird" + set).hide();
	}
	headlinesData["set" + set].counter++;
}

function unLinkCurrentStory(){
	if (typeof pageUrl != 'undefined') {
		var UrlParamRegEx = new RegExp("objectid=[0-9]+", "i");
		var aUrlParams = pageUrl.match(UrlParamRegEx);
		if (aUrlParams && aUrlParams.length != 0) {
			var iObjectid = aUrlParams[0].replace("objectid=", "");
			if (iObjectid) {
				storyLink = $('a#' + iObjectid);
				storyLink.parent().prepend(storyLink.html());
				$('a#' + iObjectid).remove();
			}
		}
	}
} 

/* redefine $.getScript() function to allow caching */
$.getScript = function(url, callback, cache){ $.ajax({ type: "GET", url: url, success: callback, dataType: "script", cache: cache }); }; 

/**** Combined File : _055_polls.js ****/
var bCookiesEnabled = false;
var regex = new RegExp('(\.(apn|nzherald)\.co\.nz)');
var cookieDomain        = regex.exec(thisDynamicDomain).toString().split(',')[0];


$.cookie('SET_COOKIE', true, {path:'/',domain:cookieDomain});
if ($.cookie('SET_COOKIE')) {
    $.cookie('SET_COOKIE', null, {path:'/',domain:cookieDomain});
    bCookiesEnabled = true;
}


//Wraps functions to ensure a session token is available to interact with dynamic domain
function sessionWrapper(fn_name, fn_params) {	
	var f = fn_name;
	if ($.cookie('NZH_SESSIONTOKEN')) {
		f(fn_params);
	} else {
		$.jsonp({
			url: thisDynamicDomain + '/community/getKey.cfm?callback=?',
			cache: false,
			success: function(data) {
				$.cookie('NZH_SESSIONTOKEN', data.HTML, {path:'/',domain:cookieDomain});
				f(fn_params);
			}
		});
	}
}

function showPollResults(qnaid, aResult) {				
	var thisPollOL = 'ol#r-' + qnaid;	
	for (var i = 0; i < aResult.length;  i++) {
		var thisIndex = i+1;
		var thisPercent = aResult[i] + '%'				
		$(thisPollOL + ' span#rs' + qnaid + thisIndex).html('(' + thisPercent + ')');			
	}					
	$('form#f-' + qnaid).hide(600, function() {			
		$(thisPollOL).show(600, function() {
			for (var i = 0; i < aResult.length;  i++) {
				var thisIndex = i+1;
				var thisPercent = aResult[i] + '%'
				$(thisPollOL + ' div#rb' + qnaid + thisIndex).animate({width:thisPercent}, 3000);
			}				
		});
		$('a#yv-' + qnaid).show();
	});
}

// check if this poll has already been submitted, if so switch in a rendered results view
function checkPoll(qnaid,aResult) {	
	if ( isPollVoted(qnaid) | !bCookiesEnabled) {		
		var thisPollOL = 'ol#r-' + qnaid;	
		for (var i = 0; i < aResult.length;  i++) {
			var thisIndex = i+1;
			var thisPercent = aResult[i] + '%'
			$(thisPollOL + ' div#rb' + qnaid + thisIndex).css('width',thisPercent);
			$(thisPollOL + ' span#rs' + qnaid + thisIndex).html('(' + thisPercent + ')');
		}		
		$('form#f-' + qnaid).hide();
		$(thisPollOL).show();
		$('a#yv-' + qnaid).show();
	}	
}

function isPollVoted(qnaid) {
	var pids = $.cookie('pids');
	
	if (pids == null) return false;	
	if (pids.indexOf(',') == -1) {	
		if (pids == qnaid) return true;
		else return false;
	}
	pids = pids.split(',');
	for (i=0;i<pids.length;i++) {
		if (pids[i] == qnaid) return true;
	}
		
	return false;
}

function votePoll(qnaid, aResult) {	

	var qna_type = $('input#qna_question_type_id').val();
	var oForm = {};

	
	var aForm = $('form#f-' + qnaid).serializeArray();				
	for (var i in aForm) {
		oForm[aForm[i].name] = aForm[i].value;
	}

		
	if (qna_type == 1 && $('input[name=q' + qnaid + ']:checked').length == 0) {
		alert('You must select an answer before voting!');
	} else {	
		if (bCookiesEnabled) {
			sessionWrapper( function() {

				oForm.token = $.cookie('NZH_SESSIONTOKEN');	

			    $.jsonp({
			        url: thisDynamicDomain + '/poll/vote.cfm?callback=?',
			        data: oForm,
			        cache: false,
			        async: false,
			        success: function(data) {
			    		var pids = $.cookie('pids') 		    		
			    		if (pids == null) 
			    			pids = qnaid;
			    		else 
			    			if ( !isPollVoted(qnaid)) 
			    				pids = pids + ',' + qnaid;		    				    	
			    		$.cookie('pids',pids, {path:'/',domain:cookieDomain,expires:30});		    		
			    		showPollResults(qnaid,aResult);
			    	},
			        type: 'get'
			    });	
					
			});
		} else showPollResults(qnaid,aResult);	
	}     
};      
/**** Combined File : _070_manipulateDomForAd.js ****/
// This will manipulate the dom per page / ad - should we require.
function manipulateDomForAd(pageName, adSize) {
	
	// Run specific code dependant on page.
	switch (pageName) {
		//This is the same code that runs for headlines.cfm, _sitehome.cfm, _sitehomeb and index.cfm 
		case "indexPages":
			if (adSize == 460) {
				//$('#adSpace13').hide(); // Hide the un-used ad div.
				var beltContainer = $('#belt01'); // Define the main belt container.
				
				if (!beltContainer.hasClass("ad_modified")) {
					beltContainer.addClass("ad_modified"); // Add a class to define the fact that it has been modified.
					
					beltContainer.find('.beltWrapper').css('width','480px');
					
					var bucketContainer = beltContainer.find('.bucket01:first'); // Determine the first bucket - which contains our list of articles.
					
					// Start by clearing the last article.
					bucketContainer.children('div:eq(2)').after('<div class="clearBoth"><!-- --></div><div class="hr5 contentContainer six"><!-- --></div><div class="clearBoth"><!-- --></div>');
					
					// Find the article we need to manipulate.
					var article = bucketContainer.children('div:last'); 
					article.removeClass('a140i140').addClass('a460i140');
					
					// Remove the CLEAR.
					article.find('div.clearBoth:first').remove();
				}
			}
		case "weather":
			if (adSize == 460) {
				// If we have moon phases on the page, do something with it.
				var phases = $("#moonPhases");
				phases.addClass('moonPhases440');
				phases.before('<div class="clearBoth"><!-- --></div>');
				
				// If we have UV on the page, do something with it.
				var uvdata = $("#uvForecast");
				uvdata.addClass('uvForecast440');
				uvdata.before('<div class="clearBoth"><!-- --></div>');
				
			}
		break;
	}
}
/**** Combined File : _100_jquery.imagegrid.js ****/
(function($) {

	/**
	 * @desc Take a UL list of images and text - and add desired animation.
	 * @author Craig Bassett
	 * @version 1.0
	 *
	 * @name imagegrid
	 * @type jQuery
	 *
	**/
	
	jQuery.fn.imagegrid = function(options) {
		
		// Our options.
		options = jQuery.extend({
			speedOn			: 500,
			speedOff		: 500,
			onLoad			: function() {}
		}, options);
		
		// Defined Variables.
		var pluginElement = $(this); // The element the plugin was invoked on.
		var i = 0;
		var total = pluginElement.children().find('a').length;
		
		// Private functions (exposed only to our plugin).
		//*** Check for CSS support ***
		var hasCSS = function()  {
			$('body').append(
				$(document.createElement('div')).attr('id','css_test').css({ width:'1px', height:'1px', display:'none' })
			);
			var _v = ($('#css_test').width() != 1) ? false : true;
			$('#css_test').remove();
			return _v;
		}
		
		var setPosition = function(i) {
			var options = {};
			width = 10; // The grid width.
			itemHeight = 124; // How high to animate the box to.
			itemHeightHalf = itemHeight / 2; // How high to animate the box to.
			options = { marginTop: '-'+itemHeightHalf+'px', marginLeft: '-70px', top: '50%', left: '50%', width: 140, height: itemHeight }; // Default
			
			// Determine the theoretical max.
			gridMax = Math.ceil(total / width) * width; 
			
			if (i <= width) options = { marginTop: '0', marginLeft: '-70px', top: '0', left: '50%', width: 140, height: itemHeight }; // The first row.
			if (i % width == 0) options = { marginTop: '-'+itemHeightHalf+'px', marginLeft: '-140px', top: '50%', left: '100%', width: 140, height: itemHeight }; // Items on the right.
			if ((i - 1) % width == 0) options = { marginTop: '-'+itemHeightHalf+'px', marginLeft: '0', top: '50%', left: '0', width: 140, height: itemHeight }; // Items on the left.
			if (i > (gridMax - width)) options = { marginTop: '-'+itemHeight+'px', marginLeft: '-70px', top: '100%', left: '50%', width: 140, height: itemHeight }; // The last row.
			
			// Specific Counts.
			if (i == 1) options = { marginTop: '0', marginLeft: '0', top: '0', left: '0', width: 140, height: itemHeight }; // Top left
			if (i == width) options = { marginTop: '0', marginLeft: '-140px', top: '0', left: '100%', width: 140, height: itemHeight }; // Top right
			if (i == (gridMax - width) + 1) options = { marginTop: '-'+itemHeight+'px', marginLeft: '0', top: '100%', left: '0', width: 140, height: itemHeight }; // Bottom left
			if (i == gridMax) options = { marginTop: '-'+itemHeight+'px', marginLeft: '-140px', top: '100%', left: '100%', width: 140, height: itemHeight }; // Bottom right
			
			return options;
		}
		
		// check for basic CSS support
		if (!hasCSS()) { return false; }
		
		//*** Add onHover event's to our anchor's that have an associated image. The other's we'll leave alone.
		pluginElement.children().find('a').each(function(){
			var _a = $(this);
			var _img = _a.find('img');
			var _heading = _a.find('div.headline');
			i++;
			_a.data('item', i);
			pluginElement.children().find('a').css('z-index', -1);
			
			if (_img.length > 0) {
				_a.find('.caption').parent().addClass('hasImg')
			
				_a.mouseenter(function() { // handlerIn
					_a.css('position', 'absolute').parent().css('position', 'relative'); // We do this using JS to fix the IE based z-index bugs.
					_a.addClass('selected');
					_a.css({'z-index' : '1000'}); // Add a higher z-index - so our element stay's on top.
					_a.stop().animate(setPosition(_a.data('item')), options.speedOn);
					_img.stop().animate({
						width: 140,
						height: 93
					}, options.speedOn);
				});
				
				_a.mouseleave(function() { // handlerOut
					_a.css({'z-index' : '500'}); // Drop the z-Index to 500.
					
					_a.stop().animate({
						marginTop: '0',
						marginLeft: '0',
						top: '0',
						left: '0',
						width: 92,
						height: 92
					}, options.speedOff, function(){
						_a.css({'z-index' : '0'}); // Reset the z-index.
						_a.removeClass('selected');
						_a.css('position', 'static').parent().css('position', 'static'); // Reset the positioning of our elements.
					});
					_img.stop().animate({
						width: 92,
						height: 61
					}, options.speedOff);

				});
			} else {
				
				_a.mouseenter(function() {
					_a.addClass('hover');
				});
				_a.mouseleave(function() {
					_a.removeClass('hover');
				});
				// Make sure the content is showing.
			}
		});
		
		// Fire our onLoad event.
		options.onLoad();
		
		return this;
		
	};
	
})(jQuery);

