
    // Browser data object
    function BrowserData() {
        this.isIE = function() { return ((navigator.userAgent.toUpperCase().indexOf('MSIE ') > -1) && (navigator.userAgent.toUpperCase().indexOf('OPERA') == -1)); };
        this.isChrome = function() { return navigator.userAgent.match(/Chrome/i); };
        this.isIPadOrIPhone = function() { return (navigator.userAgent.match(/iPad/i) != null || navigator.userAgent.match(/iPhone/i) != null); };
        this.getIEVersion = function() { return parseInt(navigator.appVersion.substr(navigator.appVersion.toUpperCase().indexOf('MSIE ')+5, 1)); };
        // predefined
        this.isIE6 = function() { return this.isIE() && this.getIEVersion() < 7};
        this.isIEBelow9 = function() { return this.isIE() && this.getIEVersion() < 9};
    }
    Browser = new BrowserData();

    // Date functions
    Date.prototype.parseDate = function (dateStr) {
        if (!dateStr) return;
        var parsedDay = dateStr.length == 7 ? 1 : dCalDateAsInt((dateStr.substr(8,2)));
        var parsedMonth = dCalDateAsInt((dateStr.substr(5,2)))-1;
        var parsedYear = parseInt(dateStr.substr(0,4));
        // NOTE! "Clearing" day and month before setting the values to avoid end of month overlappings...
        this.setMonth(1); this.setDate(1); this.setMonth(parsedMonth); this.setDate(parsedDay); this.setYear(parsedYear);
    };
    Date.prototype.isBeforeDate = function (checkDate) { if (!checkDate) checkDate = dCalNow(); return (this.getFullYear() < checkDate.getFullYear() || (this.getFullYear() <= checkDate.getFullYear() && this.getMonth() < checkDate.getMonth()) || (this.getFullYear() <= checkDate.getFullYear() && this.getMonth() <= checkDate.getMonth() && this.getDate() < checkDate.getDate())); };
    Date.prototype.isAfterDate = function (checkDate) { if (!checkDate) {return false;}else{ return ((this.getFullYear() > checkDate.getFullYear()) || (this.getFullYear() >= checkDate.getFullYear() && this.getMonth() > checkDate.getMonth()) || (this.getFullYear() >= checkDate.getFullYear() && this.getMonth() >= checkDate.getMonth() && this.getDate() > checkDate.getDate())); }; };
    
	// Get any object in the document
	function getDocObjectById(docObjId) {
		return document.getElementById(docObjId);
	}

	// gets the absolute left position of an object
	function getObjectLeftPos(objectId, object) {
		var obj;
		if (!object)
			obj = getDocObjectById(objectId);
		else
			obj = object;
		var objLeft = obj.offsetLeft;
		while(obj.offsetParent!=null) {
			var objParent = obj.offsetParent;
			objLeft += objParent.offsetLeft;
			obj = objParent;
		}
		return objLeft;
	}

	// gets the absolute left position of an object
	function getObjectTopPos(objectId, object) {
		var obj;
		if (!object)
			obj = getDocObjectById(objectId);
		else
			obj = object;
		var objTop = obj.offsetTop;
		while(obj.offsetParent!=null) {
			var objParent = obj.offsetParent;
			objTop += objParent.offsetTop;
			obj = objParent;
		}
		return objTop;
	}

	function getObjectWidth(objectId, object) {
		var obj;
		if (!object)
			obj = getDocObjectById(objectId);
		else
			obj = object;
		if (obj.currentStyle && obj.currentStyle.width) {
			var objWidth = parseInt(obj.currentStyle.width);
			if (objWidth && !isNaN(objWidth))
				return objWidth;
			else {
				objWidthOffsetWidth = obj.offsetWidth;
				if (objWidthOffsetWidth && !isNaN(objWidthOffsetWidth))
					return objWidthOffsetWidth;
			}
		} else if (window.getComputedStyle(obj, '')) {
			computedStyle = window.getComputedStyle(obj, '');
			objWidth = parseInt(computedStyle.getPropertyValue('width'));
			if (objWidth && !isNaN(objWidth))
				return objWidth;
		}
		return -1;
	}

	function getObjectHeight(objectId, object) {
		var obj;
		if (!object)
			obj = getDocObjectById(objectId);
		else
			obj = object;

		if (obj.offsetHeight) {
			var objHeight = parseInt(obj.offsetHeight);
			if (objHeight && !isNaN(objHeight))
				return objHeight;
		} else if (window.getComputedStyle) {
			var computedStyle = window.getComputedStyle(obj, '');
			objHeight = parseInt(computedStyle.getPropertyValue('height'));
			if (objHeight && !isNaN(objHeight))
				return objHeight;
		}
		return -1;
	}

	function getActualMousePosition(e) {
		if (!e)
			var e = window.event;

		var mouseX = 0
		var mouseY = 0;
		if( typeof( window.pageYOffset ) == 'number' ) {
			mouseY = window.pageYOffset;
			mouseX = window.pageXOffset;
		} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
			mouseY = document.body.scrollTop;
			mouseX = document.body.scrollLeft;
		} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
			mouseY = document.documentElement.scrollTop;
			mouseX = document.documentElement.scrollLeft;
		}
		return [ parseInt(e.clientX)+mouseX, mouseY+parseInt(e.clientY) ];
//		return [ parseInt(e.clientX)+mouseX, mouseY+parseInt(e.clientY)+parseInt(window.document.body.scrollTop) ];
	}

	function positionDiv(e, divId, extraX, extraY, display, ignoreWithinWindow) {
		var divObj = getDocObjectById(divId);
		if (divObj) {
			if (!extraX) extraX = 0;
			if (!extraY) extraY = 0;
			var mousePos = getActualMousePosition(e);
			divObj.style.left = (mousePos[0]+extraX)+"px";
			divObj.style.top = (mousePos[1]+extraY)+"px";
            if (!ignoreWithinWindow)
                positionForcedWithinWindow(divId);
			displayDiv(divId, display);
		}
	}

    function centerPositionDiv(divId, compensation) {
        var divObj = getDocObjectById(divId);
        if (divObj) {
            var divWidth = getObjectWidth(divId);
            var screenWidth = getScreenWidth();
            divObj.style.left = ((screenWidth/2)-(divWidth/2)-(getObjectWidth("advertisingRight")/2)+(!compensation?0:compensation))+"px";
        }
    }

    function positionForcedWithinWindow(divId) {
        var divObj = getDocObjectById(divId);
        if (divObj) {
            // adjust right pos
            if ((getObjectLeftPos(null, divObj)+getObjectWidth(null, divObj)) > (getScreenLeft()+getScreenWidth())) {
                divObj.style.left = (getScreenWidth()-getObjectWidth(null, divObj)-30)+"px";
                // alert("right adjusted");
            }
            // adjust left pos
            if (getObjectLeftPos(null, divObj) < getScreenLeft()) {
                divObj.style.left = (getScreenLeft()+10)+"px";
                // alert("left adjusted");
            }
            // adjust bottom pos
            if ((getObjectTopPos(null, divObj)+getObjectHeight(null, divObj)) > (getScreenTop()+getScreenHeight())) {
                divObj.style.top = ((getScreenTop()+getScreenHeight())-getObjectHeight(null, divObj)-10)+"px";
                // alert("bottom adjusted");
            }
            // adjust top pos
            if (getObjectTopPos(null, divObj) < getScreenTop()) {
                divObj.style.top = (getScreenTop()+10)+"px";
                // alert("top adjusted");
            }
        }
    }

    function getScreenTop() {
        if( typeof( window.pageYOffset ) == 'number' ) { return window.pageYOffset; }
        else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { return document.body.scrollTop; }
        else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { return document.documentElement.scrollTop; }
        return 0;
    }
    function getScreenLeft() {
        if( typeof( window.pageYOffset ) == 'number' ) { return window.pageXOffset; }
        else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { return document.body.scrollLeft; }
        else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { return document.documentElement.scrollLeft; }
        return 0;
    }
    function getScreenWidth() {
        if (typeof window.innerWidth != 'undefined') {return window.innerWidth;}
        else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {return document.documentElement.clientWidth;}
        else {return document.getElementsByTagName('body')[0].clientWidth;}
    }
    function getScreenHeight() {
        if (typeof window.innerHeight != 'undefined') {return window.innerHeight;}
        else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientHeight != 0) {return document.documentElement.clientHeight;}
        else {return document.getElementsByTagName('body')[0].clientHeight;}
    }

    // usage e.g: addEvent(divObj, "click", "[function_no_args]") or addEvent(divObj, "blur", "[function_no_args]")
    function addEvent(object, eventType, functionOrExpression) {
        if(window.addEventListener) {
            object.addEventListener(eventType, functionOrExpression, false);
            return true;
        } else if(window.attachEvent) { // for IE
            object.attachEvent('on' + eventType, functionOrExpression);
            return true;
        } else return false;
    }

	function toggleDivList(divPrefix, id, length) {
		for (var i=0; i < length; i++) {
			var divObj = getDocObjectById(divPrefix+i);
			if (divObj)
				divObj.style.display = (id == i ? (divObj.style.display == 'block' ? 'none' : 'block') : 'none');
		}
	}

	function toggleDivListClass(divPrefix, id, length, classSelected, classUnselected) {
		for (var i=0; i < length; i++) {
			var divObj = getDocObjectById(divPrefix+i);
			if (divObj)
				divObj.className = (id == i ? (divObj.className == classUnselected ? classSelected : classUnselected) : classUnselected);
		}
	}

	function toggleDivDisplay(divId) {
		var divObj = getDocObjectById(divId);
		if (divObj)
			divObj.style.display = (divObj.style.display == 'none' ? 'block' : 'none');
	}

	function displayDiv(divId, display) {
		var divObj = getDocObjectById(divId);
		if (divObj)
			divObj.style.display = (display ? 'block' : 'none');
	}

	function displayObject(divObj, display) {
		if (divObj)
			divObj.style.display = (display ? 'block' : 'none');
	}

	function isDivDisplayed(divId) {
		var divObj = getDocObjectById(divId);
		if (divObj)
			return divObj.style.display != 'none';
		else
			return false;
	}

	function printToDiv(divId, htmlOrText) {
		if (getDocObjectById(divId))
			getDocObjectById(divId).innerHTML = htmlOrText;
	}

    function addStyleClass(id, className) {
        var obj = getDocObjectById(id);
        if (obj) {
            if (obj.className) {
                var contains = false;
                var split = obj.className.split(" ");
                for (var i=0; i < split.length; i++) {
                    if (split[i] == className) {
                        contains = true;
                        break;
                    }
                }
                if (!contains)
                    obj.className += (obj.className.length==0?"":" ")+className;
            }
        }
    }

    function removeStyleClass(id, className) {
        var obj = getDocObjectById(id);
        if (obj) {
            if (obj.className) {
                var newClassName = "";
                var split = obj.className.split(" ");
                for (var i=0; i < split.length; i++) {
                    if (split[i] != className) {
                        newClassName += (newClassName.length==0?"":" ")+split[i];
                        break;
                    }
                }
                obj.className += newClassName;
            }
        }
    }

	function goPlaces(protocol, subdomain, domain, topdomain, additionalPath) {
		var path = protocol+'://'+(subdomain?subdomain+'.':'')+domain+'.'+topdomain+additionalPath;
		window.open(path);
	}

	function goInternal(part1, part2) {
		document.location.href = part1+"?"+part2;
	}

	function disableEnterKey(e)	{
		var key;
		if(window.event)
			key = window.event.keyCode; //IE
		else
			key = e.which; //firefox      

		return (key != 13);
	}

	function stripHTML(text){
		var re = /(<([^>]+)>)/gi;
		return text.replace(re, "");
	}

	function displayMilkyLayer(show) {
		getDocObjectById('milkyLayer').style.display = (show ? 'block' : 'none');
		if (show)
			window.scrollTo(0,0);
	}

	function trimAll(strText) {
		return trimLeading(trimTrailing(strText));
	}

	function trimLeading(strText) {
		// this will get rid of leading spaces
		while (strText.substring(0,1) == ' ')
			strText = strText.substring(1, strText.length);
	   return strText;
	}

	function trimTrailing(strText) {
		while (strText.substring(strText.length-1,strText.length) == ' ')
			strText = strText.substring(0, strText.length-1);
	   return strText;
	}

	function addOption(selObj, value, text) {
		if (selObj) {
			var newOption = new Option();
			newOption.value = value;
			newOption.text = text;
			selObj.options[selObj.options.length] = newOption;
		}
	}

	function appendToArray(arr, obj, uniqueOnly) {
		if (!arr) return;
		
		var addToArray = true;
		if (uniqueOnly) {
			for (var i=0; i < arr.length && addToArray; i++) {
				if (arr[i] == obj)
					addToArray = false;
			}
		}
		if (addToArray)
			arr[arr.length] = obj;
	}

	function getSelBoxValue(selObj, firstOptionValid) {
		if (selObj && selObj.options && selObj.options.length >= selObj.options.selectedIndex && (firstOptionValid || selObj.options.selectedIndex > 0)) {
			return selObj.options[selObj.options.selectedIndex].value;
		}
		return 0;
	}

	function selectOption(selObj, selectedOption) {
		if (selObj && selObj.options && selObj.options.length > 0) {
			for (var i=0; i < selObj.options.length; i++) {
                if (selObj.options[i].value == selectedOption) {
                    selObj.options.selectedIndex = i;
                    break;
                }
            }
		}
	}

	function isInArray(arr, value) {
		for (var i=0; i < arr.length; i++) {
			if (arr[i] == value) {
				return true;
			}
		}
		return false;
	}

	function radioValue(radioObj) {
		for (var i = 0; i < radioObj.length; i++) {
			if (radioObj[i].checked)
				return radioObj[i].value;
		}
		return -1;
	}

	function checkRadioValue(radioObj, value) {
		for (var i = 0; i < radioObj.length; i++) {
            radioObj[i].checked = (radioObj[i].value == value ? "checked" : "");
		}
	}

	function getCheckboxActiveValues(checkboxObj) {
		var values = new Array();
		for (var i = 0; i < checkboxObj.length; i++) {
			if (checkboxObj[i].checked)
				values[values.length] = checkboxObj[i].value;
		}
		return values;
	}

	function createButton(url, onclick, text, buttonType, blankTarget, additional, resultAsString) {
		var buttonHTML = '';
        if (Browser.isIEBelow9()) {
            var additionalbuttonStyle = "";
            if (buttonType && buttonType != "right") {
                var styleSplit = buttonType.split(" ");
                for (var i=0; i < styleSplit.length; i++) {
                    additionalbuttonStyle += " ie-"+styleSplit[i];
                }
            }

            buttonHTML += '<div class="button-wrapper">';
            buttonHTML += '<a class="ie-button'+additionalbuttonStyle+'" href="'+url+'"'+(blankTarget ? ' target="_blank"' : '')+' onclick="'+(onclick ? onclick : '')+'" '+(additional ? additional : '')+'><span><span><span>'+text+'</span></span></span></a>';
            buttonHTML += '</div>';
        } else {
		    buttonHTML += '<div class="button-wrapper">';
			buttonHTML += '<a class="button'+(!buttonType||buttonType=='right'?'':' '+buttonType)+'" href="'+url+'"'+(blankTarget ? ' target="_blank"' : '')+' onclick="'+(onclick ? onclick : '')+'" '+(additional ? additional : '')+'>'+text+'</a>';
			buttonHTML += '</div>';
        }
        if (resultAsString)
            return buttonHTML;
        else
		    document.write(buttonHTML);
	}

/*
	function createButton(url, onclick, text, position, blankTarget) {
		var buttonHTML = '<div class="'+(position == 'right' ? 'btnRight' : 'btn')+'"><div class="btnBodyLeft"></div><span class="btnBodyMiddle">';
			buttonHTML += '<a href="'+url+'"'+(blankTarget ? ' target="_blank"' : '')+' onclick="'+(onclick ? onclick : '')+'">'+text+'</a>';
			buttonHTML += '</span><div class="btnBodyRight"></div></div>';
		document.write(buttonHTML);
	}

*/
	function createSearchButton(url, text, width, blankTarget) {
		var buttonHTML = '<div class="searchButton" style="width: '+width+'px;">';
			buttonHTML += '<div class="inner">';
			buttonHTML += '<a href="'+url+'"'+(blankTarget ? ' target="_blank"' : '')+'>'+text+'</a>';
			buttonHTML += '</div></div>';
		return buttonHTML;
	}

	function showFloatingDiv(e, cnt, withMilky, display) {
		var fcObj = getDocObjectById("floatingContent");
		var fcBodyObj = getDocObjectById("floatingContentBody");
		if (fcObj && fcBodyObj) {
			if (withMilky || !display)
				displayDiv("milkyLayer", display);
			positionDiv(e, "floatingContent", 0, 0);
			fcBodyObj.innerHTML = cnt;
			displayDiv("floatingContent", display);
		}
	}

	/* *********************************************************************************************************************
		AJAX...
	***********************************************************************************************************************/
	var AJAX_REQUEST;
	function getReqObject(asJson){
		var reqObj = null;
		if (window.XMLHttpRequest) {
			try {
				reqObj = new XMLHttpRequest();
				if (reqObj.overrideMimeType && !asJson) // not for everyone...
					reqObj.overrideMimeType('text/xml');
			} catch(e) { }
		} else if (window.ActiveXObject) { /* Internet Explorer */
			try {
				reqObj = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) { }
		}

		return reqObj;
	}

	function doReq(url, responseHandler){
		if (AJAX_REQUEST) {
			eval('AJAX_REQUEST.onreadystatechange = ' + responseHandler);
			AJAX_REQUEST.open('GET', url, true);
			AJAX_REQUEST.send(null);
		}
	}

	function doPost(url, params, responseHandler){
		if (AJAX_REQUEST) {
			eval('AJAX_REQUEST.onreadystatechange = ' + responseHandler);
			AJAX_REQUEST.open('POST', url, true);
			AJAX_REQUEST.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			AJAX_REQUEST.setRequestHeader("Content-length", params.length);
			AJAX_REQUEST.setRequestHeader("Connection", "close");
			AJAX_REQUEST.send(params);
		}
	}


	function getNodeText(node){
		if (node && node.childNodes[0])
			return node.childNodes[0].nodeValue;
		else
			return '';
	}

	// -----------------------------------------------------------------------------------------------------------------
	var AJAX_CURRENT_FORM_OBJECT;
	function fp(formObj, type) {
		AJAX_CURRENT_FORM_OBJECT = formObj;
		AJAX_REQUEST = getReqObject();
		doReq('/forms/formChecksum.jsp?type='+(type ? type : ""), 'formPrep');
	}

	function formPrep() {
		if (AJAX_REQUEST && AJAX_REQUEST.readyState == 4) {
			if (AJAX_REQUEST.status == 200) {
				r = AJAX_REQUEST.responseXML.getElementsByTagName('r');
				if (r) {
					AJAX_CURRENT_FORM_OBJECT.checksum.value = getNodeText(r[0]);
				}
			}
		}
	}

	function observe(eventStr) {
		AJAX_REQUEST = getReqObject();
		doReq('/observe/observe.jsp?event='+eventStr, 'observeVoid');
	}

	function observeVoid() {
		// ignore...
	}

	// -----------------
	// Menu
	// -----------------
	var SUB_MENU_PREFIX = "submenu_";
	var LAST_ACTIVE_SUB_MENU_KEY = null;
	var ACTIVE_SUB_MENU = null;
	function showSubMenu(aTag, menuKey) {
		var subMenuDiv = getDocObjectById(SUB_MENU_PREFIX+menuKey);
		if (subMenuDiv) {
            // position sub div center to menu option
            var parentDiv = aTag.parentNode;
            subMenuDiv.style.top = getObjectHeight(null, parentDiv)+getObjectTopPos(null, parentDiv)+"px";
            subMenuDiv.style.left = ((getObjectWidth(null, parentDiv)+getObjectLeftPos(null, parentDiv))/2)+"px";

			displayDiv(SUB_MENU_PREFIX+menuKey, true);
			LAST_ACTIVE_SUB_MENU_KEY = SUB_MENU_PREFIX+menuKey;
			registerActiveSubMenu(true);
		}
	}
	function closeSubMenu() {
		if (!ACTIVE_SUB_MENU)
			displayDiv(LAST_ACTIVE_SUB_MENU_KEY, false);
	}
	function registerActiveSubMenu(status) {
		ACTIVE_SUB_MENU = status;
	}

	// -----------------
	// Panoramio
	// -----------------
	var PP_MAX_THUMBS = 10;
	var PP_MAX_TOTAL = 220;
	var PP_OBJECTS = new Array();
	var PP_AUTO_RETRY_DONE = false;
	var PP_RESPONSE_COUNTER = 0;
	var PP_TOTAL_RESPONSE_COUNTER = 0;
	var PP_LONGITUDE = 0;
	var PP_LATITUDE = 0;
	function PanoramioPhoto(id, title, thumbUrl, photoUrl, moreUrl, longitude, latitude, ownerName, ownerUrl, width, height) {this.ID=id;this.TITLE=title;this.THUMB=thumbUrl;this.IMAGE=photoUrl;this.LONGITUDE=longitude;this.LATITUDE=latitude;this.MORE_URL=moreUrl;this.OWNER_NAME=ownerName;this.OWNER_URL=ownerUrl;this.IMAGE_WIDTH=width;this.IMAGE_HEIGHT=height;}

	function addToPhotoLoadLog(str) {
		var loadLogDiv = getDocObjectById("photoLoadLog");
		loadLogDiv.innerHTML += str+" # ";
	}

	function initPanoramioPhotos(longitude, latitude) {
		if (longitude && latitude) {
			PP_LONGITUDE = longitude;
			PP_LATITUDE = latitude;
		}
		PP_RESPONSE_COUNTER = 0;
		PP_OBJECTS = new Array();
		setTimeout("getPanoramioPhotos()", 100);
	}
	function getPanoramioPhotos() {
		AJAX_REQUEST = getReqObject(true);
		var range = 0.01;
		var url = "/blocks/location/locationPanoramioPhotosJSON.jsp?longMin="+(PP_LONGITUDE-range)+"&longMax="+(PP_LONGITUDE+range)+"&latMin="+(PP_LATITUDE-range)+"&latMax="+(PP_LATITUDE+range);
		doReq(url, "handlePanoramioPhotosResponse");
	}

	function handlePanoramioPhotosResponse() {
		if (AJAX_REQUEST && AJAX_REQUEST.readyState == 4) {
			if (AJAX_REQUEST.status == 200) {
				if (PP_TOTAL_RESPONSE_COUNTER++ == 10) {
					printToDiv("locationPhotoLoadMessage", "Tyvärr kunde vi inte hitta några foton för tillfället");
					return;
				} else if (PP_RESPONSE_COUNTER++ > 0) {
					addToPhotoLoadLog("Response counter above zero");
					setTimeout("initPanoramioPhotos()", 50);
					return;
				}
				addToPhotoLoadLog("AJAX response received!");

				var responseJSON = AJAX_REQUEST.responseText;
				var totalPhotos = 0;
				if (responseJSON.indexOf("@@@ERROR@@@") > -1) {
					printToDiv("locationPhotoLoadMessage", "Tyvärr kunde vi inte hitta några foton för tillfället");
				} else {
					var jsonData = eval('(' + responseJSON + ')');
					if (jsonData.root) {
						AJAX_REQUEST.abort();
						if (PP_AUTO_RETRY_DONE) {
							printToDiv("locationPhotoLoadMessage", "Något gick tyvärr fel när vi försökte hämta foton. <a href='javascript:void(0)' onclick='initPanoramioPhotos()'>Försök igen?</a> (1)");
							return;
						} else {
							addToPhotoLoadLog("Root response, doing auto retry");
							PP_AUTO_RETRY_DONE = true;
							initPanoramioPhotos();
							return;
						}
					} else {
						if (jsonData.photos.length > 0) {
							totalPhotos = (jsonData.photos.length > PP_MAX_TOTAL ? PP_MAX_TOTAL : jsonData.photos.length);
							for (var i=0; i < totalPhotos; i++) {
								createPanoramioPhotoData(jsonData.photos[i]);
							}
						} else {
							printToDiv("locationPhotoLoadMessage", "Tyvärr kunde vi inte hitta några foton   för tillfället...");
							addToPhotoLoadLog("Response was: " + responseJSON);
							return;
						}
					}
				}

				printToDiv("photoCount", totalPhotos+" bilder")
				pagingPhotos(0, true);
				// renderPanoramioPhoto(0);
				displayDiv("locationPhotoLoadMessage", false);
				displayDiv("locationPhotoWrapper", true);
				addToPhotoLoadLog("LOAD DONE!");
			} else {
				addToPhotoLoadLog("INCORRECT RESPONSE: " + AJAX_REQUEST.status);
				printToDiv("locationPhotoLoadMessage", "Något gick tyvärr fel när vi försökte hämta foton. <a href='javascript:void(0)' onclick='initPanoramioPhotos()'>Försök igen?</a> (3)");
				AJAX_REQUEST.abort();
			}
		}
	}

	function renderPanoramioPhoto(idx) {
		var scaledWidthHeight = scalePanoramioPhoto(PP_OBJECTS[idx].IMAGE_WIDTH, PP_OBJECTS[idx].IMAGE_HEIGHT);
		var width = scaledWidthHeight[0];
		var height = scaledWidthHeight[1];
		var preLoadImage = new Image();
		preLoadImage.src = PP_OBJECTS[idx].IMAGE;
		printToDiv("locationPhoto", "<img src='" + PP_OBJECTS[idx].IMAGE + "' style='width:" + width + "px;height:" + height + "px;' />");
		printToDiv("photoCreditsOwner", "Foto taget av <a href='" + PP_OBJECTS[idx].OWNER_URL + "' target='_blank'>" + PP_OBJECTS[idx].OWNER_NAME + "</a>");
	}

	function scalePanoramioPhoto(width, height) {
		if ((width != 500 || height != 375) && !(width <= 500 && height <= 375)) {
			while (width > 500 || height > 375) {
				width--;
				height--;
			}
		}
		return new Array(width, height);
	}

	function renderPanoramioThumbs(photoIdx) {
		var thumbCounter = 0;
		var currentPhotoIdx;
		for (var ppi=0; ppi < PP_MAX_THUMBS; ppi++) {
			currentPhotoIdx = ppi+photoIdx;
			if (currentPhotoIdx < PP_OBJECTS.length) {
//				printToDiv("locationPhotoThumb"+(thumbCounter), "<img src='"+PP_OBJECTS[currentPhotoIdx].THUMB+"' border='0' onmouseover='renderPanoramioPhoto("+currentPhotoIdx+")' />");
				printToDiv("locationPhotoThumb"+(thumbCounter), "<div class='image' style='background: url("+PP_OBJECTS[currentPhotoIdx].THUMB+");' onclick='renderPanoramioPhoto("+currentPhotoIdx+")' onmouseover='renderPanoramioPhoto("+currentPhotoIdx+")'><div class='number'>"+(currentPhotoIdx+1)+"</div></div>");
				getDocObjectById("locationPhotoThumb"+(thumbCounter)).className = "locationPhotoThumb";
			} else {
				printToDiv("locationPhotoThumb"+(thumbCounter), "");
				getDocObjectById("locationPhotoThumb"+(thumbCounter)).className = "locationPhotoThumbClosed";
			}
			thumbCounter++;
		}
	}

	function pagingPhotos(idx, isInit) {
		renderPanoramioThumbs(idx);
		if (isInit)
			setTimeout("renderPanoramioPhoto(0)", 100);
		else
			renderPanoramioPhoto(idx);

		var pagingHTML = "<b>Totalt "+PP_OBJECTS.length+" bilder</b> (vi visar max 10 bilder per sida)<br/>Sida: ";
		var pages = (Math.round(PP_OBJECTS.length/PP_MAX_THUMBS))+(PP_OBJECTS.length%PP_MAX_THUMBS>=5||PP_OBJECTS.length%PP_MAX_THUMBS==0?0:1);
		for (var pagingI=0; pagingI < pages; pagingI++) {
			pagingHTML += "<a href='javascript:void(0)' onclick='renderPanoramioThumbs("+((pagingI)*PP_MAX_THUMBS)+");renderPanoramioPhoto("+((pagingI)*PP_MAX_THUMBS)+")'>"+(pagingI+1)+"</a>&nbsp;&nbsp;";
		}
		printToDiv("locationPhotoPaging", pagingHTML);
	}

	function createPanoramioPhotoData(jsonData) {
		if (jsonData) {
			var photoUrl = jsonData.photo_file_url;
			var thumbUrl = (photoUrl ? photoUrl.replace("/medium/", "/square/") : "");
			PP_OBJECTS[PP_OBJECTS.length] = new PanoramioPhoto(jsonData.photo_id, jsonData.photo_title, thumbUrl, photoUrl, jsonData.photo_url, jsonData.longitude, jsonData.latitude, jsonData.owner_name, jsonData.owner_url, jsonData.width, jsonData.height);
		}
	}

    // -----------------
    // Flashbanner area object
    // -----------------
    function FlashBannerArea(areaId) {
        this.areaId = areaId;
        this.flashObjects = new Array();
        this.width = 250;
        this.height = 240;

        this.setWidthHeight = function(width, height) {this.width=width;this.height=height;};
        this.registerFlashObject = function(path, linkUrl, imagePath) {this.flashObjects[this.flashObjects.length]=new FlashObject(path, linkUrl, imagePath)};
        this.randomFlash = function() {
            var random = Math.round(Math.random()*(this.flashObjects.length))-1;
            if (random == -1 || random >= this.flashObjects.length)
                random = 0;
            this.showFlash(random);
        };
        this.showFlash = function(idx) {
            var flashvars = {};
            var params = {}; params.wmode = "transparent";
            var attributes = {}; attributes.id = this.areaId;
            swfobject.switchOffAutoHideShow();
            swfobject.embedSWF(this.flashObjects[idx].path, this.areaId, this.width, this.height, "9.0.0", false, flashvars, params, attributes);
            if (this.flashObjects[idx].linkUrl) {
                var overlayImage = (Browser.isIPadOrIPhone() ? this.flashObjects[idx].imagePath : "/static/images/trans.gif");
                document.write("<div id=\""+this.areaId+"Overlay\" style=\"display:none;z-index:20;position:absolute;left: 0;top:0;width:"+this.width+"px; min-height: "+this.height+"px; height:auto !important; height:"+this.height+"px; background: url("+overlayImage+") repeat; cursor: pointer;\" onClick=\"window.open('"+this.flashObjects[idx].linkUrl+"')\"> </div>");
                var overlayObj = getDocObjectById(this.areaId+"Overlay");
                var mainLeftPos = getObjectLeftPos(this.areaId);
                var mainTopPos = getObjectTopPos(this.areaId);
                overlayObj.style.left=mainLeftPos+"px";
                overlayObj.style.top=mainTopPos+"px";
                displayObject(overlayObj, true);
            }
        };
        function FlashObject(path, linkUrl, imagePath) {this.path=path;this.linkUrl=linkUrl;this.imagePath=imagePath;}
    }


    // -----------------
    // Map wrapper
    // -----------------
    function GoogleMap() {
        this.CLOSE_MAP = "Stäng karta";
        
        this.header = "";
        this.preLabelPrint = true;
        this.useForcedZoom = false;
        this.forcedZoom = 6;
        this.googleMapStaticObjects = new Array();
        this.googleMapObjects = new Array();
        this.setHeader = function(headerName) {this.header=headerName;if (getDocObjectById("googleMapHeader")){getDocObjectById("googleMapHeader").innerHTML=headerName;}};
        this.setPreLabelPrint = function(status) {this.preLabelPrint=status;};
        this.setForcedZoom = function(zoomLevel) {this.forcedZoom=zoomLevel;};
        this.setUseForcedZoom = function(useForcedZoom) {this.useForcedZoom=useForcedZoom;};
        this.isUseForcedZoom = function() {return this.useForcedZoom;};
        this.cleanGoogleMapObjects = function() {this.googleMapObjects = new Array();};
        this.addGoogleMapObject = function(latitude, longitude, name, url, func, iconType) {this.googleMapObjects[this.googleMapObjects.length] = new GoogleMapObject(latitude, longitude, name, url, func, iconType);};
        this.addGoogleMapStaticObject = function(latitude, longitude, name, url, func, iconType) {this.googleMapStaticObjects[this.googleMapStaticObjects.length] = new GoogleMapObject(latitude, longitude, name, url, func, iconType);};

        this.printWrapper = function() {
            var mapWrapperObj = getDocObjectById("mapWrapper");
            if (!mapWrapperObj) {
                var mapHTML = "<div id=\"mapWrapper\" style=\"display: none;\">";
                mapHTML += "<div class=\"head\"><div class=\"close\"><a href=\"javascript:void(0)\" onclick=\"toggleDivDisplay('mapWrapper');\">"+this.CLOSE_MAP+"</a></div><h3 id=\"googleMapHeader\">"+this.header+"</h3></div>";
		        mapHTML += "<iframe name=\"mapFrame\" width=\"610\" height=\"440\" style=\"padding:0;margin:0;border:none;\" frameborder=\"0\" border=\"0\" scrolling=\"no\"></iframe></div>";
                document.write(mapHTML);

                document.onmousedown = function (e) {
                    var clickLocation = (e && e.target) || (event && event.srcElement);
                    var clickOutside = true;
                    while (clickLocation.parentNode) {
                        if (mapWrapperObj == clickLocation) {
                            clickOutside = false;
                            break;
                        }
                        clickLocation = clickLocation.parentNode;
                    }
                    if (clickOutside)
                        displayDiv("mapWrapper", false);
                };
            }
        };
        this.openMap = function(e) {
            var mapWrapperObj = getDocObjectById("mapWrapper");
            if (mapWrapperObj) {
                var mapObjects = "";
                var i=0;
                for (i=0;i<this.googleMapObjects.length;i++) { mapObjects += "["+this.googleMapObjects[i].latitude+"|"+this.googleMapObjects[i].longitude+"|"+this.googleMapObjects[i].name+"|"+this.googleMapObjects[i].url+"|"+this.googleMapObjects[i].func+"|"+this.googleMapObjects[i].iconType+"]"; }
                for (i=0;i<this.googleMapStaticObjects.length;i++) { mapObjects += "["+this.googleMapStaticObjects[i].latitude+"|"+this.googleMapStaticObjects[i].longitude+"|"+this.googleMapStaticObjects[i].name+"|"+this.googleMapStaticObjects[i].url+"|"+this.googleMapStaticObjects[i].func+"|"+this.googleMapStaticObjects[i].iconType+"]"; }
                frames["mapFrame"].location.href  = "/blocks/location/locationMapGoogle.jsp?zoom="+(this.useForcedZoom?this.forcedZoom:-1)+"&objects="+encodeURIComponent(mapObjects)+"&preLabelPrint="+(this.preLabelPrint?"true":"false");
                mapWrapperObj.style.display='block';
                positionDiv(e, "mapWrapper", (-1*getObjectWidth(null,mapWrapperObj))-10, (-1*getObjectHeight(null,mapWrapperObj))+200, true, false);
            }
        };

        function GoogleMapObject(latitude, longitude, name, url, func, iconType) {
            this.latitude = latitude;
            this.longitude = longitude;
            this.name = name;
            this.url = url;
            this.func = func;
            this.iconType = iconType;
        }
    }
    GoogleMap = new GoogleMap();

    // -----------------
    // Tab menu
    // -----------------
    function TabMenu() {
        this.LAYER_PREFIX = null;
        this.TAB_ENTRIES = new Array();
        this.UNAVAILABLE_TAB_ENTRIES = new Array();

        this.setLayerPrefix = function(prefix) {this.LAYER_PREFIX=prefix;};
        this.addTabMenuEntry = function(tabMenuEntry) {this.TAB_ENTRIES[this.TAB_ENTRIES.length]=tabMenuEntry;};
        this.addUnavailableTabMenuEntry = function(tabMenuEntry) {this.UNAVAILABLE_TAB_ENTRIES[this.UNAVAILABLE_TAB_ENTRIES.length]=tabMenuEntry;};
        this.resetUnavailableTabMenuEntry = function() {this.UNAVAILABLE_TAB_ENTRIES=new Array();};

        this.resetTabMenu = function() {this.handleTabMenu(''); };
        this.handleTabMenu = function(activeDiv) {
            for (var i=0; i < this.TAB_ENTRIES.length; i++) {
                displayDiv(this.LAYER_PREFIX+this.TAB_ENTRIES[i], (this.TAB_ENTRIES[i]==activeDiv));
                getDocObjectById("tabMenu"+this.TAB_ENTRIES[i]).className = (this.TAB_ENTRIES[i]==activeDiv ? "active" : isInArray(this.UNAVAILABLE_TAB_ENTRIES, this.TAB_ENTRIES[i]) ? "unavailable" : "inactive");
            }
        };
        this.preOpenTab = function() {
            var hrefStr = document.location.href;
            if (hrefStr.indexOf("#") > -1) {
                var tab = hrefStr.substring(hrefStr.indexOf("\#")+1);
                if (isInArray(this.TAB_ENTRIES, tab)) {
                    this.handleTabMenu(tab);
                }
            }
        };
    }
    TabMenu = new TabMenu();

    // -----------------
    // Distance calculation
    // -----------------
    function distance(lat1, lon1, lat2, lon2) {
        var theta = lon1 - lon2;
        var dist = Math.sin(deg2rad(lat1)) * Math.sin(deg2rad(lat2)) + Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.cos(deg2rad(theta));
        dist = Math.acos(dist);
        dist = rad2deg(dist);
        dist = dist * 60 * 1.1515;
        return dist;
    }
    function deg2rad(deg) { return (deg * Math.PI / 180.0); }
    function rad2deg(rad) { return (rad * 180.0 / Math.PI); }

	/*	SWFObject v2.2 <http://code.google.com/p/swfobject/>
		is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
	*/
	var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();

