//ar	Arabic
//bg	Bulgarian
//zh-CN	Chinese Simplified
//zh-TW	Chinese Traditional
//ca	Catalan
//hr	Croatian
//cs	Czech
//da	Danish
//nl	Dutch
//en	English
//tl	Filipino
//fi	Finnish
//fr	French
//de	German
//el	Greek
//iw	Hebrew
//hi	Hindi
//id	Indonesian
//it	Italian
//ja	Japanese
//ko	Korean
//lv	Latvian
//lt	Lithuanian
//no	Norwegian
//pl	Polish
//pt-PT	Portuguese
//ro	Romanian
//ru	Russian
//es	Spanish
//sr	Serbian
//sk	Slovak
//sl	Slovenian
//sv	Swedish
//uk	Ukrainian
//vi	Vietnamese

google.load("language", "1");

var serverPath = self.location.protocol + '//' + self.location.host;

var Languages =
{
	5 : "ar",
	6 : "ar",
	7 : "ar",
	8 : "ar",
	9 : "ar",
	10 : "ar",
	11 : "ar",
	12 : "ar",
	13 : "ar",
	14 : "ar",
	15 : "ar",
	16 : "ar",
	17 : "ar",
	18 : "ar",
	19 : "ar",
	20 : "ar",
	21 : "ar",
	31 : "bg",
	32 : "bg",
	33 : "ca",
	34 : "ca",
	37 : "zh-CN",
	40 : "zh-TW",
	42 : "hr",
	43 : "hr",
	44 : "cs",
	45 : "cs",
	46 : "da",
	47 : "da",
	50 : "nl",
	51 : "nl",
	52 : "nl",
	53 : "en",
	54 : "en",
	55 : "en",
	56 : "en",
	57 : "en",
	58 : "en",
	59 : "en",
	60 : "en",
	61 : "en",
	62 : "en",
	63 : "en",
	64 : "en",
	65 : "en",
	66 : "en",
	73 : "fi",
	74 : "fi",
	75 : "fr",
	76 : "fr",
	77 : "fr",
	78 : "fr",
	79 : "fr",
	80 : "fr",
	81 : "fr",
	86 : "de",
	87 : "de",
	88 : "de",
	89 : "de",
	90 : "de",
	91 : "de",
	92 : "el",
	93 : "el",
	96 : "iw",
	97 : "iw",
	98 : "hi",
	99 : "hi",
	104 : "id",
	105 : "id",
	106 : "it",
	107 : "it",
	108 : "it",
	109 : "ja",
	110 : "ja",
	117 : "ko",
	118 : "ko",
	121 : "lv",
	122 : "lv",
	123 : "lt",
	124 : "lt",
	134 : "no",
	135 : "no",
	136 : "no",
	137 : "pl",
	138 : "pl",
	139 : "pt-PT",
	140 : "pt-PT",
	141 : "pt-PT",
	144 : "ro",
	145 : "ro",
	146 : "ru",
	147 : "ru",
	156 : "es",
	157 : "es",
	158 : "es",
	159 : "es",
	160 : "es",
	161 : "es",
	162 : "es",
	163 : "es",
	164 : "es",
	165 : "es",
	166 : "es",
	167 : "es",
	168 : "es",
	169 : "es",
	170 : "es",
	171 : "es",
	172 : "es",
	173 : "es",
	174 : "es",
	175 : "es",
	176 : "es",
	150 : "sr",
	151 : "sr",
	152 : "sk",
	153 : "sk",
	154 : "sl",
	155 : "sl",
	179 : "sv",
	180 : "sv",
	181 : "sv",
	194 : "uk",
	195 : "uk",
	201 : "vi",
	202 : "vi"
}

function CanTranslate(from, to) {
	if (google.language.isTranslatable(Languages[from])
		&& google.language.isTranslatable(Languages[to])) {
		return true;
	}
	
	return false;
}

var translationSeperators = new Array(".", "?", "!");
var translationParts;
var translationFrom;
var translationTo;
var translationCallback;

function Translate(input, from, to, callback) {
	translationParts = new Array();
	translationFrom = Languages[from];
	translationTo = Languages[to];
	translationCallback = callback;
	
	var inputText = input;

	var index = inputText.indexOf(translationSeperators[0]);
	var index2;				
	if (translationSeperators.length > 1) {
		for (var i = 1; i < translationSeperators.length; i++) {
			index2 = inputText.indexOf(translationSeperators[i]);
			if (index == -1 || (index2 != -1 && index2 < index)) {
				index = index2;
			}
		}
	}
	
	var part;
	while (index != -1) {			
		part = inputText.substr(0, index + 1);
		
		if (part.length > 500) {
			for (var j = 0; j <= (part.length / 500); j++) {
				translationParts.push(part.substr(j * 500, 500));
			}
		}
		else {
			translationParts.push(inputText.substr(0, index + 1));
		}

		inputText = inputText.substr(index + 1);

		index = inputText.indexOf(translationSeperators[0]);
		if (translationSeperators.length > 1) {
			for (var i = 1; i < translationSeperators.length; i++) {
				index2 = inputText.indexOf(translationSeperators[i]);
				if (index == -1 || (index2 != -1 && index2 < index)) {
					index = index2;
				}
			}
		}
	}
	
	translationParts.push(inputText);
	CallTranslate();
}

function CallTranslate(input) {
	if (translationParts.length > 0) {
		translationParts = translationParts.reverse();
		google.language.translate(translationParts.pop(), translationFrom, translationTo, TranslateCallback);
	}
}

function TranslateCallback(result) {
	if (translationParts.length > 0) {
		translationCallback(result.translation, false);
		google.language.translate(translationParts.pop(), translationFrom, translationTo, TranslateCallback);
	}
	else {
		translationCallback(result.translation, true);
	}
}		

function CancelEventBubble(evt) {
	if (window.event) {
		window.event.cancelBubble = true;
	}
	else {
		evt.cancelBubble = true;
		evt.stopPropagation();
	}
}

function UrlEncode(str) {
	str = escape(str);
	return str.replace(/[*+\/@]|%20/g,
		function (s) {
			switch (s) {
				case "*": s = "%2A"; break;
				case "+": s = "%2B"; break;
				case "/": s = "%2F"; break;
				case "@": s = "%40"; break;
				case "%20": s = "+"; break;
			}
			return s;
		});
}	

/// <reference name="MicrosoftAjax.js"/>
var etc_tagsArray = [];

function InitTag(tagName, tagId, count) {
	etc_tagsArray[tagId] = count;
}

function etc_GrowTag(tagName, tagId) {
	if (typeof(etc_tagsArray[tagId]) != 'undefined') {
		etc_tagsArray[tagId] += 1;
	}
	else {
		etc_tagsArray[tagId] = 2;
	}
	if (etc_tagsArray[tagId] > 10) {
		etc_tagsArray[tagId] = 10;
	}
	$get(tagId).style.fontSize = (9 + (3 * etc_tagsArray[tagId])) + "px";
	ScimWS.SaveEditableTagCloudTagSize(tagName, etc_tagsArray[tagId]);
}

function etc_ShrinkTag(tagName, tagId) {
	if (typeof(etc_tagsArray[tagId]) != 'undefined') {
		etc_tagsArray[tagId] -= 1;
	}
	else {
		etc_tagsArray[tagId] = 1;
	}
	if (etc_tagsArray[tagId] < 1) {
		etc_tagsArray[tagId] = 1;
	}
	$get(tagId).style.fontSize = (9 + (3 * etc_tagsArray[tagId])) + "px";
	ScimWS.SaveEditableTagCloudTagSize(tagName, etc_tagsArray[tagId]);
}

function ContainsText(input) {
	return input.replace(/<(.|\n)*?>/g, '').replace(/ /g, '').length > 0;
}

var hoverPopup;
var hoverPopupXoffset = 15;
var hoverPopupYoffset = 10;

function initHoverPopup() {
	hoverPopup = document.getElementById('mainHoverPopupPanel');
	hoverPopup.style.display = 'none';

	document.onmousemove = function(e) {
		if (hoverPopup.style.display == 'block') {
			var x, y, right, bottom;

			if (!e) var e = window.event;

			if (e.pageX || e.pageY) {
				x = e.pageX;
				y = e.pageY;
			}
			else if (e.clientX || e.clientY) {
				x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
				y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
			}
			
			right = (document.documentElement.clientWidth || document.body.clientWidth || document.body.scrollWidth);
			bottom = (window.scrollY || document.documentElement.scrollTop || document.body.scrollTop) + (window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || document.body.scrollHeight);

			x += hoverPopupXoffset;
			y += hoverPopupYoffset;

			if(x > right - hoverPopup.offsetWidth) {
				x = right - hoverPopup.offsetWidth;
			}

			if(y > bottom - hoverPopup.offsetHeight) {
				y = bottom - hoverPopup.offsetHeight;
			}

			hoverPopup.style.top = y + 'px';
			hoverPopup.style.left = x + 'px';
		}
	}
}

function popup(text) {
	hoverPopup.innerHTML = text;
	hoverPopup.style.display = 'block';
}

function popout() {
	hoverPopup.style.display = 'none';
}

function showPopup(text, cssClass, elementId) {
	var element = $get(elementId);
	
	if (element) {
		var popup = document.createElement('div');

		popup.className = cssClass;
		popup.innerHTML = text;
		popup.style.position = "absolute";
		popup.style.zIndex = "999999";
		popup.style.left = "-10000px";
		$addHandler(popup, "click", hidePopup);
		document.body.appendChild(popup);
				
		var elementLeft = findPosAbsolute(element)[0];
		var elementTop = findPosAbsolute(element)[1];
		
		var popupLeft = (elementLeft + (element.offsetWidth / 2) - (popup.offsetWidth / 2));
		var popupTop = (elementTop - popup.offsetHeight);
		
		popup.style.left = popupLeft + 'px';
		popup.style.top = popupTop + 'px';
	}
}

function hidePopup(eventElement) {
	try {
		document.body.removeChild(eventElement.target);
	}
	catch(e) {
	}
}
/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){if (typeof _20 != 'undefined'){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML()}else{document.write(this.getSWFHTML());};return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
/// <reference name="MicrosoftAjax.js"/>
Sys.Application.add_init(AppInit);

function AppInit(sender) {
	if (Sys.WebForms) {
		if (typeof (Sys.WebForms.PageRequestManager) == "undefined") {
			location.reload(true);
		}
		else {
			Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(initHoverPopup);
		}
	}
}

function pageLoad() {
	wrapWords();
}

function UpdateFCKLinkedFields() {
	for (var i = 0; i < parent.frames.length; ++i) {
		try {
			if (parent.frames[i].FCK) {
				parent.frames[i].FCK.UpdateLinkedField();
			}
		}
		catch(e) {
			if (typeof(console) != 'undefined') {
				console.log(e);
			}
		}
	}
}

function getStyle(el, styleProp) {
	var x = document.getElementById(el);
	if (x.currentStyle) {
		var y = x.currentStyle[styleProp];
	}
	else if (window.getComputedStyle) {
		var y = document.defaultView.getComputedStyle(x, null).getPropertyValue(styleProp);
	}
	return y;
}

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 readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function findPosAbsolute(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {	
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	return [curleft,curtop];
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			var actualPosition;
			var actualPaddingLeft;
			var actualPaddingTop;
			
			if( window.getComputedStyle ) {
				actualPosition = getComputedStyle(obj.offsetParent, null).position;
				actualPaddingLeft = getComputedStyle(obj.offsetParent, null).paddingLeft;
				actualPaddingTop = getComputedStyle(obj.offsetParent, null).paddingTop;
			}
			else if( obj.offsetParent.currentStyle ) {
				actualPosition = obj.offsetParent.currentStyle.position;
				actualPaddingLeft = obj.offsetParent.currentStyle.paddingLeft;
				actualPaddingTop = obj.offsetParent.currentStyle.paddingTop;
			}
			else {
				//fallback for browsers with low support - only reliable for inline styles
				actualPosition = obj.offsetParent.style.position;
				actualPaddingLeft = obj.offsetParent.style.paddingLeft;
				actualPaddingTop = obj.offsetParent.style.paddingTop;
			}

			actualPaddingLeft = actualPaddingLeft.replace(/px/, '');
			if (parseInt(actualPaddingLeft) != NaN) {
				curleft += parseInt(actualPaddingLeft);
			}

			actualPaddingTop = actualPaddingTop.replace(/px/, '');
			if (parseInt(actualPaddingTop) != NaN) {
				curtop += parseInt(actualPaddingTop);
			}

			if(actualPosition == 'absolute' || actualPosition == 'fixed') {
				//the offsetParent of a fixed position element is null so it will stop
				return [curleft, curtop];
			}

			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		}
		while (obj = obj.offsetParent);
		
		return [curleft, curtop];
	}
}

var getElementsByClassName = function (className, tag, elm){
	if (document.getElementsByClassName) {
		getElementsByClassName = function (className, tag, elm) {
			elm = elm || document;
			var elements = elm.getElementsByClassName(className),
				nodeName = (tag)? new RegExp("\\b" + tag + "\\b", "i") : null,
				returnElements = [],
				current;
			for(var i=0, il=elements.length; i<il; i+=1){
				current = elements[i];
				if(!nodeName || nodeName.test(current.nodeName)) {
					returnElements.push(current);
				}
			}
			return returnElements;
		};
	}
	else if (document.evaluate) {
		getElementsByClassName = function (className, tag, elm) {
			tag = tag || "*";
			elm = elm || document;
			var classes = className.split(" "),
				classesToCheck = "",
				xhtmlNamespace = "http://www.w3.org/1999/xhtml",
				namespaceResolver = (document.documentElement.namespaceURI === xhtmlNamespace)? xhtmlNamespace : null,
				returnElements = [],
				elements,
				node;
			for(var j=0, jl=classes.length; j<jl; j+=1){
				classesToCheck += "[contains(concat(' ', @class, ' '), ' " + classes[j] + " ')]";
			}
			try	{
				elements = document.evaluate(".//" + tag + classesToCheck, elm, namespaceResolver, 0, null);
			}
			catch (e) {
				elements = document.evaluate(".//" + tag + classesToCheck, elm, null, 0, null);
			}
			while ((node = elements.iterateNext())) {
				returnElements.push(node);
			}
			return returnElements;
		};
	}
	else {
		getElementsByClassName = function (className, tag, elm) {
			tag = tag || "*";
			elm = elm || document;
			var classes = className.split(" "),
				classesToCheck = [],
				elements = (tag === "*" && elm.all)? elm.all : elm.getElementsByTagName(tag),
				current,
				returnElements = [],
				match;
			for(var k=0, kl=classes.length; k<kl; k+=1){
				classesToCheck.push(new RegExp("(^|\\s)" + classes[k] + "(\\s|$)"));
			}
			for(var l=0, ll=elements.length; l<ll; l+=1){
				current = elements[l];
				match = false;
				for(var m=0, ml=classesToCheck.length; m<ml; m+=1){
					match = classesToCheck[m].test(current.className);
					if (!match) {
						break;
					}
				}
				if (match) {
					returnElements.push(current);
				}
			}
			return returnElements;
		};
	}
	return getElementsByClassName(className, tag, elm);
};
/// <reference name="MicrosoftAjax.js"/>
/// <reference name="MicrosoftAjax.js"/>
var PMSBAnimationDuration;
var PMSBCurrentAnimation;
var PMSBScrollDistance;
var PMSBElementCount;

function InitializePMSBAnimation() {
    var element = $get('personalMenuPanelShortcutsBar');
    var barWidth = $get('personalMenuPanelShortcutsBar').offsetWidth;
    var wrapperWidth = $get('personalMenuPanelShortcutsBarWrapper').offsetWidth;
    var elements = getElementsByClassName('personalMenuPanelShortcut', 'div');
    var elementWidth = elements[0].offsetWidth;
    
    PMSBScrollDistance = (barWidth - wrapperWidth);
    PMSBElementCount = PMSBScrollDistance / elementWidth;
    PMSBAnimationDuration = 0.3 * PMSBElementCount;
    element.style.marginLeft = '0px';
}
    
function StartPMSBAnimation(arrow, forward) {
	arrow.className = arrow.className + 'Hover';
	var element = $get('personalMenuPanelShortcutsBar');
	var startValue = parseInt(element.style.marginLeft);
	var endValue;

	if (forward) {
		endValue = -PMSBScrollDistance;
	}
	else {
		endValue = 0;
	}

	var offset = Math.abs(startValue - endValue);
	var duration = PMSBAnimationDuration;
	duration = (offset * duration) / PMSBScrollDistance;
	
	if (PMSBCurrentAnimation) {
		PMSBCurrentAnimation.stop();
	}
	
	PMSBCurrentAnimation = new AjaxControlToolkit.Animation.LengthAnimation(element, duration, 25, 'style', 'marginLeft', startValue, endValue, "px");
	PMSBCurrentAnimation.play();
}

function StopPMSBAnimation(arrow) {
	arrow.className = arrow.className.replace(/Hover/, '');
	PMSBCurrentAnimation.pause();
}
/// <summary>
/// Word wrapping, the actual function, translation attempt by Léon Hagenaars
///	[gt]=google translate version of the comment or variablename
/// [lh]=me trying to make some sense of it
/// After translation it can be seen that the way this javascript works is not
/// really nice, the length of the entire text is taken, divided by the length 
/// available per line and spaces are added evenly through the text.
/// The existing spaces do not have much influence.
/// </summary>
function wrapOld(input){
	var total_size, size_per_character, number_of_breaks, position_of_break, overflow_original;
	var elements, input, parent, number_of_characters, text, parent_text, display_original, width_original;
	
	if (input.nodeType == 3) {
		//elemento tipo text. tenho que verificar se o parent dele tá quebrando
		//[gt]Element type text. I have to check that his father 's breach
		//[lh]Element type is text. Check for parent's linebreak or node.
		
		if (input.nodeValue.replace('\n','').replace('\t','').trim() == '') {
			//se o textNode for vazio, não prossigo
			//[gt]If the textNode is empty, do not pursue 
			return true;
		}

		parent = input.parentNode;  
		text = input.nodeValue;   

		//pegando a largura setada oficial
		//[gt]Getting the width setada official
		//[lh]Getting the preset width
		display_original = parent.style.display;
		overflow_original = parent.style.overflow;
		width_original = parent.style.width;
		parent.style.display = "block";
		parent.style.overflow = "hidden";
		offsetWidth_original = parent.offsetWidth;

		//pegando a largura real total
		//[gt]Getting the actual total width
		parent.style.display = "table";
		parent.style.width = "auto"; //para o Opera
		parent.style.overflow = "visible";
		total_size = parent.offsetWidth;
		//alert("text: " + text + " \r\n offsetWidth_original:" + offsetWidth_original + " \r\n total_size:" + total_size)
		parent.style.overflow = overflow_original;

		if (total_size > offsetWidth_original) { 
			//se o parent do text tá extrapolando, quebro o text
			//[gt]if the father of the text is extrapolating, break the text
			//[lh]if the parent cannot contain the text, add a break
			position_of_break = 0;
			number_of_characters = parent.textContent.length;
			//recalculando a largura real tirando os espaços pra poder calcular
			// direito a largura dos number_of_characters e quando vou quebrar
			//[gt]recalculate the actual width spaces for the building to calculate
			//[gt]Width of the right and when I break number_of_characters 

			input.nodeValue = parent.textContent.replace(/ /g, "###") + " ";
			total_size = parent.offsetWidth;
			parent.style.display = display_original;

			size_per_character = total_size / number_of_characters ;
			number_of_breaks = parseInt(offsetWidth_original / size_per_character) - 2; 
			number_of_breaks = number_of_breaks > 0 ? number_of_breaks : 1 ;
			input.nodeValue = '';
			
			
			while (position_of_break <= number_of_characters) {
				input.nodeValue += text.substring(position_of_break,position_of_break + number_of_breaks) + number_of_breaks;
				position_of_break = position_of_break + number_of_breaks;
			}
		}
		parent.style.display = display_original;
		parent.style.display = overflow_original;
		parent.style.width = width_original;
	}
	else if (input.childNodes.length == 1 && input.childNodes[0].nodeType == 3) {
		//é o último do nível e o único filho é text
		//[gt]is the last level and the only child is text 
		text = String(input.innerHTML); //salvando o original

		/*input.innerHTML = " "  
		display_original = input.style.display;
		input.style.display="block";
		offsetWidth_original = input.offsetWidth;

		input.style.display="table";
		input.innerHTML = text;
		total_size = input.offsetWidth;*/

		//pegando a largura setada oficial
		//[gt]Getting the preset width
		display_original = input.style.display;
		overflow_original = input.style.overflow;
		width_original = input.style.width;
		input.style.display = "block";
		input.style.overflow = "hidden";
		offsetWidth_original = input.offsetWidth;

		//pegando a largura real total
		//[gt]Getting the actual total width 
		input.style.display = "table";
		input.style.width = "auto"; //para o Opera [lh] Opera fix
		input.style.overflow = "visible";
		total_size = input.offsetWidth;
		//alert("text: " + text + " \r\n offsetWidth_original:" + offsetWidth_original + " \r\n total_size:" + total_size)
		input.style.overflow = overflow_original;

		if (total_size > offsetWidth_original) { 
			//quebrando input extrapolou
			//[gt]break input extrapolated
			position_of_break = 0;
			number_of_characters = text.length;
			//recalculando a largura real tirando os espaços pra poder calcular
			// direito a largura dos number_of_characters e quando vou quebrar
			//[gt]recalculate the actual width spaces for the building to calculate 
			//[gt]Width of the right and when I break number_of_characters 
			input.innerHTML = input.innerHTML.replace(/ /g, "###");
			total_size = input.offsetWidth;
			size_per_character = total_size / number_of_characters ;

			number_of_breaks = parseInt(offsetWidth_original / size_per_character) - 2; 
			number_of_breaks = number_of_breaks > 0 ? number_of_breaks : 1 ;
			input.innerHTML = ""

			while (position_of_break <= number_of_characters) {
				input.innerHTML += text.substring(position_of_break,position_of_break + number_of_breaks) + " "
				position_of_break = position_of_break + number_of_breaks;
			}
		} 
		input.style.display = display_original;
		input.style.display = overflow_original;
		input.style.width = width_original;
	}
	else if (input.childNodes.length > 0) {
		//se tiver mais que um filho, vou ter que executar de filho em filho nele
		//[gt]if more than one child, I have to run to baby son in it
		for (var i = 0; i < input.childNodes.length; i++) {
			wrap(input.childNodes[i]);
		}
	}
}
//Replacement word wrapping, this version takes the text and checks everything
//that is not within a tag using splitPart(partText)
function wrap(element){
	var resultHTML = '';
	var subParts;
	var parts = element.innerHTML.split("<");
	for(var i = 0; i < parts.length; i++){
		if(i==0){
			resultHTML = splitPartIgnoreHtmlEncoded(parts[0]);
		}
		else{
			subParts = parts[i].split(">");
			resultHTML+= "<"+subParts[0]+">"+splitPartIgnoreHtmlEncoded(subParts[1]);
		}
	}
	element.innerHTML = resultHTML;
}
function splitPartIgnoreHtmlEncoded(partText){
    var wordParts = partText.split("&");
    var resultHTML = '';
    var subParts;
    for(var i = 0; i < wordParts.length; i++){
        if(i==0){
            resultHTML = splitPart(wordParts[0]);
        }
        else{
            subParts = wordParts[i].split(";");
            resultHTML += "&"+subParts[0]+";"+splitPart(subParts[1]);
        }
    }
    return resultHTML;
}
//If the word is longer then 10 characters, a break is inserted every 5 characters.
//This is done with &shy; or <wbr/> depending on the browser version.
function splitPart(partText){
    if(typeof(partText) == 'undefined'){
        return '';
    }
	var words = partText.split(" ");
	var wordSplits = 5
	var result='';
	var wordPart = '';
	var wordPartDashSplit;
	for(var i = 0; i < words.length; i++){
		if(i!=0){
			result+=' ';
		}
		if(words[i].indexOf("-")>-1){
		    wordPartDashSplit = words[i].split("-");
		    for(var j = 0; j < wordPartDashSplit.length; j++){
		        if(j!=0){
		            result+= '-';
		        }
		        result += splitPart(wordPartDashSplit[j]);
		    }
		}
		else{
		    if(words[i].length<=2*wordSplits){
			    result += words[i];
		    }
		    else{
			    result+= words[i].substring(0,wordSplits);
			    for(j=1; j < Math.ceil(words[i].length/wordSplits); j++){
			        wordPart = words[i].substring((j*wordSplits),(j+1)*wordSplits);
			        if(wordPart.length > 2){
				        if(ffVersion>=3){
					        result+="&shy;";
				        }
				        else{
					        result+="<wbr/>";
				        }
				    }
				    result += wordPart;
			    }
		    }
		}
	}
	return result;
}
var ffVersion;
function wordWrap() {  
	if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){ //test for Firefox/x.x or Firefox x.x (ignoring remaining digits);
		ffVersion=new Number(RegExp.$1) // capture x.x portion and store as a number
	}
	else{
		ffVersion = 10;
	}
	var elements = document.body.getElementsByTagName("*");
	if(navigator.appName.indexOf("Internet Explorer") > -1) {
		for(var i = 0; i < elements.length; i++) {
			if (elements[i].className.indexOf("word-wrap") > -1) {
				elements[i].style.wordWrap = "break-word";
			}
		}
	}
	else {
		for(var i = 0; i < elements.length; i++) {
			if (elements[i].className.indexOf("word-wrap") > -1) {
				wrap(elements[i]);
			}
		}
	}

	String.prototype.trim = function() { 
		//Trim ambas direcciones
		//[gt]Trim both directions
		return this.replace(/^[ ]+|[ ]+$/g, "");
	}
}

function wrapWords() {
	if (!(document.body == null)) {
		wordWrap();
	}
	else {
		var func_rep = wordWrap;
		setTimeout(function(){ bodyOnReady(func_rep) }, 100);
	}
}

/// <reference name="MicrosoftAjax.js"/>
function attachLinkHandlers() {
	var links = document.getElementsByTagName("a");
	for(var i = 0; i < links.length; i++)
	{
		$addHandler(links[i], "click", processEventInfo);	
	}
}

function processEventInfo(e) {
//	var targ;
//	if (!e) var e = window.event;
//	if (e.target) targ = e.target;
//	else if (e.srcElement) targ = e.srcElement;
//	if (targ.nodeType == 3) // defeat Safari bug
//		targ = targ.parentNode;
//	
//	RetrieveContent(targ.target, targ.href);
//	
//	e.preventDefault();
//	return false;
}

function fireEvent(element, event) {
	if (document.createEventObject) {
		// dispatch for IE   
		var evt = document.createEventObject();
		return element.fireEvent('on' + event, evt)
	}
	else {
		// dispatch for firefox + others   
		var evt = document.createEvent("HTMLEvents");
		evt.initEvent(event, true, true); // event type,bubbling,cancelable   
		return !element.dispatchEvent(evt);
	}
}


    //Makes the twitter date into something more readable, probably works with others too.
    //tested in IE 7, FF 3.5, Chrome 2.0
    function prettyDate(time, lang) {
        var justNow, oneMinute, manyMinutes, oneHour, manyHours, yesterday, manyDays,oneWeek, manyWeeks;
        var date = Date.parse(time.toString().replace("+0000 ",""));
        var now = new Date();

        if (date == null) {
        	return time;
        }
        
        var diff =  ((now.getTime() - date.valueOf()) / 1000);
        var day_diff = Math.floor(diff / 86400);

        if (lang == 'nl' || lang == 'nl-NL') {
            justNow = ' seconden geleden';
            oneMinute = '1 minuut geleden';
            manyMinutes = ' minuten geleden';
            oneHour = '1 uur geleden';
            manyHours = ' uur geleden';
            yesterday = 'gisteren';
            manyDays = ' dagen geleden';
            oneWeek = '1 week geleden';
            manyWeeks = ' weken geleden';
        }
        else {
            justNow = ' seconds ago';
            oneMinute = '1 minute ago';
            manyMinutes = ' minutes ago';
            oneHour = '1 hour ago';
            manyHours = ' hours ago';
            yesterday = 'yesterday';
            manyDays = ' days ago';
            oneWeek = '1 week ago';
            manyWeeks = ' weeks ago';
        }

        if (isNaN(day_diff) || day_diff < 0)
            return time;

        return day_diff == 0 && (
			diff < 60 && diff + justNow ||
			diff < 120 && oneMinute ||
			diff < 3600 && Math.floor(diff / 60) + manyMinutes ||
			diff < 7200 && oneHour ||
			diff < 86400 && Math.floor(diff / 3600) + manyHours) ||
		day_diff == 1 && yesterday ||
		day_diff < 7 && day_diff + manyDays ||
		day_diff < 14 && oneWeek ||
		day_diff >= 14 && Math.ceil(day_diff / 7) + manyWeeks;
    }

function makeUrlClickable(text, linkoptions){
    if(linkoptions == null){
        linkoptions = '';
    }
    else{
        linkoptions = ' '+linkoptions;
    }
    var urlRegExp =/[\w]{3,5}:\/\/\S*/g;
    var matches = text.match(urlRegExp);
    if (matches != null) {
        for (_i = 0; _i < matches.length; _i++) {
            replaceString = '<a href="' + matches[_i] + '"'+linkoptions+'>' + matches[_i] + '</a>';
            text = text.replace(matches[_i], replaceString);
        }
    }
    return text;
}

function makeTwitterPMsClickable(text, linkoptions){
    if(linkoptions == null){
        linkoptions = '';
    }
    else{
        linkoptions = ' '+linkoptions;
    }
    var urlRegExp = /\B@[\w]*/g;
    var matches = text.match(urlRegExp);
    if (matches != null) {
        for (_i = 0; _i < matches.length; _i++) {
            profile = matches[_i].replace('@','');
            replaceString = '<a href="http://twitter.com/' + profile + '"'+linkoptions+'>' + matches[_i] + '</a>';
            text = text.replace(matches[_i], replaceString);
        }
    }
    return text;
}

function makeTwitterHashtagsClickable(text, linkoptions){
    if(linkoptions == null){
        linkoptions = '';
    }
    else{
        linkoptions = ' '+linkoptions;
    }
    var urlRegExp = /\B#[\w]*/g;
    var matches = text.match(urlRegExp);
    if (matches != null) {
        for (_i = 0; _i < matches.length; _i++) {
            tag = matches[_i].replace('#','');
            replaceString = '<a href="http://twitter.com/#search?q=%23'+tag+'"'+linkoptions+'>' + matches[_i] + '</a>';
            text = text.replace(matches[_i], replaceString);
        }
    }
    return text;
}

// Custom URL Functions   ( You SHOULD have a container for the popup named 'CustomUrlSettingPopupPlaceHolder'
function ShowCustomUrl(type, typeId) {
	if ($('.customUrlSettingsPopup').length == 0) {
		$.getJSON(serverPath + "/WebServices/CustomUrlWS.asmx/GetCustomUrlPopupHtml",
			{ type: type, typeId: typeId, form: "json" },
			function(result) {
				$('#CustomUrlSettingPopupPlaceHolder').html(result);
				ShowCustomUrlPopup();
			});
	}
	else {
		ShowCustomUrlPopup();
	}
}

function ShowCustomUrlPopup() {
	$.blockUI({ message: $('#customUrlSettingsPopup') }); 
}

function CloseCustomUrlPopup() {
	$.unblockUI();
}

function SetRequestPlazaMembershipCookie(plazaId){
    createCookie("JoinProtectedPlaza",plazaId, 5);
}
