// ------------------------ gu_head.js starts here -----------------------------
ensurePackage('guardian.r2');
// ------------------------ gu_head.js ends here -------------------------------
// ------------------------ 10util.js starts here -----------------------------
/*              Utility functions                    */

ensurePackage('guardian.r2');
guardian.r2.browser = {
	isIE6 : false,
	isIE7 : false,
	isOpera:  !!window.opera,
	isWebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
	isSafari2 : (function () {
		var userAgentNumber = RegExp("( Safari/)([^ ]+)").exec(navigator.userAgent);
		if (!userAgentNumber || userAgentNumber.length < 3) {
			return false;
		}
		var mainVersionNumber = userAgentNumber[2].split('.')[0];
		if (parseInt(mainVersionNumber) > 500) { //This is Safari 3
			return false;
		}
		return true;
	})(),
	isGecko:  navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1
};

/*@cc_on @*/

/*@if (@_jscript_version <= 5.6)
 // The above conditional compilation for IE is equivalent to
 // a conditional comment in HTML of 'if lte IE 6'
guardian.r2.browser.isIE6 = true;
 /*@end @*/

/*@if (@_jscript_version > 5.6)
 // The above conditional compilation for IE is equivalent to
 // a conditional comment in HTML of 'if lte IE 6'
guardian.r2.browser.isIE7 = true;
 /*@end @*/

function addEvent(obj, eventType, fn){

	if (typeof obj === "string") {
		obj = document.getElementById(obj);
	}

    /* adds an eventListener for browsers which support it
     Written by Scott Andrew: nice one, Scott */
    if (eventType === "load") {
        //hack me
        loadEventList.addLoadEvent(fn);
        return true;
    }
	if (!obj) {
		return null;
	}
    
    if (obj.addEventListener) {
        obj.addEventListener(eventType, fn, false);
        return true;
    }
    else 
        if (obj.attachEvent) {
            var r = obj.attachEvent("on" + eventType, fn);
            return r;
        }
        else {
            return false;
        }
}

function addClickListenersToMatchingElements(inElement, cssRule, clickListenerCallback) {
		
	var elementsToAddListenersTo = guardian.r2.dom.element.getElementsByCssSelector(cssRule, inElement);
	
	for (var i = 0; i < elementsToAddListenersTo.length; i++) {
		addEvent(elementsToAddListenersTo[i], 'click', clickListenerCallback);	
	}
	
};
	
var loadEventList = [];
loadEventList.addLoadEvent = function(fn){
	if(loadEventList.hasFired) {
		fn();
	} else {
		loadEventList[loadEventList.length] = fn;
	}
};

loadEventList.hasFired = false;
loadEventList.fireLoadEvents = function(){
    for (var i = 0; i < loadEventList.length; i++) {
        loadEventList[i]();
    }
    loadEventList.hasFired = true;
};

/* the following is a hack to replicate DOMContentLoaded in browsers
 other than Firefox.  It is basically copied from
 http://dean.edwards.name/weblog/2006/06/again/
 */
if (guardian.r2.browser.isWebKit) { // Safari
    var _timer = setInterval(function(){
        if (/loaded|complete/.test(document.readyState)) {
            clearInterval(_timer);
            loadEventList.fireLoadEvents(); // call the onload handler
        }
    }, 100);
}
else 
    if (document.addEventListener) {
        document.addEventListener("DOMContentLoaded", loadEventList.fireLoadEvents, false);
    }
    else {
    // IE HACK
    /*@cc_on @*/
    /*@if (@_win32)
     document.write("<script id='__ie_onload' defer='defer' src='//:'><\/script>");
     var script = document.getElementById("__ie_onload");
     script.onreadystatechange = function() {
	     if (this.readyState == "complete") {
		     loadEventList.fireLoadEvents(); // call the onload handler
	     }
     };
     /*@end @*/
    }

var safeLoadEventList = [];

function addSafeLoadEvent(fn) {
	if (!(guardian.r2.browser.isIE6 || guardian.r2.browser.isIE7)) {
		addEvent(document, 'load', fn);
		return true;
	} else {
		// This is IE6 or 7 and therefore can't have document.body.appendChilds or innerHTMLs until the whole page has loaded.
		// See http://support.microsoft.com/kb/927917 for more information
		safeLoadEventList.push(fn);
		return true;
	}
}

safeLoadEventList.hasFired = false;
safeLoadEventList.fireLoadEvents = function() {
    for (var i = 0; i < safeLoadEventList.length; i++) {
        safeLoadEventList[i]();
    }
    safeLoadEventList.hasFired = true;
};

if ((guardian.r2.browser.isIE6 || guardian.r2.browser.isIE7)) {
	window.attachEvent("onload", safeLoadEventList.fireLoadEvents);
}


function importScript(src, onloadCallback, forceIEtoUseTimers, notifyOnState, onerrorCallback){
	var scriptElem = document.createElement('script');
	scriptElem.setAttribute('src',src);
	scriptElem.setAttribute('type','text/javascript');
	
	notifyOnState = (notifyOnState ? notifyOnState : 'loaded');
	
	if (onloadCallback) {
		
		// from http://ajaxian.com/archives/a-technique-for-lazy-script-loading
		// safari doesn't support either onload or readystate, create a timer
		// only way to do this in safari
	
        if (guardian.r2.browser.isSafari2 || guardian.r2.browser.isOpera || (forceIEtoUseTimers && (guardian.r2.browser.isIE6 || guardian.r2.browser.isIE7))) { // sniff
			importScript.guardianImportScriptTimers[src] = setInterval(function() {
				
				if (/loaded|complete/.test(document.readyState)) {
					clearInterval(importScript.guardianImportScriptTimers[src]);
					try {
						onloadCallback(); // call the callback handler
					} catch (e) {
						if(onerrorCallback) {
							onerrorCallback();
						}
					}
				}
				
			}, 10);
	
		} else {
			// and now the browsers that WORK
			
			scriptElem.onreadystatechange = function () {
			
				if (scriptElem.readyState === 'notifyOnState') {
					onloadCallback();
				}
			};
			scriptElem.onload = onloadCallback;
			scriptElem.onerror = function(){ 
				if(onerrorCallback){
					onerrorCallback();
				}
			};
			
		}
	}

	document.getElementsByTagName('head')[0].appendChild(scriptElem);
}
importScript.guardianImportScriptTimers = {};


function openGalleryPopup(url, height){
    var galleryWidth = 830;
    var leftPos = calculateXForCentredPopup(galleryWidth);
    var newWindow = window.open(url, '_blank', 'resizable=yes,scrollbars=yes,location=yes,toolbar=yes,status=no,top=0,screenY=0,left=' + leftPos + ',screenX=' + leftPos + ',height=' + height + ',width=' + galleryWidth);
    return false;
}

function calculateXForCentredPopup(popupWidth) {
    var leftPos = 0;
    if (screen.availWidth > popupWidth) {
        leftPos = Math.round((screen.availWidth - popupWidth) / 2);
    }
    
    return leftPos;
}


function openScorePopup(url){
 	var height= 335;
	var width = 420;
    var leftPos = 0;
    window.open(url, '_blank', 'resizable=yes,scrollbars=yes,location=no,toolbar=no,status=no,top=0,screenY=0,left=' + leftPos + ',screenX=' + leftPos + ',height=' + height + ',width=' + width);
    return false;
}

function popUpNewWindow(url,width,height) {
	newwindow=window.open(url,'sponsor','height=' + height + ',width=' + width + ',scrollbars=yes,location=yes,toolbar=yes,status=yes,resizable=yes');
	if (window.focus) {newwindow.focus()}
	return false;
}

function forEachElementOf(list, doThis){
    var listLength = list.length;
    for (var i = 0; i < listLength; i++) {
        doThis(list[i], i);
    }
}

function readCookie(name) {
    var nameEQ = name + "=";
    var cookieArray = document.cookie.split(';');
	
    for (var i = 0; i < cookieArray.length; i++) {
        var cookie = cookieArray[i];
		
        while (cookie.charAt(0) == ' ') {
			cookie = cookie.substring(1, cookie.length);
		}
			
        if (cookie.indexOf(nameEQ) === 0) {
			return cookie.substring(nameEQ.length, cookie.length);
		}
    }
	
    return null;
}

function createCookie(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=/";
}

function isExternalSystemOn(system){

    var extSystems = readCookie("GU_EXT_SYS");
    if (extSystems !== null) {
        return extSystems.match(system) === null;
    }
    return true;
}

function isUserLoggedIntoRegPss() {
	return readCookie("GU_ME") != null;
}

function generateScriptTag(src){
    document.write('<script type="text/javascript" src="' + src + '"></scr' + 'ipt>');
    document.close();
}

function getScrollPosition(){
    var scrollX, scrollY;
    if (self.pageYOffset) {
        scrollX = self.pageXOffset;
        scrollY = self.pageYOffset;
    }
    else 
        if (document.documentElement && document.documentElement.scrollTop) {
            scrollX = document.documentElement.scrollLeft;
            scrollY = document.documentElement.scrollTop;
        }
        else 
            if (document.body) {
                scrollX = document.body.scrollLeft;
                scrollY = document.body.scrollTop;
            }
    return {
        x: scrollX,
        y: scrollY
    };
}

function getCenterPosition(){
    var centerX, centerY;
    if (self.innerHeight) {
        centerX = self.innerWidth;
        centerY = self.innerHeight;
    }
    else 
        if (document.documentElement && document.documentElement.clientHeight) {
            centerX = document.documentElement.clientWidth;
            centerY = document.documentElement.clientHeight;
        }
        else 
            if (document.body) {
                centerX = document.body.clientWidth;
                centerY = document.body.clientHeight;
            }
    return {
        x: centerX,
        y: centerY
    };
}

function getScrollAndCenterPosition(){
    var scroll = getScrollPosition();
    var center = getCenterPosition();
    return {
        scrollX: scroll.x,
        scrollY: scroll.y,
        centerX: center.x,
        centerY: center.y
    };
}

function fixFirefoxIncrementalReflowBug() {
	if (window.getComputedStyle) {
		// This is only required for Firefox 2, where the incremental rendering sometimes gets messed
		// up. Call this to force a document reflow. This bug is (apparently) fixed in FF3.
		var body = document.getElementsByTagName('body')[0];
		var bodyHeight = window.getComputedStyle(body,'').getPropertyValue('height');
		body.style.height = bodyHeight;
		window.setTimeout(function () {body.style.height = 'auto'},100);
	}
}

function GUopenParent(target) {
	if (window.opener) {
		window.opener.location=target;
	} else {
		location=target;
	}
}

function classNameRegex(cl) {
	return new RegExp("( |^)" + cl + "( |$)")
}

function removeClassName(el, className) {
	 el.className = el.className.replace(classNameRegex(className), " ").replace(/(^\s*|\s*$)/g, '');
}

function getAncestorOfType(object, tagType) {
	if(!object.tagName) {
		return null;
	} else {
		return (object.tagName.toLowerCase() === tagType) ? object : getAncestorOfType(object.parentNode, tagType);
	}
}


function arrayIndexOf(array, value) {
	for (var i = 0; i < array.length; i++) {
		if (array[i] === value) {
			return i;
		}
	}
	return -1;
}

function isArray(value){
	
	return value &&	
		typeof value === 'object' &&
		typeof value.length === 'number' &&
		typeof value.splice === 'function' &&
		!(value.propertyIsEnumerable('length'));
	
}
	
function arrayContains(theArray, theValue) {
	for (var i = 0; i < theArray.length; i++) {
		if (theArray[i] === theValue) {
			return true;
		}
	}
	return false;
}

// ---------------//---------- 10util.js ends here ------------------------------
// -------------------- 11image-utils.js starts here ----------------------------

var applyImageMaskImmediate;
var applyFullScreenImageMask;
var removeFullScreenImageMask;
var updateVisibilityOfElementsThatRuinIE6Filters;
var ensureElementHasLayoutInIE6;

(function() {
    var root = commonStaticRoot + 'styles/wide/images/';
    
    function getMaskDef(maskName, width, height) {
        var lowerCaseMaskName = maskName.toLowerCase();
        
        function defaultMaskDef(url) {
        	return {url : url, width : width, height : height};
        }
        
        switch (lowerCaseMaskName) {
        case "roundedcorners":
            switch (width)  {
            case 460:
                return defaultMaskDef(root + '460x276-mask.png');
            case 300:
                return defaultMaskDef(root + '300x180-mask.png');
            case 140:
                switch (height) {
                case 84:
                    return defaultMaskDef(root + '140x84-mask.png');
                case 89:
                    return defaultMaskDef(root + '140x84-mask.png');
                case 180:
                    return defaultMaskDef(root + '140x180-mask.png');
                case 120:
                    return defaultMaskDef(root + '140x120-mask.png');
                 case 95:
                    return defaultMaskDef(root + '140x95-mask.png');
                }
                break;
            case 280:
                return defaultMaskDef(root + '280x168-mask.png');
            case 130:
                switch (height) {
                case 78:
                    return defaultMaskDef(root + '130x78-mask.png');
                case 88:
                    return defaultMaskDef(root + '130x88-mask.png');    
                case 111:
                    return defaultMaskDef(root + '130x111-mask.png');
                }
                break;
            case 220:
                return defaultMaskDef(root + '220x132-mask.png');
            }
            break;
            
        case "article" :
        case "cartoon" :
        case "poll" :
        case "trailblock" :
		case "contributor" :
        	// no mask
            break;
        	
        default:
            if (width >= 140 && height >= 84) {
                return {url : root + lowerCaseMaskName + '_140.png', width : 140, height : 84};
            }
        }
        return null;
    }
    
    function createIE6BackgroundDiv(maskDef) {
        var newImageDiv = document.createElement("div");
        newImageDiv.style.width = maskDef.width + "px";
        newImageDiv.style.height = maskDef.height + "px";
        newImageDiv.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + maskDef.url + "',sizingMethod='scale')";
        newImageDiv.style.position = "absolute";
        newImageDiv.style.left = String( - maskDef.leftOffset);
        newImageDiv.style.top = String( - maskDef.topOffset);
        newImageDiv.style.zIndex = "100";
    
    	return newImageDiv;
    }
    
    var applyMaskInIE6 = function (parentNode, maskDef) {
    	maskDef.leftOffset = maskDef.topOffset = 0;
        var newImageDiv = createIE6BackgroundDiv(maskDef);
        newImageDiv.className = 'mask';
        parentNode.style.position = 'relative';
        parentNode.style.display = 'block';
        ensureElementHasLayoutInIE6(parentNode);
        parentNode.appendChild(newImageDiv);
        if (document.getElementById('content')) {
        	// Force IE6 to redraw.
        	document.getElementById('content').style.display = 'none';
        	document.getElementById('content').style.display = 'block';
        }
        
        return newImageDiv;
    };
    
    var applyMask = function (originalElement, parentNode, maskDef) {
        parentNode.style.display = 'block';
        parentNode.style.position = 'relative';
		
        var newImage = originalElement.cloneNode(false);
		newImage.style.width = maskDef.width + 'px';
        newImage.style.height = maskDef.height + 'px';
        newImage.setAttribute('src', maskDef.url);
        newImage.className = 'mask';
        newImage.setAttribute('alt', ' ');
		parentNode.appendChild(newImage);
        
        return newImage;
    };

	getNumberPropertyValue = function (originalElement, propertyName) {
        var propVal = Number(originalElement.getAttribute(propertyName));
        if (propVal === 0) {
        	if (document.defaultView && document.defaultView.getComputedStyle) {
	        	propVal = document.defaultView.getComputedStyle(originalElement,'').getPropertyValue(propertyName);        	
        	} else if (originalElement.currentStyle){
	        	propVal = originalElement.currentStyle[propertyName];
	        }
	        
	 		if (propVal !== null) {
				propVal = parseInt(propVal.replace('px', ''), 10);
			}
        }
		if (!isNaN(propVal) && propVal !== null) {
			return propVal;
		}
		else {
			return 0;
		}
 	}

    applyImageMaskImmediate = function (originalElement, maskName) {
        var parentNode = originalElement.parentNode;
        var width = getNumberPropertyValue(originalElement, 'width');
        var height = getNumberPropertyValue(originalElement, 'height');
        var maskDef = getMaskDef(maskName, width, height);
        if (maskDef) {
            if (guardian.r2.browser.isIE6) {
                return applyMaskInIE6(parentNode, maskDef);
            } else {
                return applyMask(originalElement, parentNode, maskDef);
            }
        }
    };
    
    var applyFullScreenMaskInIE6 = function (parentNode, maskDef) {
        var newImageDiv = createIE6BackgroundDiv(maskDef);
        ensureElementHasLayoutInIE6(parentNode);
		parentNode.insertBefore(newImageDiv, parentNode.firstChild);
		
        return newImageDiv;
    };
    
     updateVisibilityOfElementsThatRuinIE6Filters = function (visibility, elementThatContainsThingToNOTHide) {
    	
    	var elementsToIgnore = elementThatContainsThingToNOTHide ? elementThatContainsThingToNOTHide.getElementsByTagName('select') : [];
    	
    	forEachElementOf(elementsToIgnore, function(element) {
    		element.dontHideThisElement = true;
    	});
    	
    	var badElements = guardian.r2.dom.element.getElementsByCssSelector(['select','embed','object']);    	
    	
		forEachElementOf(badElements, function(element) {
			if (!element.dontHideThisElement) {
				element.style.visibility = visibility;
			}
		});
		
    	forEachElementOf(elementsToIgnore, function(element) {
			if (element.dontHideThisElement) {
	    		element.dontHideThisElement = false;
	    	}
    	});

    }
    
    applyFullScreenImageMask = function (elementThatContainsThingToNOTHide) {
    	if (guardian.r2.browser.isIE6) {
			document.body.parentNode.style.overflow = 'hidden';

    		var element = document.getElementById(elementThatContainsThingToNOTHide);
			updateVisibilityOfElementsThatRuinIE6Filters('hidden', element);
			
			var leftOffset = element.offsetParent.offsetLeft;
			
    		var body = document.body;
    		return applyFullScreenMaskInIE6(
    			element,
    			{
    				url : root + 'white-bg.png',
    				width : body.clientWidth,
    				height : body.clientHeight,
    				leftOffset : leftOffset,
    				topOffset : 0
    			});
    	}
    };
    
    removeFullScreenImageMask = function () {
    	updateVisibilityOfElementsThatRuinIE6Filters('visible');
		document.body.parentNode.style.overflow = '';
    };
    
    ensureElementHasLayoutInIE6 = function (element) {
        if (!element.currentStyle.hasLayout) {
	        element.style.zoom = '1';
	    }    	
    }
    
})();

// -------------------- 11image-utils.js ends here ----------------------------
// ------------------------ 12non-browser-utils.js starts here -----------------------------
function ensurePackage(packageName, packageBlock){
    var package_parts = packageName.split(".");
    var package_so_far = this;
    for (var i = 0; i < package_parts.length; i += 1) {
        var package_part = package_parts[i];
        if (!package_so_far[package_part]) {
            package_so_far[package_part] = {};
        }
        package_so_far = package_so_far[package_part];
    }
    if (packageBlock) {
        packageBlock(package_so_far);
    }
    return package_so_far;
}

function trim(str) {
	return ltrim(rtrim(str));
}

function ltrim(str) {
	return str.replace(/^\s+/, '');
}

function leftTrim(str){
    return str.replace(new RegExp(/^\s*/g), "");
}

function rtrim(str) {
	return str.replace(/\s+$/, '');
}

function stripParamFromUrl(param, urlToStrip) {
	var paramterValueExpression = "=[\\w\\-]*";
	var url = urlToStrip.replace(new RegExp("\\?" + param + paramterValueExpression + "$"), ""); // first and only param
	url = url.replace(new RegExp("\\?" + param + paramterValueExpression +  "&"), "?"); // first of many params
	url = url.replace(new RegExp("&" + param + paramterValueExpression), ""); // not first param
	return url;	
}

function isNumber(value) {
	return typeof value === 'number';
}

function delegateErrorHandler(to, from) {
	to.errorHandler = from.errorHandler;
}

function isValidUrl(url) {
	var regexp = /(http:\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;
	return regexp.test(url);
}

function appendParameter(url, parameter) {
	if (url.indexOf('?') !== -1) {
		return url + '&' + parameter;
	} else {
		return url + '?' + parameter;
	}
}

function isArray(object) {
	return object != null && typeof object == "object" && 'splice' in object && 'join' in object;
}

// ------------------------ 12non-browser-utils.js ends here -----------------------------
/* ---- DialogBox.js ---- */
ensurePackage("guardian.r2");

guardian.r2.DialogBox = function () {

	var appliedImageMask = false;
	var instance = this;

	this.showDialogBox = function (dialogBox, dialogBoxWrapper, scrollable) {
		if (guardian.r2.browser.isIE6) {
			document.body.parentNode.style.overflow = 'hidden';
		}
		scrollable = scrollable ? scrollable : false;
		instance.positionDialogBox(dialogBox, dialogBoxWrapper, scrollable);
		dialogBoxWrapper.style.display = "block";
		if (guardian.r2.browser.isIE6) {
			dialogBoxWrapper.style.background = "none";
			if (dialogBoxWrapperHasNotAlreadyHadImageMaskApplied(dialogBox, dialogBoxWrapper)) {
				applyFullScreenImageMask(dialogBoxWrapper.id);
				appliedImageMask = true;
			}
			else {
				dialogBoxWrapper.firstChild.style.width = document.body.clientWidth + "px";
				leftOffset = dialogBoxWrapper.offsetParent.offsetLeft;
				dialogBoxWrapper.firstChild.style.left = "-" + leftOffset + "px";
				updateVisibilityOfElementsThatRuinIE6Filters('hidden', dialogBoxWrapper);
			}
		} else {
			updateVisibilityOfElementsThatRuinIE6Filters('hidden', dialogBoxWrapper);
		}
	};

	this.hideDialogBox = function (dialogBoxWrapper) {
		if (guardian.r2.browser.isIE6) {
			removeFullScreenImageMask();
		} else {
			updateVisibilityOfElementsThatRuinIE6Filters('', dialogBoxWrapper);
		}
	};

	this.positionDialogBox = function (dialogBox, dialogBoxWrapper, scrollable) {
		var position = getCenterPosition();
		var scroll = getScrollPosition();
		var wrapperWidth = 0;
		var posX = position.x;
		if (guardian.r2.browser.isIE6) {
			dialogBoxWrapper.style.position = 'absolute';
			dialogBox.style.position = 'absolute';
		}
		dialogBoxWrapper.style.visibility = 'hidden';
		dialogBoxWrapper.style.display = 'block';
		dialogBox.style.visibility = 'hidden';
		dialogBox.style.display = 'block';
		var w = getAxisBoxModelTotalSize(dialogBox, "width");
		if (guardian.r2.browser.isIE6) {
			if (dialogBoxIsContainedByWrapper(dialogBox)) {
				wrapperWidth = getNumberPropertyValue(document.getElementById('wrapper'), "width");
				if (wrapperWidth < posX) {
					posX = wrapperWidth;
				}
			}
		}
		var centreX = posX / 2;
		var centreOffset = w / 2;
		var leftOffset = Math.round(centreX - centreOffset);
		dialogBoxWrapper.style.top = "0px";
		dialogBoxWrapper.style.left = "0px";
		dialogBox.style.left = leftOffset + "px";
		var boxHeight = getAxisBoxModelTotalSize(dialogBox, "height");
		var windowHeight = position.y;
		var scrollHeight = scroll.y;
		var topOffset = 5;
		if (boxHeight < windowHeight) {
			topOffset = (windowHeight - boxHeight) / 2;
		}
		if (guardian.r2.browser.isIE6 || scrollable) {
			topOffset += scrollHeight;
		}
		dialogBox.style.top = topOffset + "px";
		dialogBox.style.visibility = '';
		dialogBoxWrapper.style.visibility = '';
		dialogBoxWrapper.style.display = 'none';
	};
	
	this.createCloseLink = function(dialogBox, dialogBoxWrapper) {
		function closeDialogBox() {
			dialogBox.style.display = 'none';
			dialogBoxWrapper.style.display = 'none';
			instance.hideDialogBox(dialogBoxWrapper);
		}
		var closeLinkId = (dialogBox.id + '-close-link');
		if (!document.getElementById(closeLinkId)) {
			var closeLink = document.createElement('a');
			closeLink.href = '#';
			closeLink.innerHTML = 'close';
			closeLink.id = (closeLinkId);
			closeLink.className='close';
			addEvent(closeLink, 'click', closeDialogBox);
			
			var toolBox= document.createElement('p');
			toolBox.className='toolbox';
			toolBox.appendChild(closeLink);
			
			dialogBox.insertBefore(toolBox, dialogBox.firstChild);

		}
	}
	
	function dialogBoxWrapperHasNotAlreadyHadImageMaskApplied(dialogBox, dialogBoxWrapper) {
		var isEmptyString = /^\s*$/;
		if (dialogBoxIsContainedByWrapper(dialogBox)) {
			return !appliedImageMask;
		}
		return !appliedImageMask && isEmptyString.test(dialogBoxWrapper.innerHTML)
	}

	function dialogBoxIsContainedByWrapper(dialogBox) {
		return !(dialogBox.parentNode === document.body);
	}

	function getAxisBoxModelTotalSize(el, axis) {
		var boxHeight, boxPadding, boxMargins, boxWidth;
		switch (axis) {
		case 'height':
			boxHeight = el.offsetHeight;
			boxMargins = getNumberPropertyValue(el, "marginTop") + getNumberPropertyValue(el, "marginBottom");
			return (boxHeight + boxMargins);
		case 'width':
			boxWidth = el.offsetWidth;
			boxPadding = getNumberPropertyValue(el, "paddingLeft") + getNumberPropertyValue(el, "paddingRight");
			boxMargins = getNumberPropertyValue(el, "marginLeft") + getNumberPropertyValue(el, "marginRight");
			return (boxWidth + boxPadding + boxMargins);
		}
	}
};
/* ---- GoogleMapsGeoRssFeedController.js ---- */
ensurePackage("guardian.r2");
guardian.r2.GoogleMapsGeoRssFeedController = function (googleMapsGeoRssView,googleMapsGeoRssFeedService,feedUrl) {
	
	var instance = this;
	var numberOfEntries;
	
	this.initialize = function () {
		googleMapsGeoRssView.addLoadEvent(instance.onLoad);
		googleMapsGeoRssView.addUnloadEvent(instance.onUnload);
	};
	
	this.onLoad = function() {
		googleMapsGeoRssView.initializeMap();
		googleMapsGeoRssView.initContainerFontSize();
		googleMapsGeoRssFeedService.getEntries(feedUrl,instance.displayFeedEntries);
	};
	
	this.displayFeedEntries = function(entries) {
	   if(entries.length > 0) {
	   	  googleMapsGeoRssView.showMap();
		  for(var index = 0 ; index < entries.length ; index++) {
			  googleMapsGeoRssView.displayEntryOnMap(entries[index]);
		  }
	      googleMapsGeoRssView.zoomToLatest();
	      
	      if(entries.length > 1) {
	      	googleMapsGeoRssView.createNav(entries.length );
	      }
	    }
	};
	
	this.onUnload = function() {
		googleMapsGeoRssView.unloadMaps();
	}
};

// ----------------------- GoogleMapsGeoRssFeedController.js ends here ------------------------------
/* ---- GoogleMapsGeoRssFeedService.js ---- */
ensurePackage("guardian.r2");
guardian.r2.GoogleMapsGeoRssFeedService = function () {
	
	var instance = this;
	
	this.initialize = function () {
	};
	
	this.getEntries = function(feedsUrl,entriesReadyCallback) {
	  
	  var ajaxRequest = new guardian.r2.ajax.Request(feedsUrl,{
			  method: 'get',
			  onSuccess: function (transport) {
			  		instance.populateEntries(transport,entriesReadyCallback);
	  		 }
		  });
	};
	
	this.populateEntries = function(transport,entriesReadyCallback) {
		var responseXML = transport.responseXML;
		var entries = new Array();
		var items; 
		
		try {
			items = responseXML.getElementsByTagName('item');
		} catch (e) {
			parser=new DOMParser();
			responseXML = parser.parseFromString(transport.responseText,"text/xml");
			items = responseXML.getElementsByTagName('item');
		}
		
		for (var index = 0; index < items.length ; index++) {
			var item = items[index];
			
			var title = item.getElementsByTagName("title")[0].childNodes[0].data;
			var description;
			try {
		 		description = item.getElementsByTagName("description")[0].childNodes[0].nodeValue;
			} catch (e) {}
		
			var link;
			try {
				 link = item.getElementsByTagName("link")[0].childNodes[0].nodeValue;
			} catch (e) {}
			
			var lat='';
			var lng ='';
			var latlng;
			
			try {
				if (navigator.userAgent.toLowerCase().indexOf("msie") < 0) {
					latlng = item.getElementsByTagNameNS("http://www.georss.org/georss","point")[0].childNodes[0].nodeValue;
				} else {
					latlng = item.getElementsByTagName("georss:point")[0].childNodes[0].nodeValue;
				}
				
				if (latlng.length > 0) {
					lat = latlng.split(" ")[0];
					lng = latlng.split(" ")[1];
				}
			} catch (e) { }
			
			if (lat.length > 0 && lng.length > 0 ) {
				entries.push({linkText:title, description:description, latitude:Number(lat), longitude:Number(lng),pageURL:link});
			}
		}
	
		entriesReadyCallback(entries);
	};
	
	this.getDescription = function(item) {
		
	}
};
// ----------------------- GoogleMapsGeoRssFeedService.js ends here ------------------------------
/* ---- GoogleMapsGeoRssFeedView.js ---- */
ensurePackage("guardian.r2");
guardian.r2.GoogleMapsGeoRssFeedView = function () {
	
	var instance = this;
	var mapItems = new Array();
	var current = 0;
	var navroot = commonStaticRoot + 'images/calendar/';
	var root = commonStaticRoot + 'styles/wide/images/';
	
    var guardianMapIcon = new GIcon(G_DEFAULT_ICON);
    guardianMapIcon.image = root + "mapmarkers/1_marker.png";
    guardianMapIcon.iconSize = new GSize(23,32);
    guardianMapIcon.shadow = root + "mapmarkers/2_shadow_75.png";
    guardianMapIcon.shadowSize = new GSize(35,32);
    guardianMapIcon.iconAnchor = new GPoint(12, 29);
    guardianMapIcon.infoWindowAnchor = new GPoint(18,5);
    guardianMapIcon.printImage = root + "mapmarkers/3_print.gif";
    guardianMapIcon.mozPrintImage = root + "mapmarkers/4_ffPrint.gif";
    guardianMapIcon.printShadow = root + "mapmarkers/5_print-shadow.gif";
    guardianMapIcon.imageMap = [ 12,28, 2,16, 2,8, 11,2, 20,8, 20,16 ];
    var markerOptions = { icon : guardianMapIcon }
    
    this.initializeMap = function() {
		instance.map = new GMap2(document.getElementById("map-canvas"));
		instance.map.setCenter(new GLatLng(0,0),13);
		instance.map.addControl(new GSmallMapControl());
	};
	
	this.initContainerFontSize = function() {
		instance.map.getContainer().childNodes[1].style.fontSize = '7px';
	};

	this.displayEntryOnMap = function (entry) {
		var latlng = new GLatLng(entry.latitude,entry.longitude);
		var marker = new GMarker(latlng, markerOptions);
		var html = instance.htmlForEntry(entry);
		
		GEvent.addListener(marker, "click", function() {
			marker.openInfoWindowHtml(html,{maxWidth:200});
		});
		
		if (! instance.mostRecentMarker) {
			instance.mostRecentMarker = marker;
		}
		instance.map.addOverlay(marker);
		mapItems.push(latlng);

	};
	
	this.createNav = function (all){
			var list = document.getElementById('map-nav');
			if(list){
				var ul = document.createElement('ul');
				guardian.r2.dom.element.addClassName(ul, 'promo-nav');
				// create previous button
				prev = document.createElement('li');
				guardian.r2.dom.element.addClassName(prev, 'previous');
				prevLink = document.createElement('a');
				prevImg = document.createElement('img');
				prevImg.setAttribute('src', navroot + 'left_arrow.gif');
				prevTxt = document.createTextNode('Previous');
				prevLink.setAttribute('href', '#');
				prevLink.appendChild(prevImg);
				prevLink.appendChild(prevTxt);
				// add click event to previous navigation
				instance.addEvent(prevLink, 'click', instance.show);		
				prev.appendChild(prevLink);
				ul.appendChild(prev);
				// add current tweet display
				count = document.createElement('li');
				guardian.r2.dom.element.addClassName(count, 'index');
				templabel = document.createTextNode( all + ' / ' + all);
				count.appendChild(templabel);
				ul.appendChild(count);
				// create next button
				next = document.createElement('li');
				guardian.r2.dom.element.addClassName(next, 'next');
				guardian.r2.dom.element.addClassName(next, 'next-post');
				nextLink = document.createElement('a');
				nextLink.style.display = "none";
				nextImg = document.createElement('img');
				nextImg.setAttribute('src', navroot + 'right_arrow.gif');
				nextTxt = document.createTextNode('Next');
				nextLink.setAttribute('href', '#');
				nextLink.appendChild(nextTxt);
				nextLink.appendChild(nextImg);
				// add click even to next navigation
				instance.addEvent(nextLink, 'click', instance.show);	
				next.appendChild(nextLink);	
				ul.appendChild(next);
				list.appendChild(ul);
			}
	};
	
	this.addEvent = function( obj, type, fn ) {
			if ( obj.attachEvent ) {
			 obj['e'+type+fn] = fn;
			 obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
			 obj.attachEvent( 'on'+type, obj[type+fn] );
			} else
			 obj.addEventListener( type, fn, false );
		}
		
	this.show = function (e){
			if(this === nextLink || this === prevLink){
				var addto = this === nextLink ? -1 : 1;
				current = current + addto;
				if(current == mapItems.length-1){
					prevLink.style.display = "none";
				}
					else {
						prevLink.style.display = "block";
					}
				if(current == 0){
					nextLink.style.display = "none";
				}
					else {
						nextLink.style.display = "block";
					}
				panMap(mapItems[current]);
			}
			var templabel = document.createTextNode( (mapItems.length-current) + ' / ' + mapItems.length);
			count.replaceChild(templabel, count.firstChild);
			cancelClick(e); 
		};
	
	function panMap (toMarker) {
		instance.map.panTo(toMarker);
	};
	
	function cancelClick(e){
			if (window.event){
				window.event.cancelBubble = true;
				window.event.returnValue = false;
			}
			if (e && e.stopPropagation && e.preventDefault){
				e.stopPropagation();
				e.preventDefault();
			}
	};
			
	this.showMap = function() {
		var mapCanvas = document.getElementById("map-canvas");
		mapCanvas.style.display = 'block';
	};
	
	this.zoomToLatest = function () {
		instance.map.checkResize();
		instance.map.setCenter(this.mostRecentMarker.getLatLng(),6);

		
	};
	
	this.htmlForEntry = function(entry) {
		var html = "";
		
		if (entry.pageURL) {
			html = html + "<a href=\"" + entry.pageURL + "\">";
		}
		
		if (entry.linkText) {
			html = html + entry.linkText;
		}
		
		if (entry.pageURL) {
			html = html + "</a>";
		}
		
		return html;
	};
	
	this.unloadMap = function() {
		GUnload();
	};
	
	this.addLoadEvent = function (callback) {
		addEvent(document, 'load', callback);
	};
	
	this.addUnloadEvent = function (callback) {
		addEvent(document, 'unload', callback);
	};
};

// ----------------------- GoogleMapsGeoRssFeedView.js ends here ------------------------------
/* ---- HitboxLinkTrackedController.js ---- */
ensurePackage("guardian.r2");

guardian.r2.HitboxLinkTrackedController = function (view) {

	var instance = this;

	this.handleOnLoad = function () {
		view.regsiterLinkClickedEvent(instance.handleLinkClicked);
	};

	this.handleLinkClicked = function (elementName, url) {
		var matches = /&lid=(.*)&lpos=(.*)/.exec(elementName);
		
		if (matches !== null) {
			_hbLink(matches[1], matches[2]);
			view.updateDocumentLocationWithDelay(url);
			return false;
		}
		
		return true;
	};

	view.registerOnLoadEvent(instance.handleOnLoad);
};
 
/* ---- HitboxLinkTrackedView.js ---- */
ensurePackage("guardian.r2");

guardian.r2.HitboxLinkTrackedView = function () {
	function getParentAnchorTag(element) {
		var parentElement = element;
		
		while (parentElement) {
			if (parentElement.tagName === "A") {
				return parentElement;
			}
			
			parentElement = parentElement.parentNode;
		} 
		
		return null;
	}
	
	this.regsiterLinkClickedEvent = function (callback) {
		var viewCallback = function (event) {
			var anchorTag = getParentAnchorTag(event.target);
			if (!anchorTag) {
				return true;
			}
			
			return callback(anchorTag.name, anchorTag.href);
		};
		
		forEachElementOf(guardian.r2.dom.element.getElementsByCssSelector('.js-hitbox-tracked'),
			function (trackingWrapper) {
				addEvent(trackingWrapper, "click", viewCallback);
			}
		);
	};
	
	this.registerOnLoadEvent = function (callback) {
		addEvent(document, "load", callback);
	};
	
	this.updateDocumentLocationWithDelay = function (url) {
		setTimeout(
			function () {
				document.location = url;
			}, 500);
	};
};
// ---------------------- ObfuscationService.js starts here -----------------------------

ensurePackage("guardian.r2");

guardian.r2.ObfuscationService = function(){
	var instance = this;
	
	this.encryptPassword = function(password, challenge2){
		return binl2hex(core_hmac_md5(challenge2, password));
	};
	
	
}
	
// ----------------------- ObfuscationService.js ends here ------------------------------
// ---------------------- PieChartController.js starts here -----------------------------

ensurePackage("guardian.r2");

guardian.r2.PieChartController = function (view, pieData) {

var onLoad = function () {
	setUpVariablesOnView();
	buildPie();
}

var setUpVariablesOnView = function () {
	var canvasSize = view.getCanvasDimensions();
	var radius = Math.min(canvasSize[0], canvasSize[1]) / 2;
	var centrePoint = [canvasSize[0]/2, canvasSize[1]/2];
	view.setRadius(radius);
	view.setCentre(centrePoint);
};

var buildPie = function () {
	var totalPieValue = getTotalPieValue();
	if (totalPieValue === 0) {
		view.drawPieSlice(0, 2 * Math.PI);
	} else {
		var soFar = 0;
		var midPoint = (Math.PI * 2 * (pieData[0].sliceValue / totalPieValue)) / 2;
		midPoint = isNaN(midPoint) ? 0 : midPoint;
		for (var i = 0; i < pieData.length; ++i) {
			var currentSliceValue = pieData[i].sliceValue / totalPieValue;
			if (currentSliceValue === 1) {
				view.drawPieSlice(0, 2 * Math.PI, true);
				break;
			}
			var startPoint = Math.PI * (2 * soFar);
			var offsetStartPoint = startPoint - midPoint + Math.PI;
			var endPoint = Math.PI * (2 * (soFar + currentSliceValue));
			var offsetEndPoint = endPoint - midPoint + Math.PI;
			var isMajoritySlice = getMajoritySlice(currentSliceValue);
			if (!(offsetStartPoint === offsetEndPoint)) {
				view.drawPieSlice(offsetStartPoint, offsetEndPoint, isMajoritySlice);
			}
			soFar += currentSliceValue;
		}
	}
	view.completePieChartRendering(pieData);
};

var majoritySliceSet = false;

var getMajoritySlice = function (sliceValue) {
	if (sliceValue === 0.5 && !majoritySliceSet) {
		majoritySliceSet = true;
		return true;
	}
	return sliceValue > 0.5
};

var getTotalPieValue = function () {
	var totalPieValue = 0;
	for (var i = 0; i < pieData.length; ++i) {
		totalPieValue += pieData[i].sliceValue;
	}
	return totalPieValue;
};

if (view.canBrowserUseCanvasTags()) {
	view.addLoadEvent(onLoad);
}

}

// ----------------------- PieChartController.js ends here ------------------------------
// ---------------------- PieChartView.js starts here -----------------------------

ensurePackage("guardian.r2");

guardian.r2.PieChartView = function (pieChartId, percentImageSrc) {
		var canvas = document.getElementById(pieChartId);
		if (typeof window.G_vmlCanvasManager!="undefined") { //check to see if we're in IE emulating Canvas
		  	canvas = window.G_vmlCanvasManager.initElement(canvas);
		}

   		var radius, centre, radianDifference;
   		var innerCircleRadius = 30;
		var defaultColour = '#666666';
		var majorityColour = '#FF3A00';

		var doesCanvasHaveGetContext = function () {
			return canvas.getContext;
		};
		
		if (doesCanvasHaveGetContext()) {
			var context = canvas.getContext('2d');
		}
		
		this.addLoadEvent = function (callback) {
			callback();
		};
		
		
		this.canBrowserUseCanvasTags = doesCanvasHaveGetContext;
		
		this.getCanvasDimensions = function () {
			return [canvas.width, canvas.height];
		};
		
		this.setRadius = function (newRadius) {
			radius = newRadius;
		};
		
		this.setCentre = function (newCentre) {
			centre = newCentre;
		};
		
		this.drawPieSlice = function (startPoint, endPoint, isMajoritySlice) {
			context.beginPath();
		    context.moveTo(centre[0], centre[1]); // center of the pie
		    context.arc(centre[0], centre[1], radius, startPoint, endPoint, false);
		    context.lineTo(centre[0], centre[1]); // line back to the center
		    context.closePath();
		    context.fillStyle = isMajoritySlice ? majorityColour : defaultColour;
		    context.fill();
		};
		
		this.completePieChartRendering = function (pieData) {
			placeInnerCircle();
			addPercentageImage();
			placePercentageValueLabels(pieData);
		};
		
		var placeInnerCircle = function () {
			context.beginPath();
		    context.moveTo(centre[0], centre[1]); // center of the pie
		    context.arc(centre[0], centre[1], innerCircleRadius, 0, 2 * Math.PI, false);
		    context.lineTo(centre[0], centre[1]); // line back to the center
		    context.closePath();
		    context.fillStyle = '#FFFFFF';    // color
		    context.fill();
		};
		
		var addPercentageImage = function() {
			var img = new Image();   // Create new Image object
			img.onload = function (){
			  context.drawImage(img, centre[0] - 17, centre[1] - 15);
			};
			img.src = percentImageSrc;
		};
		
		var placePercentageValueLabels = function (pieData) {
			var containerDiv = getAncestorOfType(canvas, 'div');
			var divTop = radius - 8;
			var divWidth = (radius - innerCircleRadius);
			var divs = ['left', 'right'];
			for (var i = 0; i < divs.length; ++i) {
				var myDiv = document.createElement('div');
				myDiv.innerHTML = pieData[i].sliceValue;
				myDiv.className = 'pie-values';
				myDiv.style.top = divTop + 'px';
				myDiv.style.width = divWidth  + 'px';
				myDiv.style.left = (i === 0) ? '0' : (canvas.width - divWidth) + 'px';
				containerDiv.appendChild(myDiv);
			}
		};
		


}

// ----------------------- PieChartView.js ends here ------------------------------
// ---------------------- ProfileLinkController.js starts here -----------------------------

ensurePackage("guardian.r2");

guardian.r2.ProfileLinkController = function (profileLinkView, userProfileUrl) {
	
	function setUserProfileLink() {
		var atCookie = profileLinkView.readATCookie();
		
		if (atCookie) {
			var userNameRegExp = /\&a=([\w]*)\&/;
			var userName = atCookie.match(userNameRegExp)[1];
			var completeUrl = userProfileUrl + userName;
			profileLinkView.setUserProfileLink(completeUrl);
		}
	}
	if (profileLinkView.isUserLoggedIn()) {
		profileLinkView.addLoadEvent(setUserProfileLink);
	}
}

// ----------------------- ProfileLinkController.js ends here ------------------------------
// ---------------------- ProfileLinkView.js starts here -----------------------------

ensurePackage("guardian.r2");

guardian.r2.ProfileLinkView = function (elementName) {

	this.readATCookie = function () {
		return readCookie('at');
	};
	
	this.addLoadEvent = function (callback) {
		addEvent(document, 'load', callback);
	};
	
	this.setUserProfileLink = function (url) {
		var anchor = document.getElementById('profile-link');
		
		if (anchor) {
			anchor.href = url;
			var profileLinkHolder = document.getElementById('profile-link-holder');
			profileLinkHolder.style.display = '';
		}
	};

	this.isUserLoggedIn = function() {
		return isUserLoggedIntoRegPss();	
	};	

}


// ----------------------- ProfileLinkView.js ends here ------------------------------

// ---------------------- SignInController.js starts here -----------------------------

ensurePackage("guardian.r2");

guardian.r2.SignInController = function (signInView, signInListeners, obfuscationService, popupUrl) {
	var instance = this;
	var savedDestinationUrl;
	
	this.submitSignInForm = function (event) {
		
		var formFields = signInView.getPasswordAndChallenge2FormFields();
		var obfuscated_tokens = obfuscationService.encryptPassword(formFields.password, formFields.challenge2);
		var hidden_password = signInView.hidePassword();

		urlStack.clearUrlStack();
		urlStack.pushUrlOntoStack(savedDestinationUrl);

		signInView.submitForm(obfuscated_tokens, hidden_password);	
		
		guardian.r2.event.stop(event)
		return false;
	};
	
	this.forwardToRegistrationPage = function (event) {
		urlStack.clearUrlStack();
		urlStack.pushUrlOntoStack(savedDestinationUrl);
	};
	
	this.openSignInBox = function (event, getTargetUrlCallback, getClassNameCallback) {
		savedDestinationUrl = getTargetUrlCallback(event);

		signInView.createScriptElements();
		signInView.createDivElements();
		
		var packageCode = signInView.getPackageCode(event, getClassNameCallback);
		var popupUrlWithPackageCode = popupUrl;
		
		if(packageCode){
			popupUrlWithPackageCode = popupUrl + "?package=" +packageCode;
		}
		
		showSignInBox(popupUrlWithPackageCode);
		
		guardian.r2.event.stop(event);
		return false;
	};
	
	this.pushLocationToUrlStack = function () {
		var documentLocation = signInView.getDocumentLocation();
		urlStack.clearUrlStack();
		urlStack.pushUrlOntoStack(documentLocation);
	};
	
	this.closeSignInBox = function (event) {
		signInView.closeDialogBox();
		
		guardian.r2.event.stop(event);
		return false;
	};
	
	function showSignInBox(requestUrl) {
		var ajaxRequest = new guardian.r2.ajax.Request(requestUrl, {
			method: 'get',
			onSuccess: instance.showSignInBoxSuccess,
	 		onFailure: function (transport) {
				signInView.updateAndShowDialogBox(transport.responseText);
				signInView.addSignInFormListeners(
						instance.submitSignInForm, 
						instance.closeSignInBox,
						instance.forwardToRegistrationPage);
			}
		});
	};
	
	this.showSignInBoxSuccess = function (transport){
		signInView.updateAndShowDialogBox(transport.responseText);
		signInView.addSignInFormListeners(
			instance.submitSignInForm, 
			instance.closeSignInBox, 
			instance.forwardToRegistrationPage);	
		signInView.setFocus();
	};
	
	this.addListenersTo = function (element) {
		if (!signInView.isUserLoggedIn()) {
			if(!element) {
				element = signInView.getDocumentBody();
			}
			signInListeners.addRegisterListeners(element, instance.pushLocationToUrlStack);
			signInListeners.addLoginListeners(element, instance.openSignInBox);
		}
	};

	if (!signInView.isUserLoggedIn()) {
		signInView.addLoadEvent(instance.addListenersTo);
	}	
}

// ----------------------- SignInController.js ends here ------------------------------
// ---------------------- SignInListeners.js starts here -----------------------------

ensurePackage("guardian.r2");

guardian.r2.SignInListeners = function () {
	
	this.addLoginListeners = function (inElement, openSignInBoxCallback) {
		addClickListenersToMatchingElements(	inElement, 
						'a.same-page-login-required', 
						function (event) {
							openSignInBoxCallback(event, getTargetUrlFromSamePageLoginAnchor,getClassNameFromSamePageLoginAnchor);
						});
		
		addClickListenersToMatchingElements(	inElement, 
						'a.anchor-based-login-required', 
						function (event) {
							openSignInBoxCallback(event, getTargetUrlFromAnchorBasedLogin, getClassNameFromAnchorBasedLogin);
						});
		
		addClickListenersToMatchingElements(	inElement, 
						'form input.form-based-login-required', 
						function (event) {
							openSignInBoxCallback(event, getTargetUrlFromFormBasedLogin, getClassNameFromFormBasedLogin);
						});
	};
	
	this.addRegisterListeners = function (inElement, registerCallback) {
		addClickListenersToMatchingElements( inElement, 'a.register-required', registerCallback);
	};
	
	function getTargetUrlFromSamePageLoginAnchor(event) {
		return document.location;
	};
	
	function getClassNameFromSamePageLoginAnchor(event) {
		return getAncestorOfType(guardian.r2.event.getElement(event), 'a').className;
	};
	
	function getTargetUrlFromAnchorBasedLogin(event) {
		return getAncestorOfType(guardian.r2.event.getElement(event), 'a').href;
	};
	
	function getClassNameFromAnchorBasedLogin(event) {
		return getAncestorOfType(guardian.r2.event.getElement(event), 'a').className;
	};

	function getTargetUrlFromFormBasedLogin(event) {
		return getAncestorOfType(guardian.r2.event.getElement(event), 'form').action;
	};
	
	function getClassNameFromFormBasedLogin(event) {
		return guardian.r2.event.getElement(event).className;
	};
	
};
// ---------------------- SignInView.js starts here -----------------------------

ensurePackage("guardian.r2");

guardian.r2.SignInView = function (scriptLocation) {

	var instance = this;
	
	var dummy = '----------------------------------------';
	var dialogBoxDivId = "signin-div";
	var wrapperDivId = "signin-div-wrapper";
	
	var dialogBox = new guardian.r2.DialogBox();
	
	this.getDocumentBody = function () {
		return document.body;
	};
	
	this.addLoadEvent = function (callback) {
		addEvent(document, 'load', callback);
	};
	
	this.addSignInFormListeners = function(submitCallback, closeCallback, registerCallback) {
		addEvent(document.getElementById('popUpSignIn'), 'click', submitCallback);
		addEvent(document.getElementById('login-close-link'), "click", closeCallback);
		addEvent(document.getElementById('cancelSignIn'), "click", closeCallback);
		addEvent(document.getElementById('signin-popup-registration-link'), "click", registerCallback);
	};
		
	this.hidePassword = function (){
		return dummy.substr(0, document.getElementById('inline-password').value.length);
	};
	
	this.getPasswordAndChallenge2FormFields = function () {
		return {challenge2 : document.getElementById('AU_CHALLENGE2').value, password : document.getElementById('inline-password').value};			
	};
	
	this.submitForm = function (obfuscated_tokens, hidden_password) {
	
		document.getElementById('AU_PASSWORD_HASH').value = obfuscated_tokens;
		document.getElementById('inline-password').value = hidden_password;
		
		document.getElementById('regpss1').submit();
	};
	
	this.createScriptElements = function () {
		importScript(scriptLocation);
	};
	
	this.createDivElements = function () {
		createWrapperDiv();
		
		if(!document.getElementById(dialogBoxDivId)) {
			var dialogBoxDivElement = document.createElement("div");
			dialogBoxDivElement.id = dialogBoxDivId;
			dialogBoxDivElement.className = "dialog-box";
			document.body.appendChild(dialogBoxDivElement);
		}	
	};
	
	this.updateAndShowDialogBox = function(text){
		document.getElementById(dialogBoxDivId).innerHTML = text;		
		dialogBox.showDialogBox(document.getElementById(dialogBoxDivId), document.getElementById(wrapperDivId), false);
	};
	
	this.closeDialogBox = function () {
		var signInBoxWrapper = document.getElementById(wrapperDivId);
		var signInBox = document.getElementById(dialogBoxDivId);
		
		signInBox.style.display = "none";
		signInBoxWrapper.style.display = "none";
		
		dialogBox.hideDialogBox(signInBoxWrapper);
	};
	
	function createWrapperDiv() {
		if (!document.getElementById(wrapperDivId)) {
			var wrapperDivElement = document.createElement("div");
			wrapperDivElement.id = wrapperDivId;
			wrapperDivElement.className = "dialog-wrapper";
			document.body.appendChild(wrapperDivElement);
		}		
	};
	
	this.getDocumentLocation = function() {
		return document.location;
	};
	
	this.getPackageCode = function (event, getClassNameCallback){
		
		var className = getClassNameCallback(event);
		if(className) {
			var packageRequiredMatcher = /package-required-(\w+)/;
			var match = packageRequiredMatcher.exec(className);
			if (match) {
				return match[1];
			}	
		}
				
		return null;
	};
	
	this.setFocus = function (){
		document.getElementById('inline-email').focus();
	};
	
	this.isUserLoggedIn = function() {
		return isUserLoggedIntoRegPss();	
	};	
}

// ----------------------- SignUpView.js ends here ------------------------------

/* ---- TechnoratiController.js ---- */
ensurePackage("guardian.r2");
guardian.r2.TechnoratiController = function (technoratiView, technoratiService) {
	
	var instance = this;
	
	this.technoratiScriptLoadedCallback = function () {
		var response = technoratiService.getBlogs();
		
		if (response.blogs.length > 0) {
			technoratiView.insertTechnoratiHTML(response);
		} else {
			technoratiView.onZeroBlogs(response);
		}
	};
	
	this.technoratiScriptErrorCallback = function () {
		technoratiView.onError();
	};
	
	technoratiView.addTechnoratiScript(technoratiService.getEndPointUrl(), instance.technoratiScriptLoadedCallback, instance.technoratiScriptErrorCallback);
};

// ----------------------- TechnoratiController.js ends here ------------------------------
/* ---- TechnoratiMostBloggedService.js ---- */
ensurePackage("guardian.r2");
guardian.r2.TechnoratiMostBloggedService = function (numberOfBlogsToShow) {
	
	var instance = this;
	
	this.getBlogs = function () {
		var data = {blogs : []};
		var response = instance.getTechnoratiResponse();
		
		if (response && response.length > 0) {
			var maxentries = (numberOfBlogsToShow < response.length ? numberOfBlogsToShow : response.length);
			for(var i = 0; i < maxentries; i++) {
				data.blogs[i] = response[i];
			}
		}
		
		return data;
	};
		
	this.getEndPointUrl = function () {
		return "http://mp.technorati.com/440/roundup.json";
	};
	
	this.getTechnoratiResponse = function () {
		return technorati_roundup;
	}
};

// ----------------------- TechnoratiMostBloggedService.js ends here ------------------------------
/* ---- TechnoratiMostBloggedView.js ---- */
ensurePackage("guardian.r2");

guardian.r2.TechnoratiMostBloggedView = function(templateElementName, targetElement, tabBodyDivId) {
	
	var instance = this;
	var controller;
	
	this.addTechnoratiScript = function(jsUrl, technoratiScriptLoadedCallback, technoratiScriptErrorCallback) {
		importScript(jsUrl, technoratiScriptLoadedCallback, /* force IE to use timers */true, "completed", technoratiScriptErrorCallback);
	};
	
	this.getTechnoratiResponse = function () {
		return technorati_roundup;
	};

	this.insertTechnoratiHTML = function(json) {
		document.getElementById(targetElement).innerHTML = TrimPath.processDOMTemplate(templateElementName, json);
	};
	
	this.onZeroBlogs = function () {
		hideTabOnBlogComponent();
	};
	
	this.onError = function () {
		hideTabOnBlogComponent();
	};
	
	var hideTabOnBlogComponent = function() {
		guardian.r2.dom.element.addClassName(document.getElementById('most-blogged-tab'), 'hidden');
		document.getElementById(tabBodyDivId).style.display = "none";
	}
};


// ----------------------- TechnoratiMostBloggedView.js ends here ------------------------------
/* ---- TechnoratiRelatedBlogsService.js ---- */
ensurePackage("guardian.r2");
guardian.r2.TechnoratiRelatedBlogsService = function (url, displayMode, minAuthorityLevel, numberOfBlogsToShow) {
	
	var instance = this;
	
	this.getBlogs = function () {
		var data = {
			blogs : [],
			numberOfBlogs : 0,
			pageUrl : url
		};
		
		var response = instance.getTechnoratiResponse();
		
		data.numberOfBlogs = response.length;
		if (response && response.length > 0) {
			data.blogs = filterBlogs(response);
		}
		
		return data;
	};
		
	this.getEndPointUrl = function () {
		return "http://mp.technorati.com/440/json/" + url;
	};
	
	this.getTechnoratiResponse = function () {
		return technorati_article;
	};
	
	var filterBlogs = function (response) {
		var blogs = [];
		if (displayMode === "DETAIL") {
			var maxentries = (numberOfBlogsToShow < response.length ? numberOfBlogsToShow : response.length);
			for(var i = 0 ; blogs.length < maxentries && i < response.length ; i++) {
				var blog = response[i]; 
				if (blog.inboundlinks >= minAuthorityLevel ) {
					blogs.push(blog);
				}
			}
		}
		return blogs;
	}
};

// ----------------------- TechnoratiRelatedBlogsService.js ends here ------------------------------
/* ---- TechnoratiRelatedBlogsView.js ---- */
ensurePackage("guardian.r2");

guardian.r2.TechnoratiRelatedBlogsView = function(templateElementName, targetElement, componentDivId, isOnPageEditor) {
	
	var instance = this;
	var controller;
	
	this.addTechnoratiScript = function(jsUrl, technoratiScriptLoadedCallback, technoratiScriptErrorCallback) {
		importScript(jsUrl, technoratiScriptLoadedCallback, /* force IE to use timers */true, "completed", technoratiScriptErrorCallback);
	};
	
	this.getTechnoratiResponse = function () {
		return technorati_article;
	};

	this.insertTechnoratiHTML = function(json) {
		// factor pluck specific template functions out of frontend templateRenderer and use it here. 
		json._MODIFIERS = {
			formatDateISO : function(dateString) {
				return guardian.r2.DateUtil.formatDateFromISO(dateString, new Date().toUTCString());
			}
		};
		document.getElementById(targetElement).innerHTML = TrimPath.processDOMTemplate(templateElementName, json);
		showComponent();
	};
	
	this.onZeroBlogs = function (response) {
		if (response.numberOfBlogs > 0) {
			instance.insertTechnoratiHTML(response);
		}
		else {
			setPageEditorMessage();
		}
	};
	
	this.onError = function () {
		setPageEditorMessage();
	};
	
	function showComponent() {
		document.getElementById(componentDivId).style.display = "block";
	}
	
	function setPageEditorMessage() {
		if(isOnPageEditor) {
			showComponent();
			document.getElementById(componentDivId).innerHTML = "This is where the content of this related blogs component would appear, if there were any.";
		}
	}
};


// ----------------------- TechnoratiRelatedBlogsView.js ends here ------------------------------
// ---------------------- twitterController.js starts here -----------------------------

ensurePackage("guardian.r2");

guardian.r2.TwitterController = function (view) {

var init = function () {
	view.init();
};

var onLoad = function () {
	init();
}

if (view.canBrowserUseCanvasTags) {
	view.addLoadEvent(onLoad);
};

}
// ----------------------- twitterController.js ends here ------------------------------
// ---------------------- TwitterView.js starts here -----------------------------

ensurePackage("guardian.r2");

guardian.r2.TwitterView = function (twitterBalloonColour, twitterTextColour, imgPathLeft, imgPathRight) {

		var instance = this;
		
		var currentTweet = 0;
		
		var canvas = document.getElementById('twitter-balloon');
		if (typeof window.G_vmlCanvasManager!="undefined") { //check to see if we're in IE emulating Canvas
			canvas = window.G_vmlCanvasManager.initElement(canvas);
		}
		
		document.getElementById('nojs-balloon').style.display='none';

		this.init = function(){
			if(document.getElementById && document.createTextNode){
				var list = document.getElementById('tweets');
				if(list){
					items = list.getElementsByTagName('li');
					all = items.length;
					if(all > 1){
						guardian.r2.dom.element.addClassName(list, 'js');
						instance.createNav(list);
					}
				}
			}
		twitterShow();
		};
		
		var doesCanvasHaveGetContext = function () {
			return canvas.getContext;
		};
		
		if (doesCanvasHaveGetContext()) {
			var context = canvas.getContext('2d');
		}
		
		this.canBrowserUseCanvasTags = doesCanvasHaveGetContext;
		
		drawTwitterBalloon();
		
		this.addEvent = function( obj, type, fn ) {
			if ( obj.attachEvent ) {
			 obj['e'+type+fn] = fn;
			 obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
			 obj.attachEvent( 'on'+type, obj[type+fn] );
			} else
			 obj.addEventListener( type, fn, false );
		}
	
		this.createNav = function(o){
			var ul = document.createElement('ul');
			guardian.r2.dom.element.addClassName(ul, 'promo-nav');
			// create previous button
			twitterPrev = document.createElement('li');
			twitterPrevLink = document.createElement('a');
			twitterPrevImg = document.createElement('img');
			twitterPrevImg.setAttribute('src', imgPathLeft);
			twitterPrevLink.setAttribute('href', '#');
			twitterPrevLink.appendChild(twitterPrevImg);
			// add click event to previous navigation
			instance.addEvent(twitterPrevLink, 'click', twitterShow);		
			twitterPrev.appendChild(twitterPrevLink);
			ul.appendChild(twitterPrev);
			// add current tweet display
			twitterCount = document.createElement('span');
			twitterTempLabel = document.createTextNode( (currentTweet+1) + ' / ' + all);
			twitterCount.appendChild(twitterTempLabel);
			ul.appendChild(twitterCount);
			// create next button
			twitterNext = document.createElement('li');
			guardian.r2.dom.element.addClassName(twitterNext, 'next-tweet');
			twitterNextLink = document.createElement('a');
			twitterNextImg = document.createElement('img');
			twitterNextImg.setAttribute('src', imgPathRight);
			twitterNextLink.setAttribute('href', '#');
			twitterNextLink.appendChild(twitterNextImg);
			// add click even to next navigation
			instance.addEvent(twitterNextLink, 'click', twitterShow);	
			twitterNext.appendChild(twitterNextLink);	
			ul.appendChild(twitterNext);
			o.parentNode.parentNode.appendChild(ul);
		};
	
		function twitterShow (e){
			if(this === twitterNextLink || this === twitterPrevLink){
				removeClassName(items[currentTweet], 'current');
				var addto = this === twitterNextLink ? -1 : 1;
				currentTweet = currentTweet + addto;
				if(currentTweet < 0){
					currentTweet = (all-1);
				}
				if(currentTweet > all-1){
					currentTweet = 0;
				}
			}
			var templabel = document.createTextNode( (currentTweet+1) + ' / ' + all);
			twitterCount.replaceChild(templabel, twitterCount.firstChild);
			guardian.r2.dom.element.addClassName(items[currentTweet], 'current');
			items[currentTweet].getElementsByTagName('p')[0].style.color = twitterTextColour;
			items[currentTweet].getElementsByTagName('a')[0].style.color = twitterTextColour;
			
			cancelClick(e);
		};

		function cancelClick(e){
			if (window.event){
				window.event.cancelBubble = true;
				window.event.returnValue = false;
			}
			if (e && e.stopPropagation && e.preventDefault){
				e.stopPropagation();
				e.preventDefault();
			}
		};
	
		
		this.addLoadEvent = function (callback) {
			callback();
		};
		
		function roundedRect(context,x,y,width,height,radius){
		  context.beginPath();
		  context.moveTo(x,y+radius);
		  context.lineTo(x,y+height-radius);
		  context.quadraticCurveTo(x,y+height,x+radius,y+height);
		  context.lineTo(x+width-radius,y+height);
		  context.quadraticCurveTo(x+width,y+height,x+width,y+height-radius);
		  context.lineTo(x+width,y+radius);
		  context.quadraticCurveTo(x+width,y,x+width-radius,y);
		  context.lineTo(x+radius,y);
		  context.quadraticCurveTo(x,y,x,y+radius);
		  
		  context.moveTo(145,202);
		  context.lineTo(135,230);
		  context.lineTo(165,202);
		  context.lineTo(145,202);
			
		  context.fillStyle = twitterBalloonColour;
		  context.fill();
		}

		function drawTwitterBalloon (twitterBalloonColour) {
			roundedRect(context,12,12,175,190,15);
		};

}
// ----------------------- TwitterView.js ends here ------------------------------





















// ---------------------- ad_support.js starts here ---------------------------
// Time out is in minutes
var hoursToCount = 0; // Set this to make the cookie _not_ be session based (that is, an expire field is set)
var timeOut = 720;
var maxAdCount = 100;
var showAdsOnNthVideo = 2;

function buildIntrusiveAd(adHost, geoCountry, geoRegion, geoCity, geoBandwidth, randString, commercialFolder, keywords, pageUrl, site, system, blockVideoAds) {
	var theseCookies = document.cookie;
	var pos = theseCookies.indexOf('GUDHTMLAds=');
	if 	(pos == -1) {
		var seconds = 180;
		var expireTime = new Date();
		var currenttimeinmills = expireTime.getTime();
		expireTime.setTime(currenttimeinmills + seconds * 1000 );
		document.cookie = 'GUDHTMLAds=Dummy; expires=' + expireTime.toGMTString() + ' ; path=/ ; domain=guardian.co.uk';
		
        var	intrusad = 
            '<' + 'script type="text/javascript" src="' + adHost + 
            '/js.ng/spacedesc=01&amp;comfolder=' + commercialFolder + 
            '&amp;keywords=' + keywords + 
            '&amp;country=' + geoCountry + 
            '&amp;region=' + geoRegion + 
            '&amp;city=' + geoCity + 
            '&amp;bandwidth=' + geoBandwidth + 
            '&amp;rand=' + randString + 
			'&amp;site=' + site +
            '&amp;url=' + pageUrl +  
			'&amp;system=' + system + 
			'&amp;blockVideoAds=' + blockVideoAds + '"></' + 'script>';
			
		document.write(intrusad);
		document.close();
	}
}

function AdCookieValue() {
	this.date = new Date();
	this.date.setTime(0);
	this.adsPlayed = 0;
	this.videosPlayed = 0;
	
	if (hoursToCount != 0) {
		var t = new Date().getTime();
		t += hoursToCount * 1000 * 60 * 60;
		this.expiryDate = new Date();
		this.expiryDate.setTime(t);
	}
}

AdCookieValue.prototype.adDisplayed = function() {
	this.adsPlayed++;
	this.date = new Date();
}

AdCookieValue.prototype.videoDisplayed = function() {
	this.videosPlayed++;
}

AdCookieValue.prototype.shouldDisplayAdvert = function() {
	return true;  
}

AdCookieValue.parseText = function(text) {
	var bits = text.split("|");
	var cookieValue = new AdCookieValue();
	cookieValue.adsPlayed = bits[0] - 0;
	cookieValue.videosPlayed = bits[1] - 0;
	cookieValue.date.setTime(Date.parse(bits[2]));
	if (hoursToCount != 0 && bits[3]) {
		cookieValue.expiryDate.setTime(Date.parse(bits[3]));
	}
	return cookieValue;
}

AdCookieValue.prototype.toString = function() {
	if (hoursToCount != 0) {
		return this.adsPlayed + "|" + this.videosPlayed + "|" + this.date + "|" + this.expiryDate;
	} 
	return this.adsPlayed + "|" + this.videosPlayed + "|" + this.date;
}

AdCookieValue.loadFromCookie = function() {
	var cookies = document.cookie.split(';');
	
	for (var i = 0; i < cookies.length; i++) {
		var nameValuePair = cookies[i].split('=');
		if (nameValuePair[0].charAt(0) == ' ') {
			nameValuePair[0] = nameValuePair[0].substring(1, nameValuePair[0].length);
		}
		
		if (nameValuePair[0] == "GUVidAd") {
			return AdCookieValue.parseText(nameValuePair[1]);
		}
	}
	
	return new AdCookieValue();
}

function isVideoAdDisplayed() {
	return AdCookieValue.loadFromCookie().shouldDisplayAdvert();
}

function videoAdPlayed(domain) {
	var cookieValue = AdCookieValue.loadFromCookie();
	cookieValue.adDisplayed();
	writeCookie(domain, cookieValue);
}

function videoPlayed(domain) {
	var cookieValue = AdCookieValue.loadFromCookie();
	cookieValue.videoDisplayed();
	writeCookie(domain, cookieValue);
}

function writeCookie(domain, cookieValue) {
	var cookieString;
	if (hoursToCount != 0) {
		cookieString = "GUVidAd=" + cookieValue.toString() + "; expires=" + cookieValue.expiryDate.toGMTString() + " ; path=/ ; domain=" + domain;
	} else {
		cookieString = "GUVidAd=" + cookieValue.toString() + "; path=/ ; domain=" + domain;
	}
	document.cookie = cookieString;
}

// ----------------------- ad_support.js ends here ----------------------------
// --------------------------------- ajax.js -------------------------------------------

ensurePackage('guardian.r2');
(function () {
var XMLHttpArray = [
        function () {return new XMLHttpRequest()},
        function () {return new ActiveXObject("Msxml2.XMLHTTP")},
        function () {return new ActiveXObject("Microsoft.XMLHTTP")}
];

function createXMLHTTPObject() {
	var xmlhttp = false;
	for (var i = 0; i < XMLHttpArray.length; i++) {
		try {
	        xmlhttp = XMLHttpArray[i]();
		} catch (e) {
	        continue;
		}
		break;
	}
	return xmlhttp;
}

function AjaxRequest(url, requestDetails) {
        var requestObject = createXMLHTTPObject();
        var method = requestDetails.method ? requestDetails.method.toLowerCase() : 'get';
        var postBody = null;
        if (method === 'get' && requestDetails.parameters) {
        	url += ((url.indexOf('?') === -1) ? '?' : '&') + requestDetails.parameters;
        } else {
        	postBody = requestDetails.parameters;
        }
        requestObject.onreadystatechange = function () {
            if (requestObject.readyState !== 4) {
            	return;
            }
            if (requestObject.status === 200) {
	            requestDetails.onSuccess(requestObject);
            } else {
            	requestDetails.onFailure(requestObject);
            }
        }
        requestObject.open(method, url, true);
        if (method === 'post') {
        	requestObject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
        }
        requestObject.send(postBody);
}
	
guardian.r2.ajax = {
	Request : AjaxRequest
}
})();
function indeed_clk(a,sig) { var hr = a.href; var si = hr.indexOf('&jsa='); if (si > 0) return; var jsh = hr + '&jsa=' + sig; a.href = jsh; }
// ------------------------ caption.js starts here ----------------------------

function Caption() {
	
	var instance = this;
	
	this.init = function () {
		var imageList = guardian.r2.dom.element.getElementsByCssSelector('li.pixie');
		for (var i = 0; i < imageList.length; i++) {
			imageList[i].onmouseover = function () {
				instance.changeState(this, 'over');
			};
			imageList[i].onmouseout =  function () {
				instance.changeState(this, 'off');
			};
			imageList[i].onfocus = function () {
				instance.changeState(this, 'over');
			};
			imageList[i].onblur =  function () {
				instance.changeState(this, 'off');
			};
		}
	};

	this.changeState = function (element, state)  {
		var existingClassName = instance.getOldClassName(element, 'static-state');
		var currentClassName = element.className;
		var startPosition, endPosition;
	
		var isMini = classNameRegex('mini');
		if (isMini.test(currentClassName)) {
			startPosition = -7;
			endPosition = 0;
		} else {
			startPosition = -4;
			endPosition = 1.4;
		}
		
		if (currentClassName.match(/c-[0-9]+-c/)) {
			var timeOutHide = currentClassName.match(/[0-9]+/);
			timeOutHide = parseInt(timeOutHide, 10);
			clearInterval(timeOutHide);
		}
		var trailText = element.getElementsByTagName('div')[1];
		if (trailText && classNameRegex('trail-text').test(trailText.className)) {
			var elementRef = element.getElementsByTagName('div')[1];
			var timeOutRef = setInterval(function () {
				instance.show(elementRef, state, startPosition, endPosition);
			}, 10);
			element.className = existingClassName + "c-" + timeOutRef + "-c";
		}
	};
	
	this.show = function (element, state, startPosition, endPosition)  {
	
		var rate = 1;
		
		var captionPosition = parseInt(element.style.marginTop, 10);
		if (isNaN(captionPosition)) {
			captionPosition = startPosition;
		} else if (state === 'over') {	
			captionPosition = captionPosition + rate;
		} else {
			captionPosition = captionPosition - rate;
		}
		
		if (captionPosition <= endPosition && state === 'over' || captionPosition >= startPosition && state === 'off') {
			element.style.marginTop = captionPosition + 'em';
		} else {
			var timeOut = element.parentNode.className.match(/[0-9]+/);
			var existingClassName = instance.getOldClassName(element.parentNode, 'static-state');
			element.parentNode.className = existingClassName + "static-state";
			timeOut = parseInt(timeOut, 10);		
			if (!isNaN(timeOut)) {
				clearInterval(timeOut);
			}
		}
	};
	
	this.getOldClassName = function (element, modificationClass)  {
		var oldClass = '';
		if (element.className) {
			oldClass = element.className;
		} else {
			return oldClass;
		}
		var modifiedMatch = classNameRegex('(' + modificationClass + ')|(c-[0-9]+-c)');
		var newClass;
		if (modifiedMatch.test(oldClass))  {
			newClass = oldClass.replace(modifiedMatch, " ");
		} else {
			newClass = oldClass + " ";
		}
		return newClass;
	};
}

var caption = new Caption();
addEvent(window, "load", caption.init); 

// ------------------------- caption.js ends here -----------------------------
// ------------------------ clear.js starts here ------------------------------
addEvent(window, "load", handleText); 
function handleText ()  {
	if (!document.getElementsByTagName) return;
	var inputFields=document.getElementsByTagName('input');
	for (var i=0; i<inputFields.length; i++)  {
		if (inputFields[i].className.match(/\bsearch-field\b/))  {
			inputFields[i].onfocus= function () {
		
				clearText(this);
			}
			
			inputFields[i].onblur= function () {
			
				setText(this);
			}
			
		}
	}
	
}


function clearText (e)  {
	var curentText=e.value;
	var defaultText=e.getAttribute('title');
	if (curentText==defaultText) e.value ='';
	
}

function setText (e)  {
	var curentText=e.value;
	var defaultText=e.getAttribute('title');	
	if (curentText=='') e.value =defaultText;
}
// ------------------------- clear.js ends here -------------------------------
// --------------------- convert-png.js starts here ---------------------------
/*@cc_on @*/
/*@if (@_jscript_version <= 5.6)
// The above conditional compilation for IE is equivalent to
// a conditional comment in HTML of 'if lte IE 6'

addEvent(window, "load", doPng); 

function doPng()  {

	var pngsList=document.getElementsByTagName('img');
	
	var pngs = []
	forEachElementOf(pngsList, function(element) {
		pngs.push(element);
		});
	

	if(pngs.length==0) return;
	for(var i=0; i<pngs.length; i++){
	var parent=pngs[i].parentNode;
		if(pngs[i].src.match(/\.png$/) && !pngs[i].src.match("/reuters/")){
			var newImage=document.createElement("div");
			newImage.style.width=pngs[i].width+'px';
			newImage.style.height=pngs[i].height+'px';
			newImage.id=pngs[i].id;
			newImage.className=pngs[i].className;
			var mask=pngs[i].src;
			newImage.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+mask+"',sizingMethod='scale')";			
			parent.replaceChild(newImage, pngs[i]);
		}
		
	}
	
}
/*@end @*/
// ---------------------- convert-png.js ends here ----------------------------
/* ---- DateUtil.js ---- */
ensurePackage("guardian.r2.DateUtil");

guardian.r2.DateUtil.myParseDate = function (dateString) {
	return new Date(Date.parse(dateString.replace(/(\d\d?:\d\d?:\d\d?)(:\d?\d?\d?)?/, "$1")));
};

guardian.r2.DateUtil.formatDate = function (commentDateString, currentDateString) {
	var commentDate = guardian.r2.DateUtil.myParseDate(commentDateString);
	var currentDate = guardian.r2.DateUtil.myParseDate(currentDateString);
	
	var relativeTimeDifference = guardian.r2.DateUtil.relativeTimeDifference(commentDate.toUTCString(), currentDate.toUTCString());
	if (relativeTimeDifference !== "") {
		if (relativeTimeDifference.indexOf("hour") > 0) {
			relativeTimeDifference = "about " +relativeTimeDifference;
		}
		relativeTimeDifference =  " (" +relativeTimeDifference + ")";
	}
	
	return commentDate.formatDate('M d y, g:ia') + relativeTimeDifference;
};

guardian.r2.DateUtil.formatDateFromISO = function (dateTimeString, currentDateString) {
	var dateTimeSplit = dateTimeString.split("T");
	var formattedDate = dateTimeSplit[0].replace(/-/g, "/");
	var dateTime = new Date(formattedDate + " " + dateTimeSplit[1]);

	var now = new Date(currentDateString);
	var relativeTimeDifference = guardian.r2.DateUtil.relativeTimeDifference(dateTime.toUTCString(), now.toUTCString());
	if (relativeTimeDifference !== "") {
		return relativeTimeDifference;
	} else {
		return dateTime.formatDate('M d y, g:ia');
	}
};

//dateString and currentDateString should be UTC formatted
guardian.r2.DateUtil.relativeTimeDifference = function (dateString, currentDateString) {
	var date = guardian.r2.DateUtil.myParseDate(dateString);
	var currentDate = guardian.r2.DateUtil.myParseDate(currentDateString);
	
	var relativeTimeDifference = "";
	var difference = currentDate.getTime() - date.getTime();

	if (difference < 60 * 60 * 1000) {
		var minutesAgo = Math.round(difference / (1000 * 60));
		if (minutesAgo > 1) {
			relativeTimeDifference = minutesAgo + " minutes ago";
		} else {
			relativeTimeDifference = "1 minute ago";
		}
	}
	else if (Math.round(difference / (1000 * 60 * 60)) < 24) {
		var hoursAgo = Math.round(difference / (1000 * 60 * 60));
		if (hoursAgo > 1) {
			relativeTimeDifference = hoursAgo + " hours ago";
		}
		else {
			relativeTimeDifference = hoursAgo + " hour ago";
		}
	}
	return relativeTimeDifference;
};

guardian.r2.DateUtil.formatToISO = function (dateString) {
	var pad = function (number) {
        return (number > 9) ? number : '0' + number;
	};

	var date = new Date(dateString);
	return date.getFullYear() + '-' + pad(date.getMonth() + 1) + '-' + pad(date.getDate());
};
// --------------------------------- dom.js -------------------------------------------

ensurePackage('guardian.r2');

guardian.r2.dom = {
	
	element : new function () {
		var instance = this;
		
		function hasClassNameFunction(className) {
			var classNameRegExp = new RegExp('(^| )' + className + '( |$)');
			return function (inputElement) {
				return classNameRegExp.test(inputElement.className);
			};
		}

		this.hasClassName = function (inputElement, className) {
			return hasClassNameFunction(className)(inputElement);
		};
		
		this.addClassName = function (inputElement, className) {
			if (!instance.hasClassName(inputElement, className)) {
				inputElement.className += ' ' + className;
				inputElement.className = inputElement.className.replace(/^\s|\s$/, '');
			}
		}
		
		//syntax : 'li.pixie a.class-name'. Only supports class & tag Names
		this.getElementsByCssSelector = function (cssExpression, parentElement) {
			
			if (isArray(cssExpression)) {
				var results = [];
				var cssExpressionLength = cssExpression.length;
				for (var i = 0; i < cssExpressionLength; i++) {
					results = results.concat(getElementsByIndividualCssSelector(cssExpression[i], parentElement));
				}
				return results;
			}
			return getElementsByIndividualCssSelector(cssExpression, parentElement);
			
		};

		var getElementsByIndividualCssSelector = function (cssExpression, parentElement) {
			var cssParts = cssExpression.split(' ');
			var firstTagAndClassNamePair = cssParts[0];
			var moreTagAndClassNamePairs = cssParts.slice(1).join(' ');
			
			// extract tag and classname
			var firstTagAndClassNamePairSplit = firstTagAndClassNamePair.split('.'); 
			var tagType = firstTagAndClassNamePairSplit[0];
			var className = firstTagAndClassNamePairSplit[1];
			
			var selectedElements = instance.getElementsByClassName(className, tagType, parentElement);

			if (moreTagAndClassNamePairs) { // If this exists, then we want to process the child elements
				var matchingElementList = [];
				var selectedElementsLength = selectedElements.length;
				var getElementsByCssSelector = instance.getElementsByCssSelector;
				for (var i = 0; i < selectedElementsLength; i++) {
					// recurse
					matchingElementList = matchingElementList.concat(getElementsByCssSelector(moreTagAndClassNamePairs, selectedElements[i]));
				}
				return matchingElementList; //This produces the final result.
			}
			return selectedElements;
		};

		this.getElementsByClassName = function(className, tagType, parentElement) {
		
			parentElement = parentElement ? parentElement : document;
			className = className ? className : null;
			
			if (!!document.evaluate && className) {
				var expression;
				if (tagType) {
					expression = ".//" + tagType + "[contains(concat(' ', @class, ' '), ' " + className + " ')]";
				} else {
					expression = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]";
				}
				var query = document.evaluate(expression, parentElement, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
				
				var results = [];
				for (var i = 0, length = query.snapshotLength; i < length; i++) {
					results.push(query.snapshotItem(i));
				}
				
				return results;
			}

			tagType = tagType ? tagType : '*';

			var matchingTags = parentElement.getElementsByTagName(tagType);
			if (className) {
				var matchingElements = [];
				var matchingTagsLength = matchingTags.length;
				var elementHasSuppliedClassName = hasClassNameFunction(className);
				for (var  i = 0; i < matchingTagsLength; i++) {
					if (elementHasSuppliedClassName(matchingTags[i])) {
						matchingElements.push(matchingTags[i])
					}
				}
				return matchingElements;
			}
			return convertNodeListToArray(matchingTags);

		};
		
		var convertNodeListToArray = function (listLikeObject) {
			var currentPlace = listLikeObject.length;
			var results = [];
			while (currentPlace--) {
			    results[currentPlace] = listLikeObject[currentPlace];
			}
			return results;
		}
	},
	
	form : new function () {
		var instance = this;
		var inputTags = ['input', 'textarea', 'select'];
		this.serializeForm = function (domForm) {
			var serializedFields = [];
			for (var i = 0; i <inputTags.length; i++) {
				var fields = domForm.getElementsByTagName(inputTags[i]);
				for (var j = 0; j < fields.length; j++) {
					var field = fields[j];
					if (!field.disabled && field.name) {
						serializedFields.push(instance.serialize(field));
					}
				}
			}
			var formAction = domForm.action;
			return serializedFields.join('&');
		};
		
		this.serialize = function (element) {
			var tagType = element.tagName.toLowerCase();
			var elValue = null;
			switch (tagType) {
			case 'textarea':
				elValue = element.value;
				break;
			case 'input':
				switch (element.type.toLowerCase()) {
				case 'radio':
				case 'checkbox':
					elValue = element.checked ? element.value : null;
					break;
				default:
					elValue = element.value;
					break;
				}
				break;
			case 'select':
				var selectedOptions = [];
				for(var k = 0; k < element.options.length; k++){
					if(element.options[k].selected){
						selectedOptions.push(element.options[k].value ? element.options[k].value : element.options[k].text);
						if(!element.multiple) {
							break;
						}
					}
				}
				if (selectedOptions.length > 0) {
					elValue = selectedOptions.join(',');
				}
			}				
			
			if(elValue !== null){
				return encodeURIComponent(element.name) + "=" + encodeURIComponent(elValue);
			}
			
		}
	}
}
// --------------------------------- event.js -------------------------------------------

ensurePackage('guardian.r2');

guardian.r2.event = {

	stop : function (event) {
		event = event || window.event; //IE.
		if (event.preventDefault) {
			event.preventDefault();
		} else { //IE
			event.returnValue = false;
		}
		if (event.stopPropagation) {
			event.stopPropagation();
		} else { //IE. Again.
			event.cancelBubble = true;
		}
	},
	
	getElement : function (event) {
		if ( !event.target ) {
			event.target = event.srcElement || document;
		}
		// check if target is a textnode (safari)
		if ( event.target.nodeType == 3 ) {
			event.target = event.target.parentNode;
		}
		return event.target;
	}
	
}
// ---------------------- fixframes.js starts here -----------------------------
function forceTickerIframeReload() {

    var tickerIfame = document.getElementById('ticker-frame');
    
    if (tickerIfame && tickerIfame.src && tickerIfame.contentWindow) {
        tickerIfame.contentWindow.location = tickerIfame.src;
    }
}

if (!(guardian.r2.browser.isIE6 || guardian.r2.browser.isIE7)) {
    addEvent(window, "load", forceTickerIframeReload);
}

// ----------------------- fixframes.js ends here ------------------------------
// --------------------- font-sizer.js starts here ----------------------------
/*
	this script adjusts the font-size of the document in 10% increments.
	it checks for the sizing-widget id and then attaches click events 
	it also sets a cookie to rember the font size for 1 year form the last visit

*/

/*
	if javascript is turned off the links goto larger.html and smaller.html
	these pages should explain about what the widget is for and how to adjust 
	the font-size in the browser...
*/

addEvent(window, "load", fontSizer);
addEvent(window, "load", fontSizerSidebar);
addEvent(window, "load", setFontSize);

function fontSizer() {
	_fontSizer(document.getElementById('larger'), document.getElementById('smaller'));
}

function fontSizerSidebar() {
	_fontSizer(document.getElementById('larger-sidebar'), document.getElementById('smaller-sidebar'));
}

function _fontSizer(increase, decrease) {
	
	if (!increase || !decrease) {
		return;
	}

	increase.style.display="inline";
	decrease.style.display="inline";
	
	var myDate= new Date();
	expires=myDate.getFullYear()+1
	myDate.setFullYear(expires);
	expires='; expires='+myDate.toGMTString();
	
	increase.onclick= function() {
		//get the calculated font-size
		if (document.getElementsByTagName('body')[0].style.fontSize)  {
			var currentSize=document.getElementsByTagName('body')[0].style.fontSize;
			
			currentSize=currentSize.match(/([0-9]+)/);
			currentSize=(Number(currentSize[0])+10)+'%';

		}else{//no calculated font size so we are just starting
			var currentSize='110%';
		}
		
		document.getElementsByTagName('body')[0].style.fontSize=currentSize;
		document.cookie="fontSize="+currentSize+expires;
		return false;
	}
	
	decrease.onclick= function() {
		//get the calculated font-size
		if (document.getElementsByTagName('body')[0].style.fontSize)  {
			var currentSize=document.getElementsByTagName('body')[0].style.fontSize;
			currentSize=currentSize.match(/([0-9]+)/);
			currentSize=(Number(currentSize[0])-10);
			if (currentSize<60) currentSize=60;
			currentSize=currentSize+'%';
		} else {//no calculated font size so we are just starting
			var currentSize='90%';
		}
		document.getElementsByTagName('body')[0].style.fontSize=currentSize;
		document.cookie="fontSize="+currentSize+expires;
		return false;
	}
}

/*
	Get the cookie and set the adjusted font-size
*/

function setFontSize ()  {
	var cookies=document.cookie;
	var cookieList=cookies.split(';');
	var fontSize='';

	for ( var i=0; i<cookieList.length; i++)  {
		if (cookieList[i].match('fontSize')) fontSize=cookieList[i];
	}
	if (fontSize)  {	
		fontSize=fontSize.match((/([0-9]+\%)/))[0];
		document.getElementsByTagName('body')[0].style.fontSize=fontSize;
	}
}
// ---------------------- font-sizer.js ends here -----------------------------
// -----------------------formChecker.js starts here ------------------------------

function _formChecker(elem, limit, warning) {
var charsLeft = limit-elem.value.length;
	warning.innerHTML=charsLeft + ' characters left';
	warning.className = "";
	if(elem.value.length>limit) {
	elem.value=elem.value.substring(0,limit);
	warning.innerHTML = "Max 250 characters";
	warning.className = "warning";
	elem.scrollTop = elem.scrollHeight - elem.clientHeight;
	}
}

function formChecker(elem, limit) {
	_formChecker(elem, limit, document.getElementById('warning'));
}

function formCheckerSide(elem, limit) {
	_formChecker(elem, limit, document.getElementById('warning-side'));
}
/* ---- formatDate.js ---- */
// formatDate :
// a PHP date like function, for formatting date strings
// authored by Svend Tofte <www.svendtofte.com>
// the code is in the public domain
//
// see http://www.svendtofte.com/code/date_format/
// and http://www.php.net/date
//
// thanks to
//  - Daniel Berlin <mail@daniel-berlin.de>,
//    major overhaul and improvements
//  - Matt Bannon,
//    correcting some stupid bugs in my days-in-the-months list!
//
// input : format string
// time : epoch time (seconds, and optional)
//
// if time is not passed, formatting is based on
// the current "this" date object's set time.
//
// supported switches are
// a, A, B, c, d, D, F, g, G, h, H, i, I (uppercase i), j, l (lowecase L),
// L, m, M, n, N, O, P, r, s, S, t, U, w, W, y, Y, z, Z
//
// unsupported (as compared to date in PHP 5.1.3)
// T, e, o
//
// [TomG IuliaA] Fixed option 'g' so that it returns 12:39am instead of 0:39am

Date.prototype.formatDate = function (input,time) {

    var daysLong =    ["Sunday", "Monday", "Tuesday", "Wednesday",
                       "Thursday", "Friday", "Saturday"];
    var daysShort =   ["Sun", "Mon", "Tue", "Wed",
                       "Thu", "Fri", "Sat"];
    var monthsShort = ["Jan", "Feb", "Mar", "Apr",
                       "May", "Jun", "Jul", "Aug", "Sep",
                       "Oct", "Nov", "Dec"];
    var monthsLong =  ["January", "February", "March", "April",
                       "May", "June", "July", "August", "September",
                       "October", "November", "December"];

    var switches = { // switches object

        a : function () {
            // Lowercase Ante meridiem and Post meridiem
            return date.getHours() > 11? "pm" : "am";
        },

        A : function () {
            // Uppercase Ante meridiem and Post meridiem
            return (this.a().toUpperCase ());
        },

        B : function (){
            // Swatch internet time. code simply grabbed from ppk,
            // since I was feeling lazy:
            // http://www.xs4all.nl/~ppk/js/beat.html
            var off = (date.getTimezoneOffset() + 60)*60;
            var theSeconds = (date.getHours() * 3600) +
                             (date.getMinutes() * 60) +
                              date.getSeconds() + off;
            var beat = Math.floor(theSeconds/86.4);
            if (beat > 1000) beat -= 1000;
            if (beat < 0) beat += 1000;
            if ((String(beat)).length == 1) beat = "00"+beat;
            if ((String(beat)).length == 2) beat = "0"+beat;
            return beat;
        },

        c : function () {
            // ISO 8601 date (e.g.: "2004-02-12T15:19:21+00:00"), as per
            // http://www.cl.cam.ac.uk/~mgk25/iso-time.html
            return (this.Y() + "-" + this.m() + "-" + this.d() + "T" +
                    this.h() + ":" + this.i() + ":" + this.s() + this.P());
        },

        d : function () {
            // Day of the month, 2 digits with leading zeros
            var j = String(this.j());
            return (j.length == 1 ? "0"+j : j);
        },

        D : function () {
            // A textual representation of a day, three letters
            return daysShort[date.getDay()];
        },

        F : function () {
            // A full textual representation of a month
            return monthsLong[date.getMonth()];
        },

        g : function () {
            // 12-hour format of an hour without leading zeros
            if (date.getHours() > 12) {
            	return date.getHours()-12;
            } else {
            	if (date.getHours() === 0) {
            		return 12;
            	} else {
            		return date.getHours();
            	}
            }
        },

        G : function () {
            // 24-hour format of an hour without leading zeros
            return date.getHours();
        },

        h : function () {
            // 12-hour format of an hour with leading zeros
            var g = String(this.g());
            return (g.length == 1 ? "0"+g : g);
        },

        H : function () {
            // 24-hour format of an hour with leading zeros
            var G = String(this.G());
            return (G.length == 1 ? "0"+G : G);
        },

        i : function () {
            // Minutes with leading zeros
            var min = String (date.getMinutes ());
            return (min.length == 1 ? "0" + min : min);
        },

        I : function () {
            // Whether or not the date is in daylight saving time (DST)
            // note that this has no bearing in actual DST mechanics,
            // and is just a pure guess. buyer beware.
            var noDST = new Date ("January 1 " + this.Y() + " 00:00:00");
            return (noDST.getTimezoneOffset () ==
                    date.getTimezoneOffset () ? 0 : 1);
        },

        j : function () {
            // Day of the month without leading zeros
            return date.getDate();
        },

        l : function () {
            // A full textual representation of the day of the week
            return daysLong[date.getDay()];
        },

        L : function () {
            // leap year or not. 1 if leap year, 0 if not.
            // the logic should match iso's 8601 standard.
            // http://www.uic.edu/depts/accc/software/isodates/leapyear.html
            var Y = this.Y();
            if (
                (Y % 4 == 0 && Y % 100 != 0) ||
                (Y % 4 == 0 && Y % 100 == 0 && Y % 400 == 0)
                ) {
                return 1;
            } else {
                return 0;
            }
        },

        m : function () {
            // Numeric representation of a month, with leading zeros
            var n = String(this.n());
            return (n.length == 1 ? "0"+n : n);
        },

        M : function () {
            // A short textual representation of a month, three letters
            return monthsShort[date.getMonth()];
        },

        n : function () {
            // Numeric representation of a month, without leading zeros
            return date.getMonth()+1;
        },

        N : function () {
            // ISO-8601 numeric representation of the day of the week
            var w = this.w();
            return (w == 0 ? 7 : w);
        },

        O : function () {
            // Difference to Greenwich time (GMT) in hours
            var os = Math.abs(date.getTimezoneOffset());
            var h = String(Math.floor(os/60));
            var m = String(os%60);
            h.length == 1? h = "0"+h:1;
            m.length == 1? m = "0"+m:1;
            return date.getTimezoneOffset() < 0 ? "+"+h+m : "-"+h+m;
        },

        P : function () {
            // Difference to GMT, with colon between hours and minutes
            var O = this.O();
            return (O.substr(0, 3) + ":" + O.substr(3, 2));
        },

        r : function () {
            // RFC 822 formatted date
            var r; // result
            //  Thu         ,     21               Dec              2000
            r = this.D() + ", " + this.d() + " " + this.M() + " " + this.Y() +
            //    16          :    01          :    07               0200
            " " + this.H() + ":" + this.i() + ":" + this.s() + " " + this.O();
            return r;
        },

        s : function () {
            // Seconds, with leading zeros
            var sec = String (date.getSeconds ());
            return (sec.length == 1 ? "0" + sec : sec);
        },

        S : function () {
            // English ordinal suffix for the day of the month, 2 characters
            switch (date.getDate ()) {
                case  1: return ("st");
                case  2: return ("nd");
                case  3: return ("rd");
                case 21: return ("st");
                case 22: return ("nd");
                case 23: return ("rd");
                case 31: return ("st");
                default: return ("th");
            }
        },

        t : function () {
            // thanks to Matt Bannon for some much needed code-fixes here!
            var daysinmonths = [null,31,28,31,30,31,30,31,31,30,31,30,31];
            if (this.L()==1 && this.n()==2) return 29; // ~leap day
            return daysinmonths[this.n()];
        },

        U : function () {
            // Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
            return Math.round(date.getTime()/1000);
        },

        w : function () {
            // Numeric representation of the day of the week
            return date.getDay();
        },

        W : function () {
            // Weeknumber, as per ISO specification:
            // http://www.cl.cam.ac.uk/~mgk25/iso-time.html

            var DoW = this.N ();
            var DoY = this.z ();

            // If the day is 3 days before New Year's Eve and is Thursday or earlier,
            // it's week 1 of next year.
            var daysToNY = 364 + this.L () - DoY;
            if (daysToNY <= 2 && DoW <= (3 - daysToNY)) {
                return 1;
            }

            // If the day is within 3 days after New Year's Eve and is Friday or later,
            // it belongs to the old year.
            if (DoY <= 2 && DoW >= 5) {
                return new Date (this.Y () - 1, 11, 31).formatDate ("W");
            }

            var nyDoW = new Date (this.Y (), 0, 1).getDay ();
            nyDoW = nyDoW != 0 ? nyDoW - 1 : 6;

            if (nyDoW <= 3) { // First day of the year is a Thursday or earlier
                return (1 + Math.floor ((DoY + nyDoW) / 7));
            } else {  // First day of the year is a Friday or later
                return (1 + Math.floor ((DoY - (7 - nyDoW)) / 7));
            }
        },

        y : function () {
            // A two-digit representation of a year
            var y = String(this.Y());
            return y.substring(y.length-2,y.length);
        },

        Y : function () {
            // A full numeric representation of a year, 4 digits

            // we first check, if getFullYear is supported. if it
            // is, we just use that. ppks code is nice, but wont
            // work with dates outside 1900-2038, or something like that
            if (date.getFullYear) {
                var newDate = new Date("January 1 2001 00:00:00 +0000");
                var x = newDate .getFullYear();
                if (x == 2001) {
                    // i trust the method now
                    return date.getFullYear();
                }
            }
            // else, do this:
            // codes thanks to ppk:
            // http://www.xs4all.nl/~ppk/js/introdate.html
            var x = date.getYear();
            var y = x % 100;
            y += (y < 38) ? 2000 : 1900;
            return y;
        },


        z : function () {
            // The day of the year, zero indexed! 0 through 366
            var t = new Date("January 1 " + this.Y() + " 00:00:00");
            var diff = date.getTime() - t.getTime();
            return Math.floor(diff/1000/60/60/24);
        },

        Z : function () {
            // Timezone offset in seconds
            return (date.getTimezoneOffset () * -60);
        }

    }

    function getSwitch(str) {
        if (switches[str] != undefined) {
            return switches[str]();
        } else {
            return str;
        }
    }

    var date;
    if (time) {
        var date = new Date (time);
    } else {
        var date = this;
    }

    var formatString = input.split("");
    var i = 0;
    while (i < formatString.length) {
        if (formatString[i] == "\\") {
            // this is our way of allowing users to escape stuff
            formatString.splice(i,1);
        } else {
            formatString[i] = getSwitch(formatString[i]);
        }
        i++;
    }

    return formatString.join("");
}


// Some (not all) predefined format strings from PHP 5.1.1, which
// offer standard date representations.
// See: http://www.php.net/manual/en/ref.datetime.php#datetime.constants
//

// Atom      "2005-08-15T15:52:01+00:00"
Date.DATE_ATOM    = "Y-m-d\\TH:i:sP";
// ISO-8601  "2005-08-15T15:52:01+0000"
Date.DATE_ISO8601 = "Y-m-d\\TH:i:sO";
// RFC 2822  "Mon, 15 Aug 2005 15:52:01 +0000"
Date.DATE_RFC2822 = "D, d M Y H:i:s O";
// W3C       "2005-08-15T15:52:01+00:00"
Date.DATE_W3C     = "Y-m-d\\TH:i:sP";

addEvent(window, "load", setUpGallery); 

function setUpGallery() {
	if(!document.getElementById || !document.getElementById("shower") || !document.getElementById("overlay-wrapper")) {
		return;
	}
	var maxOpacity = 90;
	var fader = maxOpacity; 
	var fadeInterval; //The Interval set by setInterval
	var overlayWrap = document.getElementById("overlay-wrapper");
	var overlay = document.getElementById("overlay");
	var controller = document.getElementById("shower");
	
	var guGallery = {
		init : function () {
			var overlayWidth = guGallery.calculateWidth();
			overlayWrap.style.width = overlayWidth + 'px';
			overlayWrap.style.display = "block";
			if (overlayWrap.filters) {
				overlay.style.width = (overlayWidth - 20) + 'px';
			}
			controller.onclick = guGallery.switchDisplay;
			guGallery.displayIsAvailable = true; 
		},
		
		calculateWidth : function () {
			var mainPicture = document.getElementById('main-picture');
			var width = mainPicture.width;
			if(width < 500) {
				return 250;
			} else {
				return 300;
			}
		},

		switchDisplay : function () {
			try {
				clearInterval (fadeInterval);
			}
			catch(e){}
			var state = overlayWrap.className;
			if(guGallery.displayIsAvailable) {
				fadeInterval = setInterval(fadeOut, 15);
				state = state.replace("gallery-on","gallery-off");
			} else {
				fadeInterval = setInterval(fadeIn, 15);
				state = state.replace("gallery-off","gallery-on");
			}
			overlayWrap.className = state;
			return false;
		}
	};
		
	function fadeOut() {
		setOpacity(fader);
		fader = fader - 1;
		if (fader < 0) {
			clearInterval (fadeInterval);
			overlay.style.opacity = -2;
			overlay.style.display = 'none';
			guGallery.displayIsAvailable = false;
		}
	}
	
	function fadeIn() {
		overlay.style.display = 'block';
		setOpacity(fader);
		fader = fader + 1;
		if (fader > (maxOpacity - 1)) {
			clearInterval (fadeInterval);
			guGallery.displayIsAvailable = true;
			overlay.style.display = 'block';
		}
	}
	
	function setOpacity(fader) {
		if(overlay.filters) {
			overlay.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=" + fader + ")";
		} else {
			overlay.style.opacity = fader/100;
		}
	}
	
	guGallery.init();
}
var applyGenericTabs = (function () {
	
	function switchPanes(event) {
		var clickElement = guardian.r2.event.getElement(event);
		showSelectedPane(clickElement);
		showSubNavigation(clickElement);
		setTabClasses(clickElement);
		guardian.r2.event.stop(event);
	}
	
	function showSelectedPane(clickElement) {
		var selectedPaneId = clickElement.href.split('#')[1];
		var selectedPane = document.getElementById(selectedPaneId);
		if (selectedPane) {
			hideAllPanes(getAncestorOfType(clickElement, 'div'));
			selectedPane.style.display = 'block';
		}
	}

	function hideAllPanes(containingElement) {
		var paneClass = containingElement.id + '-pane';
		var panesList = guardian.r2.dom.element.getElementsByClassName(paneClass, 'div', containingElement);
		for (var i = 0; i < panesList.length; i++) {
			panesList[i].style.display = 'none';
		}
	}

	function setTabClasses(clickElement) {
		var allLinks = getAncestorOfType(clickElement, 'ul').getElementsByTagName('a');
		var inactiveClassName = "inactive";
		var classRegExp = classNameRegex(inactiveClassName);
		for (var ii = 0; ii < allLinks.length; ii++) {
			if (!guardian.r2.dom.element.hasClassName(allLinks[ii], inactiveClassName)) {
				allLinks[ii].className += " " + inactiveClassName;
			}
		}
		removeClassName(clickElement, inactiveClassName);
	}
	
	function showSubNavigation(clickElement) {
		// See the weather viewer @ twentyFourHourForecastDisplay to see how this works.
		// Basically give your previous and next anchors a 'rel' of prev or next
		// And this will dynamically rewrite the href to link to the correct page and 
		// will hide the links if there are no more pages in that direction. 
		// TODO: maxPaneNumber is hardcoded below. If this is required somewhere else,
		// consider using a variable to be passed in instead.
		if (clickElement.rel) {
			var newPane = clickElement.href;
			var newPaneNumber = parseInt(newPane.substring(newPane.length - 1), 10);
			var allAnchors = getAncestorOfType(clickElement, 'div').getElementsByTagName('a');
			var previousPaneNumber = newPaneNumber - 1;
			var nextPaneNumber = newPaneNumber + 1;
			var maxPaneNumber = 2;
			for (var i = 0; i < allAnchors.length; i++) {
				var link = allAnchors[i];
				var linkType = link.rel;
				if (linkType) {
					linkHref = link.href.substring(0, link.href.length - 1);
					switch (linkType) {
					case 'prev':
						link.href = linkHref + previousPaneNumber;
						link.style.display = (previousPaneNumber >= 0) ? 'block' : 'none';
						break;
					case 'next':
						link.href = linkHref + nextPaneNumber;
						link.style.display = (nextPaneNumber <= maxPaneNumber) ? 'block' : 'none';
						break;
					}
					
				}
			}
		}
	}
	
	// make sure the Generic Tab functionality isn't applied
	// to the same element more than once.
	var appliedElements = [];
	
	function appliedElementsDoesntContain(element) {
		for(var i = 0; i<appliedElements.length; i++) {
			if (element === appliedElements[i]) {
				return false;
			}
		}
		return true;
	};
	
	return function () {
		var toggles = guardian.r2.dom.element.getElementsByCssSelector("ul.tab-toggle");
		forEachElementOf(toggles, function (toggle) {
			if (appliedElementsDoesntContain(toggle)) {
				appliedElements.push(toggle);
				var activePaneSet = false;
				var anchors = toggle.getElementsByTagName("a");
				// Cache?
				forEachElementOf(anchors, function (anchor) {
					addEvent(anchor, 'click', switchPanes);
					if ((!activePaneSet) && (!guardian.r2.dom.element.hasClassName(anchor, 'inactive'))) {
						showSelectedPane(anchor);
						activePaneSet = true;
					}
				});
			}
		});	
	};
}) ();

/* Try to set up the generic tabs on document ready, but
 * just in case that doesn't work, do it again on load.
 */
addEvent(window, "load", applyGenericTabs);
addSafeLoadEvent(applyGenericTabs);
// ------------------------ generic-toolbox.js starts here -------------------------------

function genericToolbox() {
    
	var config = {
		toolboxClassName : '.article-toolbox',
		toolboxPopupDiv : '.toolbox-popup',
		closeLinkClass : 'share-top'
	};
	
	var articleToolboxes = guardian.r2.dom.element.getElementsByCssSelector([config.toolboxClassName]);
	for (var i = 0; i < articleToolboxes.length; i++) {
		addEvent(articleToolboxes[i], "click", handleClick);
	}
	
	var toolboxPopupDivs = guardian.r2.dom.element.getElementsByCssSelector(config.toolboxPopupDiv);
	for (var i = 0; i < toolboxPopupDivs.length; i++) {
		addEvent(toolboxPopupDivs[i], "click", closeToolboxes);
	}
	
	function handleClick(event)	{
		guardian.r2.event.stop(event);
		
		closeAllToolboxes();
				
		var target = guardian.r2.event.getElement(event);
		
		while(target.nodeName.toLowerCase() !== "a") {
			target = target.parentNode;	
		}
		
		var targetDivId = target.rel;
		var targetDiv = document.getElementById(targetDivId);
		
		var targetDivPosition = getPosition(target);		
				
		targetDiv.style.visibility = "hidden";
		targetDiv.style.display = "block";
						
		var positionOfBox = getPosition(document.getElementById("box"));
		
		targetDiv.style.left = (positionOfBox[0] + 160) + "px";
		targetDiv.style.top = targetDivPosition[1] + "px";
		
		targetDiv.style.visibility = "visible";
	}
	
	function closeToolboxes(event)
	{
		guardian.r2.event.stop(event);
		var target = guardian.r2.event.getElement(event);
		
		if (target.parentNode.parentNode.className === config.closeLinkClass) {
			closeAllToolboxes();
		}
	}
	
	function closeAllToolboxes() {
		for (var i = 0; i < toolboxPopupDivs.length; i++) {
			toolboxPopupDivs[i].style.visibility = "hidden";
			toolboxPopupDivs[i].style.display = "none";
		}
	}
	
	
	function getPosition(theElement) {
		var positionX = 0;
		var positionY = 0;
		
		while(theElement !== null)
		{
			positionX += theElement.offsetLeft;
			positionY += theElement.offsetTop;
			theElement = theElement.offsetParent;
		}
		return [positionX,positionY];
	}
}

addEvent(window, "load", genericToolbox); 

// ------------------------ generic-toolbox.js starts here -------------------------------
/* ---- geoLocatedContent.js ---- */

ensurePackage("guardian.r2");
guardian.r2.GeoLocatedContent = function(latitude, longitude, linkText, webPublicationDateTime, pageURL) {
	this.latitude = latitude;
	this.longitude = longitude;
	this.linkText = linkText;
	this.webPublicationDateTime = webPublicationDateTime;
	this.pageURL = pageURL;
};


guardian.r2.GeoLocatedContentController = function (geoLocatedContentView, geoLocatedContentList) {
	var instance = this;
	var numberOfEntries;
	
	this.initialize = function () {
		geoLocatedContentView.addLoadEvent(instance.onLoad);
		geoLocatedContentView.addUnloadEvent(instance.onUnload);
	};
	
	this.onLoad = function() {
		geoLocatedContentView.initializeMap();
		instance.displayFeedEntries(geoLocatedContentList);
	};
	
	this.displayFeedEntries = function(entries) {
	   if(entries.length > 0) {
	   	  geoLocatedContentView.showMap();
		  for(var index = 0 ; index < entries.length ; index++) {
		  	geoLocatedContentView.displayEntryOnMap(entries[index]);
		  }
		  geoLocatedContentView.zoomToLatest();
	      
	      if(entries.length > 1) {
	      geoLocatedContentView.createNav(entries.length );
	      }
	    }
	};
	
	this.onUnload = function() {
		geoLocatedContentView.unloadMaps();
	}
	
}	

/* ---- geoLocatedContent.js ends here ---- */
/*
Pull down navigation handler

*/
addEvent(window, "load", GUgetUrl);

function GUgetUrl()  {
	if (!document.getElementById('go-to')) return;
	
	var myUrl=document.getElementById('go-to');
	for(var i=0; i<myUrl.length;i++)  {

		myUrl.onchange=function ()  {
						
			window.location=this.value;
		}
	}
	
	

}

google_ad_output = 'js';
google_ad_type = 'text';
google_language = 'en';
google_encoding = 'utf8';
google_safe = 'high';

function google_ad_request_done(google_ads) {
	var google_attribution = 'Ads by Google';
	if (google_ads.length == 0) {
		return;
	}
	var s = '';
	if (google_ads[0].type == 'text') {
		s += '<h3>'+ google_attribution +'</h3>';
		s += '<ul class="results">';
		for(i=0; i < google_ads.length; ++i) {
			s += '<li>';
			s += '<h4><a target="_TOP" href="' + google_ads[i].url + '">' + google_ads[i].line1 + '</a></h4>';
			s += '<p>' + google_ads[i].line2 + ' ' + google_ads[i].line3 + '</p>';
			s += '<p><a target="_TOP" href="' + google_ads[i].url + '">' + google_ads[i].visible_url + '</a></p>';
			s += '</li>';
		}
		s += '</ul>';
	}

	function createAdvertisingDiv() {
		var advertisingDiv = document.getElementById('google-ads-container');
		if (advertisingDiv) {
			advertisingDiv.innerHTML = s;
			advertisingDiv.style.display = 'block';
		}
	}

	if (loadEventList.hasFired) {
		createAdvertisingDiv();
	} else {
		addEvent(document, 'load', createAdvertisingDiv);
	}
	
	return;
}
// ------------------------ more.js starts here -------------------------------
addEvent(window, "load", more); 

function more()  {
	if(!document.getElementById) return;
	var target, idValue;
	var n=0;
	var more= new Array();
	
	var showers=document.getElementsByTagName('a');
	for (var i=0;i<showers.length; i++)  {

		target=showers[i].href;
		if(target.match(/#.*/))  {
		
			if(showers[i].className.match('shower'))  {
				
				
				showers[i].onclick=function (e, n)  {
					target=this.href;
					idValue=target.match(/#.*/);
					idValue=idValue.toString();
					idValue=idValue.replace('#','');
					more=document.getElementById(idValue);
					if (!this.className.match('open'))  {
						if(this.className)
							{
								var oldClassName=this.className;
								this.className=this.className+' open';
							}else{
								this.className="open"
							}
						more.style.display='block';
						if (!e) var e = window.event;
						if (e.clientY>120)
							{
									window.scrollBy(0,100);
							}
					}else{
						var oldClassName=this.className
						oldClassName=oldClassName.replace(/ ?open/,'');
						this.className=oldClassName;
						
						more.style.display='none';
						//this.className="closed";
					}
	
					return false;
				}
			}
		}
	}	
}

//event.clientY ie
// ------------------------- more.js ends here --------------------------------
// -------------------- post-load-images.js starts here ----------------------------

var postLoadImage = function postLoadImageFactory() {
    var imagesToLoad = {};
    
    function postLoadImage(elementId, url) {
        imagesToLoad[elementId] = url;
    }
    
    function loadImages() {
        for (var elementId in imagesToLoad) {
            if (imagesToLoad.hasOwnProperty(elementId)) {
                document.getElementById(elementId).src = imagesToLoad[elementId];
            }
        }
    }
    addEvent(window, "load", loadImages); 
    
    return postLoadImage;
}();

var applyImageMask = function applyImageMaskFactory() {
    var imagesToMask = {};
    
    function applyImageMask(elementId, maskName) {
        imagesToMask[elementId] = maskName;
    }
    
    function applyImageMasks() {
        for (var elementId in imagesToMask) {
            if (imagesToMask.hasOwnProperty(elementId)) {
	            var originalElement = document.getElementById(elementId);
	            var parentNode = originalElement.parentNode;
	            var parentNodeName = parentNode.nodeName;
	            if (parentNodeName.match(/^a$|^div/i) && parentNode.lastChild.className !== 'mask') {
	                var maskName = imagesToMask[elementId];
	                applyImageMaskImmediate(originalElement, maskName);
	            }
	        }
        }
    }
    addEvent(window, "load", applyImageMasks); 
    
    return applyImageMask;
}();

// -------------------- post-load-images.js ends here ----------------------------
// ---------------------- search-bg.js starts here ----------------------------
addEvent(window, "load", guWebSearch); 

function guWebSearch() {

    if(!document.getElementById('search-web') || !document.getElementById('web-search-field')) return;
    var radioButton=document.getElementById('search-web');
    var searchField = document.getElementById('web-search-field');
    
    document.getElementById('search-web').onclick = function () { doSearchBg(this); }
    
    document.getElementById('search-guardian').onclick =  function () { doSearchBg(this); }
    
    if(document.getElementById('search-section')) {
        document.getElementById('search-section').onclick =  function () { doSearchBg(this); }
    }
    
    
    function doSearchBg(elementRef) {
    
       if (elementRef.id!="search-web") {
      
            searchField.className = searchField.className.replace(/\bweb-search\b/, '');
       }else if(!searchField.className.match(/\bweb-search\b/)) {
            searchField.className = searchField.className + ' web-search';
       }
    }   
    
}
// ----------------------- search-bg.js ends here -----------------------------
// ----------------------- search.js starts here ------------------------------
function SearchForm(liveMode, browseHost, commentsSearchBaseUrl, webSearchBaseUrl) {

	if (document.getElementById("search-pluck-comments") && document.getElementById("search-pluck-comments").selected)  {
		window.location = commentsSearchBaseUrl +  '?search=' + escape(document.getElementById('web-search-field').value);
		return false;
	}
	
	var that = this;
	this.liveMode = liveMode;
	this.browseHost = browseHost;
	this.webSearchBaseUrl = webSearchBaseUrl;

	var searchForm = document.getElementById("search");
	if(searchForm) {
		var textField = document.getElementById('web-search-field');
		searchForm.action = this.browseHost + '/search';
		textField.name = 'search';
		addEvent(searchForm, 'submit', checkSubmit);
	}
	
	function checkSubmit(e) {
		var textField = document.getElementById('web-search-field');
		var form = document.getElementById('search');
		if (document.getElementById("search-web") && (document.getElementById("search-web").selected || document.getElementById("search-web").checked)) {
			if (liveMode) {
				_hbLink ('{header}{search-google}','{header}');
			}
			textField.name = 'q';
			form.action = that.webSearchBaseUrl;
		} else if (document.getElementById("search-section") && document.getElementById("search-section").selected) {
			if (liveMode) {
				_hbLink ('{header}{search-section}','{header}');
			}
			textField.name = 'search';
			form.action = that.browseHost + '/search/' + document.getElementById("search-section").value;
		} else {
			if (liveMode) {
				_hbLink ('{header}{search-gu}','{header}');
			}
			textField.name = 'search';
			form.action =  that.browseHost +  '/search';
		}
				
		return;
	}
	
}
// ------------------------- search.js ends here ------------------------------
// ------------------------ sendtoafriend.js starts here -------------------------------

addEvent(window, "load", sendAndHistoryByline); 
addEvent(window, "load", sendtoafriend); 

function sendtoafriend() {

	var linkToBlockMapping = {'sharelink' : 'send-share', 'sendlink' : 'send-email', 'historylink' : 'history-byline', 'historylink-byline' : 'history-byline' , 'contactlink' : 'contact', 'sharelinkSidebar' : 'send-share-side', 'sendlinkSidebar' : 'send-email-side', 'contactlinkSidebar' : 'contact-side'};
	var linksToAddListenersTo = [];
	var blocksAvailable = [];
	for (var map in linkToBlockMapping) {
		blocksAvailable.push(linkToBlockMapping[map]);
		var link = document.getElementById(map);
		if (link) {
			linksToAddListenersTo.push(link);
		}
	}
	function hideAllElements() {
		hideElements(blocksAvailable);
	}
	//Finds position of an element in a page
	//Taken from Quirksmode.org www.quirksmode.org/js/findpos.html
	function findPos(id){
		var curleft = curtop = 0;
		var el = document.getElementById(id);
		if (el && el.offsetParent){
			do{
				curleft += el.offsetLeft;
				curtop += el.offsetTop;
			} while (el = el.offsetParent)
		}

		return [curleft, curtop];
	}
	function positionElement(id, coordinates){
		var el = document.getElementById(id);
		if(el){
			if(coordinates[0] == 0) {
				el.style.position = 'absolute';
				el.style.left = 10 + 'px';
				el.style.top = curtop + 25 + 'px';
			} else {
				el.style.position = 'absolute';
				el.style.left = 12 + 'em';
				el.style.top = coordinates[1] + 25 + 'px';
			}
		}		
	}
	for (var i=0; i < linksToAddListenersTo.length; i++)  {
		linksToAddListenersTo[i].onclick = function (e)  {
			var showBox = linkToBlockMapping[this.id];
			showOrHideCurrentElement(showBox);
			var coordinates = findPos(this.id);
			
			if(this.id == 'historylink-byline') {
				positionElement(linkToBlockMapping[this.id], [0, curtop]);
			} else {
				positionElement(linkToBlockMapping[this.id], coordinates);
			}
			
			var hideBoxes = [];
			for (var j = 0; j < blocksAvailable.length; j++) {
				if (!blocksAvailable[j] === showBox) {
					hideBoxes.push(blocksAvailable[j]);
				}
			}
			hideElements(hideBoxes);
			var closeButtons = guardian.r2.dom.element.getElementsByCssSelector(['.send a.sendthis', '.send a.sendside']);
			for (var j = 0; j < closeButtons.length; j++) {
				addEvent(closeButtons[j], 'click', hideAllElements);
			}
			if (!e) var e = window.event;
			if (e.clientY > 500) {
				window.scrollBy(0,200);
			}
			guardian.r2.event.stop(e);
		}
	}
}

function hideElements(ids) {
	for (var i=0; i < ids.length; i++) {
		var element = document.getElementById(ids[i]);
		if (element) {
			element.style.display = 'none';
		}
	}
}

function showOrHideCurrentElement(elementId) {
	var element = document.getElementById(elementId);
	if (!element) {
		return;
	}
	if (element.style.display === 'block') {
		element.style.display = 'none';
	} else {
		element.style.display = 'block';
	}
}

function getElementsByClass (node, tag, cssClassName)
{
	var classElements = new Array();
	if (node == null) 
	{
		node = document;
	}
	if ( tag == null)
	{
		tag = '*';
	}
	
	var tempObj = node.getElementsByTagName(tag);
	var length = tempObj.length;
	
	var pattern = new RegExp("\\b" +cssClassName+ "\\b");
	for(var i = 0; i < length; i++)
	{
		if (pattern.test(tempObj[i].className))
		{
			classElements.push(tempObj[i]);
		}
	}
	return classElements;
}

function createHistoryList() {
	
	list = document.createElement('li');
	list.className = 'history';
	
	listLink = document.createElement('a');
	listLink.className = 'sendbyline';
	listLink.setAttribute('id', 'historylink-byline');
	listLink.style.cursor = "pointer";
	listLink.appendChild(document.createTextNode('Article history'));
	
	list.appendChild(listLink);
	
	return list;
}

function showHideElement(clicked) {
	if (clicked.style.display == "block") {
		clicked.style.display = "none";
	} else {
		clicked.style.display = "block";
	}
}

function sendAndHistoryByline() {

	if ((!document.getElementById("history-byline")) && 
		(!document.getElementById("contact-byline"))) { 
		return;
	}

	var els = guardian.r2.dom.element.getElementsByClassName('article-attributes');
	if(!els) {return;}

	for (var i = 0; i < els.length; i++) {
		if (!document.getElementById('contrib-shift')) {
			els[i].appendChild(createHistoryList());
		} else {
			var childUls = els[i].getElementsByTagName('ul');
			for (var i = 0; i < childUls.length; i++) {
				childUls[i].appendChild(createHistoryList());
			}
		}
	}
	
	var shares = document.getElementsByTagName('a');
	
	for (var i=0;i<shares.length; i++)  {

		var shareclass=shares[i].className;
		
		if (shareclass.match('sendbyline'))  {
			
			shares[i].onclick=function (e)  {
			
				if (this.id == "historylink-byline") {
					showHideElement(document.getElementById('history-byline'));
				} else if (this.id == "contactlink-byline") {
					showHideElement(document.getElementById('contact-byline'));
				} else {
					document.getElementById("history-byline").style.display = "none";
				}
				return false;
			}
		}
	}

}

// ------------------------ sendtoafriend.js ends here -------------------------------

/* The toggleQuizAnswers function is specifically for showing / hiding quiz answers.
Ideally, put all show / hide type functions in this file, or just have one to do everything.
SU 21/04/2008 */



if (document.getElementById && document.getElementsByTagName) {
	addEvent(window, "load", toggleQuizAnswers);
}
	
	
function toggleQuizAnswers() {				
	
	if(document.getElementById('show-answers-link')) {			    
    	var theLink = document.getElementById('show-answers-link');
		theLink.onclick = function() {
			var className = document.getElementById('quiz-answers').className;		
			if (className.indexOf('js-hider') > -1) {			
				document.getElementById('quiz-answers').className = className.replace('js-hider', 'shower');
				theLink.innerHTML='Hide answers';
			} else {					
				document.getElementById('quiz-answers').className = className.replace('shower', 'js-hider');
				theLink.innerHTML = 'Show answers';
			}
		}
	}
}
// ---------------------- signedin.js starts here -----------------------------


function UrlStack(cookieDomain) {
	this.escapePlus = function (value) {
		return escape(value).replace(/\+/, "%2B");
	};	
	
	this.cookieDomain = cookieDomain;
}

UrlStack.prototype.getCookieForUrlStack = function (name) {
	if (!document.cookie) {
		return '';
	}
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	} else
		begin += 2;

	var end = document.cookie.indexOf(";", begin);
	if (end == -1)
	end = dc.length;
	return unescape(dc.substring(begin + prefix.length, end));
}

UrlStack.prototype.setCookieForUrlStack = function (name, value) {
  var curCookie = name + "=" + this.escapePlus(value) +
      "; domain="+this.cookieDomain+"; path=/"
  document.cookie = curCookie;
}

UrlStack.prototype.pushUrlOntoStack = function(url) {
	var cookie = this.getCookieForUrlStack('GU_ST');
	var stack = cookie ? cookie.split('|') : new Array();

	if(stack.length == 0 || (stack.length > 0 && stack[stack.length-1] != url)) {
		stack[stack.length] = url;
		this.setCookieForUrlStack('GU_ST',stack.join('|'));
	}
	return true;
}
UrlStack.prototype.URLStack_pop = function() {
	var cookie = '|' + this.getCookieForUrlStack('GU_ST');
	var x = cookie.lastIndexOf('|');
	var url = cookie.substring(x + 1);
	this.setCookieForUrlStack('GU_ST',cookie.substring(0, x));
	return url;
}

UrlStack.prototype.clearUrlStack = function() {
	if (this.getCookieForUrlStack('GU_ST') != '') {
		this.setCookieForUrlStack('GU_ST','');
	}
}

function signIn() {
	urlStack.pushUrlOntoStack(document.location);
	window.location="/Users/signin/0,,-1,00.html";
	return false;
}

function signOut() {
    urlStack.pushUrlOntoStack(document.location);
    window.location = "/Users/signout/tr/1,,,00.html";
    return false;
}

// ----------------------- signedin.js ends here ------------------------------
/*
  SortTable
  version 2
  7th April 2007
  Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
  
  Instructions:
  Download this file
  Add <script src="sorttable.js"></script> to your HTML
  Add class="sortable" to any table you'd like to make sortable
  Click on the headers to sort
  
  Thanks to many, many people for contributions and suggestions.
  Licenced as X11: http://www.kryogenix.org/code/browser/licence.html
  This basically means: do what you want with it.
  
  Thank you for this "code", we have changed it a little to work.
*/

 
var stIsIE = /*@cc_on!@*/false;

sorttable = {
  init: function() {
    // quit if this function has already been called
    if (arguments.callee.done) return;
    // flag this function so we don't do the same thing twice
    arguments.callee.done = true;
    // kill the timer
    if (_timer) clearInterval(_timer);
    
    if (!document.createElement || !document.getElementsByTagName) return;
    
    sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;
    
    forEach(document.getElementsByTagName('table'), function(table) {
      if (table.className.search(/\bsortable\b/) != -1) {
        sorttable.makeSortable(table);
      }
    });
    
  },
  
  isOdd: function(number) {
  	return !(number%2 === 0);
  },
  makeSortable: function(table) {
 
    if (table.tHead.rows.length != 1) return; // can't cope with two header rows
    
    // work through each column and calculate its type
    headrow = table.tHead.rows[0].cells;
    for (var i=0; i<headrow.length; i++) {
      // manually override the type with a sorttable_type attribute
      if (!headrow[i].className.match(/\bsorttable_nosort\b/)) { // skip this col
        mtch = headrow[i].className.match(/\bsorttable_([a-z0-9]+)\b/);
        if (mtch) { override = mtch[1]; }
	      if (mtch && typeof sorttable["sort_"+override] == 'function') {
	        headrow[i].sorttable_sortfunction = sorttable["sort_"+override];
	      } else {
	        headrow[i].sorttable_sortfunction = sorttable.guessType(table,i);
	      }
	      // make it clickable to sort
	      headrow[i].sorttable_columnindex = i;
	      headrow[i].sorttable_tbody = table.tBodies[0];
	      dean_addEvent(headrow[i],"click", function(e) {

          // are we already sorted, in which case we should reverse sort?
          var reversingThisColumn = this.className.search(/\bsorttable_sorted\b/) != -1;
          
          // remove sorttable_sorted classes
          theadrow = this.parentNode;
          forEach(theadrow.childNodes, function(cell) {
            if (cell.nodeType == 1) { // an element
              cell.className = cell.className.replace('sorttable_sorted_reverse','');
              cell.className = cell.className.replace('sorttable_sorted','');
            }
          });
          sortfwdind = document.getElementById('sorttable_sortfwdind');
          if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); }
          sortrevind = document.getElementById('sorttable_sortrevind');
          if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); }
          
          this.className += reversingThisColumn ? ' sorttable_sorted_reverse' : ' sorttable_sorted';
          sortfwdind = document.createElement('span');
          sortfwdind.id = "sorttable_sortfwdind";
          
          if(reversingThisColumn) {
          	sortfwdind.innerHTML = stIsIE ? '<font face="webdings">5</font>' : '&#x25B4;';
          } else {
          	sortfwdind.innerHTML = stIsIE ? '<font face="webdings">6</font>' : '&#x25BE;';
          }
          this.appendChild(sortfwdind);

	        // build an array to sort. This is a Schwartzian transform thing,
	        // i.e., we "decorate" each row with the actual sort key,
	        // sort based on the sort keys, and then put the rows back in order
	        // which is a lot faster because you only do getInnerText once per row
	        row_array = [];
	        col = this.sorttable_columnindex;
	        rows = this.sorttable_tbody.rows;
	        for (var j=0; j<rows.length; j++) {
	          row_array[row_array.length] = [sorttable.getInnerText(rows[j].cells[col]), rows[j]];
	        }
	        /* If you want a stable sort, uncomment the following line */
	        //sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
	        /* and comment out this one */
	        
            var unreversedSortFunction = this.sorttable_sortfunction;
	        if (reversingThisColumn) {
	          var reversedSortFunction = function (a,b) {return - unreversedSortFunction(a,b);};
		      row_array.sort(reversedSortFunction);
	        } else {
		      row_array.sort(unreversedSortFunction);
		    }
	        
	        tb = this.sorttable_tbody;
	        for (var j=0; j<row_array.length; j++) {
	          var thisRow = row_array[j][1];
	          /* remove and recalculate the odd classes */
	          thisRow.className = '';
	          
	          if (sorttable.isOdd(j)) {
	          	thisRow.className = 'odd';
	          }	
	        
	          tb.appendChild(thisRow);
	        }
	        
	        delete row_array;
	      });
	    }
    }
  },
  
  guessType: function(table, column) {
    // guess the type of a column based on its first non-blank row
    sortfn = sorttable.sort_alpha;
    for (var i=0; i<table.tBodies[0].rows.length; i++) {
      text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);
      if (text != '') {
        if (text.match(/^-?[£$¤]?[\d,.]+%?$/)) {
          return sorttable.sort_numeric;
        }
        // check for a date: dd/mm/yyyy or dd/mm/yy 
        // can have / or . or - as separator
        // can be mm/dd as well
        possdate = text.match(sorttable.DATE_RE)
        if (possdate) {
          // looks like a date
          first = parseInt(possdate[1]);
          second = parseInt(possdate[2]);
          if (first > 12) {
            // definitely dd/mm
            return sorttable.sort_ddmm;
          } else if (second > 12) {
            return sorttable.sort_mmdd;
          } else {
            // looks like a date, but we can't tell which, so assume
            // that it's dd/mm (English imperialism!) and keep looking
            sortfn = sorttable.sort_ddmm;
          }
        }
      }
    }
    return sortfn;
  },
  
  getInnerText: function(node) {
    // gets the text we want to use for sorting for a cell.
    // strips leading and trailing whitespace.
    // this is *not* a generic getInnerText function; it's special to sorttable.
    // for example, you can override the cell text with a customkey attribute.
    // it also gets .value for <input> fields.
    
    hasInputs = (typeof node.getElementsByTagName == 'function') &&
                 node.getElementsByTagName('input').length;
    
    if (node.getAttribute("sorttable_customkey") != null) {
      return node.getAttribute("sorttable_customkey");
    }
    else if (typeof node.textContent != 'undefined' && !hasInputs) {
      return node.textContent.replace(/^\s+|\s+$/g, '');
    }
    else if (typeof node.innerText != 'undefined' && !hasInputs) {
      return node.innerText.replace(/^\s+|\s+$/g, '');
    }
    else if (typeof node.text != 'undefined' && !hasInputs) {
      return node.text.replace(/^\s+|\s+$/g, '');
    }
    else {
      switch (node.nodeType) {
        case 3:
          if (node.nodeName.toLowerCase() == 'input') {
            return node.value.replace(/^\s+|\s+$/g, '');
          }
        case 4:
          return node.nodeValue.replace(/^\s+|\s+$/g, '');
          break;
        case 1:
        case 11:
          var innerText = '';
          for (var i = 0; i < node.childNodes.length; i++) {
            innerText += sorttable.getInnerText(node.childNodes[i]);
          }
          return innerText.replace(/^\s+|\s+$/g, '');
          break;
        default:
          return '';
      }
    }
  },
  
  reverse: function(tbody) {
    // reverse the rows in a tbody
    newrows = [];
    for (var i=0; i<tbody.rows.length; i++) {
      newrows[newrows.length] = tbody.rows[i];
    }
    for (var i=newrows.length-1; i>=0; i--) {
       tbody.appendChild(newrows[i]);
    }
    delete newrows;
  },
  
  /* sort functions
     each sort function takes two parameters, a and b
     you are comparing a[0] and b[0] */
  sort_numeric: function(a,b) {
    aa = parseFloat(a[0].replace(/[^0-9.-]/g,''));
    if (isNaN(aa)) aa = 0;
    bb = parseFloat(b[0].replace(/[^0-9.-]/g,'')); 
    if (isNaN(bb)) bb = 0;
    return aa-bb;
  },
  sort_alpha: function(a,b) {
    if (a[0]==b[0]) return 0;
    if (a[0]<b[0]) return -1;
    return 1;
  },
  sort_ddmm: function(a,b) {
    mtch = a[0].match(sorttable.DATE_RE);
    y = mtch[3]; m = mtch[2]; d = mtch[1];
    if (m.length == 1) m = '0'+m;
    if (d.length == 1) d = '0'+d;
    dt1 = y+m+d;
    mtch = b[0].match(sorttable.DATE_RE);
    y = mtch[3]; m = mtch[2]; d = mtch[1];
    if (m.length == 1) m = '0'+m;
    if (d.length == 1) d = '0'+d;
    dt2 = y+m+d;
    if (dt1==dt2) return 0;
    if (dt1<dt2) return -1;
    return 1;
  },
  sort_mmdd: function(a,b) {
    mtch = a[0].match(sorttable.DATE_RE);
    y = mtch[3]; d = mtch[2]; m = mtch[1];
    if (m.length == 1) m = '0'+m;
    if (d.length == 1) d = '0'+d;
    dt1 = y+m+d;
    mtch = b[0].match(sorttable.DATE_RE);
    y = mtch[3]; d = mtch[2]; m = mtch[1];
    if (m.length == 1) m = '0'+m;
    if (d.length == 1) d = '0'+d;
    dt2 = y+m+d;
    if (dt1==dt2) return 0;
    if (dt1<dt2) return -1;
    return 1;
  },
  
  shaker_sort: function(list, comp_func) {
    // A stable sort function to allow multi-level sorting of data
    // see: http://en.wikipedia.org/wiki/Cocktail_sort
    // thanks to Joseph Nahmias
    var b = 0;
    var t = list.length - 1;
    var swap = true;

    while(swap) {
        swap = false;
        for(var i = b; i < t; ++i) {
            if ( comp_func(list[i], list[i+1]) > 0 ) {
                var q = list[i]; list[i] = list[i+1]; list[i+1] = q;
                swap = true;
            }
        } // for
        t--;

        if (!swap) break;

        for(var i = t; i > b; --i) {
            if ( comp_func(list[i], list[i-1]) < 0 ) {
                var q = list[i]; list[i] = list[i-1]; list[i-1] = q;
                swap = true;
            }
        } // for
        b++;

    } // while(swap)
  }  
}

addEvent(null, "load", sorttable.init);

// written by Dean Edwards, 2005
// with input from Tino Zijdel, Matthias Miller, Diego Perini

// http://dean.edwards.name/weblog/2005/10/add-event/

function dean_addEvent(element, type, handler) {
	if (element.addEventListener) {
		element.addEventListener(type, handler, false);
	} else {
		// assign each event handler a unique ID
		if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++;
		// create a hash table of event types for the element
		if (!element.events) element.events = {};
		// create a hash table of event handlers for each element/event pair
		var handlers = element.events[type];
		if (!handlers) {
			handlers = element.events[type] = {};
			// store the existing event handler (if there is one)
			if (element["on" + type]) {
				handlers[0] = element["on" + type];
			}
		}
		// store the event handler in the hash table
		handlers[handler.$$guid] = handler;
		// assign a global event handler to do all the work
		element["on" + type] = handleEvent;
	}
};
// a counter used to create unique IDs
dean_addEvent.guid = 1;

function removeEvent(element, type, handler) {
	if (element.removeEventListener) {
		element.removeEventListener(type, handler, false);
	} else {
		// delete the event handler from the hash table
		if (element.events && element.events[type]) {
			delete element.events[type][handler.$$guid];
		}
	}
};

function handleEvent(event) {
	var returnValue = true;
	// grab the event object (IE uses a global event object)
	event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
	// get a reference to the hash table of event handlers
	var handlers = this.events[event.type];
	// execute each event handler
	for (var i in handlers) {
		this.$$handleEvent = handlers[i];
		if (this.$$handleEvent(event) === false) {
			returnValue = false;
		}
	}
	return returnValue;
};

function fixEvent(event) {
	// add W3C standard event methods
	event.preventDefault = fixEvent.preventDefault;
	event.stopPropagation = fixEvent.stopPropagation;
	return event;
};
fixEvent.preventDefault = function() {
	this.returnValue = false;
};
fixEvent.stopPropagation = function() {
  this.cancelBubble = true;
}

// Dean's forEach: http://dean.edwards.name/base/forEach.js
/*
	forEach, version 1.0
	Copyright 2006, Dean Edwards
	License: http://www.opensource.org/licenses/mit-license.php
*/

// array-like enumeration
if (!Array.forEach) { // mozilla already supports this
	Array.forEach = function(array, block, context) {
		for (var i = 0; i < array.length; i++) {
			block.call(context, array[i], i, array);
		}
	};
}

// generic enumeration
Function.prototype.forEach = function(object, block, context) {
	for (var key in object) {
		if (typeof this.prototype[key] == "undefined") {
			block.call(context, object[key], key, object);
		}
	}
};

// character enumeration
String.forEach = function(string, block, context) {
	Array.forEach(string.split(""), function(chr, index) {
		block.call(context, chr, index, string);
	});
};

// globally resolve forEach enumeration
var forEach = function(object, block, context) {
	if (object) {
		var resolve = Object; // default
		if (object instanceof Function) {
			// functions have a "length" property
			resolve = Function;
		} else if (object.forEach instanceof Function) {
			// the object implements a custom forEach method so use that
			object.forEach(block, context);
			return;
		} else if (typeof object == "string") {
			// the object is a string
			resolve = String;
		} else if (typeof object.length == "number") {
			// the object is array-like
			resolve = Array;
		}
		resolve.forEach(object, block, context);
	}
};



function sportsTabs() {
	
	function init() {
		var uls = document.getElementsByTagName("ul");
		for (i = 0; i < uls.length; i++) {
			if (uls[i].className === "tab-toggle") {
				uls[i].onclick = handleClick;
				var anchors = uls[i].getElementsByTagName("a");
				var cookie = readCookie("sportsPopupTab");
				if (cookie) {
					for (var j = 0; j < anchors.length; j++) {
						if (anchors[j].href.split("#")[1] === cookie) {
							renderTabs(anchors[j]);
						}
					}
				}
				else {
					renderTabs(anchors[0]);
				}
			}
		}
	}
	if(document.body.id === "sports-popup") {
		init();
	}
	
	function handleClick(e) {
		var target;
		if (!e) {
			e = window.event;
		}
		if (e.target) {
			target = e.target;
		}
		else if (e.srcElement) {
			target = e.srcElement;
		}
		if (target.nodeType && target.nodeType === 3) {
			target = target.parentNode;
		}
		if (target.href) {
			createCookie("sportsPopupTab", target.href.split("#")[1], 7);
			renderTabs(target);
		}
		
		return false;
	}
	
	function renderTabs(target) {
		showTabPane(target);
		
		var allLinks = target.parentNode.parentNode.getElementsByTagName('a');
		for (var j = 0; j < allLinks.length; j++) {
			allLinks[j].className = "inactive";
		}
		var body = document.getElementsByTagName("body")[0];
		if (target.id === "cricket-live-score") {
			target.className = "active";
			body.className = "cricket cricket-score";
		}
		else {
			target.className = "";
			if (body.className.match(/cricket/)) {
				body.className = "cricket";
			}
		}
		
	}
	
	function showTabPane(e) {
		hideTabPane(e);
		var id = e.href.match(/#(\w.+)/)[1];
		var element = document.getElementById(id);
		if (element) {
			element.style.display = 'block';
		}
	}
	
	function hideTabPane(e) {
		var togglenode = e.parentNode.parentNode.parentNode;
		var toggleid = togglenode.id + '-pane';
		var toggleable = togglenode.getElementsByTagName('div');
		for (var i = 0; i < toggleable.length; i++) {
			var divClass = toggleable[i].className;
			if (divClass.match(toggleid)) {
				toggleable[i].style.display = 'none';
			}
		}
	}
}

if (document.getElementById && document.getElementsByTagName) {
	addEvent(window, "load", sportsTabs);
}
/* ---- PollSubmissionController.js ---- */
ensurePackage("guardian.r2.pluck");

guardian.r2.PollSubmissionController = function (view) {	
	
	function onLoad() {		
		view.addRadioClickListener(validate);
		view.addDropDownChangeListener(validate);
		
		validate();
	}
	
	function validate() {
		if (view.getIgnoredRadioGroups().length === 0 && view.getIgnoredDropDowns().length === 0) {
			view.enableVoting();
		} else {
			view.disableVoting();
		}
	}
	
	view.addLoadEvent(onLoad);
};
// ----------------------- PollSubmissionController.js ends here ------------------------------
/* ---- PollSubmissionView.js ---- */
ensurePackage("guardian.r2.pluck");

guardian.r2.pluck.PollSubmissionView = function () {	
	
	this.addLoadEvent = function (callback) {
		addSafeLoadEvent(callback);				
	};
	
	this.addRadioClickListener = function (callback) {
		var buttons = getRadioButtons();
		for (var i = 0; i < buttons.length; i++) {
			addEvent(buttons[i], 'click', callback);
		}
	};
	
	this.addDropDownChangeListener = function (callback) {
		var dropDowns = getDropDowns();
		for (var i = 0; i < dropDowns.length; i++) {
			addEvent(dropDowns[i], 'change', callback);
		}
	};
	
	this.getIgnoredRadioGroups = function () {
		var ignoredRadioGroups = [];
		var buttons = getRadioButtons();
		var checkedRadioGroups = getCheckedRadioGroups(buttons);
		
		for (var i = 0; i < buttons.length; i++) {
			if (!checkedRadioGroups[buttons[i].name]) {											
				ignoredRadioGroups[buttons[i].name] = true;
			}
		}

		return convertKeysToList(ignoredRadioGroups);		
	};
	
	this.getIgnoredDropDowns = function () {
		var ignoredDropDowns = [];
		var dropDowns = getDropDowns();
		for (var i = 0; i < dropDowns.length; i++) {
			var dropDown = dropDowns[i];
			if (dropDown.options[dropDown.selectedIndex].text === 'Please select') {
				ignoredDropDowns.push(dropDown.name);
			}
		}
		return ignoredDropDowns;
	};	
	
	this.enableVoting = function () {
		document.getElementById('submit').disabled = false;
	};
	
	this.disableVoting = function () {
		document.getElementById('submit').disabled = true;
	};
	
	function getRadioButtons() {
		
		var form = document.getElementById('poll-submission-form');
		var inputElements = guardian.r2.dom.element.getElementsByCssSelector('input', form);
		
		var radioButtons = [];
		for (var i = 0; i < inputElements.length; i++) {
			if (inputElements[i].type === 'radio') {
				radioButtons.push(inputElements[i]);
			}
		}
		
		return radioButtons;
	}	

	function getCheckedRadioGroups(buttons) {
		var checkedRadioGroups = [];
		for (var i = 0; i < buttons.length; i++) {			
			if (buttons[i].checked) {
				checkedRadioGroups[buttons[i].name] = true;
			}						
		}		
		
		return checkedRadioGroups;
	}
	
	function getDropDowns() {
		var form = document.getElementById('poll-submission-form');
		return guardian.r2.dom.element.getElementsByCssSelector('select', form);
	}	
	
	function convertKeysToList(map) {
		var list = [];
		for (var key in map) {
			if (map.hasOwnProperty(key)) {
				list.push(key);
			}
		}
		return list;
	}
	
};
// ----------------------- PollSubmissionView.js ends here ------------------------------
// ----------------- textresizedetector.js starts here ------------------------
/** 
 *  @fileoverview TextResizeDetector
 * 
 *  Detects changes to font sizes when user changes browser settings
 *  <br>Fires a custom event with the following data:<br><br>
 * 	iBase  : base font size  	
 *	iDelta : difference in pixels from previous setting<br>
 *  	iSize  : size in pixel of text<br>
 *  
 *  * @author Lawrence Carvalho carvalho@uk.yahoo-inc.com
 * @version 1.0
 *
 *	REQUIRED BY: zones-navigation-rollover
 */

/**
 * @constructor
 */
TextResizeDetector = function() { 
    var el  = null;
	var iIntervalDelay  = 200;
	var iInterval = null;
	var iCurrSize = -1;
	var iBase = -1;
 	var aListeners = [];
 	var createControlElement = function() {
	 	el = document.createElement('span');
		el.id='textResizeControl';
		el.innerHTML='&nbsp;';
		el.style.position="absolute";
		el.style.left="-9999px";
		var elC = document.getElementById(TextResizeDetector.TARGET_ELEMENT_ID);
		// insert before firstChild
		if (elC)
			elC.insertBefore(el,elC.firstChild);
		iBase = iCurrSize = TextResizeDetector.getSize();
 	};

 	function _stopDetector() {
		window.clearInterval(iInterval);
		iInterval=null;
	};
	function _startDetector() {
		if (!iInterval) {
			iInterval = window.setInterval('TextResizeDetector.detect()',iIntervalDelay);
		}
	};
 	
 	 function _detect() {
 		var iNewSize = TextResizeDetector.getSize();
		
 		if(iNewSize!== iCurrSize) {
			for (var 	i=0;i <aListeners.length;i++) {
				aListnr = aListeners[i];
				var oArgs = {  iBase: iBase,iDelta:((iCurrSize!=-1) ? iNewSize - iCurrSize + 'px' : "0px"),iSize:iCurrSize = iNewSize};
				if (!aListnr.obj) {
					aListnr.fn('textSizeChanged',[oArgs]);
				}
				else  {
					aListnr.fn.apply(aListnr.obj,['textSizeChanged',[oArgs]]);
				}
			}

 		}
 		return iCurrSize;
 	};
	var onAvailable = function() {
		
		if (!TextResizeDetector.onAvailableCount_i ) {
			TextResizeDetector.onAvailableCount_i =0;
		}

		if (document.getElementById(TextResizeDetector.TARGET_ELEMENT_ID)) {
			TextResizeDetector.init();
			if (TextResizeDetector.USER_INIT_FUNC){
				TextResizeDetector.USER_INIT_FUNC();
			}
			TextResizeDetector.onAvailableCount_i = null;
		}
		else {
			if (TextResizeDetector.onAvailableCount_i<600) {
	  	 	    TextResizeDetector.onAvailableCount_i++;
				setTimeout(onAvailable,200)
			}
		}
	};
	setTimeout(onAvailable,500);

 	return {
		 	/*
		 	 * Initializes the detector
		 	 * 
		 	 * @param {String} sId The id of the element in which to create the control element
		 	 */
		 	init: function() {
		 		
		 		createControlElement();		
				_startDetector();
 			},
			/**
			 * Adds listeners to the ontextsizechange event. 
			 * Returns the base font size
			 * 
			 */
 			addEventListener:function(fn,obj,bScope) {
				aListeners[aListeners.length] = {
					fn: fn,
					obj: obj
				}
				return iBase;
			},
			/**
			 * performs the detection and fires textSizeChanged event
			 * @return the current font size
			 * @type {integer}
			 */
 			detect:function() {
 				return _detect();
 			},
 			/**
 			 * Returns the height of the control element
 			 * 
			 * @return the current height of control element
			 * @type {integer}
 			 */
 			getSize:function() {
	 				var iSize;
			 		return el.offsetHeight;
		 		
		 		
 			},
 			/**
 			 * Stops the detector
 			 */
 			stopDetector:function() {
				return _stopDetector();
			},
			/*
			 * Starts the detector
			 */
 			startDetector:function() {
				return _startDetector();
			}
 	}
 }();

TextResizeDetector.TARGET_ELEMENT_ID = 'doc';
TextResizeDetector.USER_INIT_FUNC = null;



// ------------------ textresizedetector.js ends here -------------------------
// ------------------- textresizeinit.js starts here --------------------------
/*
	detect the users font size and adjust the layout appropriately
	
	REQUIRED BY: zones-navigation-rollover
*/
 	function init()  {
	   var iBase = TextResizeDetector.addEventListener(onFontResize,null);
	   var bodyTag = document.getElementById('wrapper');
	   if(bodyTag)  {
		   if (iBase>27)  {
				bodyTag.className='large-type';
			}
		}
	}
	//id of element to check for and insert control
	TextResizeDetector.TARGET_ELEMENT_ID = 'wrapper';
	//function to call once TextResizeDetector has init'd
	TextResizeDetector.USER_INIT_FUNC = init;
		function onFontResize(e,args) {
			// to aid navigation roll-overs
			zone_navigation_rollover.simpleNavResizer();
			// end of aid to navigaiton roll-overs
			var bodyTag = document.getElementById('wrapper');
			if(bodyTag){
				//27 is the last font size for the standard layout
				if (args[0].iSize>27)  {
					bodyTag.className='large-type';
				}
				if (args[0].iSize<26)
				{
					bodyTag.className='';
				}
			}
		}
// -------------------- textresizeinit.js ends here ---------------------------
// -------------------- togglingTabs.js starts here ---------------------------
addEvent(window, "load", tabs); 

function tabs()
{
	if(!document.getElementById('blogging-section')) return;
	
	if(!document.getElementById('most-commented-entries')){
		return;
	}
	
	document.getElementById('most-commented-entries').className = "active";
	
	var buttons=document.getElementById('blogging-section').getElementsByTagName('span');
	var bloggies=document.getElementById('blogging-section');
	
	for(var i=0; i<buttons.length; i++) {
		buttons[i].onclick= function (){
			var parent= this.parentNode
			if(this.id=="recent-entries") {
			
				this.className = "active";
				document.getElementById('most-commented-entries').className = "inactive";
			
				if(parent.getElementsByTagName('ul')[0].className.match(/\bhidden\b/)){
					toggleClass(parent);
					toggleClass(document.getElementById('most-commented-entries').parentNode);
				}
			} else {
				
				this.className = "active";
				document.getElementById('recent-entries').className = "inactive";
			
				if(parent.getElementsByTagName('ul')[0].className.match(/\bhidden\b/)){
					toggleClass(parent);
					toggleClass(document.getElementById('recent-entries').parentNode);
				}
		}
			
			function toggleClass(element){
						
				var currentClass=element.getElementsByTagName('ul')[0].className;
				if(currentClass.match(/\bvisible\b/)) currentClass=currentClass.replace(/visible/ , 'hidden');
				else if(currentClass.match(/\hidden\b/)) currentClass=currentClass.replace(/hidden/ , 'visible');	
				element.getElementsByTagName('ul')[0].className=currentClass;
			}

			
			
		}
	}
}
// -------------------- togglingTabs.js ends here ----------------------------





// -------------------- generic togglingTabs.js starts here ----------------------------

addEvent(window, "load", generictabs); 

function generictabs(activetab)
{
	if(!document.getElementById('tab-section')) return;
	
	document.getElementById('tab-default').className = "active";
	
	var buttons=document.getElementById('tab-section').getElementsByTagName('span');
	var bloggies=document.getElementById('tab-section');
	
	for(var i=0; i<buttons.length; i++) {
		buttons[i].onclick= function (){
			var parent= this.parentNode
			if(this.id=="tab-default") {
			
				this.className = "active";
				document.getElementById('tab-other').className = "inactive";
			
				if(parent.getElementsByTagName('ul')[0].className.match(/\bhidden\b/)){
					toggleClass(parent);
					toggleClass(document.getElementById('tab-other').parentNode);
				}
			} else {
				
				this.className = "active";
				document.getElementById('tab-default').className = "inactive";
			
				if(parent.getElementsByTagName('ul')[0].className.match(/\bhidden\b/)){
					toggleClass(parent);
					toggleClass(document.getElementById('tab-default').parentNode);
				}
		}
			
			function toggleClass(element){
						
				var currentClass=element.getElementsByTagName('ul')[0].className;
				if(currentClass.match(/\bvisible\b/)) currentClass=currentClass.replace(/visible/ , 'hidden');
				else if(currentClass.match(/\hidden\b/)) currentClass=currentClass.replace(/hidden/ , 'visible');	
				element.getElementsByTagName('ul')[0].className=currentClass;
			}

			
			
		}
	}
}

// -------------------- generic togglingTabs.js ends here ----------------------------
// -------------------- travel-mask.js starts here ----------------------------
function maskImages()  {
	var images = []; 
	// we need to copy the images into an array because the object returned from
	// getElementsByTagName is kept up to date - so as we add images, they appear
	// in the 'array', leading to repeated insertions.
	if(document.getElementsByTagName('body')[0].className.match('commercial'))  {
		forEachElementOf(document.getElementsByTagName('img'), function(image) {
			images.push(image);
		});
	} else {
		var divs = document.getElementsByTagName('div');
		forEachElementOf(divs, function (div) {
			if(div.className.match(/\bcommercial\b/))  {
				forEachElementOf(div.getElementsByTagName('img'), function(image) {
					images.push(image);
				});
			}
		});
	}
	
	var mask = /\bmask\b/;
	function imageDoesntAlreadyHaveOverlay(image) {
		if (image.nextSibling && image.nextSibling.className) {
			return ! image.nextSibling.className.match(mask);
		}
		return true;
	}
	
	forEachElementOf(images, function (image) {
		if (imageDoesntAlreadyHaveOverlay(image)) {
			applyImageMaskImmediate(image, 'roundedcorners');
		}
	});
}

addEvent(window, "load", maskImages);
// --------------------- travel-mask.js ends here -----------------------------
// -------------- trimpath-template-1.0.38.js starts here ---------------------
/**
 * TrimPath Template. Release 1.0.38.
 * Copyright (C) 2004, 2005 Metaha.
 * 
 * TrimPath Template is licensed under the GNU General Public License
 * and the Apache License, Version 2.0, as follows:
 *
 * This program is free software; you can redistribute it and/or 
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed WITHOUT ANY WARRANTY; without even the 
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var TrimPath;

// TODO: Debugging mode vs stop-on-error mode - runtime flag.
// TODO: Handle || (or) characters and backslashes.
// TODO: Add more modifiers.

(function() {               // Using a closure to keep global namespace clean.
    if (TrimPath == null)
        TrimPath = new Object();
    if (TrimPath.evalEx == null)
        TrimPath.evalEx = function(src) { return eval(src); };

    var UNDEFINED;
    if (Array.prototype.pop == null)  // IE 5.x fix from Igor Poteryaev.
        Array.prototype.pop = function() {
            if (this.length === 0) {return UNDEFINED;}
            return this[--this.length];
        };
    if (Array.prototype.push == null) // IE 5.x fix from Igor Poteryaev.
        Array.prototype.push = function() {
            for (var i = 0; i < arguments.length; ++i) {this[this.length] = arguments[i];}
            return this.length;
        };

    TrimPath.parseTemplate = function(tmplContent, optTmplName, optEtc) {
        if (optEtc == null)
            optEtc = TrimPath.parseTemplate_etc;
        var funcSrc = parse(tmplContent, optTmplName, optEtc);
        var func = TrimPath.evalEx(funcSrc, optTmplName, 1);
        if (func != null)
            return new optEtc.Template(optTmplName, tmplContent, funcSrc, func, optEtc);
        return null;
    }
    
    try {
        String.prototype.process = function(context, optFlags) {
            var template = TrimPath.parseTemplate(this, null);
            if (template != null)
                return template.process(context, optFlags);
            return this;
        }
    } catch (e) { // Swallow exception, such as when String.prototype is sealed.
    }
    
    TrimPath.parseTemplate_etc = {};            // Exposed for extensibility.
    TrimPath.parseTemplate_etc.statementTag = "forelse|for|if|elseif|else|var|macro";
    TrimPath.parseTemplate_etc.statementDef = { // Lookup table for statement tags.
        "if"     : { delta:  1, prefix: "if (", suffix: ") {", paramMin: 1 },
        "else"   : { delta:  0, prefix: "} else {" },
        "elseif" : { delta:  0, prefix: "} else if (", suffix: ") {", paramDefault: "true" },
        "/if"    : { delta: -1, prefix: "}" },
        "for"    : { delta:  1, paramMin: 3, 
                     prefixFunc : function(stmtParts, state, tmplName, etc) {
                        if (stmtParts[2] != "in")
                            throw new etc.ParseError(tmplName, state.line, "bad for loop statement: " + stmtParts.join(' '));
                        var iterVar = stmtParts[1];
                        var listVar = "__LIST__" + iterVar;
                        return [ "var ", listVar, " = ", stmtParts[3], ";",
                             // Fix from Ross Shaull for hash looping, make sure that we have an array of loop lengths to treat like a stack.
                             "var __LENGTH_STACK__;",
                             "if (typeof(__LENGTH_STACK__) == 'undefined' || !__LENGTH_STACK__.length) __LENGTH_STACK__ = new Array();", 
                             "__LENGTH_STACK__[__LENGTH_STACK__.length] = 0;", // Push a new for-loop onto the stack of loop lengths.
                             "if ((", listVar, ") != null) { ",
                             "var ", iterVar, "_ct = 0;",       // iterVar_ct variable, added by B. Bittman     
                             "for (var ", iterVar, "_index in ", listVar, ") { ",
                             iterVar, "_ct++;",
                             "if (typeof(", listVar, "[", iterVar, "_index]) == 'function') {continue;}", // IE 5.x fix from Igor Poteryaev.
                             "__LENGTH_STACK__[__LENGTH_STACK__.length - 1]++;",
                             "var ", iterVar, " = ", listVar, "[", iterVar, "_index];" ].join("");
                     } },
        "forelse" : { delta:  0, prefix: "} } if (__LENGTH_STACK__[__LENGTH_STACK__.length - 1] == 0) { if (", suffix: ") {", paramDefault: "true" },
        "/for"    : { delta: -1, prefix: "} }; delete __LENGTH_STACK__[__LENGTH_STACK__.length - 1];" }, // Remove the just-finished for-loop from the stack of loop lengths.
        "var"     : { delta:  0, prefix: "var ", suffix: ";" },
        "macro"   : { delta:  1, 
                      prefixFunc : function(stmtParts, state, tmplName, etc) {
                          var macroName = stmtParts[1].split('(')[0];
                          return [ "var ", macroName, " = function", 
                                   stmtParts.slice(1).join(' ').substring(macroName.length),
                                   "{ var _OUT_arr = []; var _OUT = { write: function(m) { if (m) _OUT_arr.push(m); } }; " ].join('');
                     } }, 
        "/macro"  : { delta: -1, prefix: " return _OUT_arr.join(''); };" }
    }
    TrimPath.parseTemplate_etc.modifierDef = {
        "eat"        : function(v)    { return ""; },
        "escape"     : function(s)    { return String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"); },
        "capitalize" : function(s)    { return String(s).toUpperCase(); },
        "default"    : function(s, d) { return s != null ? s : d; }
    }
    TrimPath.parseTemplate_etc.modifierDef.h = TrimPath.parseTemplate_etc.modifierDef.escape;

    TrimPath.parseTemplate_etc.Template = function(tmplName, tmplContent, funcSrc, func, etc) {
        this.process = function(context, flags) {
            if (context == null)
                context = {};
            if (context._MODIFIERS == null)
                context._MODIFIERS = {};
            if (context.defined == null)
                context.defined = function(str) { return (context[str] != undefined); };
            for (var k in etc.modifierDef) {
                if (context._MODIFIERS[k] == null)
                    context._MODIFIERS[k] = etc.modifierDef[k];
            }
            if (flags == null)
                flags = {};
            var resultArr = [];
            var resultOut = { write: function(m) { resultArr.push(m); } };
            try {
                func(resultOut, context, flags);
            } catch (e) {
                if (flags.throwExceptions == true)
                    throw e;
                var result = new String(resultArr.join("") + "[ERROR: " + e.toString() + (e.message ? '; ' + e.message : '') + "]");
                result["exception"] = e;
                return result;
            }
            return resultArr.join("");
        }
        this.name       = tmplName;
        this.source     = tmplContent; 
        this.sourceFunc = funcSrc;
        this.toString   = function() { return "TrimPath.Template [" + tmplName + "]"; }
    }
    TrimPath.parseTemplate_etc.ParseError = function(name, line, message) {
        this.name    = name;
        this.line    = line;
        this.message = message;
    }
    TrimPath.parseTemplate_etc.ParseError.prototype.toString = function() { 
        return ("TrimPath template ParseError in " + this.name + ": line " + this.line + ", " + this.message);
    }
    
    var parse = function(body, tmplName, etc) {
        body = cleanWhiteSpace(body);
        var funcText = [ "var TrimPath_Template_TEMP = function(_OUT, _CONTEXT, _FLAGS) { with (_CONTEXT) {" ];
        var state    = { stack: [], line: 1 };                              // TODO: Fix line number counting.
        var endStmtPrev = -1;
        while (endStmtPrev + 1 < body.length) {
            var begStmt = endStmtPrev;
            // Scan until we find some statement markup.
            begStmt = body.indexOf("{", begStmt + 1);
            while (begStmt >= 0) {
                var endStmt = body.indexOf('}', begStmt + 1);
                var stmt = body.substring(begStmt, endStmt);
                var blockrx = stmt.match(/^\{(cdata|minify|eval)/); // From B. Bittman, minify/eval/cdata implementation.
                if (blockrx) {
                    var blockType = blockrx[1]; 
                    var blockMarkerBeg = begStmt + blockType.length + 1;
                    var blockMarkerEnd = body.indexOf('}', blockMarkerBeg);
                    if (blockMarkerEnd >= 0) {
                        var blockMarker;
                        if( blockMarkerEnd - blockMarkerBeg <= 0 ) {
                            blockMarker = "{/" + blockType + "}";
                        } else {
                            blockMarker = body.substring(blockMarkerBeg + 1, blockMarkerEnd);
                        }                        
                        
                        var blockEnd = body.indexOf(blockMarker, blockMarkerEnd + 1);
                        if (blockEnd >= 0) {                            
                            emitSectionText(body.substring(endStmtPrev + 1, begStmt), funcText);
                            
                            var blockText = body.substring(blockMarkerEnd + 1, blockEnd);
                            if (blockType == 'cdata') {
                                emitText(blockText, funcText);
                            } else if (blockType == 'minify') {
                                emitText(scrubWhiteSpace(blockText), funcText);
                            } else if (blockType == 'eval') {
                                if (blockText != null && blockText.length > 0) // From B. Bittman, eval should not execute until process().
                                    funcText.push('_OUT.write( (function() { ' + blockText + ' })() );');
                            }
                            begStmt = endStmtPrev = blockEnd + blockMarker.length - 1;
                        }
                    }                        
                } else if (body.charAt(begStmt - 1) != '$' &&               // Not an expression or backslashed,
                           body.charAt(begStmt - 1) != '\\') {              // so check if it is a statement tag.
                    var offset = (body.charAt(begStmt + 1) == '/' ? 2 : 1); // Close tags offset of 2 skips '/'.
                                                                            // 10 is larger than maximum statement tag length.
                    if (body.substring(begStmt + offset, begStmt + 10 + offset).search(TrimPath.parseTemplate_etc.statementTag) == 0) 
                        break;                                              // Found a match.
                }
                begStmt = body.indexOf("{", begStmt + 1);
            }
            if (begStmt < 0)                              // In "a{for}c", begStmt will be 1.
                break;
            var endStmt = body.indexOf("}", begStmt + 1); // In "a{for}c", endStmt will be 5.
            if (endStmt < 0)
                break;
            emitSectionText(body.substring(endStmtPrev + 1, begStmt), funcText);
            emitStatement(body.substring(begStmt, endStmt + 1), state, funcText, tmplName, etc);
            endStmtPrev = endStmt;
        }
        emitSectionText(body.substring(endStmtPrev + 1), funcText);
        if (state.stack.length != 0)
            throw new etc.ParseError(tmplName, state.line, "unclosed, unmatched statement(s): " + state.stack.join(","));
        funcText.push("}}; TrimPath_Template_TEMP");
        return funcText.join("");
    }
    
    var emitStatement = function(stmtStr, state, funcText, tmplName, etc) {
        var parts = stmtStr.slice(1, -1).split(' ');
        var stmt = etc.statementDef[parts[0]]; // Here, parts[0] == for/if/else/...
        if (stmt == null) {                    // Not a real statement.
            emitSectionText(stmtStr, funcText);
            return;
        }
        if (stmt.delta < 0) {
            if (state.stack.length <= 0)
                throw new etc.ParseError(tmplName, state.line, "close tag does not match any previous statement: " + stmtStr);
            state.stack.pop();
        } 
        if (stmt.delta > 0)
            state.stack.push(stmtStr);

        if (stmt.paramMin != null &&
            stmt.paramMin >= parts.length)
            throw new etc.ParseError(tmplName, state.line, "statement needs more parameters: " + stmtStr);
        if (stmt.prefixFunc != null)
            funcText.push(stmt.prefixFunc(parts, state, tmplName, etc));
        else 
            funcText.push(stmt.prefix);
        if (stmt.suffix != null) {
            if (parts.length <= 1) {
                if (stmt.paramDefault != null)
                    funcText.push(stmt.paramDefault);
            } else {
                for (var i = 1; i < parts.length; i++) {
                    if (i > 1)
                        funcText.push(' ');
                    funcText.push(parts[i]);
                }
            }
            funcText.push(stmt.suffix);
        }
    }

    var emitSectionText = function(text, funcText) {
        if (text.length <= 0)
            return;
        var nlPrefix = 0;               // Index to first non-newline in prefix.
        var nlSuffix = text.length - 1; // Index to first non-space/tab in suffix.
        while (nlPrefix < text.length && (text.charAt(nlPrefix) == '\n'))
            nlPrefix++;
        while (nlSuffix >= 0 && (text.charAt(nlSuffix) == ' ' || text.charAt(nlSuffix) == '\t'))
            nlSuffix--;
        if (nlSuffix < nlPrefix)
            nlSuffix = nlPrefix;
        if (nlPrefix > 0) {
            funcText.push('if (_FLAGS.keepWhitespace == true) _OUT.write("');
            var s = text.substring(0, nlPrefix).replace('\n', '\\n'); // A macro IE fix from BJessen.
            if (s.charAt(s.length - 1) == '\n')
            	s = s.substring(0, s.length - 1);
            funcText.push(s);
            funcText.push('");');
        }
        var lines = text.substring(nlPrefix, nlSuffix + 1).split('\n');
        for (var i = 0; i < lines.length; i++) {
            emitSectionTextLine(lines[i], funcText);
            if (i < lines.length - 1)
                funcText.push('_OUT.write("\\n");\n');
        }
        if (nlSuffix + 1 < text.length) {
            funcText.push('if (_FLAGS.keepWhitespace == true) _OUT.write("');
            var s = text.substring(nlSuffix + 1).replace('\n', '\\n');
            if (s.charAt(s.length - 1) == '\n')
            	s = s.substring(0, s.length - 1);
            funcText.push(s);
            funcText.push('");');
        }
    }
    
    var emitSectionTextLine = function(line, funcText) {
        var endMarkPrev = '}';
        var endExprPrev = -1;
        while (endExprPrev + endMarkPrev.length < line.length) {
            var begMark = "${", endMark = "}";
            var begExpr = line.indexOf(begMark, endExprPrev + endMarkPrev.length); // In "a${b}c", begExpr == 1
            if (begExpr < 0)
                break;
            if (line.charAt(begExpr + 2) == '%') {
                begMark = "${%";
                endMark = "%}";
            }
            var endExpr = line.indexOf(endMark, begExpr + begMark.length);         // In "a${b}c", endExpr == 4;
            if (endExpr < 0)
                break;
            emitText(line.substring(endExprPrev + endMarkPrev.length, begExpr), funcText);                
            // Example: exprs == 'firstName|default:"John Doe"|capitalize'.split('|')
            var exprArr = line.substring(begExpr + begMark.length, endExpr).replace(/\|\|/g, "#@@#").split('|');
            for (var k in exprArr) {
                if (exprArr[k].replace) // IE 5.x fix from Igor Poteryaev.
                    exprArr[k] = exprArr[k].replace(/#@@#/g, '||');
            }
            funcText.push('_OUT.write(');
            emitExpression(exprArr, exprArr.length - 1, funcText); 
            funcText.push(');');
            endExprPrev = endExpr;
            endMarkPrev = endMark;
        }
        emitText(line.substring(endExprPrev + endMarkPrev.length), funcText); 
    }
    
    var emitText = function(text, funcText) {
        if (text == null ||
            text.length <= 0)
            return;
        text = text.replace(/\\/g, '\\\\');
        text = text.replace(/\n/g, '\\n');
        text = text.replace(/"/g,  '\\"');
        funcText.push('_OUT.write("');
        funcText.push(text);
        funcText.push('");');
    }
    
    var emitExpression = function(exprArr, index, funcText) {
        // Ex: foo|a:x|b:y1,y2|c:z1,z2 is emitted as c(b(a(foo,x),y1,y2),z1,z2)
        var expr = exprArr[index]; // Ex: exprArr == [firstName,capitalize,default:"John Doe"]
        if (index <= 0) {          // Ex: expr    == 'default:"John Doe"'
            funcText.push(expr);
            return;
        }
        var parts = expr.split(':');
        funcText.push('_MODIFIERS["');
        funcText.push(parts[0]); // The parts[0] is a modifier function name, like capitalize.
        funcText.push('"](');
        emitExpression(exprArr, index - 1, funcText);
        if (parts.length > 1) {
            funcText.push(',');
            funcText.push(parts[1]);
        }
        funcText.push(')');
    }

    var cleanWhiteSpace = function(result) {
        result = result.replace(/\t/g,   "    ");
        result = result.replace(/\r\n/g, "\n");
        result = result.replace(/\r/g,   "\n");
        result = result.replace(/^(\s*\S*(\s+\S+)*)\s*$/, '$1'); // Right trim by Igor Poteryaev.
        return result;
    }

    var scrubWhiteSpace = function(result) {
        result = result.replace(/^\s+/g,   "");
        result = result.replace(/\s+$/g,   "");
        result = result.replace(/\s+/g,   " ");
        result = result.replace(/^(\s*\S*(\s+\S+)*)\s*$/, '$1'); // Right trim by Igor Poteryaev.
        return result;
    }

    // The DOM helper functions depend on DOM/DHTML, so they only work in a browser.
    // However, these are not considered core to the engine.
    //
    TrimPath.parseDOMTemplate = function(elementId, optDocument, optEtc) {
        if (optDocument == null)
            optDocument = document;
        var element = optDocument.getElementById(elementId);
        var content = element.value;     // Like textarea.value.
        if (content == null)
            content = element.innerHTML; // Like textarea.innerHTML.
        content = content.replace(/&lt;/g, "<").replace(/&gt;/g, ">");
        return TrimPath.parseTemplate(content, elementId, optEtc);
    }

    TrimPath.processDOMTemplate = function(elementId, context, optFlags, optDocument, optEtc) {
        return TrimPath.parseDOMTemplate(elementId, optDocument, optEtc).process(context, optFlags);
    }
}) ();
// --------------- trimpath-template-1.0.38.js endss here ---------------------
// ------------------------ ufo.js starts here --------------------------------
/*	Unobtrusive Flash Objects (UFO) v3.21 <http://www.bobbyvandersluis.com/ufo/>
	Copyright 2005, 2006 Bobby van der Sluis
	This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
*/

var UFO = {
	req: ["movie", "width", "height", "majorversion", "build"],
	opt: ["play", "loop", "menu", "quality", "scale", "salign", "wmode", "bgcolor", "base", "flashvars", "devicefont", "allowscriptaccess", "seamlesstabbing", "allowfullscreen"],
	optAtt: ["id", "name", "align"],
	optExc: ["swliveconnect"],
	ximovie: "ufo.swf",
	xiwidth: "215",
	xiheight: "138",
	ua: navigator.userAgent.toLowerCase(),
	pluginType: "",
	fv: [0,0],
	foList: [],
		
	create: function(FO, id) {
		if (!UFO.uaHas("w3cdom") || UFO.uaHas("ieMac")) return;
		UFO.getFlashVersion();
		UFO.foList[id] = UFO.updateFO(FO);
		UFO.createCSS("#" + id, "visibility:hidden;");
		UFO.domLoad(id);
	},

	updateFO: function(FO) {
		if (typeof FO.xi != "undefined" && FO.xi == "true") {
			if (typeof FO.ximovie == "undefined") FO.ximovie = UFO.ximovie;
			if (typeof FO.xiwidth == "undefined") FO.xiwidth = UFO.xiwidth;
			if (typeof FO.xiheight == "undefined") FO.xiheight = UFO.xiheight;
		}
		FO.mainCalled = false;
		return FO;
	},

	domLoad: function(id) {
		var _t = setInterval(function() {
			if ((document.getElementsByTagName("body")[0] != null || document.body != null) && document.getElementById(id) != null) {
				UFO.main(id);
				clearInterval(_t);
			}
		}, 250);
		if (typeof document.addEventListener != "undefined") {
			document.addEventListener("DOMContentLoaded", function() { UFO.main(id); clearInterval(_t); } , null); // Gecko, Opera 9+
		}
	},

	main: function(id) {
		var _fo = UFO.foList[id];
		if (_fo.mainCalled) return;
		UFO.foList[id].mainCalled = true;
		document.getElementById(id).style.visibility = "hidden";
		if (UFO.hasRequired(id)) {
			if (UFO.hasFlashVersion(parseInt(_fo.majorversion, 10), parseInt(_fo.build, 10))) {
				if (typeof _fo.setcontainercss != "undefined" && _fo.setcontainercss == "true") UFO.setContainerCSS(id);
				UFO.writeSWF(id);
			}
			else if (_fo.xi == "true" && UFO.hasFlashVersion(6, 65)) {
				UFO.createDialog(id);
			}
		}
		document.getElementById(id).style.visibility = "visible";
	},
	
	createCSS: function(selector, declaration) {
		var _h = document.getElementsByTagName("head")[0]; 
		var _s = UFO.createElement("style");
		if (!UFO.uaHas("ieWin")) _s.appendChild(document.createTextNode(selector + " {" + declaration + "}")); // bugs in IE/Win
		_s.setAttribute("type", "text/css");
		_s.setAttribute("media", "screen"); 
		_h.appendChild(_s);
		if (UFO.uaHas("ieWin") && document.styleSheets && document.styleSheets.length > 0) {
			var _ls = document.styleSheets[document.styleSheets.length - 1];
			if (typeof _ls.addRule == "object") _ls.addRule(selector, declaration);
		}
	},
	
	setContainerCSS: function(id) {
		var _fo = UFO.foList[id];
		var _w = /%/.test(_fo.width) ? "" : "px";
		var _h = /%/.test(_fo.height) ? "" : "px";
		UFO.createCSS("#" + id, "width:" + _fo.width + _w +"; height:" + _fo.height + _h +";");
		if (_fo.width == "100%") {
			UFO.createCSS("body", "margin-left:0; margin-right:0; padding-left:0; padding-right:0;");
		}
		if (_fo.height == "100%") {
			UFO.createCSS("html", "height:100%; overflow:hidden;");
			UFO.createCSS("body", "margin-top:0; margin-bottom:0; padding-top:0; padding-bottom:0; height:100%;");
		}
	},

	createElement: function(el) {
		return (UFO.uaHas("xml") && typeof document.createElementNS != "undefined") ?  document.createElementNS("http://www.w3.org/1999/xhtml", el) : document.createElement(el);
	},

	createObjParam: function(el, aName, aValue) {
		var _p = UFO.createElement("param");
		_p.setAttribute("name", aName);	
		_p.setAttribute("value", aValue);
		el.appendChild(_p);
	},

	uaHas: function(ft) {
		var _u = UFO.ua;
		switch(ft) {
			case "w3cdom":
				return (typeof document.getElementById != "undefined" && typeof document.getElementsByTagName != "undefined" && (typeof document.createElement != "undefined" || typeof document.createElementNS != "undefined"));
			case "xml":
				var _m = document.getElementsByTagName("meta");
				var _l = _m.length;
				for (var i = 0; i < _l; i++) {
					if (/content-type/i.test(_m[i].getAttribute("http-equiv")) && /xml/i.test(_m[i].getAttribute("content"))) return true;
				}
				return false;
			case "ieMac":
				return /msie/.test(_u) && !/opera/.test(_u) && /mac/.test(_u);
			case "ieWin":
				return /msie/.test(_u) && !/opera/.test(_u) && /win/.test(_u);
			case "gecko":
				return /gecko/.test(_u) && !/applewebkit/.test(_u);
			case "opera":
				return /opera/.test(_u);
			case "safari":
				return /applewebkit/.test(_u);
			default:
				return false;
		}
	},
	
	getFlashVersion: function() {
		if (UFO.fv[0] != 0) return;  
		if (navigator.plugins && typeof navigator.plugins["Shockwave Flash"] == "object") {
			UFO.pluginType = "npapi";
			var _d = navigator.plugins["Shockwave Flash"].description;
			if (typeof _d != "undefined") {
				_d = _d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
				var _m = parseInt(_d.replace(/^(.*)\..*$/, "$1"), 10);
				var _r = /r/.test(_d) ? parseInt(_d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
				UFO.fv = [_m, _r];
			}
		}
		else if (window.ActiveXObject) {
			UFO.pluginType = "ax";
			try { // avoid fp 6 crashes
				var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
			}
			catch(e) {
				try { 
					var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
					UFO.fv = [6, 0];
					_a.AllowScriptAccess = "always"; // throws if fp < 6.47 
				}
				catch(e) {
					if (UFO.fv[0] == 6) return;
				}
				try {
					var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
				}
				catch(e) {}
			}
			if (typeof _a == "object") {
				var _d = _a.GetVariable("$version"); // bugs in fp 6.21/6.23
				if (typeof _d != "undefined") {
					_d = _d.replace(/^\S+\s+(.*)$/, "$1").split(",");
					UFO.fv = [parseInt(_d[0], 10), parseInt(_d[2], 10)];
				}
			}
		}
	},

	hasRequired: function(id) {
		var _l = UFO.req.length;
		for (var i = 0; i < _l; i++) {
			if (typeof UFO.foList[id][UFO.req[i]] == "undefined") return false;
		}
		return true;
	},
	
	hasFlashVersion: function(major, release) {
		return (UFO.fv[0] > major || (UFO.fv[0] == major && UFO.fv[1] >= release)) ? true : false;
	},

	writeSWF: function(id) {
		var _fo = UFO.foList[id];
		var _e = document.getElementById(id);
		if (UFO.pluginType == "npapi") {
			if (UFO.uaHas("gecko") || UFO.uaHas("xml")) {
				while(_e.hasChildNodes()) {
					_e.removeChild(_e.firstChild);
				}
				var _obj = UFO.createElement("object");
				_obj.setAttribute("type", "application/x-shockwave-flash");
				_obj.setAttribute("data", _fo.movie);
				_obj.setAttribute("width", _fo.width);
				_obj.setAttribute("height", _fo.height);
				var _l = UFO.optAtt.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[UFO.optAtt[i]] != "undefined") _obj.setAttribute(UFO.optAtt[i], _fo[UFO.optAtt[i]]);
				}
				var _o = UFO.opt.concat(UFO.optExc);
				var _l = _o.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[_o[i]] != "undefined") UFO.createObjParam(_obj, _o[i], _fo[_o[i]]);
				}
				_e.appendChild(_obj);
			}
			else {
				var _emb = "";
				var _o = UFO.opt.concat(UFO.optAtt).concat(UFO.optExc);
				var _l = _o.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[_o[i]] != "undefined") _emb += ' ' + _o[i] + '="' + _fo[_o[i]] + '"';
				}
				_e.innerHTML = '<embed type="application/x-shockwave-flash" src="' + _fo.movie + '" width="' + _fo.width + '" height="' + _fo.height + '" pluginspage="http://www.macromedia.com/go/getflashplayer"' + _emb + '></embed>';
			}
		}
		else if (UFO.pluginType == "ax") {
			var _objAtt = "";
			var _l = UFO.optAtt.length;
			for (var i = 0; i < _l; i++) {
				if (typeof _fo[UFO.optAtt[i]] != "undefined") _objAtt += ' ' + UFO.optAtt[i] + '="' + _fo[UFO.optAtt[i]] + '"';
			}
			var _objPar = "";
			var _l = UFO.opt.length;
			for (var i = 0; i < _l; i++) {
				if (typeof _fo[UFO.opt[i]] != "undefined") _objPar += '<param name="' + UFO.opt[i] + '" value="' + _fo[UFO.opt[i]] + '" />';
			}
			var _p = window.location.protocol == "https:" ? "https:" : "http:";
			_e.innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + _objAtt + ' width="' + _fo.width + '" height="' + _fo.height + '" codebase="' + _p + '//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + _fo.majorversion + ',0,' + _fo.build + ',0"><param name="movie" value="' + _fo.movie + '" />' + _objPar + '</object>';
		}
	},
		
	createDialog: function(id) {
		var _fo = UFO.foList[id];
		UFO.createCSS("html", "height:100%; overflow:hidden;");
		UFO.createCSS("body", "height:100%; overflow:hidden;");
		UFO.createCSS("#xi-con", "position:absolute; left:0; top:0; z-index:1000; width:100%; height:100%; background-color:#fff; filter:alpha(opacity:75); opacity:0.75;");
		UFO.createCSS("#xi-dia", "position:absolute; left:50%; top:50%; margin-left: -" + Math.round(parseInt(_fo.xiwidth, 10) / 2) + "px; margin-top: -" + Math.round(parseInt(_fo.xiheight, 10) / 2) + "px; width:" + _fo.xiwidth + "px; height:" + _fo.xiheight + "px;");
		var _b = document.getElementsByTagName("body")[0];
		var _c = UFO.createElement("div");
		_c.setAttribute("id", "xi-con");
		var _d = UFO.createElement("div");
		_d.setAttribute("id", "xi-dia");
		_c.appendChild(_d);
		_b.appendChild(_c);
		var _mmu = window.location;
		if (UFO.uaHas("xml") && UFO.uaHas("safari")) {
			var _mmd = document.getElementsByTagName("title")[0].firstChild.nodeValue = document.getElementsByTagName("title")[0].firstChild.nodeValue.slice(0, 47) + " - Flash Player Installation";
		}
		else {
			var _mmd = document.title = document.title.slice(0, 47) + " - Flash Player Installation";
		}
		var _mmp = UFO.pluginType == "ax" ? "ActiveX" : "PlugIn";
		var _uc = typeof _fo.xiurlcancel != "undefined" ? "&xiUrlCancel=" + _fo.xiurlcancel : "";
		var _uf = typeof _fo.xiurlfailed != "undefined" ? "&xiUrlFailed=" + _fo.xiurlfailed : "";
		UFO.foList["xi-dia"] = { movie:_fo.ximovie, width:_fo.xiwidth, height:_fo.xiheight, majorversion:"6", build:"65", flashvars:"MMredirectURL=" + _mmu + "&MMplayerType=" + _mmp + "&MMdoctitle=" + _mmd + _uc + _uf };
		UFO.writeSWF("xi-dia");
	},

	expressInstallCallback: function() {
		var _b = document.getElementsByTagName("body")[0];
		var _c = document.getElementById("xi-con");
		_b.removeChild(_c);
		UFO.createCSS("body", "height:auto; overflow:auto;");
		UFO.createCSS("html", "height:auto; overflow:auto;");
	},

	cleanupIELeaks: function() {
		var _o = document.getElementsByTagName("object");
		var _l = _o.length
		for (var i = 0; i < _l; i++) {
			_o[i].style.display = "none";
			for (var x in _o[i]) {
				if (typeof _o[i][x] == "function") {
					_o[i][x] = null;
				}
			}
		}
	}

};

if (typeof window.attachEvent != "undefined" && UFO.uaHas("ieWin")) {
	window.attachEvent("onunload", UFO.cleanupIELeaks);
}
// ------------------------- ufo.js ends here ---------------------------------
// -------------------- update-content-mask.js starts here ----------------------------

function maskMediaImages() {
	// must do this because 'images' is dynamically updated by DOM - see travel-mask.js
    var images = document.getElementsByTagName('img');
    var imagesToProcess = [];
    forEachElementOf(images, function (image) {
        imagesToProcess.push(image);
    });

    var maskClass = /([a-zA-Z]+)-mask/;
    var anchorOrDiv = /^a$|^div/i;
    forEachElementOf(imagesToProcess, function (image) {
        var matchMaskClass = maskClass.exec(image.className); 
        if (matchMaskClass && image.parentNode.nodeName.match(anchorOrDiv)) {
            var maskName = matchMaskClass[1];
            applyImageMaskImmediate(image, maskName);
        }
    });

}

addEvent(window, "load", maskMediaImages);

// --------------------- update-content-mask.js ends here -----------------------------
/*
	this script shows the roll-overs for the crumb navigation

	if javascript is turned off no rollovers appear
	
	REQUIRES: textresizedetector and textresizeinit to run before this
	
*/

( function () {
	var timeout;
	
	function pollForLoad () {
		var crumbNav = document.getElementById("crumb-nav");
		if (crumbNav) {
			zone_navigation_rollover.setupNavRolloverEvents(crumbNav);
			clearInterval (timeout);
		}
	}

	timeout = setInterval(pollForLoad, 500);
} ) ();


zone_navigation_rollover = ( function () {
	var zone_navigation_rollover = {};
	
	function checkClass(navItem,class1) {
	      var regExpString = '\\b'+class1+'\\b';
	      var regularExpression = new RegExp(regExpString);
	      return regularExpression.test(navItem.className);
	}
	
	var currentPositionNames = [/\bfirst-end\b/, 
					/\bfirst-hover-end\b/,
					/\bfirst-end-hover\b/,
					/\bfirst-second\b/,
					/\bfirst-hover-second\b/,
					/\bfirst-second-hover\b/];
	var localNavItemMatcher = /\bfirst-local-item\b/;
					
	// this is used instead of getting the current background position as it is not reliably implemented across browser.
	var currentYPositions = [-13,-114,-215,-316,-417,-518];
					
	function removeClass(classes, className) {
  		for(var i=0; i<classes.length; i++){
  			if(classes[i] === className) {
  				classes.splice(i, 1);
  				return;
  			}
  		}
	}
	
	function addClass(classes, className) {
   		classes.push( className );
	}
	
	function determineChangesToSwapClassesOn(navItem,class1,class2){
		var classes = navItem.className.split(' ');
    	removeClass(classes, class1);
    	addClass(classes, class2);
    	var classString = classes.join(' ');
		
		var updateInfo = zone_navigation_rollover.determineBackgroundPositionAndPadding(classString);
		
    	updateInfo.className = classString;
    	
    	return updateInfo;
	}
		
	function eventProvider(navItem, thisClass, thisClassHover, previousNavItem, previousClass, previousClassHover) {
		
		//check for focus already
		navItem.focused = false;
		
		//accommodate the resizing of text
		var navItemInfo = zone_navigation_rollover.determineBackgroundPositionAndPadding(navItem.className);
		zone_navigation_rollover.updateNavItems(navItem, navItemInfo);
		
		navItem.hasFocus = function () { 
			return this.focused; 
		};
		
		navItem.onmouseover = function () {
			var navItemInfo, previousNavItemInfo;
			
			navItemInfo = determineChangesToSwapClassesOn(this, thisClass, thisClassHover);
			if (previousNavItem) { 
				previousNavItemInfo = determineChangesToSwapClassesOn( previousNavItem, previousClass, previousClassHover); 
			}
			
			zone_navigation_rollover.updateNavItems( navItem, navItemInfo, previousNavItem, previousNavItemInfo);
		};
		
		navItem.onmouseout = function () {
			var navItemInfo, previousNavItemInfo;
				
			if (!this.focused) {		 
				navItemInfo = determineChangesToSwapClassesOn( this, thisClassHover, thisClass);
				if (previousNavItem) { 
					previousNavItemInfo = determineChangesToSwapClassesOn( previousNavItem, previousClassHover, previousClass); 
				}
			
				zone_navigation_rollover.updateNavItems( navItem, navItemInfo, previousNavItem, previousNavItemInfo);
			}
		};
		navItem.onfocus = function () {
			var navItemInfo, previousNavItemInfo;
				
			this.focused = true;
			if (!checkClass(this, thisClassHover)) {
				navItemInfo = determineChangesToSwapClassesOn( this, thisClass, thisClassHover);
				if (previousNavItem) { 
					previousNavItemInfo = determineChangesToSwapClassesOn( previousNavItem, previousClass, previousClassHover);
				}
				
				zone_navigation_rollover.updateNavItems( navItem, navItemInfo, previousNavItem, previousNavItemInfo);
			}
		};
		navItem.onblur = function () {
			var navItemInfo, previousNavItemInfo;
				
			this.focused = false;
			navItemInfo = determineChangesToSwapClassesOn( this, thisClassHover, thisClass);
			if (previousNavItem) { 
				previousNavItemInfo = determineChangesToSwapClassesOn( previousNavItem, previousClassHover, previousClass); 
			}
			
			zone_navigation_rollover.updateNavItems( navItem, navItemInfo, previousNavItem, previousNavItemInfo);
		};
	}
	
	/* if the text size is different from normal, center the arrow. */
	zone_navigation_rollover.determineBackgroundPositionAndPadding = function(classString) {
		var textSize = Number(TextResizeDetector.getSize());
		var result = {};
		
		if (classString && textSize) {
			if (textSize < 40) {
					
				// 16px specified in base.css for navigation
				var yPosition = ((textSize - 16) / 2);
				var currentPlacementY = 0;
				
				for (var i = 0; i < currentPositionNames.length; i++) {
					if (currentPositionNames[i].test(classString)) {
						currentPlacementY = currentYPositions[i];
					}
				}
				
				var newYPosition = yPosition + currentPlacementY;
				result.backgroundPosition = "100% " + newYPosition + "px";
				
				// add a bit of padding when text size goes up
				var isLocalNavItem = localNavItemMatcher.test(classString);
			
				if (!isLocalNavItem) {
					if (textSize > 20) {
						result.paddingRight = "20px";
					} else if (textSize <= 20) {
						result.paddingRight = "15px";
					}
				} else {
					result.paddingRight = "5px";
				}
			} else { 
				result.backgroundPosition = "-460px 0";
				result.paddingRight = "5px";
			}
		}
		return result;
	};
	
	zone_navigation_rollover.updateNavItems = function(navItem, navItemInfo, previousNavItem, previousNavItemInfo) {
		navItem.style.backgroundPosition = navItemInfo.backgroundPosition;
    	navItem.className = navItemInfo.className ? navItemInfo.className : navItem.className;
		navItem.style.paddingRight = navItemInfo.paddingRight;
		if(previousNavItemInfo) {
			previousNavItem.style.backgroundPosition = previousNavItemInfo.backgroundPosition;
	    	previousNavItem.className = previousNavItemInfo.className;
			previousNavItem.style.paddingRight = previousNavItemInfo.paddingRight;
		}
	};
	
	zone_navigation_rollover.setupNavRolloverEvents = function(crumbNav) {
	
		var numOfCrumbs = 0;
		var previous = null;
		var crumb;
		var crumbs = crumbNav.getElementsByTagName('li');
		numOfCrumbs = crumbs.length;
		
		if (numOfCrumbs === 1) {
			/* the only one */
			crumb = crumbs[0].getElementsByTagName('a')[0];
			eventProvider(crumb, 'first-end', 'first-hover-end');
		}
		else if (numOfCrumbs > 1) {
			for(var i=0;i<numOfCrumbs;i++){
				crumb = crumbs[i].getElementsByTagName('a')[0];
				/* first and not the only one */
				if (i === 0) {
					eventProvider(crumb, 'first-second', 'first-hover-second');
				}	
				/* the last one */	
				if (numOfCrumbs === (i + 1)) {
					previous = crumbs[i - 1].getElementsByTagName('a')[0];
					eventProvider(crumb, 'first-end', 'first-hover-end', previous, 'first-second', 'first-second-hover');
				}
				/* the second one of many */
				if (numOfCrumbs > 2 && i === 1) { 
					previous = crumbs[i - 1].getElementsByTagName('a')[0];	
					eventProvider(crumb, 'first-second', 'first-hover-second', previous, 'first-second', 'first-second-hover');
				}
			}
		}
		
		/* roll-over effect with tags on last crumb */
		var localNav = document.getElementById('local-nav');
		if (localNav) {
			var localNavItems = localNav.getElementsByTagName('a');
			var lastCrumb = crumbs[numOfCrumbs-1].getElementsByTagName('a')[0];
			if(lastCrumb && localNavItems[0]){
				eventProvider(localNavItems[0],'first-local-item','first-local-item',lastCrumb,'first-end','first-end-hover');
			}
		}
	};
	
	/* textresizedetector notifies us of a text change so that we can change the arrow */
	zone_navigation_rollover.simpleNavResizer = function(){
		if (!document.getElementById) {
			return false;
		}
			
		var crumbNavItems = document.getElementById("crumb-nav") ? document.getElementById("crumb-nav").getElementsByTagName('a') : false;
		
		var textSize = Number(TextResizeDetector.getSize());
		var updateInfo;
		if (crumbNavItems) {
			for (var i = 0; i < crumbNavItems.length; i++) {
				if (Number(textSize) < 40) {
					updateInfo = zone_navigation_rollover.determineBackgroundPositionAndPadding(crumbNavItems[i].className);
				} else { 
					updateInfo = {};
					updateInfo.backgroundPosition = "-460px 0";
					updateInfo.paddingRight = "5px";
				}
				zone_navigation_rollover.updateNavItems(crumbNavItems[i], updateInfo);
			}
		}
	}
	
	return zone_navigation_rollover;
} ) ();


// ---------------------- zone-navigation-rollover.js ends here -----------------------------
// ------------------------ gu_tail.js starts here ----------------------------
if (isExternalSystemOn("hbx")) {
	(function() {
		var hitboxView = new guardian.r2.HitboxLinkTrackedView();
		new guardian.r2.HitboxLinkTrackedController(hitboxView);
	}) ();
}
// ------------------------ gu_tail.js ends here ------------------------------