/**
 * @author Oleg Korovin (http://olegrorovin.spb.ru/)
 */

jQuery.noConflict();


jQuery(function(){

	var
		mButtons = jQuery('.GraphTypeSwitcher span'),
		mBoxes = jQuery('.GraphTypeBox');

	mButtons.each(function(i){
		var
			elThis = this,
			oThis = jQuery(this),
			oBox = mBoxes.eq(i);

		oThis.click(function(e,sSpeed){
			window.location = '#' + this.id.substr(2)
			//toLowerCase();

			mBoxes.filter('.X').hide().removeClass('X');

			if(sSpeed == null){
				sSpeed = 'slow'
			}

			mBoxes
				.not(oBox).not(':hidden')
				.slideUp(sSpeed, function(){
					oBox.filter(':hidden').slideDown(sSpeed);
				});

			mButtons.addClass('dashed');
			oThis.removeClass('dashed');


		});
	});
//console.dir(Url.cur.hash)
/*	if(Url.cur.hash == '#map'){//alert(Url.cur.hash + 'x')
		mButtons.eq(1).triggerHandler('click',[0]);

	}/**/
	if(Url.cur.hash)
		mButtons.filter('#a_'+Url.cur.hash.substr(1)).triggerHandler('click',[0]);
});
