
if (!window.Event) Event = {};

function checkBrowser()
{
	$B = {};
	
	var a = navigator.userAgent.toLowerCase();
	var s;
	var e;
	
	$B.isIE = a.has('msie');
	$B.isFF = a.has('firefox');
	$B.isNN = a.has('netscape');
	$B.isOpera = a.has('opera');
	$B.isSafari = a.has('safari');
	
	if ($B.isIE)
	{
		s = a.indexOf('msie ') + 5;
		e = a.indexOf(';', s);
		$B.version = a.substring(s, e);
	}
	else if ($B.isFF)
	{
		s = a.indexOf('firefox/') + 8;
		$B.version = a.substr(s);
	}
	else if ($B.isNN)
	{
		s = a.indexOf('netscape/') + 9;
		$B.version = a.substr(s);
	}
	else if ($B.isOpera)
	{
		s = a.indexOf('opera/') + 6;
		e = a.indexOf(" ", s);
		$B.version = a.substring(s, e);
	}
	else if ($B.isSafari)
	{
		s = a.indexOf('safari') + 7;
		$B.version = a.substring(s);
	}
}

function getURL()
{
	return location.href;
}

function changeDate(s)
{
	var url = location.href,
        idx = url.indexOf("#");

	location.href = ((idx > -1) ? url.substr(0, idx) : url) + "#" + s;
}

Event.observe = function(e, n, o, c)
{
	c = c || false;
	
	if (n == 'mousewheel' && !document.attachEvent && !$B.isSafari)
	{
		n = 'DOMMouseScroll';
	}
	
	this._observeAndCache(e,n,o,c);
}

Event._observeAndCache = function(e, n, o, c)
{
	if (!this.observers)
	{
		this.observers = [];
	}
	
	this.observers.push([e, n, o, c]);
	
	if (e.addEventListener)
	{
		e.addEventListener(n,o,c);		
	}
	else if (e.attachEvent)
	{
		e.attachEvent('on' + n, o);
	};
};

String.prototype.has = function()
{
	var i, a = arguments;
	
	for (i = 0; i < a.length; i++)
	{
		if (this.indexOf(a[i]) > -1) {
			return true;
		}
	}
	
	return false;
};

function wheelMouse(e)
{
	var delta = $B.isSafari ? -e.wheelDelta / 40 : e.detail;
	
	document[targetSwf].setWheel(delta, $B.isSafari);
}

checkBrowser();

if (!$B.isIE && !$B.isOpera)
{
	Event.observe(window, 'mousewheel', wheelMouse, false);
}
