						
			/********** page functions ***********/

			function show(section, page, user)
			{
				var actual_page;
				//var sections = new Array("Popular", "Recent", "Inane", "Funny", "Pretentious");
				var sections = new Array("Popular", "Recent", "Hall");
				switch(section)
				{
					case 'Popular':
						actual_page = 'index.php?controller=Tweet&action=Display&section='+section+'&page='+page;
						document.images["section-title"].src = "Views/Images/title_popular.png"; 
						break;
					case 'Recent':
						actual_page = 'index.php?controller=Tweet&action=Display&section='+section+'&page='+page;
						document.images["section-title"].src = "Views/Images/title_recent.png"; 
						break;
					case 'Hall':
						actual_page = 'index.php?controller=Tweet&action=Display&section='+section+'&page='+page;
						document.images["section-title"].src = "Views/Images/Spec.Stupid.Tweets.png"; 
						break;
					case 'User':
						actual_page = 'index.php?controller=Tweet&action=Display&section='+section+'&page='+page+'&user='+user;
						document.images["section-title"].src = "Views/Images/title_recent.png"; 
						break;
					/*case 'Inane':
						actual_page = 'index.php?controller=Tweet&action=Display&section='+section+'&page='+page;
						document.images["section-title"].src = "Views/Images/title_inane.png"; 
						break;
					case 'Funny':
						actual_page = 'index.php?controller=Tweet&action=Display&section='+section+'&page='+page;
						document.images["section-title"].src = "Views/Images/title_funny.png"; 
						break;
					case 'Pretentious':
						actual_page = 'index.php?controller=Tweet&action=Display&section='+section+'&page='+page;
						document.images["section-title"].src = "Views/Images/title_pretentious.png"; 
						break;*/
					case 'Search':
						var keyword = document.getElementById("keyword").value;
						actual_page = 'index.php?controller=Tweet&action=Display&section='+section+'&page='+page+'&keyword='+keyword;
						document.images["section-title"].src = "Views/Images/title_searchResults.png"; 
						break;
				}
				for(var i=0;i<sections.length;i++)
				{
					$('#'+sections[i]).removeClass('current');
				}
				$('#'+section).addClass('current');
				$('#main-cental-container-left').load(actual_page);
			}
			
			function MoreComments(tweet, comment)
			{
				if( document.getElementById('Comments'+comment).innerHTML == '+' )
				{	
					document.getElementById('Comments'+comment).innerHTML = '-';
				}
				else
				{
					document.getElementById('Comments'+comment).innerHTML = '+';
				}
				$('tr').filter('[class=MoreComments'+tweet+']').toggle();
				
			}
			
			function NewComment(tweet, comment)
			{
				if( document.getElementById('New_Comment'+comment).innerHTML == '+' )
				{
					document.getElementById('New_Comment'+comment).innerHTML = '-';
				}
				else
				{
					document.getElementById('New_Comment'+comment).innerHTML = '+';
				}
				$('tr').filter('[class=NewComment'+tweet+']').toggle();
		
			}
			
			function VoteTweet(type, tweet, section, page)
			{
				var actual_page; 
				actual_page = "index.php?controller=Tweet&action=Vote"+type+"&tweet_id="+tweet;
				$.get(actual_page, function(data){
					  if (data == "ok")
					  {
						$.gritter.add({
							title: 'Thank you!',
	      					text: 'for voting this tweet!',
	                      	time: '3000'
						})
						$('div.pp_overlay,div.pp_pic_holder,div.ppt').remove();
						show(section, page);
					  }
					  else
					  {
						  $.gritter.add({
      						title: 'Sorry...',
      						text: 'You cannot vote twice on the same comment.',
                      		time: '3000'
						  })
							$('div.pp_overlay,div.pp_pic_holder,div.ppt').remove();

					  }
					});
			}
			
			function VoteComment(type, comment, section, page)
			{
				var actual_page; 
				actual_page = "index.php?controller=Comment&action=Vote"+type+"&comment_id="+comment;
				$.get(actual_page, function(data){
					  if (data == "ok")
					  {
						  $.gritter.add({
								title: 'Thank you!',
								text: 'for voting this comment!',
								time: '3000'
							})
							$('div.pp_overlay,div.pp_pic_holder,div.ppt').remove();
						  show(section, page);
					  }
					  else
					  {
						$.gritter.add({
							title: 'Sorry...',
							text: 'You cannot vote twice on the same comment.',
							time: '3000'
						})
						$('div.pp_overlay,div.pp_pic_holder,div.ppt').remove();
					  }
					});
			}
			
			function SaveComment(tweet, section, page)
			{
				var actual_page;
				var comment;
				comment = document.getElementById("comment"+tweet).value;
				if (comment)
				{
					actual_page = "index.php?controller=Comment&action=Save&tweet_id="+tweet+"&comment="+comment;
					$.get(actual_page);
					$.gritter.add({
						title: 'Thanks!',
						text: 'For your comment.',
						time: '3000'
					})
					$('div.pp_overlay,div.pp_pic_holder,div.ppt').remove();
					show(section, page);
				}
				return false;
			}
			
			function ReportComment(comment, section, page)
			{
				var actual_page;
				actual_page = "index.php?controller=Comment&action=Report&comment_id="+comment;
				$.get(actual_page, function(data){
					$.gritter.add({
						title: 'Thanks!',
						text: 'This comment has been reported.',
						time: '3000'
					})
					$('div.pp_overlay,div.pp_pic_holder,div.ppt').remove();
					  if (data == "10")
					  {
						  show(section, page);
					  }
					 
					});
			}
			
			/*function VoteCategory(tweet, category)
			{
				$.gritter.add({
					title: 'Thanks!',
					text: 'Your vote has been added to this tweet.',
					time: '3000'
				})
				$('div.pp_overlay,div.pp_pic_holder,div.ppt').remove();
				$.get("index.php?controller=Category&action=VoteUp&tweet_id="+tweet+"&category_id="+category);
			}*/
			
			function EvenMore(tweet, section, page)
			{
				$('#ding').attr("href", "index.php?iframe=true&width=800&height=400&closesection="+section+"&closepage="+page+"&controller=Tweet&action=Tweet&section=Tweet&tweet_id="+tweet);
				$('#ding').click();
			}
			
			function terms()
			{
				$('#terms').attr("href", "Views/Terms.php?iframe=true&width=500&height=400");
			}
			
			function privacy()
			{
				$('#privacy').attr("href", "Views/Privacy.php?iframe=true&width=500&height=400");
			}
