$(function(){
/*	$(window).scroll(function(){
		($(this).scrollTop() >= '400') ? $("#gototop_link").fadeIn('fast') : $("#gototop_link").fadeOut('fast');
	});
	
	$('a#gototop_link').click(function(){
		$("html, body").animate({scrollTop: $("#container").offset().top}, 800);
	});*/
	
	if ($.browser.msie) {
		if ($.browser.version <= 6) { window.location = base_url + 'ie6'; }
	}
	

	function getHashtag(){
		url = location.href;
		hashtag = (url.indexOf('#!') != -1) ? decodeURI(url.substring(url.indexOf('#!')+2,url.length)) : false;
		return hashtag;
	};
	
	if(getHashtag())
	{
		var id = getHashtag();
		url = location.href;
		x = decodeURI(url.substring(0,url.indexOf('#!')+2)) + id;
		$('html, body').animate({scrollTop: $("#" + id).offset().top}, 1200);
		$('.navlink li').removeClass('active');
		$('.navlink').find('a[href="'+x+'"]').parent().addClass('active');
	}

	
	$('#rightcol ul li').click(function(){
		$('#rightcol ul li').removeClass('active');
		$(this).addClass('active');
		var id = ($(this).find('a').attr('href')).split('#!')[1];

		$('html, body').animate({
			scrollTop: $("#" + id).offset().top
		}, 1200);
		
		$(location).attr('href','#!' + id);
		return false;
	});
	
	$('#rightcol ul li.parent a.newsbox').click(function(){
		$(this).next('ul').slideToggle();
	});
});
