<?php

	include "library.php";

	$cxn = start_code();

	$cxn_common = db_common_login();


	
			/* get variables */

	$id = val( $_SESSION, "id" );

	$box = val( $_GET, "box" );

		/* if the user is not logged in them direct them to the login page then back to here */

	if ($id == "")
	{
		$_SESSION['nextpage'] = url_encode( "mailboxes.php", "box", $box );

	    jump_to_page( val( $_SESSION, "login_page" ) );		/* must happen before print output */

		exit();
	}


	crash_if_missing( $box, "box missing in mailboxes", $cxn );

	
		/* start the page  */

	if ($box == "inbox")
	{
		page_header( "Inbox", $cxn, $cxn_common );

		show_buttons( $cxn );

		$query = "SELECT message.*, profile.handle, reveal_first_name, first_name FROM message LEFT JOIN profile ON profile.id = message.sender_id WHERE show_in_inbox = 'yes' AND receiver_id = ".$id." ORDER BY sent DESC";

		$result = run_query( $query, $cxn );

        echo "<br>";
        
		echo "<form name='form' action='".url_encode( "remove_from_inbox.php" )."' method='POST'>";

//		echo "<table width='100%'><td width='100%' align='center'><input type='image' src='buttons/".button_filename( "remove_selected" )."' border='0'></td></tr></table>";
		
		echo "<table width='100%'><td width='100%' align='center'>";
		
		show_green_button_submit( "Remove Selected", 170 );
		
		echo "</td></tr></table>";


		echo "<br><br>";


		if (! low_res_screen())
			echo "<table width='100%'><tr><td width='5'></td><td width='14%'>".black( "<b>Date</b>" )."</td><td width='10%'>".black( "<b>Type</b>" )."</td><td width='12%'>".black( "<b>From</b>" )."</td><td width='12%'>".black( "<b>Name</b>" )."</td><td width='25%'>".black( "<b>Subject Line</b>" )."</td><td width='19%'></td><td width='8%'></td></tr>";
		else
			echo "<table width='100%'><tr><td width='5'></td><td width='14%'>".black( "<b>Date</b>" )."</td><td width='10%'>".black( "<b>Type</b>" )."</td><td width='12%'>".black( "<b>From</b>" )."</td><td width='12%'>".black( "<b>Name</b>" )."</td><td width='59%'>".black( "<b>Subject Line</b>" )."</td></tr>";


		if (! low_res_screen())
		{
			echo "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td width='25%' rowspan='35' valign='top' align='center'>";
			
			show_ads_medium_skyscraper();
			
			echo "</td></tr>";
		}


		if (query_num_rows($result) == 0)
			echo "<tr><td></td><td></td><td></td><td colspan='3'>".black( "<br>There are no messages in your inbox" )."</td></tr>";

		for ($i=0;$i < query_num_rows($result);$i++)
		{
			$data = get_row( $result );

				/* fill in blank subject lines */

			if ($data['type'] == "email" && $data['subject'] == "")
				$subj = "No subject";
			else
				$subj = convert_to_html( $data['subject'] );


//				/* highlight kisses that haven't been replied to */
//

			$show_red = false;

//
//			if ($data['type'] == 'kiss' && $data['has_been_replied_to'] != "yes")
//			{
//				$show_red = true;
//
//				$url = url_encode( "display_profile.php", "showid", $data['sender_id'], "returnpoint", "inbox", "startpos", "" );
//
//				$subj = "<a class='gred' href='".$url."'>".red( "<span style='{text-decoration: underline}'>Not replied to yet</span>" )."</a>";
//			}
//
//			if ($data['type'] == "kiss reply")
//			{
//				if ($data['message'] == "1")
//					$subj = "kiss accepted";
//				else
//					$subj = "kiss declined";
//			}


				/* selection tickbox */

			echo "<tr><td><input type='checkbox' name='id".$data['id']."'></td>";


				/* date */

			if ($show_red)
				echo "<td>".red( Date( "j M Y", strtotime( $data['sent'] )) )."</td>";
			else
				echo "<td>".black( Date( "j M Y", strtotime( $data['sent'] )) )."</td>";


				/* type */

//			if ($show_red)
//				echo "<td>".red( $data['type'] )."</td>";
//			else
//				echo "<td>".black( $data['type'] )."</td>";

            if ($data['type'] == "contact_request")
				echo "<td>".black( "Contact Request" )."</td>";
			else
                echo "<td>".black( "Email" )."</td>";

				/* handle */

			echo "<td>";

			echo show_handle( $data['sender_id'], $data['handle'], "inbox", "" );

			echo "</td>";


				/* first name */

			echo "<td>";

			if (val( $data, 'reveal_first_name' ) == "on")
				echo black( strtolower( $data['first_name'] ) );

			echo "</td>";


				/* delete from inbox */

//			echo "<td>".show_link( "remove from inbox", "remove_from_inbox.php", "messageid", $data['id'] )."</td>";


				/* subject */

			if ($data['type'] == "email")
			{
				echo "<td>".show_link( $subj, "view_email.php", "emailid", $data['id'] )."</td></tr>";
			}
			else
			{
				if ($show_red)
					echo "<td>".red( $subj )."</td></tr>";
				else
					echo "<td>".black( $subj )."</td></tr>";
			}
		}

		echo "</form>";

            // leave the lines in below as space for the skyscraper ad
            
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";
        echo "<tr><td>&nbsp;</td></tr>";

	}
	else
	if ($box == "received")
	{
		page_header( "Received Messages", $cxn, $cxn_common );

		show_buttons( $cxn );

		echo "<br><br>";

		$query = "SELECT message.*, profile.handle, reveal_first_name, first_name FROM message LEFT JOIN profile ON profile.id = message.sender_id WHERE receiver_id = ".$id." ORDER BY sent DESC";

		$result = run_query( $query, $cxn );

		echo "<table width='100%'><tr><td width='14%'>".black( "<b>Date</b>" )."</td><td width='8%'>".black( "<b>Type</b>" )."</td><td width='13%'>".black( "<b>Received</b>" )."</td><td width='10%'>".black( "<b>From</b>" )."</td><td width='10%'>".black( "<b>Name</b>" )."</td><td width='45%'>".black( "<b>Subject Line</b>" )."</td></tr>";

		echo "<tr><td>&nbsp;</td></tr>";

		if (query_num_rows($result) == 0)
			echo "<tr><td></td><td></td><td></td><td colspan='3'>".black( "<br>There are no messages in your received box" )."</td></tr>";

		for ($i=0;$i < query_num_rows($result);$i++)
		{
			$data = get_row( $result );

				/* fill in blank subject lines */

			if ($data['type'] == "email" && $data['subject'] == "")
				$subj = "No subject";
			else
				$subj = convert_to_html( $data['subject'] );


//				/* highlight kisses that haven't been replied to */
//

			$show_red = false;

//
//			if ($data['type'] == 'kiss' && $data['has_been_replied_to'] != "yes")
//			{
//				$show_red = true;
//
//				$url = url_encode( "display_profile.php", "showid", $data['sender_id'], "returnpoint", "received", "startpos", "" );
//
//				$subj = "<a class='gred' href='".$url."'>".red( "<span style='{text-decoration: underline}'>Not replied to yet</span>" )."</a>";
//			}
//
//			if ($data['type'] == "kiss reply")
//			{
//				if ($data['message'] == "1")
//					$subj = "kiss accepted";
//				else
//					$subj = "kiss declined";
//			}

				/* date */

			if ($show_red)
				echo "<tr><td>".red( Date( "j M Y", strtotime( $data['sent'] )) )."</td>";
			else
				echo "<tr><td>".black( Date( "j M Y", strtotime( $data['sent'] )) )."</td>";


				/* type */

            if ($data['type'] == "contact_request")
				echo "<td>".black( "Contact Request" )."</td>";
			else
                echo "<td>".black( "Email" )."</td>";


				/* comment to avoid confusion */

			if ($show_red)
				echo "<td>".red( "received from" )."</td>";
			else
				echo "<td>".black( "received from" )."</td>";


				/* handle */

			echo "<td>";

			echo show_handle( $data['sender_id'], $data['handle'], "received", "" );

			echo "</td>";


				/* first name */

			echo "<td>";

			if (val( $data, 'reveal_first_name' ) == "on")
				echo black( strtolower( $data['first_name'] ) );

			echo "</td>";


				/* subject */

			if ($data['type'] == "email")
			{
				echo "<td>".show_link( $subj, "view_email.php", "emailid", $data['id'] )."</td></tr>";
			}
			else
			{
				if ($show_red)
					echo "<td>".red( $subj )."</td></tr>";
				else
					echo "<td>".black( $subj )."</td></tr>";
			}
		}
	}
	else
	if ($box == "sent")
	{
		page_header( "Sent Messages", $cxn, $cxn_common );

		show_buttons( $cxn );

		echo "<br><br>";
		
		$query = "SELECT message.*, profile.handle, reveal_first_name, first_name FROM message LEFT JOIN profile ON profile.id = message.receiver_id WHERE sender_id = ".$id." ORDER BY sent DESC";

		$result = run_query( $query, $cxn );

		echo "<table width='100%'><tr><td width='14%'>".black( "<b>Date</b>" )."</td><td width='8%'>".black( "<b>Type</b>" )."</td><td width='10%'>".black( "<b>Sent</b>" )."</td><td width='14%'>".black( "<b>To</b>" )."</td><td width='10%'>".black( "<b>Name</b>" )."</td><td width='44%'>".black( "<b>Subject Line</b>" )."</td></tr>";
//		echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'><tr bgcolor='#d9ffff'><td width='14%'>".black( "Date" )."</td><td width='8%'>".black( "Type" )."</td><td width='10%'>".black( "Sent" )."</td><td width='14%'>".black( "To" )."</td><td width='10%'>".black( "Name" )."</td><td width='44%'>".black( "Subject Line" )."</td></tr>";

		echo "<tr><td>&nbsp;</td></tr>";

		if (query_num_rows($result) == 0)
			echo "<tr><td></td><td></td><td></td><td colspan='3'><br>".black( "There are no messages in your sent box" )."</td></tr>";

		for ($i=0;$i < query_num_rows($result);$i++)
		{
			$data = get_row( $result );

				/* date  */

			echo "<tr><td>".black( Date( "j M Y", strtotime( $data['sent'] )) )."</td>";


				/* type */

			echo "<td>".black( $data['type'] )."</td>";


				/* comment to avoid confusion */

			echo "<td>".black( "sent to" )."</td>";


				/* handle */

			echo "<td>";

			if (val( $data, 'handle' ) == "")
				echo black( "<i>profile deleted</i>" );
			else
				echo show_handle( $data['receiver_id'], $data['handle'], "sent", "" );

			echo "</td>";


				/* first name */

			echo "<td>";

			if (val( $data, 'reveal_first_name' ) == "on")
				echo black( strtolower( $data['first_name'] ) );

			echo "</td>";


				/* subject */

			if ($data['type'] == "email" && $data['subject'] == "")
				$subj = "No subject";
			else
				$subj = convert_to_html( $data['subject'] );

//			if ($data['type'] == "kiss reply")
//			{
//				if ($data['message'] == "1")
//					$subj = "kiss acceptance";
//				else
//					$subj = "kiss declined";
//			}

			if ($data['type'] == "email")
			{
				echo "<td>".show_link( $subj, "view_email.php", "emailid", $data['id'] )."</td></tr>";
			}
			else
				echo "<td>".black( $subj )."</td></tr>";
		}

		echo "</table></table>";
	}
	else
	if ($box == "credits")
	{
		page_header( "Credits History", $cxn, $cxn_common );

		show_buttons( $cxn );

		echo "<br><br>";
		
		$query = "SELECT profile.credits_balance FROM profile WHERE id = ".$id;

		$result = run_query( $query, $cxn );

		$data = get_row( $result );

		if ($data['credits_balance'] == "1")
			echo red( "You have 1 credit<br><br>" );
		else
			echo red( "You have ".$data['credits_balance']." credits<br><br>" );

		$query = "SELECT credits.*, profile.id as receiver_id, profile.handle as receiver_handle, profile.credits_balance, message.subject FROM credits LEFT JOIN message ON credits.message_id = message.id LEFT JOIN profile ON profile.id = message.receiver_id WHERE credits.member_id = ".$id." ORDER BY credits.event_datetime";

		$result = run_query( $query, $cxn );

		echo "<table width='100%'><tr><td width='14%'>".black( "<b>Date</b>" )."</td><td width='14%'>".black( "<b>Member</b>" )."</td><td width='20%'>".black( "<b>Event</b>" )."</td><td width='10%'>".black( "<b>Number</b>" )."</td><td width='52%'>".black( "<b>Message</b>" )."</td></tr>";

		echo "<tr><td>&nbsp;</td></tr>";

		if (query_num_rows($result) == 0)
			echo "<tr><td></td><td></td><td colspan='3'>".black( "<br>There are no items in your credits history" )."</td></tr>";

		for ($i=0;$i < query_num_rows($result);$i++)
		{
			$data = get_row( $result );

				/* date  */

			echo "<tr><td>".black( Date( "j M Y", strtotime( $data['event_datetime'] )) )."</td>";


				/* handle */

			echo "<td>";

			if (val( $data, 'receiver_id' ) != "")
				echo show_handle( $data['receiver_id'], $data['receiver_handle'], "credits", "" );

			echo "</td>";


				/* type */

			echo "<td>".black( $data['event'] )."</td>";


				/* number */

                        if ($data['event'] == "purchase")
                        {
   			    $num = abs( $data['number'] );

			    echo "<td>".black( $num )."</td>";
                        }
                        else
                        {
   			    $num = abs( $data['number'] );

//			    echo "<td>-".black( $num )."</td>";
			    echo "<td>".black( $num )."</td>";
                        }


				/* type */

			echo "<td>".black( $data['tx'] )."</td>";
			
			
				/* subject */

			echo "<td>";

			if (val( $data, 'message_id' ) != "" && val( $data, 'event' ) == 'email sent')
			{
				if (val( $data, 'subject' ) != "")
					echo show_link( $data['subject'], "view_email.php", "emailid", $data['message_id'] );
				else
					echo show_link( "No Subject", "view_email.php", "emailid", $data['message_id'] );
			}

			echo "</td>";
		}
	}
	else
	if ($box == "blocked")
	{
		page_header( "Blocked Members", $cxn, $cxn_common );

		show_buttons( $cxn );

		echo "<br><br>";
		
		$query = "SELECT blocked_list.blockee_id, profile.handle FROM blocked_list LEFT JOIN profile ON blocked_list.blockee_id = profile.id WHERE blocker_id = ".$id." ORDER BY blockee_id";

		$result = run_query( $query, $cxn );

		echo "<table width='100%'><tr><td width='10%'></td><td width='10%'>".black( "<b>Member</b>" )."</td><td width='80%'>".black( "<b>Unblock</b>" )."</td></tr>";

		echo "<tr><td>&nbsp;</td></tr>";

		if (query_num_rows($result) == 0)
			echo "<tr><td></td><td></td><td>".black( "<br>There are no members in your blocked list" )."</td></tr>";

		for ($i=0; $i < query_num_rows($result); $i++)
		{
			$data = get_row( $result );

				/* handle */

			echo "<td></td><td>";

			echo show_handle( $data['blockee_id'], $data['handle'], "blocked", "" );

			echo "</td>";


				/* unblock link */

			echo "<td>".show_link( "Unblock", "unblock.php", "unblockid", $data['blockee_id'] )."</td></tr>";
		}
	}
	else
	if ($box == "chat_history")
	{
		page_header( "Chat History", $cxn, $cxn_common );

		show_buttons( $cxn );

		echo "<br><br>";

		$query = "SELECT profile.id, profile.handle, chat_history.started FROM chat_history INNER JOIN profile ON profile.id = chat_history.responder_id WHERE initiator_id = ".$id." ORDER BY started DESC";

		$result = run_query( $query, $cxn );

		echo "<table width='100%'><tr><td width='10%'></td><td width='10%'>".black( "<b>Member</b>" )."</td><td width='80%'>".black( "<b>Date</b>" )."</td></tr>";

		echo "<tr><td>&nbsp;</td></tr>";

		for ($i=0; $i < query_num_rows($result); $i++)
		{
			$data = get_row( $result );

				/* handle */

			echo "<td></td><td>";

			echo show_handle( $data['id'], $data['handle'], "chat_history", "" );
				
			echo "</td>";
			
			echo "<td>".black( Date( "j M Y", strtotime( $data['started'] )) )."</td>";
			
			echo "<tr>";
			
		}


		$query = "SELECT profile.id, profile.handle, chat_history.started FROM chat_history INNER JOIN profile ON profile.id = chat_history.initiator_id WHERE responder_id = ".$id." ORDER BY started DESC";

		$result = run_query( $query, $cxn );

//		echo "<table width='100%'><tr><td width='10%'></td><td width='10%'>".black( "<b>Member</b>" )."</td><td width='80%'>".black( "<b>Date</b>" )."</td></tr>";

//		echo "<tr><td>&nbsp;</td></tr>";

		for ($i=0; $i < query_num_rows($result); $i++)
		{
			$data = get_row( $result );

				/* handle */

			echo "<td></td><td>";

			echo show_handle( $data['id'], $data['handle'], "chat_history", "" );
				
			echo "</td>";
			
			echo "<td>".black( Date( "j M Y", strtotime( $data['started'] )) )."</td>";
			
			echo "<tr>";

		}

		
//		if (query_num_rows($result) == 0)
//			echo "<tr><td></td><td></td><td>".black( "<br>There are no members in your chat history" )."</td></tr>";
		
	}
	else
	if ($box == "remembered")
	{
		page_header( "Remembered List", $cxn, $cxn_common );

		show_buttons( $cxn );

		echo "<br><br>";
		
		$query = "SELECT remembered.member_id, remembered.remembered_id, profile.handle, reveal_first_name, first_name FROM remembered LEFT JOIN profile ON remembered.remembered_id = profile.id WHERE remembered.member_id = ".$id." ORDER BY remembered_id";

		$result = run_query( $query, $cxn );

		echo "<table width='100%'><tr><td width='14%' align='center'></td><td width='14%'>".black( "<b>Member</b>" )."</td><td width='10%'>".black( "<b>Name</b>" )."</td><td width='62%'>".black( "<b>Delete</b>" )."</td></tr>";

		echo "<tr><td>&nbsp;</td></tr>";
		
		if (query_num_rows($result) == 0)
			echo "<tr><td></td><td></td><td colspan='2'>".black( "<br>There are no members in your remembered list" )."</td></tr>";

		for ($i=0; $i < query_num_rows($result); $i++)
		{
			$data = get_row( $result );

			echo "<tr>";

				/* photo */

			echo "<td align='center'>";

			show_photo( $data['remembered_id'], 80, -1, true, false, $cxn );

			echo "</td>";
				
				/* handle */

			echo "<td>";

			echo show_handle( $data['remembered_id'], $data['handle'], "remembered", "" );

			echo "</td>";


				/* first name */

			echo "<td>";

			if (val( $data, 'reveal_first_name' ) == "on")
				echo black( strtolower( $data['first_name'] ) );

			echo "</td>";


				/* delete */

			echo "<td>".show_link( "delete", "delete_from_remembered.php", "rememberedid", $data['remembered_id'] )."</td></tr>";
		}
	}
	else
	if ($box == "contacts")
	{
		page_header( "Contacts", $cxn, $cxn_common );

		show_buttons( $cxn );

		echo "<br><br>";
		
		$query = "SELECT DISTINCT profile.id as noted_member_id, handle, reveal_first_name, first_name, online_status.id as logged_in, notes.text FROM profile LEFT JOIN online_status ON online_status.member_id = profile.id LEFT JOIN notes ON notes.member_id = ".$id." AND notes.noted_member_id = profile.id WHERE profile.id <> ".$id." AND (profile.id IN (SELECT DISTINCT sender_id FROM message WHERE receiver_id = ".$id.") OR profile.id IN (SELECT receiver_id FROM message WHERE sender_id = ".$id.")) ORDER BY reveal_first_name DESC, first_name, handle";

		$result = run_query( $query, $cxn );

		echo "<table width='100%'><tr><td width='5%'></td><td width='15%'>".black( "<b>Member</b>" )."</td><td width='10%'>".black( "<b>Name</b>" )."</td><td width='10%'>".black( "<b>Online</b>" )."</td><td width='15%'>".black( "<b>Notes</b>" )."</td><td width='45%'>".black( "<b>Notes Text</b>" )."</td></tr>";

		echo "<tr><td>&nbsp;</td></tr>";
		
		if (query_num_rows($result) == 0)
			echo "<tr><td></td><td></td><td colspan='4'>".black( "<br>There are no members in your contacts list" )."</td></tr>";

		for ($i=0; $i < query_num_rows($result); $i++)
		{
			$data = get_row( $result );

			echo "<tr><td></td>";

				/* handle */

			echo "<td>";

			echo show_handle( $data['noted_member_id'], $data['handle'], "contacts", "" );

			echo "</td>";


				/* first name */

			echo "<td>";

			if (val( $data, 'reveal_first_name' ) == "on")
				echo black( strtolower( $data['first_name'] ) );

			echo "</td>";


				/* online */

			if ($data['logged_in'] != "")
				echo "<td>".watermark( "online" )."</td>";
			else
				echo "<td></td>";


				/* notes */

			echo "<td>".show_link( "notes", "notes.php", "notedid", $data['noted_member_id'] )."</td>";


				/* notes text */

			if (strlen( $data['text'] ) > 60)
				echo "<td>".black( substr( $data['text'], 0, 60 ) )."</td></tr>";
			else
				echo "<td>".black( $data['text'] )."</td></tr>";
		}
	}
	else
	{
		crash( "Internal Error: invalid box in mailboxes", $cxn );
	}


		/* show the line of buttons on the top of the screen */

	function show_buttons( $cxn )
	{
		$bg = "#73b8bb";

        echo "<style>";
        echo "table.menubartable td {";
        echo "    color: #000000;";
//        echo "    line-height: 25pt;";
        echo "    font-size: ".fs( 12) ."pt;";
        echo "    font-family:verdana;";
        echo "    background-color: #73b8bb;";
        echo "}";
        
        echo "table.menubartable td:hover {";
        echo "      background-color: #eeeeee;";
        echo "      cursor: pointer;";
        echo "}";        
        echo "</style>";

		echo "<table class='menubartable' width='100%' border='0' cellspacing='0'>";

		echo "<tr bgcolor='".$bg."'>";

		echo show_one_item( "Inbox", "inbox" );

		echo show_one_item( "Sent", "sent" );

		echo show_one_item( "Received", "received" );

		echo show_one_item( "Contacts", "contacts" );

		echo show_one_item( "Blocked", "blocked" );

		echo show_one_item( "Remembered", "remembered" );

		echo show_one_item( "Chat History", "chat_history" );

		echo "</tr>";

		echo "</table>";
	}
	
	function show_one_item( $prompt, $box )
	{
		return "<td height='40' style='background-color: #73b8bb' width='2%'></td><td width='10%' align='center' onclick='location.href=\"".url_encode( "mailboxes.php", "box", $box )."\"'>".$prompt."</td><td style='background-color: #73b8bb' width='2%'></td>";
	}
	

?>