var popup = new Array(),
	menuitem = new Array(),
	lvl_two = new Array(),
	timer = new Array(),
	timer2 = new Array();

	var popup_content = [
		
		"<a class='top' href='/homeowners.php'>Home Owners</a><br/>" +
		"<a class='one ho bp' href='/homeowners_practices.php'>Best Practices</a><br/>" +
		"<div class='ho bp'>" +
		"<div id='horizontaldash'></div>" +
		"<a class='two' href='/homeowners_practices_detail.php?ArticleTitle=DO THE NUMBERS'>> Do the Numbers</a><br/>" +
		"<a class='two' href='/homeowners_practices_detail.php?ArticleTitle=BEFORE YOU BUY/SELL'>> Before You Buy/Sell</a><br/>" +
		"<a class='two' href='/homeowners_practices_detail.php?ArticleTitle=SCAM ALERT!'>> Scam Alert</a><br/>" +
		"<a class='two' href='/homeowners_practices_detail.php?ArticleTitle=AVOID FORECLOSURE'>> Avoid Foreclosure</a><br/>" +
		"</div>" +
		"<div id='horizontaldash'></div>" +
		"<a class='one ho nd' href='/homeowners_developments.php'>New Developments</a><br/>" +
		"<div class='ho nd'>" +
		"<div id='horizontaldash'></div>" +
		"<a class='two' href='/homeowners_developments_detail.php?ArticleTitle=RECENT NEWS'>> Recent News</a><br/>" +
		"<a class='two' href='/homeowners_developments_detail.php?ArticleTitle=ENVIRONMENT/GO GREEN!'>> Environment/Go Green!</a><br/>" +
		"<a class='two' href='/homeowners_developments_detail.php?ArticleTitle=SPECIAL PLACES'>> Special Places</a><br/>" +
		"<a class='two' href='/homeowners_developments_detail.php?ArticleTitle=UNCOVER'>> Uncover</a><br/>" +
		"</div>" +
		"<div id='horizontaldash'></div>" +
		"<a class='one ho fq' href='/homeowners_faqs.php'>FAQs</a><br/>" +
		"<div class='ho fq'>" +
		"<div id='horizontaldash'></div>" +
		"<a class='two' href='/homeowners_faqs_detail.php?ArticleTitle=ARTICLES'>> Articles</a><br/>" +
		//"<a class='two' href='/forum/viewforum.php'>Forum Postings</a><br/>" +
		"<div class='two'> &nbsp;</div>" +
		"<div class='two'> &nbsp;</div>" +
		"<div class='two'> &nbsp;</div>" +
		"</div>" +
		"<div id='horizontaldash'></div>" +
		"<a class='one ho sy' href='/homeowners_stuff.php'>Stuff for You</a><br/>" +
		"<div class='ho sy'>" +
		"<div id='horizontaldash'></div>" +
		"<a class='two' href='/homeowners_stuff_detail.php?ArticleTitle=FLO-FOLDER'>> Flo-Folder</a><br/>" +
		//"<a class='two' href='/homeowners_stuff_detail.php?ArticleTitle=AMAZON'>Amazon</a><br/>" +
		"<a class='two' href='/homeowners_stuff_detail.php?ArticleTitle=HIGHLIGHT CLASSES'>> Highlight Classes</a><br/>" +
		"<div class='two'> &nbsp;</div>" +
		"<div class='two'> &nbsp;</div>" +
		"</div>"
		
		,
		"<a class='top' href='/investors.php'>Investors</a><br/>" +
		"<a class='one iv bp' href='/investors_practices.php'>Best Practices</a><br/>" +
		"<div class='iv bp'>" +
		"<div id='horizontaldash'></div>" +
		"<a class='two' href='/investors_practices_detail.php?ArticleTitle=DO THE NUMBERS'>> Do the Numbers</a><br/>" +
		"<a class='two' href='/investors_practices_detail.php?ArticleTitle=BEFORE YOU BUY/SELL'>> Before You Buy/Sell</a><br/>" +
		"<a class='two' href='/investors_practices_detail.php?ArticleTitle=SCAM ALERT!'>> Scam Alert</a><br/>" +
		"<a class='two' href='/investors_practices_detail.php?ArticleTitle=AVOID FORECLOSURE'>> Avoid Foreclosure</a><br/>" +
		"</div>" +
		"<div id='horizontaldash'></div>" +
		"<a class='one iv nd' href='/investors_developments.php'>New Developments</a><br/>" +
		"<div class='iv nd'>" +
		"<div id='horizontaldash'></div>" +
		"<a class='two' href='/investors_developments_detail.php?ArticleTitle=RECENT NEWS'>> Recent News</a><br/>" +
		"<a class='two' href='/investors_developments_detail.php?ArticleTitle=ENVIRONMENT/GO GREEN!'>> Environment/Go Green!</a><br/>" +
		"<a class='two' href='/investors_developments_detail.php?ArticleTitle=SPECIAL PLACES'>> Special Places</a><br/>" +
		"<a class='two' href='/investors_developments_detail.php?ArticleTitle=UNCOVER'>> Uncover</a><br/>" +
		"</div>" +
		"<div id='horizontaldash'></div>" +
		"<a class='one iv fq' href='/investors_faqs.php'>FAQs</a><br/>" +
		"<div class='iv fq'>" +
		"<div id='horizontaldash'></div>" +
		"<a class='two' href='/investors_faqs_detail.php?ArticleTitle=ARTICLES'>> Articles</a><br/>" +
		//"<a class='two' href='/forum/viewforum.php'>Forum Postings</a><br/>" +
		"<div class='two'> &nbsp;</div>" +
		"<div class='two'> &nbsp;</div>" +
		"<div class='two'> &nbsp;</div>" +
		"</div>" +
		"<div id='horizontaldash'></div>" +
		"<a class='one iv sy' href='/investors_stuff.php'>Stuff for You</a><br/>" +
		"<div class='iv sy'>" +
		"<div id='horizontaldash'></div>" +
		"<a class='two' href='/investors_stuff_detail.php?ArticleTitle=FLO-FOLDER'>> Flo-Folder</a><br/>" +
		//"<a class='two' href='/investors_stuff_detail.php?ArticleTitle=AMAZON'>Amazon</a><br/>" +
		"<a class='two' href='/investors_stuff_detail.php?ArticleTitle=HIGHLIGHT CLASSES'>> Highlight Classes</a><br/>" +
		"<div class='two'> &nbsp;</div>" +
		"<div class='two'> &nbsp;</div>" +
		"</div>"
		,
		"<a class='top' href='/nonprofit.php'>Non-Profit Developers</a><br/>" +
		"<a class='one np bp' href='/nonprofit_practices.php'>Best Practices</a><br/>" +
		"<div class='np bp'>" +
		"<div id='horizontaldash'></div>" +
		"<a class='two' href='/nonprofit_practices_detail.php?ArticleTitle=DO THE NUMBERS'>> Do the Numbers</a><br/>" +
		"<a class='two' href='/nonprofit_practices_detail.php?ArticleTitle=BEFORE YOU BUY/SELL'>> Before You Buy/Sell</a><br/>" +
		"<a class='two' href='/nonprofit_practices_detail.php?ArticleTitle=SCAM ALERT!'>> Scam Alert</a><br/>" +
		"<a class='two' href='/nonprofit_practices_detail.php?ArticleTitle=AVOID FORECLOSURE'>> Avoid Foreclosure</a><br/>" +
		"</div>" +
		"<div id='horizontaldash'></div>" +
		"<a class='one np nd' href='/nonprofit_developments.php'>New Developments</a><br/>" +
		"<div class='np nd'>" +
		"<div id='horizontaldash'></div>" +
		"<a class='two' href='/nonprofit_developments_detail.php?ArticleTitle=RECENT NEWS'>> Recent News</a><br/>" +
		"<a class='two' href='/nonprofit_developments_detail.php?ArticleTitle=ENVIRONMENT/GO GREEN!'>> Environment/Go Green!</a><br/>" +
		"<a class='two' href='/nonprofit_developments_detail.php?ArticleTitle=SPECIAL PLACES'>> Special Places</a><br/>" +
		"<a class='two' href='/nonprofit_developments_detail.php?ArticleTitle=UNCOVER'>> Uncover</a><br/>" +
		"</div>" +
		"<div id='horizontaldash'></div>" +
		"<a class='one np fq' href='/nonprofit_faqs.php'>FAQs</a><br/>" +
		"<div class='np fq'>" +
		"<div id='horizontaldash'></div>" +
		"<a class='two' href='/nonprofit_faqs_detail.php?ArticleTitle=ARTICLES'>> Articles</a><br/>" +
		//"<a class='two' href='/forum/viewforum.php'>Forum Postings</a><br/>" +
		"<div class='two'> &nbsp;</div>" +
		"<div class='two'> &nbsp;</div>" +
		"<div class='two'> &nbsp;</div>" +
		"</div>" +
		"<div id='horizontaldash'></div>" +
		"<a class='one np sy' href='/nonprofit_stuff.php'>Stuff for You</a><br/>" +
		"<div class='np sy'>" +
		"<div id='horizontaldash'></div>" +
		"<a class='two' href='/nonprofit_stuff_detail.php?ArticleTitle=FLO-FOLDER'>> Flo-Folder</a><br/>" +
		//"<a class='two' href='/nonprofit_stuff_detail.php?ArticleTitle=AMAZON'>Amazon</a><br/>" +
		"<a class='two' href='/nonprofit_stuff_detail.php?ArticleTitle=HIGHLIGHT CLASSES'>> Highlight Classes</a><br/>" +
		"<div class='two'> &nbsp;</div>" +
		"<div class='two'> &nbsp;</div>" +
		"</div>"
		,
		"<a class='top' href='/developers.php'>Developers</a><br/>" +
		"<a class='one dv bp' href='/developers_practices.php'>Best Practices</a><br/>" +
		"<div class='dv bp'>" +
		"<div id='horizontaldash'></div>" +
		"<a class='two' href='/developers_practices_detail.php?ArticleTitle=DO THE NUMBERS'>> Do the Numbers</a><br/>" +
		"<a class='two' href='/developers_practices_detail.php?ArticleTitle=BEFORE YOU BUY/SELL'>> Before You Buy/Sell</a><br/>" +
		"<a class='two' href='/developers_practices_detail.php?ArticleTitle=SCAM ALERT!'>> Scam Alert</a><br/>" +
		"<a class='two' href='/developers_practices_detail.php?ArticleTitle=AVOID FORECLOSURE'>> Avoid Foreclosure</a><br/>" +
		"</div>" +
		"<div id='horizontaldash'></div>" +
		"<a class='one dv nd' href='/developers_developments.php'>New Developments</a><br/>" +
		"<div class='dv nd'>" +
		"<div id='horizontaldash'></div>" +
		"<a class='two' href='/developers_developments_detail.php?ArticleTitle=RECENT NEWS'>> Recent News</a><br/>" +
		"<a class='two' href='/developers_developments_detail.php?ArticleTitle=ENVIRONMENT/GO GREEN!'>> Environment/Go Green!</a><br/>" +
		"<a class='two' href='/developers_developments_detail.php?ArticleTitle=SPECIAL PLACES'>> Special Places</a><br/>" +
		"<a class='two' href='/developers_developments_detail.php?ArticleTitle=UNCOVER'>> Uncover</a><br/>" +
		"</div>" +
		"<div id='horizontaldash'></div>" +
		"<a class='one dv fq' href='/developers_faqs.php'>FAQs</a><br/>" +
		"<div class='dv fq'>" +
		"<div id='horizontaldash'></div>" +
		"<a class='two' href='/developers_faqs_detail.php?ArticleTitle=ARTICLES'>> Articles</a><br/>" +
		//"<a class='two' href='/forum/viewforum.php'>Forum Postings</a><br/>" +
		"<div class='two'> &nbsp;</div>" +
		"<div class='two'> &nbsp;</div>" +
		"<div class='two'> &nbsp;</div>" +
		"</div>" +
		"<div id='horizontaldash'></div>" +
		"<a class='one dv sy' href='/developers_stuff.php'>Stuff for You</a><br/>" +
		"<div class='dv sy'>" +
		"<div id='horizontaldash'></div>" +
		"<a class='two' href='/developers_stuff_detail.php?ArticleTitle=FLO-FOLDER'>> Flo-Folder</a><br/>" +
		//"<a class='two' href='/developers_stuff_detail.php?ArticleTitle=AMAZON'>Amazon</a><br/>" +
		"<a class='two' href='/developers_stuff_detail.php?ArticleTitle=HIGHLIGHT CLASSES'>> Highlight Classes</a><br/>" +
		"<div class='two'> &nbsp;</div>" +
		"<div class='two'> &nbsp;</div>" +
		"</div>"
		,
		"<a class='top' href='/learning_center.php'>Learning Center</a><br/>",
		"<a class='top' href='/financial_center.php'>Financal Center</a><br/>",
		"<a class='top' href='/service_center.php'>Service Center</a><br/>"
		
	]

	
$( document ).ready( function() {
	$( ".topnav" ).each( function( k, v ){
		menuitem[k] = $( this ).parent();
		popup[k] = $( this ).after( 
			"<div>" +
			"<table border=0 cellpadding=0 cellspacing=0>" +
			"<tr>" +
			"<td class=top_left></td>" +
			"<td class=top_mid></td>" +
			"<td class=top_right></td>" +
			"</tr>" +
			"<tr>" +
			"<td class=mid_left></td>" +
			"<td class=mid_mid></td>" +
			"<td class=mid_right></td>" +
			"</tr>" +
			"<tr>" +
			"<td class=bot_left></td>" +
			"<td class=bot_mid></td>" +
			"<td class=bot_right></td>" +
			"</tr>" +
			"</table>" +
			"</div>"
		).next().css({
			'position' : 'absolute',
			'minWidth' : ( parseInt( $( this ).parent().outerWidth()) + 20 ) + 'px',
			'top' : $( this ).parent().position().top - 5,
			'left' : $( this ).parent().position().left-1,
			'zIndex' : 1
		});
		popup[k].children( ':first' ).children( ':first' ).children( ':first' ).next().children( ':first' ).next().html( popup_content[k] );
		$( 'a.one' ).each( function(){
			cla = $( this ).attr( 'class' ).replace( /one\s/, '' ).replace( /\s/g, '.');
			if( !lvl_two[$( 'div.' + cla ).attr( 'class' )] ){
				lvl_two[$( 'div.' + cla ).attr( 'class' )] = ( parseInt( $( 'div.' + cla ).height() ) + 3 ) + 'px' ;
				$( 'div.' + cla ).css({
					'height' : 0,
					'overflow' : 'hidden'
				}); 
			}
		});
		popup[k].hide();
		menuitem[k].mouseover( function(){
			clearTimeout( timer[k] );
			popup[k].show();
		});
		menuitem[k].mouseleave( function(){
			timer[k] = setTimeout( 'popup[' + k + '].hide()', 250 );
		});
		function rollup( $items, exception ){
			$items.each( function(){
				if( $( this ).attr( 'class' ) != $( 'div.' + exception ).attr( 'class' )){
				 	$( this ).stop().animate({ 'height' : 0 }, 1000 );
				}
			});
		}
		
	
		
		$( 'a.one' ).each( function(){
			cla = $( this ).attr( 'class' ).replace( /one\s/, '' ).replace( /\s/g, '.');
			$( 'a.' + cla ).unbind('mouseover').mouseover( function(){
				cla = $( this ).attr( 'class' ).replace( /one\s/, '' ).replace( /\s/g, '.');
				hold = cla.replace( /...$/, '' );
				rollup( $( 'div.' + hold ), cla);
				$( 'div.' + cla ).animate({ 'height' : lvl_two[$( 'div.' + cla ).attr( 'class' )] }, 1000);
			});
		});
	});
});
