// custom class for spec, will animat important notice
// version 1.0
var notice = 
{
	showText: 'View Notices',
	
	animate: function(type)
	{
		if(type == 'hide')
		{
			// hide important notices			
			$('#noticeContainer').slideUp('normal', function()
			{
				$('#openNoticePopUp').html(notice.showText);
			});			
		
			// ajax request to set a browser session var
			$.ajax(
			{
				type: 'post',
				dataType: 'json',
		   		url: 'webservice/notice.php',
		   		data: 'action=hideNotice',
		   		success: function(jsonObject)
				{		
					if(jsonObject.save.status == 'success')
					{
						// stubb
					}
		   		}			
		 	});
			// end ajax request
		}
		else
		{
			// show important notices
			$('#openNoticePopUp').html('');
			$('#noticeContainer').slideDown('normal');
					
			// ajax request to set a browser session var
			$.ajax(
			{
				type: 'post',
				dataType: 'json',
		   		url: 'webservice/notice.php',
		   		data: 'action=showNotice',
		   		success: function(jsonObject)
				{		
					if(jsonObject.save.status == 'success')
					{
						// stub
					}
		   		}			
		 	});
			// end ajax request
		}
	},
	
	init: function()
	{
		// add hide notice
		$('#closeNoticePopUp').html('x').bind('click', function() { notice.animate('hide'); });
		
		// show notice
		$('#openNoticePopUp').bind('click', function() { notice.animate('show'); });
		
		if($('#noticeContainer').is(':hidden'))
		{
			$('#openNoticePopUp').html(notice.showText);			
		}
	}
}

$(document).ready(function(){ notice.init(); });