/*
 * jQuery ifixpng plugin
 * (previously known as pngfix)
 * Version 3.1.2  (2008/09/01)
 * @requires jQuery v1.2.6 or above, or a lower version with the dimensions plugin
 *
 * Based on the plugin by Kush M., http://jquery.khurshid.com
 *
 * Background position Fixed
 * Also fixes non-visible images
 * (c) Copyright Yereth Jansen (yereth@yereth.nl)
 * personal website: http://www.yereth.nl
 * Company website: http://www.wharf.nl
 *
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * For a demonstration of the background-position being fixed:
 * http://www.yereth.nl/bgpos.html
 *
 * Plugin page:
 * http://plugins.jquery.com/project/iFixPng2
 *
 */

/**
 *
 * @example
 *
 * optional if location of pixel.gif if different to default which is images/pixel.gif
 * $.ifixpng('media/pixel.gif');
 *
 * $('img[@src$=.png], #panel').ifixpng();
 *
 * @apply hack to all png images and #panel which icluded png img in its css
 *
 * @name ifixpng
 * @type jQuery
 * @cat Plugins/Image
 * @return jQuery
 * @author jQuery Community
 */
;(function($) {

	/**
	 * helper variables and function
	 */
	$.ifixpng = function(customPixel) {
		$.ifixpng.pixel = customPixel;
	};

	$.ifixpng.regexp = {
		bg: /^url\(["']?(.*\.png([?].*)?)["']?\)$/i,
		img: /.*\.png([?].*)?$/i
	},

	$.ifixpng.getPixel = function() {
		return $.ifixpng.pixel || 'images/pixel.gif';
	};

	var hack = {
		base	: $('base').attr('href'),
		ltie7	: $.browser.msie && $.browser.version < 7,
		filter	: function(src) {
			return "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='"+src+"')";
		}
	};

	/**
	 * Applies ie png hack to selected dom elements
	 *
	 * $('img[@src$=.png]').ifixpng();
	 * @desc apply hack to all images with png extensions
	 *
	 * $('#panel, img[@src$=.png]').ifixpng();
	 * @desc apply hack to element #panel and all images with png extensions
	 *
	 * @name ifixpng
	 */

	$.fn.ifixpng = hack.ltie7 ? function() {
		function fixImage(image, source, width, height, hidden) {
			image.css({filter:hack.filter(source), width: width, height: height})
			  .attr({src:$.ifixpng.getPixel()})
			  .positionFix();
		}

    	return this.each(function() {
			var $$ = $(this);
			if ($$.is('img') || $$.is('input')) { // hack image tags present in dom
				var source, img;
				if (this.src && this.src.match($.ifixpng.regexp.img)) { // make sure it is png image
					// use source tag value if set
					source = (hack.base && this.src.substring(0,1)!='/' && this.src.indexOf(hack.base) === -1) ? hack.base + this.src : this.src;
					// If the width is not set, we have a problem; the image is not probably visible or not loaded
					// and we need a work around.
					if (!this.width || !this.height) {
						$(new Image()).one('load', function() {
							fixImage($$, source, this.width, this.height);
							$(this).remove();
						}).attr('src', source);
					// If the image already has dimensions (it's loaded and visible) we can fix it straight away.
					} else fixImage($$, source, this.width, this.height);
				}
			} else if (this.style) { // hack png css properties present inside css
				var imageSrc = $$.css('backgroundImage');
				// Background repeated images we cannot fix unfortunately
				if (imageSrc && imageSrc.match($.ifixpng.regexp.bg) && this.currentStyle.backgroundRepeat == 'no-repeat') {
					imageSrc = RegExp.$1;
					var x = this.currentStyle.backgroundPositionX || 0, y = this.currentStyle.backgroundPositionY || 0;
					if (x || y) {
						var css = {}, img;
						if (typeof x != 'undefined') {
							if (x == 'left') css.left = 0;
							// if right is 0, we have to check if the parent has an odd width, because of an IE bug
							else if (x == 'right') css.right = $$.width() % 2 === 1 ? -1 : 0;
							else css.left = x;
						}
						if (typeof y != 'undefined') {
							// if bottom is 0, we have to check if the parent has an odd height, because of an IE bug
							if (y == 'bottom') css.bottom = $$.height() % 2 === 1 ? -1 : 0;
							else if (y == 'top') css.top = 0;
							else css.top = y;
						}
						img = new Image();
						$(img).one('load', function() {
							var x,y, expr = {}, prop;
							// Now the image is loaded for sure, we can see if the background position needs fixing with an expression (in case of percentages)
							if (/center|%/.test(css.top)) {
								expr.top = "(this.parentNode.offsetHeight - this.offsetHeight) * " + (css.top == 'center' ? 0.5 : (parseInt(css.top) / 100));
								delete css.top;
							}
							if (/center|%/.test(css.left)) {
								expr.left = "(this.parentNode.offsetWidth - this.offsetWidth) * " + (css.left == 'center' ? 0.5 : (parseInt(css.left) / 100));
								delete css.left;
							}
							// Let's add the helper DIV which will simulate the background image
							$$.positionFix().css({backgroundImage: 'none'}).prepend(
								$('<div></div>').css(css).css({
									width: this.width,
									height: this.height,
									position: 'absolute',
									filter: hack.filter(imageSrc)
								})
							);
							if (expr.top || expr.left) {
								var elem = $$.children(':first')[0];
								for (prop in expr) elem.style.setExpression(prop, expr[prop], 'JavaScript');
							}
							$(this).remove();
						});
						img.src = imageSrc;
					} else {
						$$.css({backgroundImage: 'none', filter:hack.filter(imageSrc)});
					}
				}
			}
		});
	} : function() { return this; };

	/**
	 * positions selected item relatively
	 */
	$.fn.positionFix = function() {
		return this.each(function() {
			var $$ = $(this);
			if ($$.css('position') != 'absolute') $$.css({position:'relative'});
		});
	};

})(jQuery);


/*	sIFR v2.0.7 SOURCE
	Copyright 2004 - 2008 Mark Wubben and Mike Davidson. Prior contributions by Shaun Inman and Tomas Jogin.

	This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
*/

var hasFlash = function(){
	var nRequiredVersion = 6;

	if(navigator.appVersion.indexOf("MSIE") != -1 && navigator.appVersion.indexOf("Windows") > -1){
		document.write('<script language="VBScript"\> \non error resume next \nhasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & ' + nRequiredVersion + '))) \n</script\> \n');
		/*	If executed, the VBScript above checks for Flash and sets the hasFlash variable.
			If VBScript is not supported it's value will still be undefined, so we'll run it though another test
			This will make sure even Opera identified as IE will be tested */
		if(window.hasFlash != null){
			return window.hasFlash;
		};
	};

	if(navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
		var flashDescription = (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description;
		return parseInt(flashDescription.substr(flashDescription.indexOf(".") - 2, 2), 10) >= nRequiredVersion;
	};

	return false;
}();

String.prototype.normalize = function(){
	return this.replace(/\s+/g, " ");
};

/* IE 5.0 does not support the push method, so here goes */
if(Array.prototype.push == null){
	Array.prototype.push = function(){
		var i = 0, index = this.length, limit = arguments.length;
		while(i < limit){
			this[index++] = arguments[i++];
		};
		return this.length;
	};
};

/*	Implement function.apply for browsers which don't support it natively
	Courtesy of Aaron Boodman - http://youngpup.net */
if (!Function.prototype.apply){
	Function.prototype.apply = function(oScope, args) {
		var sarg = [];
		var rtrn, call;

		if (!oScope) oScope = window;
		if (!args) args = [];

		for (var i = 0; i < args.length; i++) {
			sarg[i] = "args["+i+"]";
		};

		call = "oScope.__applyTemp__(" + sarg.join(",") + ");";

		oScope.__applyTemp__ = this;
		rtrn = eval(call);
		oScope.__applyTemp__ = null;
		return rtrn;
	};
};

/*	The following code parses CSS selectors.
	This script however is not the right place to explain it,
	please visit the documentation for more information. */
var parseSelector = function(){
	var reParseSelector = /^([^#.>`]*)(#|\.|\>|\`)(.+)$/;
	function parseSelector(sSelector, oParentNode){
		var listSelectors = sSelector.split(/\s*\,\s*/);
		var listReturn = [];
		for(var i = 0; i < listSelectors.length; i++){
			listReturn = listReturn.concat(doParse(listSelectors[i], oParentNode));
		};

		return listReturn;
	};

	function doParse(sSelector, oParentNode, sMode){
		sSelector = sSelector.replace(" ", "`");
		var selector = sSelector.match(reParseSelector);
		var node, listNodes, listSubNodes, subselector, i, limit;
		var listReturn = [];

		if(selector == null){ selector = [sSelector, sSelector] };
		if(selector[1] == ""){ selector[1] = "*" };
		if(sMode == null){ sMode = "`" };
		if(oParentNode == null){
			oParentNode = document;
		};

		switch(selector[2]){
			case "#":
				subselector = selector[3].match(reParseSelector);
				if(subselector == null){ subselector = [null, selector[3]] };
				node = 	document.getElementById(subselector[1]);
				if(node == null || (selector[1] != "*" && !matchNodeNames(node, selector[1]))){
					return listReturn;
				};
				if(subselector.length == 2){
					listReturn.push(node);
					return listReturn;
				};
				return doParse(subselector[3], node, subselector[2]);
			case ".":
				if(sMode != ">"){
					listNodes = getElementsByTagName(oParentNode, selector[1]);
				} else {
					listNodes = oParentNode.childNodes;
				};

				for(i = 0, limit = listNodes.length; i < limit; i++){
					node = listNodes[i];
					if(node.nodeType != 1){
						continue;
					};
					subselector = selector[3].match(reParseSelector);
					if(subselector != null){
						if(node.className == null || node.className.match("(\\s|^)" + subselector[1] + "(\\s|$)") == null){
							continue;
						};
						listSubNodes = doParse(subselector[3], node, subselector[2]);
						listReturn = listReturn.concat(listSubNodes);
					} else if(node.className != null && node.className.match("(\\s|^)" + selector[3] + "(\\s|$)") != null){
						listReturn.push(node);
					};
				};
				return listReturn;
			case ">":
				if(sMode != ">"){
					listNodes = getElementsByTagName(oParentNode, selector[1]);
				} else {
					listNodes = oParentNode.childNodes;
				};

				for(i = 0, limit = listNodes.length; i < limit; i++){
					node = listNodes[i];

					if(node.nodeType != 1){
						continue;
					};

					if(!matchNodeNames(node, selector[1])){
						continue;
					};
					listSubNodes = doParse(selector[3], node, ">");
					listReturn = listReturn.concat(listSubNodes);
				};
				return listReturn;
			case "`":
				listNodes = getElementsByTagName(oParentNode, selector[1]);
				for(i = 0, limit = listNodes.length; i < limit; i++){
					node = listNodes[i];
					listSubNodes = doParse(selector[3], node, "`");
					listReturn = listReturn.concat(listSubNodes);
				};
				return listReturn;
			default:
				if(sMode != ">"){
					listNodes = getElementsByTagName(oParentNode, selector[1]);
				} else {
					listNodes = oParentNode.childNodes;
				};

				for(i = 0, limit = listNodes.length; i < limit; i++){
					node = listNodes[i];
					if(node.nodeType != 1){
						continue;
					};
					if(!matchNodeNames(node, selector[1])){
						continue;
					};
					listReturn.push(node);
				};
				return listReturn;
		};
	};

	function getElementsByTagName(oParentNode, sTagName){
		/*	IE5.x does not support document.getElementsByTagName("*")
			therefore we're falling back to element.all */
		if(sTagName == "*" && oParentNode.all != null){
			return oParentNode.all;
		};
		return oParentNode.getElementsByTagName(sTagName);
	};

	function matchNodeNames(node, sMatch){
		if(sMatch == "*"){
			return true;
		};
		return node.nodeName.toLowerCase().replace("html:", "") == sMatch.toLowerCase();
	};

	return parseSelector;
}();

/*	Adds named arguments support to JavaScript. */
function named(oArgs){
	return new named.Arguments(oArgs);
};

named.Arguments = function(oArgs){
	this.oArgs = oArgs;
};

named.Arguments.prototype.constructor = named.Arguments;

named.extract = function(listPassedArgs, oMapping){
	var oNamedArgs, passedArg;

	var i = listPassedArgs.length;
	while(i--){
		passedArg = listPassedArgs[i];
		if(passedArg != null && passedArg.constructor != null && passedArg.constructor == named.Arguments){
			oNamedArgs = listPassedArgs[i].oArgs; /* oNamedArgs isn't the named.Arguments class! */
			break;
		};
	};

	if(oNamedArgs == null){ return };

	for(sName in oNamedArgs){
		if(oMapping[sName] != null){
			oMapping[sName](oNamedArgs[sName]);
		};
	};

	return;
};

/*	Executes an anonymous function which returns the function sIFR (defined inside the function).
	You can replace elements using sIFR.replaceElement()
	All other variables and methods you see are private. If you want to understand how this works you should
	learn more about the variable-scope in JavaScript. */
var sIFR = function(){
	/* Opera and Mozilla require a namespace when creating elements in an XML page */
	var sNameSpaceURI = "http://www.w3.org/1999/xhtml";
	var bIsInitialized = false;
	var bIsSetUp = false;
	var bInnerHTMLTested = false;
	var sDocumentTitle;
	var stackReplaceElementArguments = [];
	var UA = function(){
		var sUA = navigator.userAgent.toLowerCase();
		var oReturn =  {
			bIsWebKit : sUA.indexOf("applewebkit") > -1,
			bIsSafari : sUA.indexOf("safari") > -1,
			bIsKonq: navigator.product != null && navigator.product.toLowerCase().indexOf("konqueror") > -1,
			bIsOpera : sUA.indexOf("opera") > -1,
			bIsXML : document.contentType != null && document.contentType.indexOf("xml") > -1,
			bHasTransparencySupport : true,
			bUseDOM : true,
			nFlashVersion : null,
			nOperaVersion : null,
			nGeckoBuildDate : null,
			nWebKitVersion : null
		};

		oReturn.bIsKHTML = oReturn.bIsWebKit || oReturn.bIsKonq;
		oReturn.bIsGecko = !oReturn.bIsWebKit && navigator.product != null && navigator.product.toLowerCase() == "gecko";
		if(oReturn.bIsGecko && sUA.match(/.*gecko\/(\d{8}).*/)){ oReturn.nGeckoBuildDate = new Number(sUA.match(/.*gecko\/(\d{8}).*/)[1]) };
    if(oReturn.bIsOpera && sUA.match(/.*opera(\s|\/)(\d+\.\d+)/)){ oReturn.nOperaVersion = new Number(sUA.match(/.*opera(\s|\/)(\d+\.\d+)/)[2]) };
		oReturn.bIsIE = sUA.indexOf("msie") > -1 && !oReturn.bIsOpera && !oReturn.bIsKHTML && !oReturn.bIsGecko;
		oReturn.bIsIEMac = oReturn.bIsIE && sUA.match(/.*mac.*/) != null;
		if(oReturn.bIsIE || (oReturn.bIsOpera && oReturn.nOperaVersion < 7.6)){ oReturn.bUseDOM = false };
		if(oReturn.bIsWebKit && sUA.match(/.*applewebkit\/(\d+).*/)){ oReturn.nWebKitVersion = new Number(sUA.match(/.*applewebkit\/(\d+).*/)[1]) };
		if(window.hasFlash && (!oReturn.bIsIE || oReturn.bIsIEMac)){
			var flashDescription = (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description;
			oReturn.nFlashVersion = parseInt(flashDescription.substr(flashDescription.indexOf(".") - 2, 2), 10);
		};
		if(sUA.match(/.*(windows|mac).*/) == null ||
		oReturn.bIsIEMac || oReturn.bIsKonq ||
		(oReturn.bIsOpera && oReturn.nOperaVersion < 7.6) ||
		(oReturn.bIsSafari && oReturn.nFlashVersion < 7) ||
		(!oReturn.bIsSafari && oReturn.bIsWebKit && oReturn.nWebKitVersion < 312) ||
		(oReturn.bIsGecko && oReturn.nGeckoBuildDate < 20020523)){
			oReturn.bHasTransparencySupport = false;
		};

		if(!oReturn.bIsIEMac && !oReturn.bIsGecko && document.createElementNS){
			try {
				document.createElementNS(sNameSpaceURI, "i").innerHTML = "";
			} catch(e){
				oReturn.bIsXML = true;
			};
		};

		oReturn.bUseInnerHTMLHack = oReturn.bIsKonq || (oReturn.bIsWebKit && oReturn.nWebKitVersion < 312);

		return oReturn;
	}();

	/*	Disable sIFR for non-Flash or old browsers
		Also disable it for IE and KHTML browsers in XML mode, since we are using innerHTML for those browsers */
	if(window.hasFlash == false || !document.createElement || !document.getElementById || (UA.bIsXML && (UA.bUseInnerHTMLHack || UA.bIsIE))){
		return {UA:UA};
	};

	function sIFR(e){
		if((!self.bAutoInit && (window.event || e) != null) || !mayReplace(e)){
			return;
		};
		bIsInitialized = true;

		for(var i = 0, limit = stackReplaceElementArguments.length; i < limit; i++){
			replaceElement.apply(null, stackReplaceElementArguments[i]);
		};
		stackReplaceElementArguments = [];
	};

	var self = sIFR;

	function mayReplace(e){
		if(bIsSetUp == false || self.bIsDisabled == true || ((UA.bIsXML && UA.bIsGecko || UA.bIsKHTML) && e == null && bIsInitialized == false) || document.getElementsByTagName("body").length == 0){
			return false;
		};
		return true;
	};

	function escapeHex(sHex){
		if(UA.bIsIE){ /* The RegExp for IE breaks old Gecko's, the RegExp for non-IE breaks IE 5.01 */
			return sHex.replace(new RegExp("%\d{0}", "g"), "%25");
		}
		return sHex.replace(new RegExp("%(?!\d)", "g"), "%25");
	};

	function matchNodeNames(node, sMatch){
		if(sMatch == "*"){
			return true;
		};
		return node.nodeName.toLowerCase().replace("html:", "") == sMatch.toLowerCase();
	};

	function fetchContent(node, nodeNew, sCase, nLinkCount, sLinkVars){
		var sContent = "";
		var oSearch = node.firstChild;
		var oRemove, nodeRemoved, oResult, sValue;

		if(nLinkCount == null){ nLinkCount = 0 };
		if(sLinkVars == null){ sLinkVars = "" };

		while(oSearch){
			if(oSearch.nodeType == 3){
				sValue = oSearch.nodeValue.replace("<", "&lt;");
				switch(sCase){
					case "lower":
						sContent += sValue.toLowerCase();
						break;
					case "upper":
						sContent += sValue.toUpperCase();
						break;
					default:
						sContent += sValue;
				};
			} else if(oSearch.nodeType == 1){
				if(matchNodeNames(oSearch, "a") && !oSearch.getAttribute("href") == false){
					if(oSearch.getAttribute("target")){
						sLinkVars += "&sifr_url_" + nLinkCount + "_target=" + oSearch.getAttribute("target");
					};
					sLinkVars += "&sifr_url_" + nLinkCount + "=" + escapeHex(oSearch.getAttribute("href")).replace(/&/g, "%26");
					sContent += '<a href="asfunction:_root.launchURL,' + nLinkCount + '">';
					nLinkCount++;
				} else if(matchNodeNames(oSearch, "br")){
					sContent += "<br/>";
				};
				if(oSearch.hasChildNodes()){
					/*	The childNodes are already copied with this node, so nodeNew = null */
					oResult = fetchContent(oSearch, null, sCase, nLinkCount, sLinkVars);
					sContent += oResult.sContent;
					nLinkCount = oResult.nLinkCount;
					sLinkVars = oResult.sLinkVars;
				};
				if(matchNodeNames(oSearch, "a")){
					sContent += "</a>";
				};
			};
			oRemove = oSearch;
			oSearch = oSearch.nextSibling;
			if(nodeNew != null){
				nodeRemoved = oRemove.parentNode.removeChild(oRemove);
				nodeNew.appendChild(nodeRemoved);
			};
		};

		return {"sContent" : sContent, "nLinkCount" : nLinkCount, "sLinkVars" : sLinkVars};
	};

	function createElement(sTagName){
		if(document.createElementNS && UA.bUseDOM){
			return document.createElementNS(sNameSpaceURI, sTagName);
		} else {
			return document.createElement(sTagName);
		};
	};

	function createObjectParameter(nodeObject, sName, sValue){
		var node = createElement("param");
		node.setAttribute("name", sName);
		node.setAttribute("value", sValue);
		nodeObject.appendChild(node);
	};

	/*	Konqueror does not treat empty classNames as strings, so we need a workaround */
	function appendToClassName(node, sAppend){
		var sClassName = node.className;
		if(sClassName == null){
			sClassName = sAppend;
		} else {
			sClassName = sClassName.normalize() + (sClassName == "" ? "" : " ") + sAppend;
		};
		node.className = sClassName;
	};

	function prepare(bNow){
		var node = document.documentElement;
		if(self.bHideBrowserText == false){
			node = document.getElementsByTagName("body")[0];
		};
		if((self.bHideBrowserText == false || bNow) && node){
			if(node.className == null || node.className.match(/\bsIFR\-hasFlash\b/) == null){
				appendToClassName(node, "sIFR-hasFlash");
			};
		};
	};

	function replaceElement(sSelector, sFlashSrc, sColor, sLinkColor, sHoverColor, sBgColor, nPaddingTop, nPaddingRight, nPaddingBottom, nPaddingLeft, sFlashVars, sCase, sWmode){
		if(!mayReplace()){
			return stackReplaceElementArguments.push(arguments);
		};

		prepare();

		/*	Extract any named arguments.	*/
		named.extract(arguments, {
			sSelector : function(value){ sSelector = value },
			sFlashSrc : function(value){ sFlashSrc = value },
			sColor : function(value){ sColor = value },
			sLinkColor : function(value){ sLinkColor = value },
			sHoverColor : function(value){ sHoverColor = value },
			sBgColor : function(value){ sBgColor = value },
			nPaddingTop : function(value){ nPaddingTop = value },
			nPaddingRight : function(value){ nPaddingRight = value },
			nPaddingBottom : function(value){ nPaddingBottom = value },
			nPaddingLeft : function(value){ nPaddingLeft = value },
			sFlashVars : function(value){ sFlashVars = value },
			sCase : function(value){ sCase = value },
			sWmode : function(value){ sWmode = value }
		});

		/* Check if we can find any nodes first */
		var listNodes = parseSelector(sSelector);
		if(listNodes.length == 0){ return false };

		/*	Set default values. */
		if(sFlashVars != null){
			sFlashVars = "&" + sFlashVars.normalize();
		} else {
			sFlashVars = "";
		};

		if(sColor != null){sFlashVars += "&textcolor=" + sColor};
		if(sHoverColor != null){sFlashVars += "&hovercolor=" + sHoverColor};
		if(sHoverColor != null || sLinkColor != null){sFlashVars += "&linkcolor=" + (sLinkColor || sColor)};

		if(nPaddingTop == null){ nPaddingTop = 0 };
		if(nPaddingRight == null){ nPaddingRight = 0 };
		if(nPaddingBottom == null){ nPaddingBottom = 0 };
		if(nPaddingLeft == null){ nPaddingLeft = 0 };

		if(sBgColor == null){ sBgColor = "#FFFFFF" };

		if(sWmode == "transparent"){
			if(!UA.bHasTransparencySupport){
				sWmode = "opaque";
			} else {
				sBgColor = "transparent";
			};
		};

		if(sWmode == null){ sWmode = "" };

		/*	Do the actual replacement. */
		var node, sWidth, sHeight, sMargin, sPadding, sVars, nodeAlternate, nodeFlash, oContent;
		var nodeFlashTemplate = null;

		for(var i = 0, limit = listNodes.length; i < limit; i++){
			node = listNodes[i];

			/* Prevents elements from being replaced multiple times. */
			if(node.className != null && node.className.match(/\bsIFR\-replaced\b/) != null){ continue };

			sWidth = node.offsetWidth - nPaddingLeft - nPaddingRight;
			sHeight = node.offsetHeight - nPaddingTop - nPaddingBottom;

			if(isNaN(sWidth) || isNaN(sHeight)){
				self.bIsDisabled = true;
				document.documentElement.className = document.documentElement.className.replace(/\bsIFR\-hasFlash\b/, "");
				return;
			};

			nodeAlternate = createElement("span");
			nodeAlternate.className = "sIFR-alternate";

			oContent = fetchContent(node, nodeAlternate, sCase);
			sVars = "txt=" + escapeHex(oContent.sContent).replace(/\+/g, "%2B").replace(/&/g, "%26").replace(/\"/g, "%22").normalize() + sFlashVars + "&w=" + sWidth + "&h=" + sHeight + oContent.sLinkVars;

			appendToClassName(node, "sIFR-replaced");

			/*	Opera only supports the object element, other browsers are given the embed element,
				for backwards compatibility reasons between different browser versions.
				Opera versions below 7.60 use innerHTML, from 7.60 and up we use the DOM */

			if(nodeFlashTemplate == null || !UA.bUseDOM){
				if(!UA.bUseDOM){
				  if(!UA.bIsIE)
  					node.innerHTML = ['<embed class="sIFR-flash" type="application/x-shockwave-flash" src="', sFlashSrc, '" quality="best" wmode="', sWmode, '" bgcolor="', sBgColor, '" flashvars="', sVars, '" width="', sWidth, '" height="', sHeight, '" sifr="true"></embed>'].join("");
  				else
  				  node.innerHTML = ['<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" sifr="true" width="', sWidth, '" height="', sHeight, '" class="sIFR-flash">',
    				                    '<param name="movie" value="', sFlashSrc, '"></param>',
    				                    '<param name="flashvars" value="', sVars, '"></param>',
    				                    '<param name="quality" value="best"></param>',
    				                    '<param name="wmode" value="', sWmode, '"></param>',
    				                    '<param name="bgcolor" value="', sBgColor, '"></param>',
    				                  '</object>'].join('');
				} else {
					if(UA.bIsOpera){
						nodeFlash = createElement("object");
						nodeFlash.setAttribute("data", sFlashSrc);
						createObjectParameter(nodeFlash, "quality", "best");
						createObjectParameter(nodeFlash, "wmode", sWmode);
						createObjectParameter(nodeFlash, "bgcolor", sBgColor);
				  } else {
						nodeFlash = createElement("embed");
						nodeFlash.setAttribute("src", sFlashSrc);
						nodeFlash.setAttribute("quality", "best");
						nodeFlash.setAttribute("flashvars", sVars);
						nodeFlash.setAttribute("wmode", sWmode);
						nodeFlash.setAttribute("bgcolor", sBgColor);
						nodeFlash.setAttribute("pluginspace", "http://www.macromedia.com/go/getflashplayer");
						nodeFlash.setAttribute("scale", "noscale");
					};
					nodeFlash.setAttribute("sifr", "true");
					nodeFlash.setAttribute("type", "application/x-shockwave-flash");
					nodeFlash.className = "sIFR-flash";
					if(!UA.bIsKHTML || !UA.bIsXML){
						nodeFlashTemplate = nodeFlash.cloneNode(true);
					};
				};
			} else {
				nodeFlash = nodeFlashTemplate.cloneNode(true);
			};
			if(UA.bUseDOM){
				/* General settings */
				if(UA.bIsOpera){
					createObjectParameter(nodeFlash, "flashvars", sVars);
				} else {
					nodeFlash.setAttribute("flashvars", sVars);
				};
				nodeFlash.setAttribute("width", sWidth);
				nodeFlash.setAttribute("height", sHeight);
				nodeFlash.style.width = sWidth + "px";
				nodeFlash.style.height = sHeight + "px";
				node.appendChild(nodeFlash);
			};

			node.appendChild(nodeAlternate);

			/*	Workaround to force KHTML-browsers to repaint the document.
				Additionally, IE for both Mac and PC need this.
				See: http://neo.dzygn.com/archive/2004/09/forcing-safari-to-repaint */

			if(UA.bUseInnerHTMLHack){
				node.innerHTML += "";
			};
		};

		if(UA.bIsIE && self.bFixFragIdBug){
			setTimeout(function(){document.title = sDocumentTitle}, 0);
		};
	};

	function updateDocumentTitle(){
		sDocumentTitle = document.title;
	};

	function setup(){
		if(self.bIsDisabled == true){ return };

		bIsSetUp = true;
		/*	Providing a hook for you to hide certain elements if Flash has been detected. */
		if(self.bHideBrowserText){
			prepare(true);
		};

		if(window.attachEvent){
			window.attachEvent("onload", sIFR);
		} else if(!UA.bIsKonq && (document.addEventListener || window.addEventListener)){
			if(document.addEventListener){
				document.addEventListener("load", sIFR, false);
			};
			if(window.addEventListener){
				window.addEventListener("load", sIFR, false);
			};
		} else {
			if(typeof window.onload == "function"){
				var fOld = window.onload;
				window.onload = function(){ fOld(); sIFR(); };
			} else {
				window.onload = sIFR;
			};
		};

		if(!UA.bIsIE || window.location.hash == ""){
			self.bFixFragIdBug = false;
		} else {
			updateDocumentTitle();
		};
	};

	function debug(){
		prepare(true);
	};

	debug.replaceNow = function(){
		setup();
		sIFR();
	};

	/* Public Fields */
	self.UA = UA;
	self.bAutoInit = true;
	self.bFixFragIdBug = true;
	self.replaceElement = replaceElement;
	self.updateDocumentTitle = updateDocumentTitle;
	self.appendToClassName = appendToClassName;
	self.setup = setup;
	self.debug = debug;
	self.bIsDisabled = false;
	self.bHideBrowserText = true;

	return self;
}();

/*	sIFR setup. You can add browser detection here.
	sIFR's browser detection is exposed through sIFR.UA. */

if(typeof sIFR == "function" && !sIFR.UA.bIsIEMac && (!sIFR.UA.bIsWebKit || sIFR.UA.nWebKitVersion >= 100)){
	sIFR.setup();
};


//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated.  All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");

			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful.

			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}

	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;

	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?');
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs)
{
  var str = '';
  if (isIE && isWin && !isOpera)
  {
    str += '<object ';
    for (var i in objAttrs)
    {
      str += i + '="' + objAttrs[i] + '" ';
    }
    str += '>';
    for (var i in params)
    {
      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    }
    str += '</object>';
  }
  else
  {
    str += '<embed ';
    for (var i in embedAttrs)
    {
      str += i + '="' + embedAttrs[i] + '" ';
    }
    str += '> </embed>';
  }

  document.write(str);
}

function AC_FL_RunContent(){
  var ret =
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret =
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();

    switch (currArg){
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblclick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
      case "id":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace":
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}



$(document).ready(function () {
	$.ifixpng('images/1.gif');
	$('.fixpng').ifixpng();
	$('table.menu td').ifixpng();
	$('.fixpng:hidden').show();

	$('div.map-popup div.map-button a').click(function(ev) {
		$(this).parent().parent().parent().hide();
	});

	$('ul.world li a').click(function(ev) {
		id = '#' + $(this).parent().attr('class');
		$('div.map-popup').hide();
		$(id).show();
	});

	$('.gallery-scroller ul li a').click(function(ev) {
		img = '';

		if ($(this).attr('rel'))
		{
			img = '<img src="'+$(this).attr('rel')+'" alt="" title="" />';
		}

		$('#gallery-big-pic').html(img);
	});

	$('.gallery-scroller .top a').click(function(ev) {
		dy = 104;

		curPos = $('.gallery-scroller ul').scrollTop();
		newPos = (curPos - dy);

		$('.gallery-scroller ul').animate({scrollTop: newPos}, 300);
	});

	$('.gallery-scroller .bottom a').click(function(ev) {
		dy = 104;

		curPos = $('.gallery-scroller ul').scrollTop();
		newPos = (curPos + dy);

		$('.gallery-scroller ul').animate({scrollTop: newPos}, 300);
	});

});
