// Thunderstruck-guild.com 
// Javascript file
// 
// Dependencies:  jquery
//                jquery-ui-slider
//                jquery-slidemenuj
//                jquery.cookie


// Login animation script
$(document).ready(function() {
	$("#Login").click(function () {
		if ( $('#headerBLogin').is(':hidden') ) { 	
			$("#headerB").hide();	
			$("#headerBLogin").show("slide", { direction: "right" }, 500);
		}
	});

});

// Functions to re-position the character background image
// 1300 - Character Image Width
$(document).ready(function() {
	var newRight = 400 + $('#fullContainer').offset().left;
	$('#wrapper').css('background-position', newRight + 'px top');
});

$(window).bind('resize', function() {
	var newRight = 400 + $('#fullContainer').offset().left;
	$('#wrapper').css('background-position', newRight + 'px top');
});

// Hide content during character mouseover
$(document).ready(function() {
  $('#rightOverlay').hover(function() {
    $('#maskingContainer').fadeTo(200,0);
	 $("#leftOverlay").stop(true, true).show(200);
  }, function() {
    $('#maskingContainer').fadeTo(200, 1); 
	$("#leftOverlay").stop(true, true).hide();	
  } );
});

// Toggle right pane items on index
$(document).ready(function() {
	
	var recruit = $.cookie('recruit');
	var schedule = $.cookie('schedule');
	var latestposts = $.cookie('latestposts');
	var drops = $.cookie('drops');
	var vent = $.cookie('vent');
	var online = $.cookie('online');

	// Show all by default
	$('#rightRecruit').show();        
	$('#rightSchedule').show();       
	$('#rightLatestPosts').show();    
	$('#rightDrops').show();         
	$('#rightVentrilo').show();       
	$('#rightOnline').show();	


	// Hide the ones we don't want to show
	if(recruit == 'hide') $('#rightRecruit').hide();  
	if(schedule == 'hide') $('#rightSchedule').hide();
	if(latestposts == 'hide') $('#rightLatestPosts').hide();
	if(drops == 'hide') $('#rightDrops').hide();
	if(vent == 'hide') $('#rightVentrilo').hide();
	if(online == 'hide') $('#rightOnline').hide();
	
	
	$('#rightRecruitTitle').click(function() {
		if( $('#rightRecruit').is(':visible') ){
			$.cookie('recruit', 'hide', { expires: 180 });
		} else {
			$.cookie('recruit', 'show', { expires: 180 });
		}
		$('#rightRecruit').slideToggle(200);
	} );
	
	$('#rightScheduleTitle').click(function() {
		if( $('#rightSchedule').is(":visible") ){
			$.cookie('schedule', 'hide', { expires: 180 });
		} else {
			$.cookie('schedule', 'show', { expires: 180 });
		}
		$('#rightSchedule').slideToggle(200);
	} );

	$('#rightLatestPostsTitle').click(function() {
		if( $('#rightLatestPosts').is(":visible") ){
			$.cookie('latestposts', 'hide', { expires: 180 });
		} else {
			$.cookie('latestposts', 'show', { expires: 180 });
		}
		$('#rightLatestPosts').slideToggle(200);
	} );
	
	$('#rightDropsTitle').click(function() {
		if( $('#rightDrops').is(":visible") ){
			$.cookie("drops", 'hide', { expires: 180 });
		} else {
			$.cookie('drops', 'show', { expires: 180 });
		}
		$('#rightDrops').slideToggle(200);
	} );
	
	$('#rightVentriloTitle').click(function() {
		if( $('#rightVentrilo').is(":visible") ){
			$.cookie('vent', 'hide', { expires: 180 });
		} else {
			$.cookie('vent', 'show', { expires: 180 });
		}
		$('#rightVentrilo').slideToggle(200);
	} );
	
	$('#rightOnlineTitle').click(function() {
		if( $('#rightOnline').is(":visible") ){
			$.cookie('online', 'hide', { expires: 180 });
		} else {
			$.cookie('online', 'show', { expires: 180 });
		}
		$('#rightOnline').slideToggle(200);
	} );
});

  


