/*

COPYRIGHT 1996, 2005, 2007, 2009 JAMES H. ZISCH. ALL RIGHTS RESERVED.

For custom application system design and development services
and ready-made customizable solution products contact:
	http://www.jhz-cs.com/
	info@jhz-cs.com

*/

var	basedir = '/';

SUBJECTS = [
	new Option( 'Select one below', '0' ),
	new Option( 'Sellers -->', '1' ),
	new Option( 'Buyers -->', '2' ),
	new Option( 'Escrow -->', '3' ),
	new Option( 'Community -->', '4' ),
//	new Option( 'News -->', '5' ),
];

TOPICS = [
	[
		new Option( '<-- Select a Subject', '0' ),
	],
	[	//	Seller
		new Option( 'Select a Sellers Topic below', '/sellers/index.html' ),
//		new Option( 'Listings', '/listings/index.html' ),
		new Option( 'Seller pages', '/sellers/index.html' ),
		new Option( 'What\'s the Value of My Home', '/sellers/comp_analysis_req.html' ),
		new Option( 'The Plan of Action', '/sellers/ThePlanofAction.html' ),
		new Option( 'Use a Realtor to Sell', '/sellers/UseaRealtortoSell.html' ),
		new Option( 'Let Your Home Smile', '/sellers/LetYourHomeSmile.html' ),
		new Option( 'Prep Your Home Report Offer!', '/sellers/PrepYourHomeReportOffer.html' ),
		new Option( 'Mortgage Rate Calculator', '/external/mortgage_calc.html' ),
		new Option( 'Real Estate Glossary', '/external/re_glossary.html' ),
		new Option( 'Free Reports', '/reports/index.html' ),
	],
	[	//	Buyer
		new Option( 'Select a Buyers Topic below', '/buyers/index.html' ),
//		new Option( 'Listings', '/listings/index.html' ),
		new Option( 'Buyer pages', '/buyers/index.html' ),
		new Option( 'What\'s the Value of My Home', '/sellers/comp_analysis_req.html' ),
		new Option( 'Use a Realtor to Buy', '/buyers/UseaRealtortoBuy.html' ),
		new Option( 'Qualifying Questions', '/buyers/QualifyingQuestions.html' ),
		new Option( 'Buying Sequence', '/buyers/BuyingSequence.html' ),
		new Option( 'How Home Loans Are Made', '/buyers/HowHomeLoansAreMade.html' ),
		new Option( 'Insurabilty', '/buyers/InsurabiltyArticle.html' ),
		new Option( 'Mortgage Rate Calculator', '/external/mortgage_calc.html' ),
		new Option( 'Real Estate Glossary', '/external/re_glossary.html' ),
		new Option( 'National Home Search', '/external/national_homesearch.html' ),
		new Option( 'Free Reports', '/reports/index.html' ),
	],
	[	//	Escrow
		new Option( 'Select an Escrow Topic below', '/escrow/index.html' ),
		new Option( 'Escrow pages', '/escrow/index.html' ),
		new Option( 'REALTOR - Sign of Help', '/escrow/REALTORsignofhelp.html' ),
		new Option( 'What Is Escrow?', '/escrow/WhatIsEscrow.html' ),
		new Option( 'What Happens In Escrow?', '/escrow/WhatHappensInEscrow.html' ),
		new Option( 'How Escrow Works For You', '/escrow/ESCROWDoesandDoesNot.html' ),
		new Option( 'Escrow Opening Guide', '/escrow/EscrowOpeningGuide.html' ),
		new Option( 'Buyer\'s Opening', '/escrow/BuyersOpening.html' ),
		new Option( 'Escrow Charges to the Buyer', '/escrow/EscrowCharges-Buyer.html' ),
		new Option( 'Seller\'s Opening', '/escrow/SellersOpening.html' ),
		new Option( 'Escrow Charges to the Seller', '/escrow/EscrowCharges-Seller.html' ),
		new Option( 'Real Estate Glossary', '/external/re_glossary.html' ),
	],
	[	//	Community
		new Option( 'Select a Community Topic below', '/community/index.html' ),
		new Option( 'Community pages', '/community/index.html' ),
		new Option( 'General Info', '/community/gen_info.html' ),
		new Option( 'City Web Sites', '/community/city_websites.html' ),
		new Option( 'County, State & Regional', '/community/orange_county.html' ),
		new Option( 'Schools', '/community/schools.html' ),
		new Option( 'Churches', '/community/worship.html' ),
		new Option( 'Dining', '/community/dining.html' ),
		new Option( 'Arts and Entertainment', '/community/arts_entertain.html' ),
		new Option( 'Golf Courses', '/community/golfcourses.html' ),
	],
//	[	//	News
//		new Option( 'Select a News Topic below', '/news/index.html' ),
//		new Option( 'News pages', '/news/index.html' ),
//		new Option( 'Real Estate News', '/news/re.html' ),
//	],
];

var navselect =
	'<div id="navsel">'
	+ '<table>'
	+ '<tr><td>'
	+ '		<form name="navSelect" action="return true;">'
	+ '			<select name="subject" onchange="updateMenu(this.value)">'
	+ '				<option value=0>Select one below</option>'
	+ '				<option value=1>Sellers --&gt;</option>'
	+ '				<option value=2>Buyers --&gt;</option>'
	+ '				<option value=3>Escrow --&gt;</option>'
	+ '				<option value=4>Community --&gt;</option>'
//	+ '				<option value=4>News --&gt;</option>'
	+ '			</select>'
	+ '			<select name="topic" onchange="gotoTopic(this.value)">'
	+ '				<option value=0>&lt;-- Select a Subject</option>'
	+ '			</select>'
	+ '		</form>'
	+ '	</td>'
	+ '	<td align=right>'
	+ '		<form action="/cgi-bin/search.cgi" method="post" id="search" name="search">'
	+ '			<input class="srchf" type="text" id="search_text" name="search_text" size="15" maxlength="40">'
	+ '			<input class="srchb" type="submit" value="Search">'
	+ '		</form>'
	+ '	</td>'
	+ '</tr>'
	+ '</table>'
	+ '</div>';

function initNavSelect () {
	found = false;
	W = location.href;
	 
	FOUND: for ( s in SUBJECTS ) {
		for ( t in TOPICS[s] ) {
			if ( ( TOPICS[s][t].value ) &&
				( W.indexOf( TOPICS[s][t].value ) != -1 ) &&
				TOPICS[s][t].value != '0' )
			{
				found = true;
				break FOUND;
			}
		}
	}
	s = ( found ) ? s : 0;
	t = ( found ) ? t : 0;

	if ( ! found && W.indexOf( '/listings/' ) != -1 ) {
		s = 2;
		t = 1;
	}
	
	for ( x in SUBJECTS ) {
		document.navSelect.subject.options[x] = SUBJECTS[x];
	}
	
	document.navSelect.subject.options[s].selected = true;
	updateMenu(s);
	document.navSelect.topic.options[t].selected = true;
}

function gotoTopic ( x ) {
	if ( x != 0 ) location.href = x;
}

function updateMenu(s) {
	document.navSelect.topic.length = 0;
	for ( x in TOPICS[s] ) {
		document.navSelect.topic.options[x] = TOPICS[s][x];
	}
	document.navSelect.topic.options[0].selected = true;
}

var dzcoastjs = true;
