
	window.my_setCookie = function(name, value, expires, path, domain, secure) {
		var curCookie = name + "=" + escape(value) +
			((expires) ? "; expires=" + expires.toGMTString() : "") +
			((path) ? "; path=" + escape(path) : "") +
			((domain) ? "; domain=" + domain : "") +
			((secure) ? "; secure" : "");
		document.cookie = curCookie;
	};

	window.my_getCookie = function(name) {
		var dc = document.cookie;
		var prefix = name + "=";
		var begin = dc.indexOf("; " + prefix);

		if (begin == -1) {
			begin = dc.indexOf(prefix);

			if (begin != 0)
				return null;
		} else
			begin += 2;

		var end = document.cookie.indexOf(";", begin);

		if (end == -1)
			end = dc.length;

		return unescape(dc.substring(begin + prefix.length, end));
	};

function IsIE8Browser() {
	return false;
    var rv = -1;
    var ua = navigator.userAgent;
    var re = new RegExp("Trident\/([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null) {
        rv = parseFloat(RegExp.$1);
    }
    return (rv == 4);
}

	function getDevicePixelRatio() {
		if(window.devicePixelRatio === undefined) return 1; // No pixel ratio available. Assume 1:1.
		return window.devicePixelRatio;
	}
	
	window.hideMDD = function (x) {
		$('raceDropper_'+x).style.display = 'none';
		$('raceDropper2_'+x).style.display = 'none';
		if (window.manuX) {
			window.clearTimeout(window.manuX);
			window.manuX = 0;
		}
	}

	window.showMDD = function (x) {
		if (window.manuX) {
			window.clearTimeout(window.manuX);
			window.manuX = 0;
		}
		window.currActive_idmdd = x;
		$('raceDropper_'+x).style.display = 'block';
		$('raceDropper2_'+x).style.display = 'block';
		$('raceDropper_'+x).style.visibility = 'hidden';
		$('raceDropper2_'+x).style.visibility = 'hidden';		
	}
	
	window.repositionMDD = function(p, c, c2) {
		var co = $(p).cumulativeOffset();
		var cohe = $('Header').cumulativeOffset();
		var anchorWidth = $(p).getWidth()+12;
		var xBlockWidth = c.useWi.getWidth();
		var bottomBlockWidth = (Math.max(anchorWidth + 12, xBlockWidth));
		$(c).style.width = bottomBlockWidth+'px';
		$(c2).style.width = anchorWidth+'px';
		var xleft = (co.left - cohe.left - 6);
		$(c2).style.left = xleft +'px';	
		var bottomLeft = xleft - Math.round((bottomBlockWidth - anchorWidth) /2);
		if (bottomLeft + bottomBlockWidth > 901) {
			bottomLeft -= Math.round((bottomBlockWidth - anchorWidth) / 2);
		}
		
		
		if (bottomLeft <= 0) {
			bottomLeft = 0;
			$(c).addClassName('leftBo');
		} else {
			$(c).removeClassName('leftBo');	
		}
		$(c).style.left = bottomLeft +'px';		
			
		var xtop = (co.top-6);
		$(c2).style.top = xtop +'px';		
		$(c).style.top = (xtop + 30) +'px';	
		if (bottomLeft + bottomBlockWidth > 901 && (window.scrollXActual != window.maxDefDif) && window.maxDefDif != 0 ) {
			return false;
		}
		return true;
	}
	
	window.wLimit = 710;
	window.wLimit2 = 820;
	window._dif = 0;
	window.defadif = 44;
	window.diffOnRaceA = 12;
	window.scrollXActual = 0;
	window.scrollingMove = null;
	window.middleIndex = 0;
	window.maxDefDif = 0;
	window.stopScrollMove = function() {
		if (window.scrollingMove) {
			window.scrollingMove.cancel();
			window.scrollingMove = 0;
		}			
	}
	
	window.scrollSetTo = function(x) {
		window.stopScrollMove();
		window.scrollingMove = new Effect.Morph($('raceListMover'), {transition: Effect.Transitions.sinoidal, style: 'left: '+x+'px;', duration: .5});
	}
	
	window.scrollerTo = function(move) {
		if (move == 0) {
			window.scrollXActual = 0;
		} else {
			if (window.middleIndex != 0) {
				if (move == 1) {
					window.scrollXActual = (window.scrollXActual >= window.middleIndex ? window.maxDefDif : window.middleIndex);						
				} else {
					window.scrollXActual = (window.scrollXActual <= window.middleIndex ? 0 : window.middleIndex);
				}
			} else {
				window.scrollXActual = (move == 1 ? window.maxDefDif : 0);	
			}
			
			if (window.scrollXActual < 0) {
				window.scrollXActual = 0;
			}
			if (window.scrollXActual >= window.offa.length) {
				window.scrollXActual = window.offa.length - 1;
			}			
		}
		window._dif = window.defadif*1;
		if (window.scrollXActual == 0) {
			window.SCLeft.fade({duration: .5});
			window._dif = 0;
		} else {
			window.SCLeft.appear({duration: .5});
		}
		window.checkRight();
		window.scrollSetTo(-window.offa[window.scrollXActual] + window._dif);
	}
	
	window.checkRight = function() {
		if (window.fullW + (-window.offa[window.scrollXActual] + window._dif) >= window.wLimit2) {
			window.SCRight.appear({duration: .5});
		} else {
			window.SCRight.fade({duration: .5});
		}		
	};

	function aMenu() {
		window.offa = [];
		window.widths_ = [];
		window._currX = 0;
		window.fullW = 0;
		window.yearPrePadding = 10;
		//window.__top = 8;
		window.RLHlist.each(function(o, i) {
			o.isYear = $(o).hasClassName('year');
			var j = Math.round($(o).getWidth() / 1) + (o.isYear ? window.yearPrePadding : 0);
			$(o)._myw = j;
			window.fullW += j+(i==0 ? 100:window.diffOnRaceA);
			window.widths_[i] = j+window.diffOnRaceA;
			if (i == 0) {
				var akt = 0;	
			} else {
				var akt = ( window.offa[i-1] + window.widths_[i-1] );
				if (o.isYear && i > 0) {
					akt += window.yearPrePadding;	
				}
			}
			window.offa[i] = akt;
			o.style.left = akt+'px';
			//o.style.top = window.__top+'px';
			if (window._fstartt) {
				
				// add image
				if (i < (window.RLHlist.length - 1)) {
					var img = new Image();
					img.src = window.ENV.url('/assets/racelist-separator.png');
					$(img).setStyle({position: 'absolute', top: '23px', width: '1px'});
					$('raceListMover').insert({bottom: img});
					o.my_img = img;
				}
				
				//o.setOpacity(0);
				o.style.visibility = 'hidden';
				o.myFu = function() {
					//new Effect.Opacity(this, {from: 0, to: 1, duration: .4});			
					//this.setOpacity(1);
					this.style.visibility = 'visible';
				}.bind(o);
				//o.myFu.delay(0.07*i);
				o.myFu();
				if (!o.isYear) {
					var oid = o.id.replace('raceListed_', '');
					o._oid = oid;
					o._mdd = $$('#raceDropper_'+oid).first();
					o._mdd2 = $$('#raceDropper2_'+oid).first();
					o._mdd.useWi = $$('#raceDropper_'+oid+' .bodyHo').first();
					var xx = function() {
						if(window.currActive_idmdd) window.hideMDD(window.currActive_idmdd);
						window.showMDD(this._oid);
						var isOk = repositionMDD(this, this._mdd, this._mdd2);
						if (isOk) {
							$('raceDropper_'+this._oid).style.visibility = 'visible';
							$('raceDropper2_'+this._oid).style.visibility = 'visible';	
						}					
					}.bind(o);
					var xx2 = function() {
						if (window.manuX) {
							window.clearTimeout(window.manuX);
							window.manuX = 0;
						}					
						window.manuX = window.setTimeout("window.hideMDD("+this+")", 250);
					};
					Event.observe(o, 'mouseover', xx);
					//Event.observe(o, 'touchstart', xx);
					Event.observe(o, 'mouseout', xx2.bind(o._oid));
				}
			}
			if (i < (window.RLHlist.length - 1)) {
				o.my_img.style.left = (akt + window.widths_[i] - 7) +'px';				
			}
			
		});
		window.checkRight();
		window._fstartt = 0;
		
		window.maxDefDif = 0;
		window.RLHlist.each(function(o, i) {
			if (window.fullW + (-window.offa[i] + window.defadif) > window.wLimit) {
				window.maxDefDif = i;
			}			
		});
		
		window.middleIndex = Math.ceil(window.maxDefDif / 2);
		if (window.middleIndex == window.maxDefDif || window.middleIndex <= 2) {
			window.middleIndex = 0;
		}	
		
		window._ale = 0;
		window._aas.each(function(o, i) {
			if (!$(o).__dot) return;
			var wc = Element.getWidth($(o).up());
			$(o).__dot.style.left = (window._ale+Math.round((wc-20)/2))+'px';
			window._ale += wc;				
			window._ale += 1;	
		})		
		
		//window._RLH.select('.scroller').first().style.width = window._currX+'px';
	}

	function checkAAWH() {
		
		window._aas.each(function(o, i) {
			var menuId = $(o).readAttribute('id').replace('_link', '');
			$(o).menuObj = $(menuId);
			if ($(o).menuObj) {
				var o2 = $(o).menuObj;
				var h = o2.getHeight();
				var w = $(o).menuObj.select('.w5x').first();
				var g = 2;
				var kk = 3;
				if ($(o).menuObj.hasClassName('smaller')) {
					g = 3;
					kk = 2;
				}
				$(o2).style.top = -(kk + h) + 'px';
				$(w).style.width = 'auto';
				var xx = Math.max(115, $(w).getWidth());
				var h = (xx+g) % 5;
				if ((xx+g) % 5 != 0) {
					w.style.width = (xx + (5-h))+'px';					
				}
			}
		});		
	
	}

	document.observe('dom:loaded', function() {
			
		if ($('Header')) {
			
			window._currTouchX = 0;
			
			$('raceListMover').observe('touchstart', function(e) {
				if (e.touches.length == 1) {
					window._currTouchX = e.touches[0].pageX;
				}
			});

			$('raceListMover').observe('touchmove', function(e) {
				var _touchDiff = window._currTouchX - e.touches[0].pageX;
				if (Math.abs(_touchDiff) > 50) {
					window.scrollerTo(_touchDiff > 0 ? 1 : -1);
				}
			});
			
			window.SCLeft = $$('.scrollerLeft').first();
			window.SCRight = $$('.scrollerRight').first();			
			
			window._fstartt = 1;
			
			window._tmr = 0;
			window._act = null;	
			window._ale = 0;

			window._aas = $$('#Header td a.x');

			window.clearActives = function() {
				window._aas.each(function(o, i) {			
					/*if ($(o).up().hasClassName('current')) {
						
					} else {*/
						$(o).up().removeClassName('active');
					//}
				});
			}
			
			window._RLH = $('raceListHeader');
			window.RLHlist = window._RLH.select('a.y');
			aMenu();
			window.setInterval(aMenu, 1000);
			Event.observe(window, 'load', aMenu);
			
			Event.observe($$('.scrollerRight').first(), 'click', function() {
				window.scrollerTo(1);
			});

			Event.observe($$('.scrollerLeft').first(), 'click', function() {
				window.scrollerTo(-1);
			});
			
			window.startOut = function() {
				if (window._tmr) {
					window.clearTimeout(window._tmr);
					window._tmr = 0;
				}
				window._tmr = window.setTimeout(window.clearActives, 150);
			};
			
			checkAAWH();
			
			window.toucheed = -1;

			window._aas.each(function(o, i) {
				if (window.currentIndexHeader > 0) {
					if ( 1*(i + 1)  == window.currentIndexHeader*1 ) {
						$(o).up().addClassName('current');
					}
				}
				var onmo = function() {
					checkAAWH();
					if (window._tmr) {
						window.clearTimeout(window._tmr);
						window._tmr = 0;
					}
					window.clearActives();
					$(this).up().addClassName('active');					
					window._act = $(this).id;
				}.bind(o);
				$(o).observe('touchstart', function() {
					if (window.toucheed == $(this).id) {
						window.toucheed = $(this).id+'_XX';
					} else {
						window.toucheed = $(this).id;						
					}
					window.clearActives();
					$(this).up().addClassName('active');					
					window._act = $(this).id;					
				}.bind(o));
				Event.observe($(o), 'mouseover', onmo);
							
				var o2 = $(o).menuObj;
				if (o2) {
					Event.observe($(o2), 'mouseover', function() {
						if (window._tmr) {
							window.clearTimeout(window._tmr);
							window._tmr = 0;
						}
						window.clearActives();
						$(this).up().addClassName('active');					
						window._act = $(this).id+'_link';
					}.bind(o2));
					Event.observe($(o2), 'mouseout', function() {
						window.startOut();
					}.bind(o2));
					Event.observe($(o), 'click', function(e) {
						if (window.toucheed != -1 && window.toucheed != $(this).id+'_XX') {
							e.stop();
						}
					}.bind(o));										
				}

				Event.observe($(o), 'mouseout', function() {
					window.startOut();
				}.bind(o));
				
				var wc = Element.getWidth($(o).up());
				var ieDot = new Element('img');
				ieDot.width = 20;
				ieDot.height = 16;
				ieDot.addClassName('menudot');
				ieDot.src = window.ENV.url('/assets/menu-dot-2.png');
				$(o).up().insert({top: ieDot});
				$(o).__dot = ieDot;
				ieDot.style.left = (window._ale+Math.round((wc-20)/2))+'px';
				window._ale += wc;				
				window._ale += 1;
			});

			
		}
		
		$$('a.addthis_button_compact').each(function(u) {
			u.style.color = '#888';
			u.style.textDecoration = 'none';
			if (!$('Welcome')) u.style.font = '10px/16px Trebuchet MS';
		});
		
		if ($('progbar')) {
			var at = $('progbar').select('.td.at').first();	
			if (at) {
				var href = at.select('a').first().href;
				var vo = at.select('.xlink').first().getStyle('marginLeft').replace('px','')*1;
				var cu1 = Element.cumulativeOffset($('progbar'));
				var cu2 = Element.cumulativeOffset($(at));
				var i = new Element('a');
				var isOnend = '';
				
				var vA = 24, vB = 45, wxi = 42;
				var atID = at.id.replace('progr-', '')*1;
				if (atID == 3) {
					var vA = 26, vB = 47;	
				}
				if (atID == 4) {
					var vA = 25, vB = 50;	
					wxi = 48;
				}
				if (atID == 5) {
					var vA = 22, vB = 47;	
					var isOnend = '_end';
				}				
				
				$(i).update('<img src="'+window.ENV.url('/images/layout/'+window._type+'/eng/status_onbg'+isOnend+'.png')+'" />');
				$(i).setStyle({cursor: 'default', marginTop: '-8px', marginLeft: (cu2[0]-cu1[0]+vo-vA)+'px', display: 'block', position: 'absolute', background: 'transparent', width: '108px', zIndex: 2});
				$('progbar').insert({before: i});
				$(at).removeClassName('at');
				var i2 = new Element('a');
				$(i2).setStyle({cursor: 'default', overflow: 'hidden', top: '-8px', left: ((cu2[0]-cu1[0])+vo-vB)+'px', display: 'block', position: 'absolute', background: 'transparent url('+window.ENV.url('/images/layout/'+window._type+'/eng/status_onbg'+isOnend+'.png')+') right top no-repeat', width: wxi+'px', height: '77px', zIndex: 30});
				$(at).insert({top: i2});
				i.href = href;
				i2.href = href;
			}
		}
		
		var fion = function() {
			this.style.visibility = 'visible';
			this.style.display = 'block';
		}
		
		var fioff = function() {
			this.style.display = 'none';
		}
		
		$$('.ibubble').each(function(b, j) {
			var miw = 95;
			var xi = b.down().getWidth();
			var w = Math.max(miw, xi+25)/*+j*11*/;
			var w = Math.max(w, b.down().next().getWidth()+10);
			var w = Math.max(w, b.down().next(1).getWidth()+10);
			b.select('a').each(function(x) {$(x).setStyle({display: 'block', position: 'absolute'});});
			w = w+(5-(w%5));
			b.down().onclick = b.next().onclick;
			b.down().setStyle({textAlign: 'center', width: w+'px', paddingTop: '10px'});
			b.setStyle({width: w+'px', backgroundImage: 'url('+window.ENV.url('/images/layout/'+window._type+'/eng/bubble-left.png')+')'});
			b.up().observe('mouseover', fion.bind(b));
			b.up().observe('mouseout', fioff.bind(b));
			var e = new Element('div');
			e.setStyle({height: '91px', width: (w-56)+'px', marginLeft: '56px', background: 'url('+window.ENV.url('/images/layout/'+window._type+'/eng/bubble-right.png')+') top right no-repeat'});
			b.insert({bottom: e});
			b.down().next().style.marginTop = '37px';
			b.down().next(1).style.marginTop = '57px';
		});
		
		if (window.onLoadJS) {
			window.onLoadJS();
		}
		
		if ($('leftflash') && window.leftFlashData && window.leftFlashData.length) {
			
			window.currentR = -1;
			window.currIndex = -1;
			window.xDur = .2;
			window.imgHo = $$('#leftflash .imgHol').first();
			window.timeHOO = $$('#leftflash .timeho').first();
			$$('#leftflash .startOpac').each(function(o) {
				if (!IsIE8Browser()) {
					$(o).setOpacity(0);	
				} else {
					$(o).style.visibility = 'hidden';
				}
				// XXX
				$(o).removeClassName('startOpac');
			});
			
			window.startNEXT = 0;
			window.setUpStartNext = function() {
				window.startNEXT = window.setTimeout(function() {
					window._newLeftFlashIndex(window.currIndex+1);	
				}, 7500);
			};
			
			window._fader = function() {
				for (var i = 0; i < 5; i++) {
					$$('#leftflash .opac'+i).each(function(o) {
						window.setTimeout(function() {
							if (!IsIE8Browser()) {
								new Effect.Opacity(o, {to: 0, duration: window.xDur});
							} else {
								o.stye.visibility = 'hidden';
							}							
							// XXX
						}.bind(o), this*25);
					}.bind(i));
				}
				var jo = window.imgHo.select('img').first();
				new Effect.Opacity(jo, {to: 0, duration: window.xDur, afterFinish: function(){this.remove();}.bind(jo)});
			};
			
			window._comeAlive = function() {
				for (var i = 0; i < 5; i++) {
					$$('#leftflash .opac'+i).each(function(o) {
						window.setTimeout(function() {
							if (!IsIE8Browser()) {
								new Effect.Opacity(o, {from: 0, to: 1, duration: window.xDur});
							} else {
								o.stye.visibility = 'visible';
							}
							// XXX
						}.bind(o), this*25);
					}.bind(i));
				}	
				var jo = new Image();
				Element.extend(jo);
				jo.setOpacity(0);
				var fj = function() {
					new Effect.Opacity(this, {to: 1, duration: window.xDur, afterFinish: window.setUpStartNext});					
				}.bind(jo);
				var fj2 = function() {
					window.setUpStartNext();
				}.bind(jo);				
				jo.onload = fj; 
				jo.onerror = fj2;
				window.imgHo.insert({top: jo});
				jo.src = window.currentR.file;	
			}
			
			window._newLeftFlashIndex = function(i) {		
				if (i >= window.leftFlashData.length) i = 0;
				if (window.currentR == -1) {
					window.currentR = window.leftFlashData[i];
					window.calculateRemaining();
					window.currIndex = i;
					window.setTimeout(window._comeAlive, 500);
				} else {
					window._fader();
					window.setTimeout(function() {
						window.currentR = window.leftFlashData[this];
						window.calculateRemaining();						
						window.currIndex = this;
						window.setTimeout(window._comeAlive, 500);	
					}.bind(i*1), 500);
				}					
			};
			
			window._thdmD = $$('#leftflash .tHD').first();
			window._thdmH = $$('#leftflash .tHH').first();
			window._thdmM = $$('#leftflash .tHM').first();
			window._thdmS = $$('#leftflash .tHS').first();
			window._subtext = $$('#leftflash .subText').first();
			window._topText1 = $$('#leftflash .topText1').first();
			window._topText2 = $$('#leftflash .topText2').first();
			window._topTextDate = $$('#leftflash .topTextDate').first();
			
			var today = new Date();
			
			window.calculateRemaining = function () {
				if (window.currentR) {
					var today = new Date();
					var newDate = new Date();
					newDate.setTime( window.currentR.startTime * 1000 );
					diff = Math.round(Math.max(0, newDate.getTime() - today.getTime()) / 1000);
					var days=Math.floor(diff / 86400);
					var hours = Math.floor((diff - (days * 86400 ))/3600);
					var minutes = Math.floor((diff - (days * 86400 ) - (hours *3600 ))/60);
					var secs = Math.floor((diff - (days * 86400 ) - (hours *3600 ) - (minutes*60)));					
					var country = window.currentR.country;
					var name = window.currentR.name;
					var city = window.currentR.city;
					var xdate = window.currentR.time;
				} else {
					var days = '';
					var hours = '';
					var minutes = '';
					var secs = '';
					var country = '';
					var name = '';
					var city = '';
					var xdate = '';
				}

				window._thdmD.update(days);
				window._thdmH.update(hours);
				window._thdmM.update(minutes);
				window._thdmS.update(secs);
				window._subtext.update(name);
				window._topTextDate.update(xdate);
				window._topText1.update((city?city+',':''));
				window._topText2.update(country);
			};
			
			window._newLeftFlashIndex(0);
			window.setInterval(window.calculateRemaining, 1000);			
			
			var div = $('leftflash');
			var d = window.leftFlashData;
			div.observe('click', function() {
				document.location = window.currentR.link;	
			});
		}

		window.setTimeout(window.usageStatBubble, 0);
		
	});

	window.usageStatBubble = function() {
		if (!window.raceUsageData) return;
		if (window.raceUsageData.length == 0) return;
	
		if ($('newLayerBG')) {
			window.setTimeout(window.usageStatBubble, 10000);
			return;
		}
		if (window.my_getCookie('gxb')) return;
		window.my_setCookie('gxb', '1', 0);

		var bubbleHolder = new Element('div');
		$('Container').insert({bottom: bubbleHolder});
		bubbleHolder.addClassName('bubbleHolder');
		bubbleHolder.setAttribute('id', 'bubbleHolderID');
		bubbleHolder.update('');

		window.bubbles = [];

		for (var j = 0; j < window.raceUsageData.length; j++) {
			var us = window.raceUsageData[j];
			var bubble = new Element('div');
			bubble.addClassName('bubble');
			Event.observe(bubble, 'click', function() {
				window.bubbles[this.bbindex].myHeight = -10;
				this.style.display = 'none';

				var summH = 0;
				for (var x = 0; x < window.bubbles.length; x++) {
					var b = window.bubbles[window.bubbles.length - 1 - x];
					if (b.mymorph) b.mymorph.cancel();
					b.mymorph = new Effect.Morph(b, {
						//transition: Effect.Transitions.sinoidal,
						style: 'top: '+(100 + summH)+'px;',
						duration: .1
					});
					summH += b.myHeight + 10;
				}

			});
			bubble.update(us);
			bubble.insert({top: new Element('div').addClassName('bubbleCloser')});
			bubble.style.position = 'absolute';
			bubble.style.right = '-26px';
			bubble.style.top = '0px';
			bubble.setOpacity(0);
			bubbleHolder.insert({top: bubble});
			bubble.style.top = (-1*Math.round(bubble.getHeight()+20))+'px';
			window.setTimeout(function() {
				$(this).addClassName('on');
				if (window.bubbles.length) {
					var summH = 0;
					for (var x = 0; x < window.bubbles.length; x++) {
						var b = window.bubbles[window.bubbles.length - 1 - x];
						if (b.mymorph) b.mymorph.cancel();
						b.mymorph = new Effect.Morph(b, {
							//transition: Effect.Transitions.sinoidal,
							style: 'top: '+(100 + summH + $(this).getHeight() + 10)+'px;',
							duration: 1
						});
						summH += b.myHeight + 10;
					}
				}
				new Effect.Morph($(this), {transition: Effect.Transitions.sinoidal, style: 'opacity: .9; top: 100px;', duration: 1, afterFinish: function() {
					$(this).setOpacity(.9);
					$(this).addClassName('readyOn');
				}.bind(this)});
				// window.currTop += $(this).getHeight() + 20;		
				this.bbindex = window.bubbles.length;
				this.myHeight = $(this).getHeight();
				window.bubbles.push(this);
				window.setTimeout(function() {
					new Effect.Morph($(this), {transition: Effect.Transitions.sinoidal, style: 'opacity: 0;', duration: 1, afterFinish: function() {$(this).remove();}.bind(this)});
				}.bind(this), 30 * 1000);
			}.bind(bubble), 5000*(j)+3000);
		}

		window.bubbleResized = function() {
			if ($('bubbleHolderID')) {
				var l = Math.max(20, Math.round((document.viewport.getWidth() + 50 - 960) / 2));
				$('bubbleHolderID').style.right = l+'px';
			}
		};

		Event.observe(window, 'resize', function() {
			window.bubbleResized();
		});
		window.bubbleResized();

	}	



