$(document).ready(function(){
	$('.slideshow').cycle({
			fx: 'fade' 
		});
		
	 $('#mycarousel, #tl_galleryList').jcarousel({});
	
	$('#twitter').social({
		network		: 'twitter',
		user		: 'korn',
		count		: 1,
		twitter		: {
			output		: '<span class="tweet"><span class="text">{text}</span> <span class="time"><a href={tweet_url}>{time}</a><a href={tweet_url}>Follow @ korn on twitter</a></span>  <a href="http://twitter.com/korn" class="twitFollow">twitter</a>'

			}
	});
	
	
	kornDash();

	function kornDash() {

		//get ref
		if ($('#kornDashboard')) var el = $('#kornDashboard');
		else return;

		//respect choice
		if (!el.find('a.toggle')) return; //if they're not logged in, there won't be this button
		el.find('a.toggle').click(togglekornDash);
		el.data('offset', el.css('margin-left'));
		if ($.cookie('dashboard_open') == 1) {
			el.css('margin-left','0px');
			el.data('open', 1);
		}
	}

	function togglekornDash(event) {

		//get element
		event.preventDefault();
		var el = $('#kornDashboard');

		//close
		if (el.data('open') == 1) {
			$('#kornDashboard').animate({marginLeft: el.data('offset')}, 300);
			el.data('open', 0);

		//open
		} else {
			$('#kornDashboard').animate({marginLeft: '0px'}, 300);
			el.data('open', 1);
		}

		//save state
		$.cookie('dashboard_open', el.data('open'), { expires: 14, path: '/' });
	}
	
});

