function swap(obj){		
		if(obj == 'events'){
			document.getElementById("bottom_tool").style.backgroundPosition = '0px 0px';
		}
		if(obj == 'tools'){
			document.getElementById("bottom_tool").style.backgroundPosition = '0px -27px';
		}
		if(obj == 'inspiration'){
			document.getElementById("bottom_tool").style.backgroundPosition = '0px -54px';
		}
		if(obj == 'video'){
			document.getElementById("bottom_tool").style.backgroundPosition = '0px -81px';
		}
		if(obj == 'facebook'){
			document.getElementById("bottom_tool").style.backgroundPosition = '0px -108px';
		}
		if(obj == 'tweeter'){
			document.getElementById("bottom_tool").style.backgroundPosition = '0px -135px';
		}		
		if(obj == 'wetv'){
			document.getElementById("bottom_tool").style.backgroundPosition = '0px -162px';
		}
		if(obj == 'weddingdish'){
			document.getElementById("bottom_tool").style.backgroundPosition = '0px -189px';
		}
	}
function unswap(){
	document.getElementById("bottom_tool").style.backgroundPosition = '0px -189px';
}

function NotStat(link, section){
	switch(link)
	{
		case 'wedding_tools':
		  //alert( "/bottom-toolbar/"+ link +"/"+ section +"/" );
		  pageTracker._trackPageview("/bottom-toolbar/"+ link +"/"+ section +"/");			  
		  break;
		default:
		  //alert( "/bottom-toolbar/"+ link +"/" );
		  pageTracker._trackPageview("/bottom-toolbar/"+ link +"/");
	}
}
	
$(document).ready(function(){
	//Adjust panel height
	$.fn.adjustPanel = function(){ 
		$(this).find("ul, .subpanel").css({ 'height' : 'auto'}); //Reset subpanel and ul height
		
		var windowHeight = $(window).height(); //Get the height of the browser viewport
		var panelsub = $(this).find(".subpanel").height(); //Get the height of subpanel	
		var panelAdjust = windowHeight - 100; //Viewport height - 100px (Sets max height of subpanel)
		var ulAdjust =  panelAdjust - 25; //Calculate ul size after adjusting sub-panel (27px is the height of the base panel)
		
		if ( panelsub >= panelAdjust ) {	 //If subpanel is taller than max height...
			$(this).find(".subpanel").css({ 'height' : panelAdjust }); //Adjust subpanel to max height
			$(this).find("ul").css({ 'height' : ulAdjust}); //Adjust subpanel ul to new size
		}
		else if ( panelsub < panelAdjust ) { //If subpanel is smaller than max height...
			$(this).find("ul").css({ 'height' : 'auto'}); //Set subpanel ul to auto (default size)
		}
	};
	
	$.fn.LoadNotices = function(v){
		
		$("#notifications_content").html('');
		
		$.post("/_new/notsys_view.php", { path: window.location.pathname },
			function(data){
				$("#notifications_content").html(data);
		});
		
	};
	
	//welcome_brides
	
	//Execute function on load
	$("#noticon").adjustPanel(); //Run the adjustPanel function on #chatpanel
	//$("#notifications_content").LoadNotices( this );
	
	//Each time the viewport is adjusted/resized, execute the function
	$(window).resize(function () { 
		$("#noticon").adjustPanel();
	});

	//Click event on Chat Panel + Alert Panel	
	$(".noticon").click(function() { //If clicked on the first link of #chatpanel and #alertpanel...
		$("#the_wetv_area").hide();
		$("#the_tools_area").hide();
		
		if($("#notifications").is(':visible')){ //If subpanel is already active...
			$("#notifications").slideToggle('slow'); //Hide active subpanel
		}
		else { //if subpanel is not active...
			$("#notifications").hide(); //Hide all subpanels
			$("#notifications").slideToggle('slow');
			//$("#notlist").load("/index.php #welcome_brides");
			//$(this).next(".subpanel").toggle('slow'); //Toggle the subpanel to make active
			$(this).toggleClass('active'); //Toggle the active class on the subpanel trigger
		}
		return false; //Prevent browser jump to link anchor
	});
	
	
	$(".the_tools").click(function() { //If clicked on the first link of #chatpanel and #alertpanel...
		$("#notifications").hide();
		$("#the_wetv_area").hide();
		
		if($("#the_tools_area").is(':visible')){ //If subpanel is already active...
			$("#the_tools_area").slideToggle('slow'); //Hide active subpanel
		}
		else { //if subpanel is not active...
			$("#the_tools_area").hide(); //Hide all subpanels
			$("#the_tools_area").slideToggle('slow');
			//$("#notlist").load("/index.php #welcome_brides");
			//$(this).next(".subpanel").toggle('slow'); //Toggle the subpanel to make active
			$(this).toggleClass('active'); //Toggle the active class on the subpanel trigger
		}
		return false; //Prevent browser jump to link anchor
	});
	
	$(".the_wetv").click(function() { //If clicked on the first link of #chatpanel and #alertpanel...
		$("#notifications").hide();
		$("#the_tools_area").hide();
		if($("#the_wetv_area").is(':visible')){ //If subpanel is already active...
			$("#the_wetv_area").slideToggle('slow'); //Hide active subpanel
		}
		else { //if subpanel is not active...
			$("#the_wetv_area").hide(); //Hide all subpanels
			$("#the_wetv_area").slideToggle('slow');
			//$("#notlist").load("/index.php #welcome_brides");
			//$(this).next(".subpanel").toggle('slow'); //Toggle the subpanel to make active
			$(this).toggleClass('active'); //Toggle the active class on the subpanel trigger
		}
		return false; //Prevent browser jump to link anchor
	});
	
	
	
	//Click event outside of subpanel
	$(document).click(function() { //Click anywhere and...
		if($("#notifications").is(':visible')){
			$("#notifications").slideToggle(); //hide subpanel
			$("#footpanel li a").removeClass('active'); //remove active class on subpanel trigger
		}
		
		if($("#the_tools_area").is(':visible')){
			$("#the_tools_area").slideToggle(); //hide subpanel
			//$("#footpanel li a").removeClass('active'); //remove active class on subpanel trigger
		}
		
		if($("#the_wetv_area").is(':visible')){
			$("#the_wetv_area").slideToggle(); //hide subpanel
			//$("#footpanel li a").removeClass('active'); //remove active class on subpanel trigger
		}
	});
	$('#notifications').click(function(e) { 
		e.stopPropagation(); //Prevents the subpanel ul from closing on click
	});
	$('#the_tools_area').click(function(e) { 
		e.stopPropagation(); //Prevents the subpanel ul from closing on click
	});
	$('#the_wetv_area').click(function(e) { 
		e.stopPropagation(); //Prevents the subpanel ul from closing on click
	});
	
});
