/************************************************

   FILE:  JavaScript/dateInfo.js
   AUTH:  Thuy Le

   LMD :  June 5, 2010

	Relating to present date info.

************************************************/


// Updates info.
updated	= "Updated on ";

mainup		= "June 5, 2010";
ttup		= "February 13, 2010";
refsUpdate	= "09/01/2008";
poetryUpdate	= "04/30/2001";

/********  CATEGORIES  **********/
dealsUpdate	= "11/10/2008";
healthUpdate	= "02/26/2008";
infoUpdate	= "02/14/2010";
eduUpdate	= "06/05/2010";
jobsUpdate	= "07/31/2007";
shopUpdate	= "03/20/2009";
travelUpdate	= "03/16/2009";
entUpdate	= "03/23/2009";
dlUpdate	= "03/23/2009";

/********  FUN STUFF  **********/
funstuffUpdate	= "02/26/2008";
funUpdate	= "02/26/2008";
humorUpdate	= "08/05/2008";
animUpdate	= "02/14/2008";
optUpdate	= "07/22/2007";
ppsUpdate	= "06/14/2007";

/*******  PIX & PLACES  ********/
pnpUpdate	= "07/22/2007";
pixUpdate	= "11/24/2003";

/******  COMPUTER RELATED  *****/
csUpdate	= "02/13/2010";
jsUpdate	= "04/17/2001";
perlUpdate	= "07/24/2001";
notesUpdate	= "04/21/2008";
solnsUpdate	= "04/21/2008";

/*********  VIETNAM  ***********/
//mainvn	= "05/03/2001";
vnUpdate	= "04/05/2009";
cuoi		= "03/12/2009";
ddvn		= "06/13/2002";
nhac		= "05/03/2001";
tho		= "03/24/2004";
havn		= "06/05/2002";
vtvn		= "04/05/2009";

vnhn		= "06/05/2002";
nhacMT		= "04/18/2001";
dynfonts	= "03/25/2004";
vpsfonts	= "04/18/2001";
hoatau		= "04/18/2001";
hoatau_midi 	= "04/18/2001";
hoatau_ra	= "05/03/2001";
nhahang		= "04/18/2001";
nhahang_sf	= "04/18/2001";

ansf		= "04/18/2001";


/*****************  RECENTLY UPDATED PAGES  ******************

updates[x++]	= new Update( "", "",  );

*/

x		= 0;
updates		= new Array();
updates[x++]	= new Update( "Education", "cat/edu.htm", eduUpdate );
updates[x++]	= new Update( "Information", "cat/info.htm", infoUpdate );
updates[x++]	= new Update( "Computer Related", "csstuff.html", csUpdate );
updates[x++]	= new Update( "Viet Nam", "vn/index.htm", vnUpdate );
updates[x++]	= new Update( "Entertainment", "cat/ent.htm", entUpdate );
updates[x++]	= new Update( "Downloads", "cat/dl.htm", dlUpdate );
updates[x++]	= new Update( "Shopping", "cat/shop.htm", shopUpdate );
updates[x++]	= new Update( "Travel", "cat/travel.htm", travelUpdate );
updates[x++]	= new Update( "Deals", "cat/deals.htm", dealsUpdate );
updates[x++]	= new Update( "References", "misc/refs.htm", refsUpdate );


/**********************  MOST POPULAR  **********************

pops[x++]	= new Pops( "", "" );

*/

x		= 0;
pops		= new Array();
pops[x++]	= new Pops( "Love Test - A Visit to Your SO's Place", "misc/tests/love_test02.htm" );
pops[x++]	= new Pops( "What's Your Drinking Style?", "misc/tests/alcohoroscope.htm" );
pops[x++]	= new Pops( "Humor", "php/humor.php" );
pops[x++]	= new Pops( "Personality Test - Shape Preference", "misc/tests/shape_test.htm" );
pops[x++]	= new Pops( "Optical Illusions", "php/illusions.php" );
pops[x++]	= new Pops( "Which Cartoon Character Are You?", "misc/tests/cartoon_char.htm" );
pops[x++]	= new Pops( "Love Test - Animal Test", "misc/tests/love_test01.htm" );
pops[x++]	= new Pops( "Personality Test - The Shower Test", "misc/tests/shower.htm" );
pops[x++]	= new Pops( "Fun Tests", "misc/fun.htm" );
pops[x++]	= new Pops( "IQ Test", "misc/tests/IQ.htm" );

// Current date info.
dateNow 	= new Date();
presMonth 	= dateNow.getMonth();
presDate 	= dateNow.getDate();
presYear 	= dateNow.getYear();
presDay 	= dateNow.getDay();
presTime 	= dateNow.getHours();
dayOfWeek 	= "";
thisMonth 	= "";
theTime 	= "";
dateSuf 	= "";

timeB4Focus = 101;

function focusMe() {
	setTimeout("", timeB4Focus);
	self.focus();
}

if (presYear<2000) presYear += 1900;

if ( presDay == 0 ) dayOfWeek = "Sunday";
if ( presDay == 1 ) dayOfWeek = "Monday";
if ( presDay == 2 ) dayOfWeek = "Tuesday";
if ( presDay == 3 ) dayOfWeek = "Wednesday";
if ( presDay == 4 ) dayOfWeek = "Thursday";
if ( presDay == 5 ) dayOfWeek = "Friday";
if ( presDay == 6 ) dayOfWeek = "Saturday";

if ( presMonth == 0 ) thisMonth = "January";
if ( presMonth == 1 ) thisMonth = "February";
if ( presMonth == 2 ) thisMonth = "March";
if ( presMonth == 3 ) thisMonth = "April";
if ( presMonth == 4 ) thisMonth = "May";
if ( presMonth == 5 ) thisMonth = "June";
if ( presMonth == 6 ) thisMonth = "July";
if ( presMonth == 7 ) thisMonth = "August";
if ( presMonth == 8 ) thisMonth = "September";
if ( presMonth == 9 ) thisMonth = "October";
if ( presMonth == 10 ) thisMonth = "November";
if ( presMonth == 11 ) thisMonth = "December";

if ( presTime >= 0 && presTime < 12 ) theTime = "morning";
else if ( presTime >= 12 && presTime < 18 ) theTime = "afternoon";
else if ( presTime >= 18 && presTime < 24 ) theTime = "evening";

/*
if ( presDate == 1 || presDate == 21 || presDate == 31 ) dateSuf = "st";
else if ( presDate == 2 || presDate == 22 ) dateSuf = "nd";
else if ( presDate == 3 || presDate == 23 ) dateSuf = "rd";
else dateSuf = "th";
*/


/**********************************  FUNCTIONS  *******************************/

/******************************************
 *
 *  Displays popular pages.
 *
 ******************************************/
function displayNew()
{
	document.write( "&nbsp; <img src='/images/newlite.gif' alt='[new]' border=0 width='31' height='12'>" );
//	document.write( "&nbsp; <font color=red size=-1><b> [new] </b></font>" );
}

/******************************************
 *
 *  Displays popular pages.
 *
 ******************************************/
function displayPops()
{
	pops_text  = "<table border=0 cellpadding=2 cellspacing=2 width=100%>";
	pops_text += "<th colspan=2 align=left id=text><b>Most Viewed:</b></th>";

	for ( i=0; i<pops.length; i++ )
	{
		if ( i%2 ) bg_color = "DCDCDC"; // Gainsboro
		else bg_color = "C0C0C0";

		pops_text += "<tr><td align=left valign=top width='*' bgcolor=" + bg_color + ">";
		pops_text += "<a href='" + pops[i].url + "' target='_top' id=hItem>";
		pops_text += pops[i].page + "</a>";
		pops_text += "</td></tr>";
	}

	pops_text += "</table>";
	document.write( pops_text );
}

/******************************************
 *
 *  Displays updates.
 *
 ******************************************/
function displayUpdates()
{
	update_text  = "<table border=0 cellpadding=2 cellspacing=2 width=100%>";
	update_text += "<th colspan=2 align=left id=text><b>Recently Updated Pages:</b></th>";

	for ( i=0; i<updates.length; i++ )
	{
		if ( i%2 ) bg_color = "DCDCDC"; // Gainsboro
		else bg_color = "C0C0C0";

		update_text += "<tr><td align=left valign=top bgcolor=" + bg_color + ">";
		update_text += "<a href='" + updates[i].url + "' target='_top' id=hItem>";
		update_text += updates[i].page + "</a>";
		update_text += "<td align=left valign=top bgcolor=" + bg_color + ">";
		update_text += "<a href='" + updates[i].url + "' target='_top' id=hItem>";
		update_text += updates[i].update+ "</a>";
		update_text += "</td></tr>";
	}
	
	update_text += "</table>";
	document.write ( update_text );
}

/******************************************
 *
 *  Displays VN updates.
 *
 ******************************************/
function displayVN_Updates()
{
	x 		= 0;
	vn_updates	= new Array();
	vn_updates[x++] = new Update( "Diễn Đàn VN", 		"ddvn.htm", ddvn );
	vn_updates[x++] = new Update( "Truyện cười & Thơ vui", 	"cuoi.htm", cuoi );
	vn_updates[x++] = new Update( "Văn & Truyện", 		"vtvn.htm", vtvn );
	vn_updates[x++] = new Update( "Nhạc", 			"nhac.htm", nhac );
	vn_updates[x++] = new Update( "Thi Ca Việt Nam", 	"tho.htm", tho );
	vn_updates[x++] = new Update( "Danh Lam Thắng Cảnh", 	"havn.htm", havn );


	update_text  = "<table border=0 cellpadding=2 cellspacing=2 width=500>";
	update_text += "<th align=left id=footer><b>Page:</b></th><th align=left id=footer><b>Update:</b></th>";

	for ( i=0; i<vn_updates.length; i++ )
	{
		if ( i%2 ) bg_color = "DCDCDC"; // Gainsboro
		else bg_color = "C0C0C0";

		update_text += "<tr><td align=left valign=top bgcolor=" + bg_color + ">";
		update_text += "<a href='" + vn_updates[i].url + "' target='_top' id=hItem>";
		update_text += vn_updates[i].page + "</a>";
		update_text += "<td align=left valign=top bgcolor=" + bg_color + ">";
		update_text += "<a href='" + vn_updates[i].url + "' target='_top' id=hItem>";
		update_text += vn_updates[i].update+ "</a>";
		update_text += "</td></tr>";
	}
	
	update_text += "</table>";
	document.write ( update_text );
}

/******************************************
 *
 *  Display current date.
 *
 ******************************************/
function curDate()
{
	document.write( dayOfWeek + " - " + thisMonth + " " + presDate + ", " + presYear );

}

/******************************************
 *
 *  Best experienced with...
 *
 ******************************************/
function view()
{
	document.write( "<hr width=300><b id=browser>Best experienced with Netscape and Internet Explorer.</b><br>" );
}

function greetSurfer() {
	greetMsg = "Good " + theTime + " ";

	if (location.hostname)
		greetMsg += "you from " + location.hostname + " ";

	greetMsg += "!!!\n\nThanks for dropping by.\n\nHave a good one!\n\nThuy";

//	alert(greetMsg);
}




/********************************************  CLASSES  ********************************************/


/******************************************
 *
 *  Class contains page name & URL.
 *
 ******************************************/
function Pops( pg_name, pg_url )
{
	this.page	= pg_name;
	this.url	= pg_url;

	return this;
}

/******************************************
 *
 *  Class contains page name, url, update.
 *
 ******************************************/
function Update( pg_name, pg_url, pg_update )
{
	this.page	= pg_name;
	this.url	= pg_url;
	this.update	= pg_update;

	return this;
}

