function drawSideMenu(pDocumentText)
{
	var pDocument = null;
	try 
	{
		pDocument = eval(pDocumentText);
		if (pDocument == null)
		{
			return;
		}
	} catch (ee) { return; }
	
	if (!top.frames.headerFrame)
	{
		return;
	}
	
	if (!top.frames.headerFrame.loaded)
	{
		setTimeout("drawSideMenu('"+pDocumentText+"');", 100);
		return;
	}
	
	if (top.frames.headerFrame.loadedEntityId == -1)
	{
		// User not logged in
		return;
	}

	var menuDiv = pDocument.getElementById("id_leftMenuGenericDiv");
	if (menuDiv != null)
	{
		var tableHtml =  "<table border='0' cellpadding='0' cellspacing='0' width='100%' bgcolor='white' style='border-width:1; border-color:rgb(153,204,255); border-style:dashed; cursor:pointer;cursor:hand;' onMouseOver='document.getElementById(\"id_myHomePageText\").style.color=\"#FF9900\";' onMouseOut='document.getElementById(\"id_myHomePageText\").style.color=\"#999999\";' onClick='top.document.location=\"../mainMenu/mainMenuFrame.html\";'>\n" +
										 "  <tr>\n" +
										 "    <td>\n" +
										 "      <div id='id_myHomePageText' class='leftMenu_new'>My Home Page</div>\n" +
										 "    </td>\n" +
										 "  </tr>\n" +
										 "</table>\n" +
									   "<br>\n" +
									   "<table border='0' cellpadding='0' cellspacing='0' width='100%' bgcolor='white' style='border-width:1; border-color:rgb(153,204,255); border-style:dashed; cursor:pointer;cursor:hand;' onMouseOver='document.getElementById(\"id_myMessagesText\").style.color=\"#FF9900\";' onMouseOut='document.getElementById(\"id_myMessagesText\").style.color=\"#999999\";' onClick='top.document.location=\"../messages/messagesFrame.html\";'>\n" +
										 "  <tr>\n" +
										 "    <td>\n" +
										 "      <div id='id_myMessagesText' class='leftMenu_new'>My Messages</div>\n" +
										 "      <div id='id_newMessagesDiv'>\n" +
									   "        <table border='0' cellpadding='0' cellspacing='0' width='100%'>\n" +
									   "          <tr>\n" +
									   "            <td nowrap align='right'><div class='vslgray'>No new messages&nbsp;</div></td>\n" +
									   "          </tr>\n" +
									   "        </table>\n" +
									   "      </div>\n" +
										 "    </td>\n" +
										 "  </tr>\n" +
										 "</table>\n" +
									   "<br>\n" +
									   "<table border='0' cellpadding='0' cellspacing='0' width='100%' bgcolor='white' style='border-width:1; border-color:rgb(153,204,255); border-style:dashed; cursor:pointer;cursor:hand;' onMouseOver='document.getElementById(\"id_myProfileText\").style.color=\"#FF9900\";' onMouseOut='document.getElementById(\"id_myProfileText\").style.color=\"#999999\";' onClick='top.document.location=\"../profile/profileFrame.html\";'>\n" +
										 "  <tr>\n" +
										 "    <td>\n" +
										 "      <div id='id_myProfileText' class='leftMenu_new'>My Profile</div>\n" +
										 "    </td>\n" +
										 "  </tr>\n" +
										 "</table>\n" +
										 "<br>\n" +
			             	 "<div class='leftMenu'><a href='../rating/ratingDownloadFrame.html' target='_top'>My Ratings Download</a></div>\n" +
			               "<br>\n" +
			               "<table border='0' cellpadding='0' cellspacing='0' width='100%' bgcolor='white' style='border-width:1; border-color:rgb(153,204,255); border-style:dashed; cursor:pointer;cursor:hand;' onMouseOver='document.getElementById(\"id_myDatingDiaryText\").style.color=\"#FF9900\";' onMouseOut='document.getElementById(\"id_myDatingDiaryText\").style.color=\"#999999\";' onClick='top.document.location=\"../rating/ratingSummaryFrame.html\";'>\n" +
										 "  <tr>\n" +
										 "    <td>\n" +
										 "      <div id='id_myDatingDiaryText' class='leftMenu_new'>My Dating Diary</div>\n" +
										 "    </td>\n" +
										 "  </tr>\n" +
										 "</table>\n" +
			               "<br>\n" +
			               "<table border='0' cellpadding='5' cellspacing='0' width='100%' bgcolor='white' style='border-width:1; border-color:rgb(153,204,255); border-style:dashed;'>\n" +
			               "  <tr>\n" +
			               "    <td nowrap>\n" +
			               "      <div id='id_my_side_profile'></div>\n" +
			               "    </td>\n" +
			               "  </tr>\n" +
			               "</table>\n" +
			               "<br><br><br><br><br><br>\n";
               
		menuDiv.innerHTML = tableHtml;
		
		getNewMessages(pDocumentText);
		getMySideProfile(pDocumentText);
	}
}

function removeSideMenuIfNotLoggedIn(pDocumentText)
{
	var pDocument = null;
	try 
	{
		pDocument = eval(pDocumentText);
		if (pDocument == null)
		{
			return;
		}
	} catch (ee) { return; }
	
	if (!top.frames.headerFrame.loaded)
	{
		setTimeout("removeSideMenuIfNotLoggedIn('"+pDocumentText+"');", 100);
		return;
	}
	
	if (top.frames.headerFrame.loadedEntityId == -1)
	{
		// User not logged in
		var menuDiv = pDocument.getElementById("id_leftMenuGenericDiv");
		if (menuDiv != null)
		{
			menuDiv.innerHTML = "";
		}
	}
}

function getMySideProfile(pDocumentText)
{
	var pDocument = null;
	try 
	{
		pDocument = eval(pDocumentText);
		if (pDocument == null)
		{
			return;
		}
	} catch (ee) { return; }
	
	if (!top.frames.headerFrame)
	{
		return;
	}
	
	if (!top.frames.headerFrame.loaded)
	{
		setTimeout("getMySideProfile('"+pDocumentText+"');", 100);
		return;
	}
	
	if (top.frames.headerFrame.loadedEntityId == -1)
	{
		// User not logged in
		return;
	}
	

	var menuDiv = pDocument.getElementById("id_my_side_profile");
	if (menuDiv != null)
	{
		var mySideProfileHTML = "";
		
		mySideProfileHTML += top.frames.headerFrame.loadedUserInfo.getLoadedThumbHTML();
		
		mySideProfileHTML += "<br><span class='slbgray'><font color="+top.frames.headerFrame.loadedUserInfo.genderColor+"><b>&nbsp;"+top.frames.headerFrame.loadedUserInfo.screenName+" </b></font></span>\n";
		
		mySideProfileHTML += "<hr noshade size='1' width='100%' color='#EBF5FF'>\n";
		
		mySideProfileHTML += top.frames.headerFrame.loadedUserInfo.getDateRepHTML();
			
		mySideProfileHTML += "<hr noshade size='1' width='100%' color='#EBF5FF'>\n";
		
		mySideProfileHTML += "<span id='id_loveLife'>\n";
		if (top.frames.headerFrame.loadedUserInfo.loveLife != '')
		{
			mySideProfileHTML += "<table border='0' cellspacing='0' cellpadding='0' width='100%'>\n" +
												 	 "  <tr>\n" +
													 "    <td>\n" +
													 "      <div class='bslgray'>My Love Life<br><font class='bspurple'>" + top.frames.headerFrame.loadedUserInfo.loveLife + "</font></div>\n" +
													 "      <input type='hidden' id='id_loveLifeTextHidden' value='"+top.frames.headerFrame.loadedUserInfo.loveLife+"'>\n" +
													 "    </td>\n" +
													 "  </tr>\n" +
													 "  <tr>\n" +
													 "    <td align='right'>\n" +
													 "      <span class='slgrayOnYellow'>[<span onClick='setLoveLife(\"document\");' style='cursor:pointer;cursor:hand;'>edit</span>]</span>\n" +
													 "    </td>\n" +
													 "  </tr>\n" +
													 "</table>\n";
		}
		else 
		{
			mySideProfileHTML += "<table border='0' cellspacing='0' cellpadding='0' width='100%'>\n" +
													 "  <tr>\n" +
													 "    <td nowrap>\n" +
													 "      <div class='vsblue' onClick='setLoveLife(\"document\");' style='cursor:pointer;cursor:hand;'><u>How's your love life?</u></div>\n" +
													 "    </td>\n" +
													 "  </tr>\n" +
													 "</table>\n";
		}
		mySideProfileHTML += "</span>\n";
		
		menuDiv.innerHTML = mySideProfileHTML;
	}
}

function getMyLoveLife(pDocumentText)
{
	var pDocument = null;
	try 
	{
		pDocument = eval(pDocumentText);
		if (pDocument == null)
		{
			return;
		}
	} catch (ee) { return; }
	
	if (!top.frames.headerFrame.loaded)
	{
		setTimeout("getMyLoveLife('"+pDocumentText+"');", 100);
		return;
	}
	
	if (top.frames.headerFrame.loadedEntityId == -1)
	{
		// User not logged in
		return;
	}
	
	var menuDiv = pDocument.getElementById("id_my_loveLife");
	if (menuDiv != null)
	{
		var mySideProfileHTML = "";
		
		if (top.frames.headerFrame.loadedUserInfo.dateRep[0] != 0 || (top.frames.headerFrame.loadedUserInfo.dateRep[1] != 0) || (top.frames.headerFrame.loadedUserInfo.dateRep[2] != 0) || (top.frames.headerFrame.loadedUserInfo.dateRep[3] != 0))
		{
			mySideProfileHTML += "<div class='bslgray'>My <font color='#CC0033'>Date</font><font color='#FF9900'>Rep</font><sup>TM</sup>:<br>\n" +
													 "<div class='bsorange'>"+top.frames.headerFrame.getDateRep(top.frames.headerFrame.loadedUserInfo.dateRep[0], top.frames.headerFrame.loadedUserInfo.dateRep[1], top.frames.headerFrame.loadedUserInfo.dateRep[2], top.frames.headerFrame.loadedUserInfo.dateRep[3], top.frames.headerFrame.loadedUserInfo.gender)+"</div>\n";
													 
			mySideProfileHTML += "<hr noshade size='1' width='100%' color='#EBF5FF'>\n";
		}
		
		mySideProfileHTML += "<span id='id_loveLife'>\n";
		if (top.frames.headerFrame.loadedUserInfo.loveLife != '')
		{
			mySideProfileHTML += "<table border='0' cellspacing='0' cellpadding='0' width='100%'>\n" +
												 	 "  <tr>\n" +
													 "    <td>\n" +
													 "      <div class='bslgray'>My Love Life<br><font class='bspurple'>" + top.frames.headerFrame.loadedUserInfo.loveLife + "</font></div>\n" +
													 "      <input type='hidden' id='id_loveLifeTextHidden' value='"+top.frames.headerFrame.loadedUserInfo.loveLife+"'>\n" +
													 "    </td>\n" +
													 "  </tr>\n" +
													 "  <tr>\n" +
													 "    <td align='right'>\n" +
													 "      <span class='slgrayOnYellow'>[<span onClick='setLoveLife(\"document\");' style='cursor:pointer;cursor:hand;'>edit</span>]</span>\n" +
													 "    </td>\n" +
													 "  </tr>\n" +
													 "</table>\n";
		}
		else 
		{
			mySideProfileHTML += "<table border='0' cellspacing='0' cellpadding='0' width='100%'>\n" +
													 "  <tr>\n" +
													 "    <td nowrap>\n" +
													 "      <div class='vsblue' onClick='setLoveLife(\"document\");' style='cursor:pointer;cursor:hand;'><u>How's your love life?</u></div>\n" +
													 "    </td>\n" +
													 "  </tr>\n" +
													 "</table>\n";
		}
		mySideProfileHTML += "</span>\n";
		
		menuDiv.innerHTML = mySideProfileHTML;
	}
}

function getMyHomePageProfile(pDocumentText)
{
	var pDocument = null;
	try 
	{
		pDocument = eval(pDocumentText);
		if (pDocument == null)
		{
			return;
		}
	} catch (ee) { return; }
	
	if (!top.frames.headerFrame.loaded)
	{
		setTimeout("getMyHomePageProfile('"+pDocumentText+"');", 100);
		return;
	}
	
	if (top.frames.headerFrame.loadedEntityId == -1)
	{
		// User not logged in
		return;
	}
	
	
	var profileDiv = pDocument.getElementById("id_myHomePageProfile");
	if (profileDiv != null)
	{
		var myHomePageProfileHTML = "";
		
		myHomePageProfileHTML += "<table border='0' cellspacing='0' cellpadding='10' width='100%'>\n" +
														 "  <tr>\n" +
														 "    <td valign='top' width='100%'>\n" +
													   "      <table border='0' cellspacing='1' cellpadding='3' bgcolor='#FFFFFF' width='100%'>\n" +
	    						 				   "        <tr>\n" +
			             				   "          <td colspan='5' bgcolor='#fcf2f5' style='border-top-width:1; border-top-color:rgb(240,178,193); border-top-style:solid;'>\n" +
			             				   "            <div class='slbgray'>Welcome to <font color='#CC0033'>Date</font><font color='#FF9900'>Raters</font> "+top.frames.headerFrame.loadedUserInfo.screenName+"!</div>\n" +
													   "          </td>\n" +
		             				     "        </tr>\n" +
		             				     "        <tr>\n" +
		             				     "       	  <td width='25%' align='center'>\n" +
		             				     "            <span onClick='top.frames.headerFrame.showProfile("+top.frames.headerFrame.loadedUserInfo.entityId+");' style='cursor:pointer;cursor:hand;'><img style='border: 3px double rgb(204, 204, 204);' src='"+top.frames.headerFrame.loadedUserInfo.getProfileImage()+"' onMouseover='ddrivetip(\""+encode(top.frames.headerFrame.loadedUserInfo.getProfileImageCaption())+"\")' onMouseout='hideddrivetip()'></span>\n" +
		             				     "          </td>\n" +
		             				     "          <td width='75%'>\n" +
		             				     "            <table border='0' cellpadding='0' cellspacing='0'>\n" +
   													 "              <tr onClick='top.frames.document.location=\"../search/searchFrame.html\"; return false;' style='cursor:pointer;cursor:hand;'>\n" +
   													 "                <td width='30'><img src='../images/bigIcons/search_verySmall.gif' border='0'></td>\n" +
   													 "                <td class='sbpurple' nowrap>Browse Profiles</td>\n" +
   													 "              </tr>\n" +
   													 "              <tr onClick='top.frames.document.location=\"../rateYourDate/rateYourDateFrame.html\"; return false;' style='cursor:pointer;cursor:hand;'>\n" +
   													 "                <td width='30'><img src='../images/bigIcons/rate_verySmall.gif' border='0'></td>\n" +
   													 "                <td class='sbpurple' nowrap>Rate Your Dates</td>\n" +
   													 "              </tr>\n" +
   													 "              <tr onClick='top.frames.document.location=\"../getDateRated/getDateRatedFrame.html\"; return false;' style='cursor:pointer;cursor:hand;'>\n" +
   													 "                <td width='30'><img src='../images/bigIcons/getRated_verySmall.gif' border='0'></td>\n" +
   													 "                <td class='sbpurple' nowrap>Request to Get DateRated</td>\n" +
   													 "              </tr>\n" +
   													 "              <tr onClick='top.frames.document.location=\"../heartBeat/heartBeatFrame.html\"; return false;' style='cursor:pointer;cursor:hand;'>\n" +
   													 "                <td width='30'><img src='../images/bigIcons/ratingsDownload_verySmall.gif' border='0'></td>\n" +
   													 "                <td class='sbpurple' nowrap>Check out Cool Stats on the HeartBeat</td>\n" +
   													 "              </tr>\n" +
   													 "            </table>\n" +
		             				     "          </td>\n" +
		             				     "        </tr>\n" +
		             				     "      </table>\n" +
														 "    </td>\n" +
														 "  </tr>\n" +
														 "</table>\n";
		
		profileDiv.innerHTML = myHomePageProfileHTML;
	}
}

function setLoveLife(pDocumentText)
{
	var pDocument = null;
	try 
	{
		pDocument = eval(pDocumentText);
		if (pDocument == null)
		{
			return;
		}
	} catch (ee) { return; }
	
	if (!top.frames.headerFrame.loaded)
	{
		setTimeout("setLoveLife('"+pDocumentText+"');", 100);
		return;
	}
	
	if (top.frames.headerFrame.loadedEntityId == -1)
	{
		// User not logged in
		return;
	}
	
	
	var loveLifeDiv = pDocument.getElementById('id_loveLife');
	if (loveLifeDiv != null)
	{
		var defaultText = "";
		var loveLifeTextDiv = pDocument.getElementById('id_loveLifeTextHidden');
		if (loveLifeTextDiv != null)
		{
			defaultText = loveLifeTextDiv.value;
		}
		if (defaultText == '')
		{
			defaultText = 'is ';
		}
		
		var setLoveLifeHTML = "";
		
		setLoveLifeHTML += "<div class='bslgray'>My Love Life ...</div>\n" +
											 "<input type='text' value='"+defaultText+"' name='loveLifeText' id='id_loveLifeText' size='22' maxlength='50' style='font-family:Verdana; font-size:10; color:rgb(51,51,51); padding:3; border-width:1; border-color:rgb(204,204,204); border-style:solid;' onChange='updateLoveLife(\"document\");' onKeyPress='return enterOnLoveLife(event, \"document\")'>\n";
											 
		loveLifeDiv.innerHTML = setLoveLifeHTML;
		
		pDocument.getElementById('id_loveLifeText').focus();
	}
}

// if hit enter 
function enterOnLoveLife(e, pDocumentText)
{
	try
	{	
		var keycode;
		if (window.event) 
		{
			keycode = window.event.keyCode;
		}
		else if (e) 
		{
			keycode = e.which;
		}
		else 
		{
			return true;
		}
		
		if (keycode == 13)
		{
			updateLoveLife(pDocumentText);
		}
		else
		{
			return true;
		}
	}
	catch(ee){}
}

function updateLoveLife(pDocumentText)
{
	var pDocument = null;
	try 
	{
		pDocument = eval(pDocumentText);
		if (pDocument == null)
		{
			return;
		}
	} catch (ee) { return; }
	
	if (!top.frames.headerFrame.loaded)
	{
		setTimeout("updateLoveLife('"+pDocumentText+"');", 100);
		return;
	}
	
	if (top.frames.headerFrame.loadedEntityId == -1)
	{
		// User not logged in
		return;
	}
	
	
	var loveLifeTextDiv = pDocument.getElementById('id_loveLifeText');
	if (loveLifeTextDiv != null)
	{
		
		var app = 'app=profile';
		var cmd = 'cmd=SAVESTATUS';
		
		var statusPresetText = 'statusPresetText='+encode("Love Life");
		var statusInput = 'statusInput='+encode(loveLifeTextDiv.value);
		
		var myRequest = new ajaxObject();
		var sendString = app+'&'+cmd+'&'+statusPresetText+'&'+statusInput;
		myRequest.update(sendString,'POST',false);
		
		try
		{
			var loveLifeDiv = pDocument.getElementById('id_loveLife');
			if (loveLifeDiv != null)
			{
				if (loveLifeTextDiv.value != '')
				{
					loveLifeDiv.innerHTML = "<table border='0' cellspacing='0' cellpadding='0' width='100%'>\n" +
																	"  <tr>\n" +
																	"    <td>\n" +
																	"      <div class='bslgray'>My Love Life<br><font class='bspurple'>" + loveLifeTextDiv.value + "</font></div>\n" +
																	"      <input type='hidden' id='id_loveLifeTextHidden' value='"+loveLifeTextDiv.value+"'>\n" +
																	"    </td>\n" +
																	"  </tr>\n" +
																	"  <tr>\n" +
																	"    <td align='right'>\n" +
																	"      <span class='slgrayOnYellow'>[<span onClick='setLoveLife(\"document\");' style='cursor:pointer;cursor:hand;'>edit</span>]</span>\n" +
																	"    </td>\n" +
																	"  </tr>\n" +
																	"</table>\n";
				}
				else
				{
					loveLifeDiv.innerHTML = "<div class='vsblue' onClick='setLoveLife(\"document\");' style='cursor:pointer;cursor:hand;'><u>How's your love life?</u></div>\n";
				}
			}
		}
		catch (ee) 
		{}
	}
}


function drawYouDateRatedDiv(pDocumentText)
{
	var pDocument = null;
	try 
	{
		pDocument = eval(pDocumentText);
		if (pDocument == null)
		{
			return;
		}
	} catch (ee) { return; }
	
	if (!top.frames.headerFrame.loaded)
	{
		setTimeout("drawYouDateRatedDiv('"+pDocumentText+"');", 100);
		return;
	}
	
	if (top.frames.headerFrame.loadedEntityId == -1)
	{
		// User not logged in
		return;
	}
	
	if ((top.frames.headerFrame.loadedEntityId != -1) && (top.frames.headerFrame.loadedUserInfo != null) &&
			(top.frames.headerFrame.loadedUserInfo.ratingsArray != null))
	{
		var ratingRequestsDiv = pDocument.getElementById('id_ratingRequestsDiv');
		if (ratingRequestsDiv != null)
		{
			var ratingRequestsHTML = "";
			
			if (top.frames.headerFrame.loadedUserInfo.numTimesThisRatedOthersNotStarted > 0)
			{
				var thisRatingsArray = top.frames.headerFrame.loadedUserInfo.ratingsArray;
				
				ratingRequestsHTML += "<table border='0' cellspacing='0' cellpadding='10' width='100%'>\n" +
														  "  <tr>\n" +
														  "    <td>\n" +
														  "      <table border='0' cellspacing='1' cellpadding='3' bgcolor='#FFFFFF' width='100%'>\n" +
		    						 				  "        <tr>\n" +
				             				  "          <td colspan='5' bgcolor='#ffffcc' style='border-top-width:1; border-top-color:rgb(255,194,102); border-top-style:solid;'>\n" +
				             				  "            <div class='slbgray'>Your <font color='#CC0033'>Date</font><font color='#FF9900'>Rating</font><sup><font size='1'>TM</font></sup> Requests</div>\n" +
														  "          </td>\n" +
			             				    "        </tr>\n" +
			             				    "        <tr>\n" +
			             				    "          <td colspan='5' bgcolor='#fffff0'>\n" +
														  "            <table border='0' cellspacing='0' cellpadding='0' width='100%'>\n" +
														  "              <tr>\n";
				
				var numRequestsPrinted = 0;
													  
				for (var numR = thisRatingsArray.length-1; numR >= 0; numR--)
				{
					var thisRatingInfo = thisRatingsArray[numR];
					if (thisRatingInfo != null)
					{
						if ((thisRatingInfo.rater != null) && (thisRatingInfo.rater.entityId == top.frames.headerFrame.loadedEntityId) && 
								(thisRatingInfo.ratingId == 0) && (thisRatingInfo.pctComplete == 0)) // Logged in user is a rater and rating not started = request
						{
							ratingRequestsHTML += "          <td width='20%' align='center' valign='bottom' onClick='top.frames.headerFrame.rateYourDate("+thisRatingInfo.ratee.entityId+");' style='border-bottom-width:1; border-bottom-color:rgb(255,194,102); border-bottom-style:solid; cursor:pointer;cursor:hand;'>\n" +
																    "            "+thisRatingInfo.ratee.getShortThumbHTML_noLink()+"<div class='slgray'><font color='#336699'><b>"+thisRatingInfo.ratee.screenName+"</b></font></div>\n" +
																    "          </td>\n";
							
							numRequestsPrinted++;
							if (numRequestsPrinted >= 5)
							{
								break;
							}
						}
					}
				}
				for (var upTo5 = numRequestsPrinted; upTo5 <=5; upTo5++)
				{
					ratingRequestsHTML += "          <td width='20%' align='center' valign='bottom' style='border-bottom-width:1; border-bottom-color:rgb(255,194,102); border-bottom-style:solid;'>&nbsp;</td>\n";
				}
														  
				ratingRequestsHTML += "              </tr>\n" +
													    "            </table>\n" +
													    "          </td>\n" +
									 				    "        </tr>\n" +
													    "      	 <tr>\n";
			}
			
			ratingRequestsDiv.innerHTML = ratingRequestsHTML;
		}
		
		var ratedYouDiv = pDocument.getElementById('id_ratedYouDiv');
		if (ratedYouDiv != null)
		{
			var ratedYouHTML = "";
			
			if (top.frames.headerFrame.loadedUserInfo.numTimesOthersRatedThis > 0)
			{
				var thisRatingsArray = top.frames.headerFrame.loadedUserInfo.ratingsArray;
				
				ratedYouHTML += "<table border='0' cellspacing='0' cellpadding='10' width='100%'>\n" +
											   "  <tr>\n" +
											   "    <td>\n" +
											   "      <table border='0' cellspacing='1' cellpadding='3' bgcolor='#FFFFFF' width='100%'>\n" +
  						 				   "        <tr>\n" +
	             				   "          <td colspan='5' bgcolor='#ffffcc' style='border-top-width:1; border-top-color:rgb(255,194,102); border-top-style:solid;'>\n" +
	             				   "            <div class='slbgray'>You recently got <font color='#CC0033'>Date</font><font color='#FF9900'>Rated</font><sup><font size='1'>TM</font></sup> by</div>\n" +
	             				   "          </td>\n" +
	             				   "        </tr>\n" +
	             				   "        <tr>\n" +
	             				   "          <td colspan='5' bgcolor='#fffff0'>\n" +
											   "            <table border='0' cellspacing='0' cellpadding='0' width='100%'>\n" +
											   "              <tr>\n";
				
				var numRatedYouPrinted = 0;
													  
				for (var numR = thisRatingsArray.length-1; numR >= 0; numR--)
				{
					var thisRatingInfo = thisRatingsArray[numR];
					if (thisRatingInfo != null)
					{
						if ((thisRatingInfo.ratee != null) && (thisRatingInfo.ratee.entityId == top.frames.headerFrame.loadedEntityId) &&
								(thisRatingInfo.pctComplete == 100))
						{
							ratedYouHTML += "          <td width='20%' align='center' valign='bottom' onClick='top.frames.headerFrame.startRating("+thisRatingInfo.ratee.entityId+", "+thisRatingInfo.ratingId+", \"MainPage\");' style='border-bottom-width:1; border-bottom-color:rgb(255,194,102); border-bottom-style:solid; cursor:pointer;cursor:hand;'>\n" +
													     "            "+thisRatingInfo.rater.getShortThumbHTML_noLink()+"<div class='slgray'><font color='#336699'><b>"+thisRatingInfo.rater.screenName+"</b></font></div>\n" +
													     "          </td>\n";
							
							numRatedYouPrinted++;
							if (numRatedYouPrinted >= 5)
							{
								break;
							}
						}
					}
				}
				for (var upTo5 = numRatedYouPrinted; upTo5 <=5; upTo5++)
				{
					ratedYouHTML += "          <td width='20%' align='center' valign='bottom' style='border-bottom-width:1; border-bottom-color:rgb(255,194,102); border-bottom-style:solid;'>&nbsp;</td>\n";
				}
														  
				ratedYouHTML += "              </tr>\n" +
										     "            </table>\n" +
										     "          </td>\n" +
						 				     "        </tr>\n" +
										     "      	 <tr>\n";
			}
			
			ratedYouDiv.innerHTML = ratedYouHTML;
		}
		
		var youRatingDiv = pDocument.getElementById('id_youRatingDiv');
		if (youRatingDiv != null)
		{
			var youRatingHTML = "";
			
			if (top.frames.headerFrame.loadedUserInfo.numTimesThisRatedOthersProgress > 0)
			{
				var thisRatingsArray = top.frames.headerFrame.loadedUserInfo.ratingsArray;
				
				youRatingHTML += "<table border='0' cellspacing='0' cellpadding='10' width='100%'>\n" +
											   "  <tr>\n" +
											   "    <td>\n" +
											   "      <table border='0' cellspacing='1' cellpadding='3' bgcolor='#FFFFFF' width='100%'>\n" +
  						 				   "        <tr>\n" +
	             				   "          <td colspan='5' bgcolor='#ffffcc' style='border-top-width:1; border-top-color:rgb(255,194,102); border-top-style:solid;'>\n" +
	             				   "            <div class='slbgray'>You are in the process of <font color='#CC0033'>Date</font><font color='#FF9900'>Rating</font><sup><font size='1'>TM</font></sup></div>\n" +
	             				   "          </td>\n" +
	             				   "        </tr>\n" +
	             				   "        <tr>\n" +
	             				   "          <td colspan='5' bgcolor='#fffff0'>\n" +
											   "            <table border='0' cellspacing='0' cellpadding='0' width='100%'>\n" +
											   "              <tr>\n";
				
				var numYouRatingPrinted = 0;
													  
				for (var numR = thisRatingsArray.length-1; numR >= 0; numR--)
				{
					var thisRatingInfo = thisRatingsArray[numR];
					if (thisRatingInfo != null)
					{
						if ((thisRatingInfo.rater != null) && (thisRatingInfo.rater.entityId == top.frames.headerFrame.loadedEntityId) && 
								(thisRatingInfo.ratingId != 0) && (thisRatingInfo.pctComplete < 100)) // Logged in user is a rater and rating not started = request
						{
							youRatingHTML += "          <td width='20%' align='center' valign='bottom' onClick='top.frames.headerFrame.startRating("+thisRatingInfo.ratee.entityId+", "+thisRatingInfo.ratingId+", \"MainPage\");' style='border-bottom-width:1; border-bottom-color:rgb(255,194,102); border-bottom-style:solid; cursor:pointer;cursor:hand;'>\n" +
													     "            "+thisRatingInfo.ratee.getShortThumbHTML_noLink()+"<div class='slgray'><font color='#336699'><b>"+thisRatingInfo.ratee.screenName+"</b></font></div>\n" +
													     "          </td>\n";
							
							numYouRatingPrinted++;
							if (numYouRatingPrinted >= 5)
							{
								break;
							}
						}
					}
				}
				for (var upTo5 = numYouRatingPrinted; upTo5 <=5; upTo5++)
				{
					youRatingHTML += "          <td width='20%' align='center' valign='bottom' style='border-bottom-width:1; border-bottom-color:rgb(255,194,102); border-bottom-style:solid;'>&nbsp;</td>\n";
				}
														  
				youRatingHTML += "              </tr>\n" +
										     "            </table>\n" +
										     "          </td>\n" +
						 				     "        </tr>\n" +
										     "      	 <tr>\n";
			}
			
			youRatingDiv.innerHTML = youRatingHTML;
		}

		var youDateRatedDiv = pDocument.getElementById('id_youDateRatedDiv');
		if (youDateRatedDiv != null)
		{
			var youDateRatedHTML = "";
			
			youDateRatedHTML += "<table border='0' cellspacing='0' cellpadding='10' width='100%'>\n" +
												  "  <tr>\n" +
												  "    <td>\n" +
												  "      <table border='0' cellspacing='1' cellpadding='3' bgcolor='#FFFFFF' width='100%'>\n" +
    						 				  "        <tr>\n" +
		             				  "          <td colspan='5' bgcolor='#EBF5FF' style='border-top-width:1; border-top-color:rgb(153,204,255); border-top-style:solid;'>\n" +
		             				  "            <div class='slbgray'>You recently <font color='#CC0033'>Date</font><font color='#FF9900'>Rated</font><sup><font size='1'>TM</font></sup></div>\n" +
		             				  "          </td>\n" +
		             				  "        </tr>\n" +
		             				  "        <tr>\n" +
		             				  "          <td colspan='5'>\n" +
												  "            <table border='0' cellspacing='0' cellpadding='0' width='100%'>\n" +
												  "              <tr>\n";
			
			if (top.frames.headerFrame.loadedUserInfo.numTimesThisRatedOthers > 0)
			{
				var thisRatingsArray = top.frames.headerFrame.loadedUserInfo.ratingsArray;
				
				var numRatings = 0;
													  
				for (var numR = thisRatingsArray.length-1; numR >= 0; numR--)
				{
					var thisRatingInfo = thisRatingsArray[numR];
					if (thisRatingInfo != null)
					{
						if ((thisRatingInfo.rater != null) && (thisRatingInfo.rater.entityId == top.frames.headerFrame.loadedEntityId) && 
								(thisRatingInfo.pctComplete == 100)) // Logged in user is a rater and rating completed
						{
							var thisRatingDate = getDateFromDBDateString(thisRatingInfo.completedDate);
		        	var thisRatingDateString = "";
		        
		        	if ((thisRatingDate != null) && (thisRatingDate != ''))
		        	{
		        		thisRatingDateString = "on " + month_short_names[thisRatingDate.getMonth()] + " " + thisRatingDate.getDate() + ", " + thisRatingDate.getFullYear();
		        	}
		        	
							youDateRatedHTML += "          <td width='20%' align='center' valign='bottom' onClick='top.frames.headerFrame.viewRatingsDownload("+thisRatingInfo.ratee.entityId+",-1);' style='border-bottom-width:1; border-bottom-color:rgb(153,204,255); border-bottom-style:solid; cursor:pointer;cursor:hand;'>\n" +
															    "            "+thisRatingInfo.ratee.getShortThumbHTML_noLink()+"<div class='slgray'><font color='#336699'><b>"+thisRatingInfo.ratee.screenName+"</b></font><br><span class='vslgray'>"+thisRatingDateString+"</span></div>\n" +
															    "          </td>\n";
							
							numRatings++;
							if (numRatings >= 5)
							{
								break;
							}
						}
					}
				}
				for (var upTo5 = numRatings; upTo5 <=5; upTo5++)
				{
					youDateRatedHTML += "          <td width='20%' align='center' valign='bottom' style='border-bottom-width:1; border-bottom-color:rgb(153,204,255); border-bottom-style:solid;'>&nbsp;</td>\n";
				}
			}
			else
			{
				youDateRatedHTML += "<td colspan='5' align='center' style='border-bottom-width:1; border-bottom-color:rgb(153,204,255); border-bottom-style:solid;'><div class='slgray'>Your did not rate anyone yet!</div></td>\n";
			}
			
			youDateRatedHTML += "              </tr>\n" +
											    "            </table>\n" +
											    "          </td>\n" +
							 				    "        </tr>\n" +
											    "      	 <tr>\n";
			
			youDateRatedDiv.innerHTML = youDateRatedHTML;
		}
	}
}


function drawRecentlyViewedBy(pDocumentText)
{
	var pDocument = null;
	try 
	{
		pDocument = eval(pDocumentText);
		if (pDocument == null)
		{
			return;
		}
	} catch (ee) { return; }
	
	if (!top.frames.headerFrame.loaded)
	{
		setTimeout("drawRecentlyViewedBy('"+pDocumentText+"');", 100);
		return;
	}
	
	if (top.frames.headerFrame.loadedEntityId == -1)
	{
		// User not logged in
		return;
	}
	
	
	var myRequest = new ajaxObject();
	myRequest.callback = function(responseText, responseStatus, responseXML) 
	{
    if (responseStatus = 200) 
	  {
	  	var status;
	  	var message;
	  	
	  	var entities = new Array();
	  	
	  	try { eval(responseText); } catch (e) {}
	  	
	  	if (status == 1)
			{
				var recentlyViewedDiv = pDocument.getElementById('id_recentlyViewedBy');
				if (recentlyViewedDiv != null)
				{
					var recentlyViewedHTML = "";
					
					recentlyViewedHTML += "<table border='0' cellspacing='0' cellpadding='10' width='100%'>\n" +
																"  <tr>\n" +
																"    <td>\n" +
																"      <table border='0' cellspacing='1' cellpadding='3' bgcolor='#FFFFFF' width='100%'>\n" +
				    						 				"        <tr>\n" +
						             				"          <td colspan='5' bgcolor='#EBF5FF' style='border-top-width:1; border-top-color:rgb(153,204,255); border-top-style:solid;'>\n" +
																"            <table border='0' cellspacing='0' cellpadding='0' width='100%'>\n" +
																"              <tr>\n" +
																"                <td>\n" +
																"                  <div class='slbgray'>Your profile was recently viewed by</div>\n" +
																"                </td>\n" +
																//"                <td align='right'>\n" +
																//"                  <a class='sblue' href=''><u>View all</u></a>\n" +
																//"                </td>\n" +
																"              </tr>\n" +
																"            </table>\n" +
																"          </td>\n" +
												 				"        </tr>\n" +
																"      	 <tr>\n";
					if (entities.length > 0)
					{
						for (var numE = 0; numE < entities.length; numE++)
						{
							var currEntityInfo = entities[numE];
							
							var photo = currEntityInfo[3];
							var photoStyle = "style='border:3px double #cccccc;'";
							if (photo == '')
							{
								if (currEntityInfo[2] == 'Female')
								{
									photo = '/images/pix/profile/female_thumb.gif';
								}
								else
								{
									photo = '/images/pix/profile/male_thumb.gif';
								}
								photoStyle = "style='border:1px double #cccccc;'";
							}
							
							var actionDate = getDateFromDBDateString(currEntityInfo[4]);
					  	var actionDateString = "";
					  
					  	if ((actionDate != null) && (actionDate != ''))
					  	{
					  		actionDateString = "on " + month_short_names[actionDate.getMonth()] + " " + actionDate.getDate() + ", " + actionDate.getFullYear();
					  	}
							
							recentlyViewedHTML += "          <td width='20%' align='center' valign='bottom' onClick='top.frames.headerFrame.showProfile("+currEntityInfo[0]+");' style='border-bottom-width:1; border-bottom-color:rgb(153,204,255); border-bottom-style:solid; cursor:pointer;cursor:hand;'>\n" +
																	  "            <img src='"+fileUrl+"/"+photo+"' "+photoStyle+" border='0'><div class='slgray'><font color='#336699'><b>"+currEntityInfo[1]+"</b></font><br><span class='vslgray'>"+actionDateString+"</span></div>\n" +
																	  "          </td>\n";
						}
						for (var numE = entities.length; numE < 5; numE++)
						{
							recentlyViewedHTML += "          <td width='20%' align='center' valign='bottom' style='border-bottom-width:1; border-bottom-color:rgb(153,204,255); border-bottom-style:solid;'>\n" +
																		"            &nbsp;\n" +
																	  "          </td>\n";
						}
					}
					else
					{
						recentlyViewedHTML += "<td colspan='5' align='center' style='border-bottom-width:1; border-bottom-color:rgb(153,204,255); border-bottom-style:solid;'><div class='slgray'>Your profile has not been viewed yet!</div></td>\n";
					}
					recentlyViewedHTML += "        </tr>\n" +
																"      </table>\n" +
																"    </td>\n" +
																"  </tr>\n" +
																"</table>\n";
																
					recentlyViewedDiv.innerHTML = recentlyViewedHTML;
				}
			}
	  }
  }
	
	var app = 'app=search';
	var cmd = 'cmd=SEARCH';
	var subcmd = 'subcmd=RECENTVIEWS';
	
	var sendString = app+'&'+cmd+'&'+subcmd;
	myRequest.update(sendString,'POST');
}


function printNotifications(pDocumentText)
{
	var pDocument = null;
	try 
	{
		pDocument = eval(pDocumentText);
		if (pDocument == null)
		{
			return;
		}
	} catch (ee) { return; }
	
	if (!top.frames.headerFrame.loaded)
	{
		setTimeout("printNotifications('"+pDocumentText+"');", 100);
		return;
	}
	
	if (top.frames.headerFrame.loadedEntityId == -1)
	{
		// User not logged in
		return;
	}
	
	var myRequest = new ajaxObject();
	myRequest.callback = function(responseText, responseStatus, responseXML) 
	{
    if (responseStatus = 200) 
	  {
	  	var status;
	  	var message;
	  	
	  	var notifications = new Array();
	  	ShortUserInfo = top.frames.headerFrame.ShortUserInfo;
	  	
	  	try { eval(responseText); } catch (e) {}
	  	
	  	if (status == 1)
			{
				if (notifications.length > 0)
				{
					var notificationsDiv = pDocument.getElementById('id_notificationsDiv');
					if (notificationsDiv != null)
					{
						var notificationsHTML = "";
						var notificationsOtherHTML = "";
						
						var numPseudo = 0;
						for (var numN = 0; numN < notifications.length; numN++)
						{
							var currNotification = notifications[numN];
							var thisAction = currNotification[0];
							
							if (thisAction == 'PSEUDO')
							{
								var currUserInfo = currNotification[1];
								var photo = currUserInfo.thumbImage;
								var photoStyle = "style='border:3px double #cccccc;'";
								if (photo == '')
								{
									if (currUserInfo.gender == 'Female')
									{
										photo = '/images/pix/profile/female_thumb.gif';
									}
									else
									{
										photo = '/images/pix/profile/male_thumb.gif';
									}
									photoStyle = "style='border:1px double #cccccc;'";
								}
								
								notificationsHTML += "          <td width='20%' align='center' valign='bottom' onClick='top.frames.headerFrame.showProfile("+currUserInfo.entityId+");' style='border-bottom-width:1; border-bottom-color:rgb(255,194,102); border-bottom-style:solid; cursor:pointer;cursor:hand;'>\n" +
																		 "            <img src='"+fileUrl+"/"+photo+"' "+photoStyle+" border='0'><div class='slgray'><font color='#336699'><b>"+currUserInfo.screenName+"</b></font></div>\n" +
																		 "          </td>\n";
								numPseudo++;
							}
							else if (thisAction == 'CLAIMPROFILE')
							{
								notificationsOtherHTML += "<table width='100%' cellpadding='0' cellspacing='0'>\n" +
																					"  <tr>\n" +
																					"    <td width='20'><img src='"+fileUrl+"/images/common/star.gif'></td>\n" +
																					"    <td><div class='sgray'>You claimed <b><font color='#336699'>"+currNotification[1]+"'s</font></b> profile</div></td>\n" +
																					"  </tr>\n" +
																					"</table>\n" +
																					"<hr width='100%' size='1' color='#99b2cc'>\n";
							}
							else if (thisAction == 'CLAIMPROFILEREQUEST')
							{
								var currUserInfo = currNotification[1];
								
								notificationsOtherHTML += "<table width='100%' cellpadding='0' cellspacing='0'>\n" +
																					"  <tr>\n" +
																					"    <td width='20'><img src='"+fileUrl+"/images/common/star.gif'></td>\n" +
																					"    <td><div class='sgray'>You sent a request to claim <span onClick='top.frames.headerFrame.showProfile("+currUserInfo.entityId+");' style='cursor:pointer;cursor:hand;'><u><b><font color='#336699'>"+currUserInfo.screenName+"'s</font></b></u></span> profile</div></td>\n" +
																					"  </tr>\n" +
																					"</table>\n" +
																					"<hr width='100%' size='1' color='#99b2cc'>\n";
							}
						}
						
						if (numPseudo > 0)
						{
							notificationsHTML  = "<table border='0' cellspacing='0' cellpadding='10' width='100%'>\n" +
																	"  <tr>\n" +
																	"    <td>\n" +
																	"      <table border='0' cellspacing='1' cellpadding='3' bgcolor='#FFFFFF' width='100%'>\n" +
					    						 				"        <tr>\n" +
							             				"          <td colspan='5' bgcolor='#ffffcc' style='border-top-width:1; border-top-color:rgb(255,194,102); border-top-style:solid;'>\n" +
																	"            <table border='0' cellspacing='0' cellpadding='0' width='100%'>\n" +
																	"              <tr>\n" +
																	"                <td>\n" +
																	"                  <div class='slbgray'>We have reason to believe this may be you</div>\n" +
																	"                </td>\n" +
																	"              </tr>\n" +
																	"            </table>\n" +
																	"          </td>\n" +
													 				"        </tr>\n" +
																	"      	 <tr>\n"
																	+ notificationsHTML;
																	
							for (var numN = numPseudo; numN < 5; numN++)
							{
								notificationsHTML += "          <td width='20%' align='center' valign='bottom' style='border-bottom-width:1; border-bottom-color:rgb(255,194,102); border-bottom-style:solid;'>\n" +
																		 "            &nbsp;\n" +
																		 "          </td>\n";
							}
						
							notificationsHTML += "        </tr>\n" +
																	 "      </table>\n" +
																   "    </td>\n" +
																	 "  </tr>\n" +
																	 "</table>\n";
																	 
							notificationsDiv.innerHTML = notificationsHTML;
						}
																	
						if (notificationsOtherHTML != "")
						{
							var notificationsOtherDiv = pDocument.getElementById('id_notificationsOtherDiv');
							if (notificationsOtherDiv != null)
							{
								notificationsOtherDiv.innerHTML = notificationsOtherHTML;
							}
						}
					}
				}
			}
	  }
  }
	
	var app = 'app=people';
	var cmd = 'cmd=USERINFO';
	var subcmd = 'subcmd=NOTIFICATIONS';

	var sendString = app+'&'+cmd+'&'+subcmd;
	myRequest.update(sendString,'POST',false);
}
