/*

        Filename:          script.js
        Description:       Javascript functions
        Site:              Marina City Online
        Author:            Steven Dahlman, DCM Software
        Start date:        02-11-07
        Last modification: 03-11-10

*/

// Baseline URL
var sBaseURL = "http://www.marinacityonline.com/";

//
// News headlines and corresponding links
//
var headlines = new Array('Gold Coast Art Fair erased from River North', 'Wendella: Closing Chicago River would not keep out Asian carp');

var links = new Array('reilly0310', 'carp0310');

//
// Special calendar dates
//
// -Date - item, time, location
// -Example: 'December 5 - West tower floors 41-60 get 50 percent Saturday brunch discount at Dick&#146;s Last Resort, 10 a.m. to 2 p.m.'
//
// February 4 - Beat 1831 CAPS meeting, 7-8 p.m., 645 North Kingsbury Street
// At CAPS meetings, police Officers and local business owners work together to solve and prevent crime.
//
var caldate = new Array('March 13 - Dyeing the Chicago River, 10:45 a.m., between Michigan Avenue and Columbus Drive bridges. 2010 Chicago Saint Patrick&#146;s Day Parade, 12:00 p.m., Columbus Drive, starting at Balbo.', 'March 14 &#150; Daylight Saving Time begins, 2 a.m.', 'March 17 &#150; St. Patrick&#146;s Day');

var crainid = '37395';

//
// Function:    bannerad
//
// Description: Display banner ad
//
// Input:
// adno = Ad to display (or 0 to display no ads)
//
// Return code:
//  0 = Success
// -1 = Invalid argument or no ads to display
//
function bannerad (adno) {

	if ( ! adno ) { return(-1); }

	document.write('<TABLE width=900 height=100 border=0 cellspacing=0 cellpadding=0><TR><TD>');

	if ( adno == 1 ) {

		// River North Business Association

		document.write('<A href="http://rivernorthassociation.com/events/2009/10/" target="new">');
		document.write('<IMG src="image/octoberfeast_900x79.jpg" width=900 height=79 border=0 alt="Click here for more information"></IMG>');
		document.write('</A>');

	}

	document.write('</TD></TR></TABLE>');

	return(0);

}

//
// Function:    breaking
//
// Description: Display "Breaking neighborhood news"
//
// Input:
//
// nlink    = URL to news source
// headline = News headline
// nsrc     = News source (CB = Chicago Business, CRED = Chicago Real Estate Daily, CT = Chicago Tribune)
// title    = 1 to print title ("Breaking neighborhood news") or 0 to not print title
//
// Return code:
//  0 = Success
//
function breaking (nlink, headline, nsrc, title) {

	if ( title == 1 ) {
		document.write('<P><CENTER><B>Breaking neighborhood news...</B></CENTER></P>');
	}

	document.write('<P><CENTER><TABLE cellpadding=0 cellspacing=0 border=0><TR>');

	if ( nsrc == 'CB' ) {
		document.write('<TD><IMG src="image/chicagobusiness.jpg" width=93 height=15 border=0 alt="Chicago Business"></IMG></TD>');
	} else if ( nsrc == 'CRED' ) {
		document.write('<TD><IMG src="image/realestatedaily.jpg" width=126 height=15 border=0 alt="Chicago Real Estate Daily"></IMG></TD>');
	} else if ( nsrc == 'CT' ) {
		document.write('<TD><IMG src="image/tribune.jpg" width=80 height=15 border=0 alt="Chicago Tribune"></IMG></TD>');
	}

	document.write('<TD width=4></TD>');

	document.write('<TD><A href="http://' + nlink + '" class="web" target="new">' + headline + '</A></TD>');

	document.write('</TR></TABLE></CENTER></P>');

	return(0);

}

//
// Function:    chicagonews
//
// Description: Display Chicago news summary
//
// Return code:
//  0 = Success
//
function chicagonews () {

	return(0);

}

//
// Function:    ffplug
//
// Description: Display "Firefox plugin" message
//
// Return code:
//  0 = Success
//
function ffplug () {

	document.write('<TABLE width=150 cellpadding=4 cellspacing=2 border=0 bgcolor="#ffffff" class="maintext2"><TR><TD align="center">');

	document.write('<IMG src="image/winmedia.gif"></IMG><BR />');

	document.write('Firefox users: Requires <A href="http://port25.technet.com/pages/windows-media-player-firefox-plugin-download.aspx" target="new" class="webs">Windows Media Player Firefox Plugin</A>');

	document.write('</TD></TR></TABLE>');

	return(0);

}

//
// Function:    footer
//
// Description: Display page footer
//
// -Support contact
// -Signup link
// -Disclaimers
//
// Input:
//
// line = 0 to display all lines
//      = 1 to display only signup link and support contact
//      = 2 to display only signup link and disclaimers
//      = 3 to display all lines but use Steve for support contact
//      = 4 to display footer for history pages
//      = 5 to not display "signup" link
//      = 6 to display disclaimers only
//
// Return code:
//  0 = Success
//
function footer (line) {

	// General disclaimer
	var disclaimer = '<P class="footer" align="center">Not sponsored by, endorsed by or affiliated with Marina Towers Condominium Association or LaSalle Hotel Properties.<BR />Marina City Online and Marina City News are registered service marks in Illinois.</P>';

	// History page disclaimer
	var history = '<P class="footer" align="center">Presented for non-profit educational purposes.</P>';

	// Signup link
	var signup = '<P class="footer" align="center"><A href="http://www.loopnorth.com/cgi-bin/eupdate.pl?MC,1" class="web">Signup</A> for updates sent to you by email.</P>';

	// Dahlman contact
	var steve = '<P class="footer" align="center"><A href="mailto:steved@dcmsoft.com" class="web">Steven Dahlman</A> | MarinaCityOnline.com</P>';

	// Support contact
	var support = '<P class="footer" align="center"><A href="mailto:support@marinacityonline.com" class="web">support@marinacityonline.com</A></P>';

	if ( line == 0 ) {

		document.write(support);
		document.write(signup);
		document.write(disclaimer);

	} else if ( line == 1 ) {

		document.write(support);
		document.write(signup);

	} else if ( line == 2 ) {

		document.write(signup);
		document.write(disclaimer);

	} else if ( line == 3 ) {

		document.write(steve);
		document.write(signup);
		document.write(disclaimer);

	} else if ( line == 4 ) {

		document.write(steve);
		document.write(signup);
		document.write(history);

	} else if ( line == 5 ) {

		document.write(support);
		document.write(disclaimer);

	} else if ( line == 6 ) {

		document.write(disclaimer);

	}

	return(0);

}

//
// Function:    google_ad
//
// Description: Display Google ad
//
// Input:
//
// size = 1 for 160x600 "wide skyscraper"
//      = 2 for 250x250 "square"
//      = 3 for 200x200 "square" (text ad)
//      = 4 for 200x200 "square" (image ad)
//
// Return code:
//  0 = Success
// -1 = Invalid argument
//
function google_ad (size) {

	document.write('<SCRIPT type="text/javascript">');
	document.write('google_ad_client = "pub-4458809128970208"; google_ad_channel = "";');

	if ( size == 1 ) {

		document.write('google_ad_width = 160; google_ad_height = 600; google_ad_format = "160x600_as";');
		document.write('google_ad_type = "image";');

	} else if ( size == 2 ) {

		document.write('google_ad_width = 250; google_ad_height = 250; google_ad_format = "250x250_as";');
		document.write('google_ad_type = "image";');

	} else if ( size == 3 ) {

		document.write('google_ad_slot = "2844485081"; google_ad_width = 200; google_ad_height = 200;');

	} else if ( size == 4 ) {

		document.write('google_ad_slot = "4244447034"; google_ad_width = 200; google_ad_height = 200;');

	} else {

		return(-1);

	}

	document.write('</SCRIPT><SCRIPT type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></SCRIPT>');

	return(0);

}

//
// Function:    headline
//
// Description: Display headline on News page
//
// Input:
// txt = Text to display
//
// Return code:
//  0 = Success
//
function headline (txt) {

	document.write('<TABLE width="100%" border=0 cellspacing=0 cellpadding=8 bgcolor="#0000ff" class="headline" style="border-style: outset; border-color: #ffffff #000000 #000000 #ffffff; border-width: 2px"><TR><TD>');

	document.write(txt);

	document.write('</TD></TR></TABLE>');

	return(0);

}

//
// Function:    high_comment
//
// Description: Highlight text on "Opinion" or "News" page
//
// Input:
// text = Text to highlight
// page = 1 for Opinion page or 2 for News page
// bg   = 1 for color background (defaut) or 0 for white
//
// Return code:
//  0 = Success
// -1 = Invalid argument
//
function high_comment (text, page, bg) {

	var bgcolor; // Background color (hex)

	if ( bg == 1 ) { bgcolor = "#f0f0f0"; } else { bgcolor = "#ffffff"; }

	if ( page == 1 ) {

		document.write('<P><TABLE border=0 cellspacing=0 cellpadding=8 bgcolor="' + bgcolor + '" class="comment"><TR><TD><FONT size="+2"><I>&#147;');
		document.write(text)
		document.write('&#148;</I></FONT></TD></TR></TABLE></P>');

	} else if ( page == 2 ) {

		document.write('<P><TABLE border=0 cellspacing=0 cellpadding=8 bgcolor="' + bgcolor + '" class="large"><TR><TD><I>&#147;');
		document.write(text)
		document.write('&#148;</I></TD></TR></TABLE></P>');

	} else {

		return(-1);

	}

	return(0);

}

//
// Function:    historypage
//
// Description: History page functions
//
// Input:
//
// option = 1 to display page header
//
// Return code:
//  0 = Success
// -1 = Invalid argument
//
function historypage (option) {

	if ( option == 1 ) {

		// Display page header
		document.write('<P align="center"><IMG src="image/cwac.jpg" width=400 height=40 border=0></IMG></P>');
		document.write('<P class="maintext2" align="center"><B>THE BIOGRAPHY OF CHICAGO&#146;S MARINA CITY</B><BR />Written by Steven Dahlman</P>');

	} else {

		// Invalid argument
		return(-1);

	}

	return(0);

}

//
// Function:    mainmenu
//
// Description: Display Main Menu
//
// Input:
//
// orient          = "H" for horizontal orientation (default; most popular menu options)
//                 = "V" for vertical orientation (home page; more menu options)
//                 = "L" for main menu on LISTINGS page (real-estate-compatible options)
//
// arg1, arg2, arg3, arg4, arg5, arg6 = Arguments to pass to mlsform()
//
// @headlines[0-1] = News headlines (text; initialized above)
// @links[0-1]     = Corresponding news links ("#anchor" value)
//
// Return code:
//  0 = Success
//
// -Required function: searchform()
//
function mainmenu (orient, arg1, arg2, arg3, arg4, arg5, arg6) {

	var cwidth = 220;           // Default column width (pixels)
	var cwidthpad = cwidth + 4; // Column width plus cellpadding

	// Vertical space
	var vspace = "<TR><TD height=8></TD></TR>";

	// Table style
	var tstyle = "border-width: 1px; border-style: outset; border-color: #ffffff #f0f0f0 #f0f0f0 #ffffff;"

	// Shades of blue (24)
	blues = new Array('', '#0000ff', '#0000f8', '#0000f0', '#0000e8', '#0000e0', '#0000d8', '#0000d0', '#0000c8', '#0000c0', '#0000ba', '#0000b2', '#0000aa', '#0000a2', '#00009a', '#000092', '#00008a', '#000082', '#00007a', '#000072', '#00006a', '#000062', '#00005A', '#000052', '#00004A');

	//
	// Menu options
	//
	// Index - TITLE                     V?  H?  L?
	//     0 - HOME PAGE                 Y   Y   Y
	//     1 - MLS LISTINGS              Y   Y   Y
	//     2 - RENTALS                   Y   Y   Y
	//     3 - RECENT TRANSFERS          Y   Y   Y
	//     4 - MARINA CITY NEWS          Y   Y   N
	//     5 - OPINION                   Y   Y   N
	//     6 - HISTORY                   Y   Y   N
	//     7 - REAL ESTATE SERVICES      N   N   Y
	//     8 - REAL ESTATE BLOG          N   N   Y
	//     9 - MARINA CITY FUN FACTS     Y   Y   Y
	//    10 - FLOOR PLATES & MAPS       Y   N   Y
	//    11 - PICTORIALS                Y   Y   N
	//    12 - VIDEO                     Y   Y   N
	//    13 - COMMERCIAL DIRECTORY      Y   Y   Y
	//    14 - RESIDENTIAL SERVICES      Y   Y   Y
	//    15 - NEIGHBORHOOD ATTRACTIONS  Y   Y   Y
	//    16 - RESTAURANT GUIDE          Y   N   Y
	//    17 - CRIME DATABASE            Y   N   Y
	//    18 - MARINA WATCHDOG           Y   N   N
	//    19 - ABOUT MCO                 Y   Y   N
	//    20 - WHAT'S NEW                Y   Y   N
	//    21 - SIGNUP FOR EMAIL UPDATES  Y   Y   Y
	//    22 - AFTERNOON NEWS SUMMARY    Y   N   N
	//    23 - MARINA CITY PRINTS        Y   N   N
	//
	// -Maximum 16 items in horizontal menu
	// -Listings Menu options are real-estate-compatible
	//
	var counter = 0; // Counters
	var index = 0;

	// Links
	var pages = new Array('index.html', 'listing.htm', 'rental.htm', 'transfers.htm', 'news.htm', 'opinion.htm', 'history/index.html', 'data/reservice.htm', 'http://marinatowers.blogspot.com/', 'funfacts.htm', 'floorplate.htm', 'pictorial.htm', 'video.htm', 'commercial.htm', 'residential.htm', 'attract.htm', 'restaurant.htm', 'crimedata.htm', 'http://www.mymarinacity.com/cgi-bin/blogmngr.pl?MW', 'about.htm', 'update.htm', 'http://www.loopnorth.com/cgi-bin/eupdate.pl?MC,1', 'news/afternews.htm', 'product/mcprints.htm');

	//
	// Menu option text
	//
	var titles = new Array('HOME PAGE', 'MLS LISTINGS', 'RENTALS', 'RECENT TRANSFERS', 'MARINA CITY NEWS', 'OPINION', 'HISTORY', 'REAL ESTATE SERVICES', 'REAL ESTATE BLOG', 'MARINA CITY FUN FACTS', 'FLOOR PLATES &amp; MAPS', 'PICTORIALS', 'VIDEO', 'COMMERCIAL DIRECTORY', 'RESIDENTIAL SERVICES', 'NEIGHBORHOOD ATTRACTIONS', 'RIVER NORTH RESTAURANT GUIDE', 'CRIME DATABASE', 'MARINA WATCHDOG', 'ABOUT MCO', 'WHAT&#146;S NEW', 'SIGNUP FOR EMAIL UPDATES', 'AFTERNOON NEWS SUMMARY', 'MARINA CITY PRINTS');

	if ( orient == 'H' || orient == 'HT' ) {
		// Short titles
		titles[3] = 'TRANSFERS';
		titles[4] = 'NEWS';
		titles[9] = 'FUN FACTS';
		titles[10] = 'FLOOR PLATES';
		titles[13] = 'COMMERCIAL';
		titles[14] = 'RESIDENTIAL';
		titles[15] = 'NEIGHBORHOOD';
		titles[21] = 'EMAIL UPDATES';
	}

	// Include option in horizontal menu (0=No 1=Yes)?
	var hmenu = new Array(1,1,1,1,1,1,1,0,0,1,0,1,1,1,1,1,0,0,0,1,1,1,0,0);

	// Include option in listings menu (0=No 1=Yes)?
	var lmenu = new Array(1,1,1,1,0,0,0,1,1,1,1,0,0,1,1,1,1,1,0,0,0,1,0,0);

	//
	// Assemble menu options
	//
	var option = new Array();

	for ( index = 0; index < pages.length; index ++ ) {

		if ( index == 8 ) {

			// Real Estate Blog
			option[index] = '<A href="' + pages[index] + '" class="mainmenu" target="new">' + titles[index] + '</A>';

		} else {

			if ( orient == 'V' ) {

				option[index] = '<A href="' + pages[index] + '" class="mainmenu">' + titles[index] + '</A>';

			} else {

				option[index] = '<A href="' + pages[index] + '" class="mainmenu">' + titles[index] + '</A>';

			}

		}

	}

	if ( orient == 'H' ) {

		//
		// Horizontal orientation
		//
		counter = 0;
		cwidth = 110;

		// Start menu row (darkest blue background)
		document.write('<TD width="100%" height=22 bgcolor="' + blues[blues.length-1] + '" align="center">');

		//
		// Display menu
		//
		// pages.length = Number of options
		// hmenu[N]     = 1 if option N should be displayed
		//
		document.write('<TABLE border=0 cellpadding=2 cellspacing=2><TR>');

		for ( index = 0; index < pages.length; index ++ ) {

			if ( hmenu[index] == 1 ) {
				counter ++;
				document.write('<TD width=' + cwidth + ' bgcolor="' + blues[8] + '" align="center" style="' + tstyle + '">' + option[index] + '</TD>');
			}

			if ( counter == 8 ) {
				// Start new row
				document.write('</TR></TABLE><TABLE border=0 cellpadding=2 cellspacing=2><TR>');
			}

		}

		document.write('</TR></TABLE>');

		// MCO logo
		// document.write('</TD><TD bgcolor="' + blues[blues.length-1] + '">
		// <IMG src="image/mco_logo_150x45.gif" width=150 height=45 border=0></IMG></TD>');

		// End menu row and start content row
		document.write('</TD></TR><TR>');

	} else if ( orient == 'HT' ) {

		//
		// Horizontal orientation
		//
		// -Self-contained table
		//
		// arg1 = Width (pixels) of background (optional)
		//
		counter = 0;
		cwidth = 110;

		if ( ! arg1 ) { arg1 = "100%"; }

		// Start outer table (darkest blue background)
		document.write('<TABLE width=' + arg1 + ' border=0 cellpadding=1 cellspacing=1 bgcolor="' + blues[blues.length-1] +'"><TR><TD align="center">');

		// Start inner table
		document.write('<TABLE border=0 cellpadding=2 cellspacing=2><TR>');

		//
		// Display menu options
		//
		// pages.length = Number of options
		// hmenu[N]     = 1 if option N should be displayed
		//
		for ( index = 0; index < pages.length; index ++ ) {

			if ( hmenu[index] == 1 ) {
				counter ++;
				document.write('<TD width=' + cwidth + ' bgcolor="' + blues[8] + '" align="center" style="' + tstyle + '">' + option[index] + '</TD>');
			}

			if ( counter == 8 ) {
				// Start new row
				document.write('</TR></TABLE><TABLE border=0 cellpadding=2 cellspacing=2><TR>');
			}

		}

		// End inner table
		document.write('</TR></TABLE>');

		// MCO logo
		// document.write('</TD><TD><IMG src="image/mco_logo_150x45.gif" width=150 height=45 border=0></IMG>');

		// End outer table
		document.write('</TD></TR></TABLE>');

	} else if ( orient == 'L' ) {

		//
		// LISTINGS page
		//

		// Start column (blue background)
		document.write('<TD bgcolor="#000080" align="center" valign="top">');

		//
		// Display menu
		//
		document.write('<TABLE border=0 cellpadding=2 cellspacing=2>');

		for ( index = 0; index < pages.length; index ++ ) {

			if ( lmenu[index] == 1 ) {
				document.write('<TR><TD width=' + cwidth + ' bgcolor="#6a5acd" align="center">' + option[index] + '</TD></TR>');
			}

		}

		document.write('</TABLE>');

		//
		// MLS search form
		//
		// mlsform() located in http://www.loopnorth.com/search_mls.js
		//
		document.write('<P>');
		mlsform ('MC', 'V', arg1, arg2, arg3, arg4, arg5, arg6);
		document.write('</P>');

		// Michalak banner ad
		document.write('<P><A href="data/reservice.htm"><IMG src="image/banner/michalak_200x237.jpg" width=200 height=237 border=0 alt="Michael Michalak"></IMG></A></P>');

		// HancockCondo.com banner ad
		document.write('<P><A href="http://www.hancockcondo.com/" target="new"><IMG src="image/banner/hancock_200x600.jpg" width=200 height=600 border=0 alt="HancockCondo.com"></IMG></A></P>');

		// End column
		document.write('</TD>');

	} else {

		//
		// Vertical orientation
		//
		// -Main menu on HOME page
		//
		// #191970 = Midnight Blue
		// #ffffff = White
		//

		// Start border
		document.write('<TABLE width=' + cwidthpad + ' border=0 cellpadding=2 cellspacing=0 bgcolor="#191970"><TR><TD align="center" valign="top">');

		// Start menu
		document.write('<TABLE border=0 cellpadding=4 cellspacing=2 bgcolor="#ffffff">');

		// Real estate
		document.write('<TR><TD width=' + cwidth + ' class="menuhead">Resources for buyers, sellers &amp; renters</TD></TR>');
		document.write('<TR><TD bgcolor="' + blues[1] + '">' + option[1] + '</TD></TR>');
		document.write('<TR><TD bgcolor="' + blues[2] + '">' + option[2] + '</TD></TR>');
		document.write('<TR><TD bgcolor="' + blues[3] + '">' + option[3] + '</TD></TR>');

		// News and information
		document.write('<TR><TD width=' + cwidth + ' class="menuhead">News and information</TD></TR>');
		document.write('<TR><TD bgcolor="' + blues[4] + '">' + option[4] + '</TD></TR>');
		document.write('<TR><TD bgcolor="' + blues[5] + '">' + option[5] + '</TD></TR>');
		document.write('<TR><TD bgcolor="' + blues[6] + '">' + option[6] + '</TD></TR>');
		document.write('<TR><TD bgcolor="' + blues[7] + '">' + option[9] + '</TD></TR>');
		document.write('<TR><TD bgcolor="' + blues[8] + '">' + option[10] + '</TD></TR>');
		document.write('<TR><TD bgcolor="' + blues[9] + '">' + option[11] + '</TD></TR>');
		document.write('<TR><TD bgcolor="' + blues[10] + '">' + option[12] + '</TD></TR>');

		// Directories
		document.write('<TR><TD width=' + cwidth + ' class="menuhead">Resources for residents and neighbors</TD></TR>');
		document.write('<TR><TD bgcolor="' + blues[11] + '">' + option[13] + '</TD></TR>');
		document.write('<TR><TD bgcolor="' + blues[12] + '">' + option[14] + '</TD></TR>');
		document.write('<TR><TD bgcolor="' + blues[13] + '">' + option[15] + '</TD></TR>');
		document.write('<TR><TD bgcolor="' + blues[14] + '">' + option[16] + '</TD></TR>');
		document.write('<TR><TD bgcolor="' + blues[15] + '">' + option[17] + '</TD></TR>');
		document.write('<TR><TD bgcolor="' + blues[16] + '">' + option[18] + '</TD></TR>');

		// Other
		document.write('<TR><TD width=' + cwidth + ' class="menuhead">Related pages</TD></TR>');
		document.write('<TR><TD bgcolor="' + blues[17] + '">' + option[19] + '</TD></TR>');
		document.write('<TR><TD bgcolor="' + blues[18] + '">' + option[20] + '</TD></TR>');
		document.write('<TR><TD bgcolor="' + blues[19] + '">' + option[21] + '</TD></TR>');
		document.write('<TR><TD bgcolor="' + blues[20] + '">' + option[22] + '</TD></TR>');
		document.write('<TR><TD bgcolor="' + blues[21] + '">' + option[23] + '</TD></TR>');

		// End menu
		document.write('</TABLE>');

		// Start headlines
		document.write('<TABLE border=0 cellpadding=4 cellspacing=2 bgcolor="#ffffff">');

		//
		// Headlines
		//
		document.write('<TR><TD width=' + cwidth + ' class="menuhead"><B>HEADLINES</B></TD></TR>');

		document.write('<TR><TD bgcolor="#191970" class="whitess3">&#187; <A href="news.htm#' + links[0] + '" class="headlink">' + headlines[0] + '</A></TD></TR>');

		document.write('<TR><TD bgcolor="#191970" class="whitess3">&#187; <A href="news.htm#' + links[1] + '" class="headlink">' + headlines[1] + '</A></TD></TR>');

		// End headlines
		document.write('</TABLE>');

		// Start search table
		document.write('<TABLE width=' + cwidthpad + ' border=0 cellspacing=2 cellpadding=4 bgcolor="#ffffff"><TR><TD>');

		// Search form
		searchform();

		// End search table
		document.write('</TD></TR></TABLE>');

		// End border
		document.write('</TD></TR></TABLE>');

	}

	return(0);

}

//
// Function:    masthead
//
// Description: Display "Marina City News" masthead
//
// Return code:
//  0 = Success
//
function masthead () {

	// Logo
	document.write('<TABLE border=0 cellspacing=0 cellpadding=0><TR>');
	document.write('<TD valign="bottom"><IMG src="image/marina_city_news.jpg" width=700 height=98 border=0 alt="Marina City News"></IMG></TD>');
	document.write('</TR></TABLE>');

	// Other info
	document.write('<TABLE width=980 border=0 cellspacing=0 cellpadding=2 bgcolor="#191970" class="whitess1"><TR>');
	document.write('<TD align="center"><B>Chicago&#146;s Marina City &#149; River North &#149; North Loop</B></TD>');
	document.write('<TD align="center"><B>Steven Dahlman, Editor</B></TD>');
	document.write('<TD align="center"><B>news.MarinaCityOnline.com</B></TD>');
	document.write('</TR></TABLE>');

	return(0);

}

//
// Function:    newsphoto
//
// Description: Display newsfeature photo on News page
//
// Input:
//
// headline     = Headline (text)
// bigpicbase   = Basename of large image (JPEG in image/ directory) or null if none
// bigpicwidth  = Width (pixels) of large image (or 0)
// bigpicheight = Height (pixels) of large image (or 0)
// smpicbase    = Basename of small image (JPEG in image/ directory)
// smpicwidth   = Width (pixels) of small image
// smpicheight  = Height (pixels) of small image
// alttext      = Image "alt" text
// caption      = Photo caption
//
// Return code:
//  0 = Success
//
function newsphoto (headline, bigpicbase, bigpicwidth, bigpicheight, smpicbase, smpicwidth, smpicheight, alttext, caption) {

	var args = '\'/image/' + bigpicbase + '.jpg\',' + bigpicwidth + ',' + bigpicheight + ',0,\'' + alttext + '\'';

	// Start table
	document.write('<P><TABLE border=0 cellpadding=0 cellspacing=0>');

	// Headline
	document.write('<TR><TD class="newstext1"><B>' + headline + '</B></TD></TR>');

	// Space
	document.write('<TR><TD height=8></TD></TR>');

	//
	// Photo
	//
	document.write('<TR><TD>');

	if ( bigpicbase ) { document.write('<A href="" onclick="showimg(' + args + '); return false;">'); }

	document.write('<IMG src="image/' + smpicbase + '.jpg" width=' + smpicwidth + ' height=' + smpicheight + ' border=0 ');
	document.write('alt="' + alttext + '"></IMG>');

	if ( bigpicbase ) { document.write('</A>'); }

	document.write('</TD></TR>');

	// Space
	document.write('<TR><TD height=8></TD></TR>');

	// Caption
	document.write('<TR><TD class="caption">' + caption + '</TD></TR>');

	// End table
	document.write('</TABLE></P>');

	// Return
	return(0);

}

//
// Function:    nsidebar
//
// Description: Display sidebar on news page
//
// Input:
// @caldate = Array of special calendar dates
// crainid  = chicagobusiness.com "id" value
//
// -Required function: weather()
//
// Return code:
//  0 = Success
//
function nsidebar () {

	var n; // Array index

	var space = "<TABLE border=0 cellpadding=0 cellspacing=0><TR><TD height=8></TD></TR></TABLE>";

	//
	// Weather and special calendar dates
	//
	document.write('<TABLE border=1 cellpadding=6 cellspacing=0><TR><TD align="left">');

	// Weather
	weather();

	if ( caldate[0] ) { document.write('<P class="header" align="center">Calendar</P>'); }

	for ( n = 0; n < caldate.length; n++ ) {
		document.write('<P class="maintext3">' + caldate[n] + '</P>');
	}

	if ( crainid > 0 ) {

		//
		// Crain's Chicago Business: 10 things to do this weekend
		// Logo: chicagobusiness.jpg 85x14
		// Description: ChicagoBusiness.com is a local business portal founded by Crain Communications Inc., publisher of more than 25 special 
		// interest publications, including Crain's Chicago Business - the nation's pre-eminent regional business newspaper.
		//
		document.write('<P><A href="http://www.chicagobusiness.com/cgi-bin/news.pl?id=' + crainid + '" target="new" class="webs">Crain&#146;s 10 things to do this weekend</A></P>');

	}

	document.write('</TD></TR></TABLE>');

	document.write(space);

	//
	// Ad
	//
	//document.write('<P><A href="http://www.trumpchicagohotel.com/Trump_Spa/Trump_Spa.asp" target="new">');
	//document.write('<IMG src="image/banner/trump_spa_march_specials.jpg" width=200 height=600 border=1 alt="The Spa at Trump"></IMG>');
	//document.write('</A></P>');

	//
	// Chicago Breaking News
	//
	// -192 x 768 pixels
	// -Required in <HEAD> section:
	//
	//  <SCRIPT src="http://cdn.widgetserver.com/syndication/subscriber/InsertWidget.js" type="text/javascript"></SCRIPT>
	//
	if ( WIDGETBOX ) {

		// Widget
		WIDGETBOX.renderWidget('91a305c6-1b04-46ca-8700-d422418ee115');

		// Space
		document.write(space);

	}

	//
	// Signup for email updates
	//
	document.write('<TABLE border=1 cellpadding=6 cellspacing=0><TR><TD align="center">');

	document.write('<P class="header">Signup for email updates</P>');

	document.write('<FORM name="update" action="http://www.loopnorth.com/cgi-bin/eupdate.pl" method="post">');

	document.write('<INPUT name="sitecode" type="hidden" value="MC" />');
	document.write('<INPUT name="option" type="hidden" value="2" />');
	document.write('<INPUT name="eaddress" size="15" maxlength="50" />');

	document.write('<P class="maintext3">Enter your email address above<BR />and click on Signup button below.</P>');

	document.write('<TABLE border=0 cellpadding=6 cellspacing=0 class="maintext3"><TR><TD>');

	document.write('<P><INPUT name="sendalso1" type="checkbox" value="listing" />&nbsp;Also send <A href="http://www.loopnorth.com/data/listing_MC.htm" target="new" class="webs">daily MLS listings of units for sale</A> at Marina City</P>');

	document.write('<P><INPUT name="sendalso2" type="checkbox" value="rental" />&nbsp;Also send <A href="http://www.loopnorth.com/data/rental_MC.htm" target="new" class="webs">daily listings of units for rent</A> at Marina City</P>');

	document.write('<P><INPUT name="sendalso3" type="checkbox" value="summary" />&nbsp;Also send <A href="http://www.loopnorth.com/data/MCO_summary.htm" target="new" class="webs">afternoon news summary</A> that includes daily closing prices of Loop / North Loop stocks</P>');

	document.write('</TD></TR></TABLE>');

	document.write('<P><INPUT type="submit" value="Signup" /></P>');

	document.write('</FORM>');

	document.write('</TD></TR></TABLE>');

	document.write(space);

	//
	// Neighborhood blogs
	//
	document.write('<TABLE border=1 cellpadding=6 cellspacing=0><TR><TD align="center">');

	document.write('<P class="header">Neighborhood blogs</P>');

	document.write('<TABLE border=0 cellpadding=6 cellspacing=0 class="maintext3"><TR>');

	document.write('<TD valign="top"><IMG src="image/becker_logo.jpg" width=20 height=20 border=0></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="http://arcchicago.blogspot.com/" target="new" class="webs">ArchitectureChicago PLUS</A>');
	document.write('<P>A daily blog by Lynn Becker on architecture in Chicago.</P>');
	document.write('</TD>');

	document.write('</TR><TR>');

	document.write('<TD valign="top"><IMG src="image/carless_logo.jpg" width=20 height=20 border=0></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="http://www.chicagocarless.com/" target="new" class="webs">Chicago Carless</A>');
	document.write('<P>The Life and Times of Mike Doyle, a former New Yorker living in downtown Chicago.</P>');
	document.write('</TD>');

	document.write('</TR><TR>');

	document.write('<TD valign="top"><IMG src="image/watchdog_logo.jpg" width=20 height=20 border=0></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="http://blog.mymarinacity.com/" target="new" class="webs">Marina Watchdog</A>');
	document.write('<P>Marina City resident blog. Post your comments, get or give recommendations, ask questions, get involved.</P>');
	document.write('</TD>');

	document.write('</TR></TABLE>');

	document.write('</TD></TR></TABLE>');

	document.write(space);

	//
	// Organizations
	//
	document.write('<TABLE border=1 cellpadding=6 cellspacing=0><TR><TD align="center">');

	document.write('<P class="header">Organizations</P>');

	document.write('<TABLE border=0 cellpadding=6 cellspacing=0 class="maintext3"><TR>');

	document.write('<TD valign="top"><IMG src="image/reilly_icon.jpg" width=20 height=20 border=0></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="http://www.ward42chicago.com/" target="new" class="webs">Alderman Brendan Reilly</A>');
	document.write('</TD>');

	document.write('</TR><TR>');

	document.write('<TD valign="top"><IMG src="image/caf_icon.gif" width=20 height=20 border=0></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="http://www.architecture.org/" target="new" class="webs">Chicago Architecture Foundation</A>');
	document.write('</TD>');

	document.write('</TR><TR>');

	document.write('<TD valign="top"><IMG src="image/cwt_icon.gif" width=20 height=20 border=0></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="http://www.chicagowatertaxi.com/" target="new" class="webs">Chicago Water Taxi</A>');
	document.write('</TD>');

	document.write('</TR><TR>');

	document.write('<TD valign="top"><IMG src="image/focr_icon.gif" width=20 height=20 border=0></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="http://www.chicagoriver.org/" target="new" class="webs">Friends of the Chicago River</A>');
	document.write('</TD>');

	document.write('</TR><TR>');

	document.write('<TD width=20 align="right" valign="top"><IMG src="image/bullet.gif"></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="http://www.lasallehotels.com/" target="new" class="webs">LaSalle Hotel Properties</A>');
	document.write('</TD>');

	document.write('</TR><TR>');

	document.write('<TD width=20 align="right" valign="top"><IMG src="image/bullet.gif"></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="http://www.mymtca.com/" target="new" class="webs">Marina Towers Condo Association</A>');
	document.write('</TD>');

	document.write('</TR><TR>');

	document.write('<TD valign="top"><IMG src="image/RNRA_logo.gif" width=20 height=20 border=0></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="http://rivernorthassociation.com/" target="new" class="webs">River North Business Association</A>');
	document.write('</TD>');

	document.write('</TR><TR>');

	document.write('<TD valign="top"><IMG src="image/rna_icon.gif" width=20 height=20 border=0></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="http://rnrachicago.org/" target="new" class="webs">River North Residents Association</A>');
	document.write('</TD>');

	document.write('</TR></TABLE>');

	document.write('</TD></TR></TABLE>');

	document.write(space);

	//
	// Reference
	//
	document.write('<TABLE border=1 cellpadding=6 cellspacing=0><TR><TD align="center">');

	document.write('<P class="header">Reference</P>');

	document.write('<TABLE border=0 cellpadding=6 cellspacing=0 class="maintext3"><TR>');

	document.write('<TD valign="top"><IMG src="image/architech_logo.jpg" width=20 height=20 border=0></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="http://www.architechgallery.com/" target="new" class="webs">ArchiTech Gallery of Architectural Art</A>');
	document.write('<P>Design drawings, photography, prints</P>');
	document.write('</TD>');

	document.write('</TR><TR>');

	document.write('<TD valign="top"><IMG src="image/bertrand_logo.jpg" width=20 height=20 border=0></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="http://www.bertrandgoldberg.org/intro/index.html" target="new" class="webs">Bertrand Goldberg</A>');
	document.write('<P>Web site by his son Geoffrey</P>');
	document.write('</TD>');

	document.write('</TR><TR>');

	document.write('<TD valign="top"><IMG src="image/blockshopper_icon.gif" width=20 height=20 border=0></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="http://chicago.blockshopper.com/" target="new" class="webs">BlockShopper Chicago</A>');
	document.write('<P>Real estate news and information</P>');
	document.write('</TD>');

	document.write('</TR><TR>');

	document.write('<TD valign="top"><IMG src="image/cwac_logo.jpg" width=20 height=20 border=0></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="history/index.html" class="webs">City Within A City</A>');
	document.write('<P>Marina City book project in progress</P>');
	document.write('</TD>');

	document.write('</TR><TR>');

	document.write('<TD valign="top"><IMG src="image/directtv_logo.jpg" width=20 height=20 border=0></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="http://www.directv.com/see/pdf/chnllineup.pdf" target="new" class="webs">DirectTV Channel Lineup</A>');
	document.write('</TD>');

	document.write('</TR><TR>');

	document.write('<TD valign="top"><IMG src="image/iga_logo.gif" width=20 height=20 border=0></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="http://www.ilga.gov/legislation/ilcs/ilcs3.asp?ActID=2200&ChapAct=765%26nbsp%3BILCS%26nbsp%3B605%2F&ChapterID=62&ChapterName=PROPERTY&ActName=Condominium+Property+Act%2E" target="new" class="webs">Illinois Condominium Property Act</A>');
	document.write('</TD>');

	document.write('</TR><TR>');

	document.write('<TD width=20 align="right" valign="top"><IMG src="image/bullet.gif"></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="commercial.htm" class="webs">Marina City Commercial Directory</A>');
	document.write('</TD>');

	document.write('</TR><TR>');

	document.write('<TD valign="top"><IMG src="image/mas_logo.gif" width=20 height=20 border=0></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="http://www.mascontext.com/" target="new" class="webs">MAS Context</A>');
	document.write('<P>A quarterly journal that addresses issues that affect the urban context.</P>');
	document.write('</TD>');

	document.write('</TR><TR>');

	document.write('<TD width=20 align="right" valign="top"><IMG src="image/bullet.gif"></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="http://egov.cityofchicago.org/webportal/COCWebPortal/COC_EDITORIAL/ResidentialHighRiseFireSafety.pdf" target="new" class="webs">Residential High Rise Fire Safety</A>');
	document.write('</TD>');

	document.write('</TR><TR>');

	document.write('<TD valign="top"><IMG src="image/skyscrapercity_icon.gif" width=20 height=20 border=0></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="http://www.skyscrapercity.com/" target="new" class="webs">SkyscraperCity</A>');
	document.write('</TD>');

	document.write('</TR><TR>');

	document.write('<TD valign="top"><IMG src="image/vincent_logo.jpg" width=20 height=20 border=0></IMG></TD>');

	document.write('<TD valign="top">');
	document.write('<A href="http://www.zweeblefilms.com/" target="new" class="webs">Zweeble Films</A>');
	document.write('<P>Producing the documentary about <A href="http://vpfalk.net/" target="new" class="webs">Vincent Falk</A></P>');
	document.write('</TD>');

	document.write('</TR></TABLE>');

	document.write('</TD></TR></TABLE>');

	document.write(space);

	//
	// New neighbors
	//
	document.write('<TABLE border=1 cellpadding=6 cellspacing=0><TR><TD align="center">');

	document.write('<P class="header">New neighbors</P>');

	document.write('<TABLE border=0 cellpadding=6 cellspacing=0 class="maintext3"><TR>');

	document.write('<TD valign="top"><IMG src="image/353_logo.jpg" width=20 height=20 border=0></IMG></TD>');
	document.write('<TD valign="top"><A href="http://www.353clark.com/" target="new" class="webs">353 North Clark</A></TD>');

	document.write('</TR><TR>');

	document.write('<TD valign="top"><IMG src="image/spire_logo.jpg" width=20 height=20 border=0></IMG></TD>');
	document.write('<TD valign="top"><A href="http://www.thechicagospire.com/" target="new" class="webs">The Chicago Spire</A></TD>');

	document.write('</TR><TR>');

	document.write('<TD valign="top"><IMG src="image/ecd_logo.jpg" width=20 height=20 border=0></IMG></TD>');
	document.write('<TD valign="top"><A href="http://www.thewithotel.com/" target="new" class="webs">theWit Hotel</A></TD>');

	document.write('</TR><TR>');

	document.write('<TD valign="top"><IMG src="image/trump_logo.jpg" width=20 height=20 border=0></IMG></TD>');
	document.write('<TD valign="top"><A href="http://www.trumpchicago.com/" target="new" class="webs">Trump International Hotel and Tower</A></TD>');

	document.write('</TR><TR>');

	document.write('<TD valign="top"><IMG src="image/trumpspa_logo.gif" width=20 height=20 border=0></IMG></TD>');
	document.write('<TD valign="top"><A href="http://www.trumpchicagohotel.com/Trump_Spa/Trump_Spa.asp" target="new" class="webs">The Spa at Trump</A></TD>');

	document.write('</TR><TR>');

	document.write('</TR></TABLE>');

	document.write('</TD></TR></TABLE>');

	document.write(space);

	//
	// Weather
	//
	document.write('<SCRIPT type="text/javascript" src="http://www.loopnorth.com/cgi-bin/widget.pl?WXR,J,200,1"></SCRIPT>');
	document.write(space);

	//
	// MCO Widget
	//
	// document.write('<TABLE border=0 cellpadding=6 cellspacing=0><TR>');

	// document.write('<TD><A href="news/widget.htm"><IMG src="image/thumb/widget_scn.gif" width=50 height=129 border=0 style="border: 1px solid #000000;"></IMG></A></TD>');

	// document.write('<TD><A href="news/widget.htm" class="newshead">Get our free news widget!</A></TD>');

	// document.write('</TR></TABLE>');

	// document.write(space);

	//
	// Search form
	//
	// searchform();
	//

	// Return
	return(0);

}

//
// Function:    pagenav
//
// Description: Display page navigation buttons
//
// Input:
//
// prevpage  = Previous page
// nextpage  = Next page
// nexttitle = Title of next page
//
// Return code:
//  0 = Success
//
function pagenav (prevpage, nextpage, nexttitle) {

	if ( nexttitle ) { document.write('<P class="maintext2" align="center"><B>Next page: ' + nexttitle + '</B></P>'); }

	document.write('<P align="center"><A href="'+ prevpage + '"><IMG src="image/back.gif" border=0 alt="Previous page"></IMG></A>');
	document.write('<A href="' + nextpage + '"><IMG src="image/next.gif" border=0 alt="Next page"></IMG></A></P>');

	return(0);

}

//
// Function:    paypal
//
// Description: PayPal interface
//
// Input:
// item_name = Item name
// price     = Price (D.CC)
//
// Return code:
//  0 = Success
//
function paypal (item_name, price) {

	document.write('<P><FORM name="purchase" action="https://www.paypal.com/cgi-bin/webscr" method="post">');

	document.write('<INPUT type="hidden" name="cmd" value="_xclick" />');
	document.write('<INPUT type="hidden" name="business" value="photo@stevendahlman.com" />');

	document.write('<INPUT type="hidden" name="item_name" value="' + item_name + '" />');
	document.write('<INPUT type="hidden" name="amount" value="' + price + '" />');
	document.write('<INPUT type="hidden" name="undefined_quantity" value="1" />');
	document.write('<INPUT type="hidden" name="currency_code" value="USD" />');

	document.write('<INPUT type="hidden" name="return" value="http://www.stevendahlman.com/psuccess.htm" />');
	document.write('<INPUT type="hidden" name="cancel_return" value="http://www.marinacityonline.com/index.html" />');

	document.write('<INPUT type="submit" value="PURCHASE" class="button" />');

	document.write('</FORM></P>');

	return(0);

}

//
// Function:    paypal_instruct
//
// Description: Display PayPal purchase instructions
//
// Input:
// prod = Product description (e.g., "print")
//
// Return code:
//  0 = Success
//
function paypal_instruct (prod) {

	document.write('<P><TABLE width=800 border=0 cellspacing=0 cellpadding=8 bgcolor="#f0f0f0" class="maintext2"><TR><TD><UL>');

	document.write('<P><LI>Price does not include Illinois sales tax. PayPal will calculate and display the total price. There is no charge for shipping.</LI></P>');

	document.write('<P><LI>Click on the &#147;Purchase&#148; button to continue. Details of the purchase will be displayed. To order more than one ' + prod + ', change the number in the Quantity field and click on the &#147;Update Totals&#148; button.</LI></P>');

	document.write('<P><LI>You may pay by credit card or PayPal account. To pay by credit card, click the &#147;Continue&#148; button in the lower left corner of the PayPal page.</LI></P>');

	document.write('<P><LI>Follow the remaining instructions as prompted by PayPal. PayPal will send you an email confirming payment, and give you a Receipt Number.</LI></P>');

	document.write('<P><LI>Your financial information is kept confidential by PayPal. Shipping information is shared only with Steven Dahlman Photography. The credit card transaction will appear on your bill as &#147;PAYPAL*SDPHOTO&#148;.</LI></P>');

	document.write('<P><LI>Orders are processed within 24 hours. Please allow two weeks for delivery.</LI></P>');

	document.write('</UL></TD></TR></TABLE></P>');

	return(0);

}

//
// Function:    photocap
//
// Description: Display photo and caption
//
// Input:
//
// file     = JPEG image file basename (in "image" directory)
// width    = Image width (pixels)
// height   = Image height (pixels)
// border   = Border size (0-1)
// caption  = Photo caption (text) or null
// alt      = Image "alt" text
// click    = "Y" to append caption with "(Click on image to view larger version)" or "N" to not
// place    = "R" to place caption to right of image
//          = "B" to place caption below image
//          = (null) to place caption along longest edge
// lgfile   = JPEG image file basename of larger version
// lgwidth  = Width of larger version
// lgheight = Height of larger version
//
// Return code:
//  0 = Success
//
// -Used by history pages
//
function photocap (file, width, height, border, caption, alt, click, place, lgfile, lgwidth, lgheight) {

	var args = '';    // showimg() arguments
	var bordersz = 0; // Border size (pixels)
	var capwidth = 0; // Caption width (pixels)

	if ( border > 0 ) { bordersz = border * 2; }

	if ( lgfile ) {
		//
		// Prepare link to larger version
		//
		args = '\'image/' + lgfile + '.jpg\',' + lgwidth + ',' + lgheight;
		if ( click == 'Y' ) { caption = caption + '<BR />(Click on image to view larger version)'; }
	}

	if ( place == 'R' || ( ! place && height > width ) ) {

		//
		// Place caption to right of image
		//

		capwidth = (width / 2);

		document.write('<TABLE cellpadding=' + bordersz + ' cellspacing=8 border=0><TR>');

		if ( args ) {

			document.write('<TD bgcolor="#000000"><A href="" onClick="showimg(' + args + '); return false;"><IMG src="image/' + file + '.jpg" width=' + width + ' height=' + height + ' border=0 alt=' + alt + '></IMG></A></TD>');

		} else {

			document.write('<TD bgcolor="#000000"><IMG src="image/' + file + '.jpg" width=' + width + ' height=' + height + ' border=0 alt=' + alt + '></IMG></TD>');

		}

		if ( caption ) {
			document.write('<TD width=' + capwidth + ' class="caption" align="left">' + caption + '</TD>');
		}

		document.write('</TR></TABLE>');

	}

	if ( place == 'B' || ( ! place && height <= width ) ) {

		//
		// Place caption below image
		//

		capwidth = width;

		document.write('<TABLE cellpadding=' + bordersz + ' cellspacing=8 border=0>');

		if ( args ) {

			document.write('<TR><TD bgcolor="#000000"><A href="" onClick="showimg(' + args + '); return false;"><IMG src="image/' + file + '.jpg" width=' + width + ' height=' + height + ' border=0 alt=' + alt + '></IMG></A></TD></TR>');

		} else {

			document.write('<TR><TD bgcolor="#000000"><IMG src="image/' + file + '.jpg" width=' + width + ' height=' + height + ' border=0 alt=' + alt + '></IMG></TD></TR>');

		}

		if ( caption ) {
			document.write('<TR><TD width=' + capwidth + ' class="caption" align="center">' + caption + '</TD></TR>');
		}

		document.write('</TABLE>');

	}

	return(0);

}

//
// Function:    playFMPvideo
//
// Description: Play Flash video created using Photo Flash Maker Professional
//
// Input:
// vname   = Video file basename (SWF in video/)
// vwidth  = Video width (pixels)
// vheight = Video height (pixels)
//
// Return code:
//  0 = Success
//
function playFMPvideo (vname, vwidth, vheight) {

	document.write('<OBJECT');
	document.write(' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"');
	document.write(' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"');
	document.write(' width="' + vwidth + '" height="' + vheight + '" align="middle">');

	document.write('<PARAM name="movie" value="video/' + vname + '.swf" />');
	document.write('<PARAM name="quality" value="high" />');
	document.write('<PARAM name="allowScriptAccess" value="sameDomain" />');
	document.write('<PARAM name="autoStart" value="true"> ');
	document.write('<PARAM name="loop" value="false">');

	document.write('<EMBED src="video/' + vname + '.swf" quality="high" width="' + vwidth + '" height="' + vheight + '" align="middle"');
	document.write(' allowScriptAccess="sameDomain" autostart="true" loop="false" type="application/x-shockwave-flash"');
	document.write(' pluginspage="http://www.macromedia.com/go/getflashplayer" />');

	document.write('</OBJECT>');

	return(0);

}

//
// Function:    playflv
//
// Description: Play FLV Flash video in new window
//
// Input:
// vfile    = Video file basename (video/[basename].flv)
// sBaseURL = Baseline URL
//
// Return code:
//  0 = Success
//
function playflv (vfile) {

	// Video path/filename
	vfile = sBaseURL + 'video/' + vfile + '.flv';

	var vwidth = 800;           // Video width (pixels)
	var vheight = 600;          // Video height (pixels)

	var wwidth = vwidth + 20;   // Window width (pixels)
	var wheight = vheight + 80; // Window height (pixels)

	// Center window on screen
	var wleft = (screen.availWidth - wwidth) / 2;
	var wtop = (screen.availHeight - wheight) / 2;

	// Window features
	var wfeatures = 'width=' + wwidth + ',height=' + wheight + ',left=' + wleft + ',top=' + wtop;
	wfeatures += ',resizable=no,scrollbars=no,titlebar=no,menubar=no,directories=no,personalbar=no,status=no';

	// Open window
	var vWin = window.open('','',wfeatures);

	//
	// Display video
	//
	var wcontent = '<HTML>';

	wcontent += '<HEAD><TITLE>Marina City Online</TITLE><BASE href="' + sBaseURL + '"></BASE></HEAD>';

	wcontent += '<BODY leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>';
	wcontent += '<TABLE width="100%" height="100%" border=0 cellspacing=0 cellpadding=0><TR><TD align="center">';

	wcontent += '<OBJECT type="application/x-shockwave-flash" width="' + vwidth + '" height="' + vheight + '" wmode="transparent" data="video/player.swf?file=' + vfile + '&autostart=true">';

	wcontent += '<PARAM name="movie" value="video/player.swf?file=' + vfile + '&autostart=true" />';
	wcontent += '<PARAM name="wmode" value="transparent" />';

	wcontent += '</OBJECT>';

	wcontent += '<P><A href="" onClick="window.close();"><INPUT type="button" value="Close"></INPUT></A></P>';

	wcontent += '</TD></TR></TABLE></BODY></HTML>';

	vWin.document.write(wcontent);
	vWin.document.close();

	return(0);

}

//
// Function:    playswf
//
// Description: Play SWF Flash video
//
// Input:
// vfile    = Video file basename (video/[basename].swf)
// newwin   = 1 to play in new window, 0 to not (default)
// sBaseURL = Baseline URL
//
// Return code:
//  0 = Success
//
function playswf (vfile, newwin) {

	// Flash variables
	var classid = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000";
	var codebase = "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0";
	var otype = "application/x-shockwave-flash";
	var plugpage = "http://www.macromedia.com/go/getflashplayer";

	// Video path/filename
	vfile = sBaseURL + 'video/' + vfile + '.swf';

	var vwidth = 800;           // Video width (pixels)
	var vheight = 600;          // Video height (pixels)

	var wwidth = vwidth + 20;   // Window width (pixels)
	var wheight = vheight + 80; // Window height (pixels)

	// Center window on screen
	var wleft = (screen.availWidth - wwidth) / 2;
	var wtop = (screen.availHeight - wheight) / 2;

	if ( newwin == 1 ) {

		//
		// Play in new window
		//

		// Window features
		var wfeatures = 'width=' + wwidth + ',height=' + wheight + ',left=' + wleft + ',top=' + wtop;
		wfeatures += ',resizable=no,scrollbars=no,titlebar=no,menubar=no,directories=no,personalbar=no,status=no';

		var vWin = window.open('','',wfeatures);

		var wcontent = '<HTML>';

		wcontent += '<HEAD><TITLE>Marina City Online</TITLE><BASE href="' + sBaseURL + '"></BASE></HEAD>';

		wcontent += '<BODY leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>';
		wcontent += '<TABLE width="100%" height="100%" border=0 cellspacing=0 cellpadding=0><TR><TD align="center">';

		wcontent += '<OBJECT classid="' + classid + '" codebase="' + codebase + '" width="' + vwidth + '" height="' + vheight + '" align="middle" autostart="false">';

		wcontent += '<PARAM name="movie" value="' + vfile + '" />';
		wcontent += '<PARAM name="quality" value="high" />';
		wcontent += '<PARAM name="allowScriptAccess" value="sameDomain" />';

		wcontent += '<EMBED src="' + vfile + '" quality="high" width="' + vwidth + '" height="' + vheight + '" align="middle" allowScriptAccess="sameDomain" type="' + otype + '" pluginspage="' + plugpage + '" autostart="false" />';

		wcontent += '</OBJECT>';

		wcontent += '<P><A href="" onClick="window.close();"><INPUT type="button" value="Close"></INPUT></A></P>';

		wcontent += '</TD></TR></TABLE></BODY></HTML>';

		vWin.document.write(wcontent);
		vWin.document.close();

	} else {

		//
		// Play embedded
		//
		document.write('<OBJECT classid="' + classid + '" codebase="' + codebase + '" width="' + vwidth + '" height="' + vheight + '" align="middle" autostart="false">');

		document.write('<PARAM name="movie" value="' + vfile + '" />');
		document.write('<PARAM name="quality" value="high" />');
		document.write('<PARAM name="autostart" value="false" />');
		document.write('<PARAM name="loop" value="false" />');
		document.write('<PARAM name="allowScriptAccess" value="sameDomain" />');

		document.write('<EMBED src="' + vfile + '" quality="high" width="' + vwidth + '" height="' + vheight + '" align="middle" allowScriptAccess="sameDomain" type="' + otype + '" pluginspage="' + plugpage + '" autostart="false" loop="false" />');

		document.write('</OBJECT>');

	}

	return(0);

}

//
// Function:    playsound()
//
// Description: Play (or stop) sound file
//
// Input:
//
// sfile = Audio file path/filename or
//       = Audio file basename (MP3 file in audio/ sub-directory)
//
// id    = Unique number to identify sound object
//
// mode  = 1 to play sound (default)
//       = 0 to stop sound
//
// -Uses SoundManager API
//
// -Required files:
//  audio/soundmanager2.js
//  audio/soundmanager2.swf
//
// Return code:
//  0 = Success
// -1 = Invalid argument
//
function playsound (sfile, id, mode) {

	if ( ! sfile ) {
		// Missing argument
		return(-1);
	} else if ( ! id ) {
		// Missing argument
		return(-1);
	}

	//
	// Audio path/filename
	//
	var position;
	var soundfile;

	position = sfile.length - 3;

	if ( sfile.substring(position) == 'mp3' ) {
		// Path/filename passed
		soundfile = sfile;
	} else {
		// Basename only passed
		soundfile = "audio/" + sfile + ".mp3";
	}

	// Sound ID
	var soundID = 'sound' + id;

	// Stop any currently-playing sound
	soundManager.stopAll();

	if ( mode != 0 ) {

		// Create sound
		soundManager.createSound( { id: soundID, url: soundfile, autoPlay: false } );

		// Play sound
		soundManager.play(soundID);

	}

	return(0);

}

//
// Function:    searchform
//
// Description: Display Search form
//
// Return code:
//  0 = Success
//
function searchform () {

	//
	// Google
	//
	//document.write('<P><CENTER><FORM name="searchbox" action="http://www.google.com/search" method="get" />');
	//document.write('<INPUT type="hidden" name="sitesearch" value="marinacityonline.com" />');
	//document.write('<INPUT type="hidden" name="hl" value="en" />');
	//document.write('<INPUT type="hidden" name="ie" value="ISO-8859-1" />');
	//document.write('<INPUT name="q" size="15" maxlength="256" value="" /><BR />');
	//document.write('<INPUT name="btnG" type="submit" value="Search MCO" />');
	//document.write('</FORM></CENTER></P>');

	//
	// Atomz
	//
	document.write('<P><CENTER><FORM name="searchbox" action="http://search.atomz.com/search/" method="get">');
	document.write('<INPUT type="hidden" name="sp_a" value="sp10041b1b" />');
	document.write('<INPUT size="15" name="sp_q" /><BR />');
	document.write('<INPUT type="submit" value="Search MCO" />');
	document.write('<INPUT type="hidden" name="sp_p" value="all" />');
	document.write('<INPUT type="hidden" name="sp_f" value="ISO-8859-1" />');
	document.write('</FORM></CENTER></P>');

	return(0);

}

//
// Function:    showimg
//
// Description: Display image in new window
//
// Input:
//
// file     = Filename of image to display
// width    = Width (pixels) of image
// height   = Height (pixels) of image
// szimg    = Resize image? 1=Yes (default) 0=No
// title    = Text to display in window title bar
// sBaseURL = Baseline URL
//
// Return code:
//  0 = Success
//
function showimg (file, width, height, szimg, title) {

	var wwidth = width + 40;   // Window width (pixels)
	var wheight = height + 80; // Window height (pixels)

	var maxwidth = screen.availWidth - 10;   // Maximum width (pixels)
	var maxheight = screen.availHeight - 10; // Maximum height (pixels)

	// Shrink to fit available space
	if ( wwidth > maxwidth )   { wwidth = maxwidth; }
	if ( wheight > maxheight ) { wheight = maxheight; }

	// Center window on screen
	var wleft = (screen.availWidth - wwidth) / 2;
	var wtop = (screen.availHeight - wheight) / 2;

	// Window features
	var wfeatures = 'width=' + wwidth + ',height=' + wheight + ',left=' + wleft + ',top=' + wtop;
	wfeatures += ',resizable=yes,scrollbars=yes,titlebar=no,menubar=no,directories=no,personalbar=no,status=no';

	// Open window
	var imgWin = window.open('','',wfeatures);

	//
	// Display image
	//
	var wcontent = '<HTML>';
	wcontent += '<HEAD>';

	if ( title ) {
		wcontent += '<TITLE>Marina City Online - ' + title + '</TITLE>';
	} else {
		wcontent += '<TITLE>Marina City Online</TITLE>';
	}

	wcontent += '<BASE href="' + sBaseURL + '"></BASE>';
	wcontent += '</HEAD>';

	wcontent += '<BODY leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>';
	wcontent += '<TABLE width="100%" height="100%" cellpadding=0 cellspacing=0 border=0><TR><TD align="center">';

	if ( szimg == 0 ) {
		// Do not specify image size
		wcontent += '<IMG src="' + sBaseURL + file + '"></IMG>';
	} else {
		wcontent += '<IMG src="' + sBaseURL + file + '" width=' + width + ' height=' + height + '></IMG>';
	}

	wcontent += '<P><A href="" onClick="window.close();"><INPUT type="button" value="Close"></INPUT></A>';
	wcontent += '<A href="" onClick="window.print();"><INPUT type="button" value="Print"></INPUT></A></P>';

	wcontent += '</TD></TR></TABLE></BODY></HTML>';

	imgWin.document.write(wcontent);
	imgWin.document.close();

	return(0);

}

//
// Function:    showlisting
//
// Description: Display property listing
//
// Input:
//
// salerent = "S" if unit is for sale or "R" if unit is for rent
// unit     = Unit number (e.g., "#4321") and configuration (Studio|One Bedroom|Two Bedroom)
// price    = Sale price or monthly rent (e.g., "$1,234")
// assess   = Monthly assessment amount (sale) or 0
// tax      = Annual tax amount (sale) or 0
// area     = Approximate square feet or 0
// security = Security deposit (rent) or 0
// avail    = Date available (rent) or "Now"
// desc     = Property description (text)
// imgbase  = Image file basename ("image/listing/[imgbase]-[N].jpg") or null if none
// imgcount = Total number of property photos
// back     = 1 for grey background or 0 for white background)
//
// Return code:
//  0 = Success
// -1 = Invalid argument
//
// -Required function: showimg()
//
function showlisting (salerent, unit, price, assess, tax, area, security, avail, desc, imgbase, imgcount, back) {

	var counter; // Index

	// Background color
	var bgcolor = "#ffffff";
	if ( back == 1 ) { bgcolor = "#f2f2f2"; }

	// Start outer table
	document.write('<TABLE width="100%" border=0 cellspacing=0 cellpadding=8 bgcolor="' + bgcolor + '" class="maintext2"><TR><TD align="center">');

	// "Featured Listing"
	document.write('<P><B>Featured Listing</B></P>');

	if ( salerent == 'S' ) {

		// Property for sale

		document.write('<TABLE border=1 cellspacing=2 cellpadding=4 class="maintext2">');

		document.write('<TR><TD width=200 bgcolor="#191970" class="whiteserif1">Unit:</TD><TD width=300><B>' + unit + '</B></TD></TR>');

		document.write('<TR><TD bgcolor="#191970" class="whiteserif1">Price:</TD><TD><B>' + price + '</B></TD></TR>');

		if ( assess ) {
			document.write('<TR><TD bgcolor="#191970" class="whiteserif1">Assessments:</TD><TD><B>' + assess + '</B></TD></TR>');
		}

		if ( tax ) {
			document.write('<TR><TD bgcolor="#191970" class="whiteserif1">Taxes:</TD><TD><B>' + tax + '</B></TD></TR>');
		}

		if ( area ) {
			document.write('<TR><TD bgcolor="#191970" class="whiteserif1">Area (approx.):</TD><TD><B>' + area + ' square feet</B></TD></TR>');
		}

		document.write('</TABLE>');

	} else if ( salerent == 'R' ) {

		// Property for rent

		document.write('<TABLE border=1 cellspacing=2 cellpadding=4 class="maintext2">');

		document.write('<TR><TD width=200 bgcolor="#191970" class="whiteserif1">Unit:</TD><TD width=300><B>' + unit + '</B></TD></TR>');

		document.write('<TR><TD bgcolor="#191970" class="whiteserif1">Price:</TD><TD><B>' + price + ' per month</B></TD></TR>');

		if ( security ) {
			document.write('<TR><TD bgcolor="#191970" class="whiteserif1">Security deposit:</TD><TD><B>' + security + '</B></TD></TR>');
		}

		if ( avail ) {
			document.write('<TR><TD bgcolor="#191970" class="whiteserif1">Available:</TD><TD><B>' + avail + '</B></TD></TR>');
		}

		if ( area ) {
			document.write('<TR><TD bgcolor="#191970" class="whiteserif1">Area (approx.):</TD><TD><B>' + area + ' square feet</B></TD></TR>');
		}

		document.write('</TABLE>');

	} else {

		// Invalid argument
		return(-1);

	}

	// Description
	document.write('<P><TABLE width=500 border=0 cellspacing=2 cellpadding=4 class="maintext2"><TR><TD>');
	document.write(desc);
	document.write('</TD></TR></TABLE></P>');

	//
	// Photos
	//
	for ( counter = 1; counter <= imgcount; counter ++ ) {

		document.write('<A href="#" onClick="showimg(\'image/listing/' + imgbase + '-' + counter + '.jpg\', 400, 300); return false;">');
		document.write('<IMG src="image/listing/' + imgbase + '-' + counter + '.jpg" width=150 hspace=4 vspace=4 border=0 alt=""></IMG>');
		document.write('</A>');

		if ( counter % 3 == 0 ) { document.write('<BR />'); }

	}

	// Instructions
	if ( imgcount > 0 ) {
		document.write('<P class="maintext2">(Click on image to view larger version)</P>');
	}

	// End outer table
	document.write('</TD></TR></TABLE>');

	// Return
	return(0);

}

//
// Function:    showtweets
//
// Description: Display recent Twitter Tweets that mention MC
//
// -Required in HEAD section: <SCRIPT src="http://widgets.twimg.com/j/2/widget.js"></SCRIPT>
//
// Return code:
//  0 = Success
//
function showtweets () {

	new TWTR.Widget({
		features: {
			avatars: false,
			behavior: 'default',
			hashtags: true,
			live: true,
			loop: true,
			scrollbar: false,
			timestamp: true
		},
		height: 300,
		interval: 6000,
		search: '"Marina City"',
		subject: 'Tweets for Marina City',
		theme: {
			shell: { background: '#8ec1da', color: '#ffffff' },
			tweets: { background: '#ffffff', color: '#444444', links: '#1985b5' }
		},
		title: 'Marina City Online',
		type: 'search',
		width: 200,
		version: 2
	}).render().start();

	return(0);

}

//
// Function:    ssidebar
//
// Description: Display sidebar on news story page
//
// Return code:
//  0 = Success
//
// -Required functions: google_ad(), weather()
//
function ssidebar () {

	// Start table
	document.write('<TABLE width=200 border=0 cellpadding=4 cellspacing=0><TR><TD class="maintext3" valign="top">');

	// Logo
	document.write('<A href="news.htm"><IMG src="image/marina_city_news_200.jpg" width=200 height=28 border=0></IMG></A>');

	//
	// Today's date
	//
	var today = new Date();

	var days = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
	var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');

	document.write('<CENTER>');
	document.write(days[today.getDay()] + ", " + months[today.getMonth()] + " " + today.getDate() + ", " + today.getFullYear());
	document.write('</CENTER>');

	// Contact link
	document.write('<P align="center"><A href="mailto:news@marinacityonline.com" class="web">news@marinacityonline.com</A></P>');

	// Weather
	document.write('<P></P>');
	weather();

	//
	// Quick links
	//
	document.write('<P><TABLE width=200 border=0 cellpadding=0 cellspacing=8>');

	document.write('<TR><TD align="center"><A href="news.htm"><IMG src="image/qlink_news.gif" width=98 height=40 border=0 alt="Marina City News"></IMG></A></TD></TR>');

	document.write('<TR><TD align="center"><A href="history/index.html"><IMG src="image/qlink_hist.gif" width=122 height=40 border=0 alt="Marina City History"></IMG></A></TD></TR>');

	document.write('<TR><TD align="center"><A href="listing.htm"><IMG src="image/qlink_list.gif" width=158 height=40 border=0 alt="MLS Listings"></IMG></A></TD></TR>');

	document.write('<TR><TD align="center"><A href="news/currents0311.htm"><IMG src="image/logo/river_currents_st_pat_day.jpg" width=200 height=107 border=0 alt="River Currents by Pasha Holiday"></IMG></A></TD></TR>');

	document.write('</TABLE></P>');

	// Other links
	document.write('<TABLE width=200 border=0 cellpadding=4 cellspacing=0><TR><TD class="maintext3" valign="top">');
	document.write('<LI><A href="restaurant.htm" class="web">River North Restaurant Guide</A></LI>');
	document.write('<LI><A href="crimedata.htm" class="web">Neighborhood Crime Database</A></LI>');
	document.write('</TD></TR></TABLE>');

	// Signup for email updates
	document.write('<P align="center"><A href="http://www.loopnorth.com/cgi-bin/eupdate.pl?MC,1" class="web">Signup for email updates</A></P>');

	// Headlines
	document.write('<P class="maintext3" align="center"><B>Most recent headlines:</B></P>');
	document.write('<SCRIPT type="text/javascript" src="cgi-bin/newsdb.pl?R5"></SCRIPT>');

	// Google ads
	google_ad(3);

	// End table
	document.write('</TD></TR></TABLE>');

	// Return
	return(0);

}

//
// Function:    subhead
//
// Description: Display bullet points below headline on news page
//
// Input:
// line1 = First sub-headline
// line2 = Second sub-headline (optional)
// line3 = Third sub-headline (optional)
//
// Return code:
//  0 = Success
// -1 = Invalid argument
//
function subhead (line1, line2, line3) {

	if ( ! line1 ) { return(-1); }

	// Start table
	document.write('<TABLE width="100%" border=0 cellspacing=0 cellpadding=4>');

	// Insert space
	document.write('<TR><TD height=4></TD></TR>');

	//
	// Bullet points
	//
	document.write('<TR><TD bgcolor="#f4f4f4" class="maintext2"><B><I><UL>');

	if ( line1 ) { document.write('<P><LI>' + line1 + '</LI></P>'); }
	if ( line2 ) { document.write('<P><LI>' + line2 + '</LI></P>'); }
	if ( line3 ) { document.write('<P><LI>' + line3 + '</LI></P>'); }

	document.write('</UL></I></B></TD></TR>');

	// End table
	document.write('</TABLE>');

	return(0);

}

//
// Function:    vertlines
//
// Description: Print blue vertical lines
//
// Input:
//
// lines = Number of lines (1-2)
//
// Return code:
//  0 = Success
//
function vertlines (lines) {

	document.write('<TD width=2 bgcolor="#000080"></TD>');

	if ( lines == 2 ) { document.write('<TD width=2 bgcolor="#000080"></TD>'); }

	document.write('<TD width=2 bgcolor="#ffffff"></TD>');

	return(0);

}

//
// Function:    weather
//
// Description: Display weather information
//
// Return code:
//  0 = Success
//
function weather () {

	document.write('<EMBED src="http://www.weatherlet.com/weather.swf?locid=60654&unit=s" quality="high" wmode="transparent" bgcolor="#ffffff" width="184" height="76" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');

	return(0);

}