function externalLink() {
	$("a[rel='external']").click(function(){
		window.open($(this).attr("href"));
		return false;
	});
}

function smoothScrolling() {
	$('a[href^=#]').click(function() {
		var speed = 400;// msec;
		var href= $(this).attr("href");
		var target = $(href == "#" || href == "" ? 'html' : href);
		var position = target.offset().top;
		$($.browser.safari ? 'body' : 'html').animate({scrollTop:position}, speed, 'swing');
		return false;
	});
}

function loadWiget() {
	
	new TWTR.Widget({
		version: 2,
		id: 'tw',
		type: 'profile',
		rpp: 3,
		interval: 6000,
		width: 'auto',
		height: 300,
		theme: {
			shell: {
				background: '#ededed',
				color: '#999999'
			},
			tweets: {
				background: '#ffffff',
				color: '#707070',
				links: '#727ee8'
			}
		},
		features: {
			scrollbar: false,
			loop: true,
			live: true,
			hashtags: true,
			timestamp: true,
			avatars: false,
			behavior: 'default'
		}
	}).render().setUser('Karada_cf').start();
}

function contentSubMenuSelecter() {
	var key = $("body").attr("id");
	$(".contentSubMenu ul li").each(function(){
		if($(this).attr("class") == key){
			$(this).addClass("selected");
		}
	});
}

function twFollowBadge(){
	tfb.account = 'Karada_cf';
	tfb.label = 'follow-us';
	tfb.color = '#8fc63d';
	tfb.side = 'l';
	tfb.top = 200;
	tfb.showbadge();
}

$(function(){
	contentSubMenuSelecter(),externalLink(),smoothScrolling(),loadWiget(),twFollowBadge();
});
