//Chrome Drop Down Menu- Author: Dynamic Drive (http://www.dynamicdrive.com)
//Last updated: Jan 1st, 06'

var cssdropdown={
disappeardelay: 250, //set delay in miliseconds before menu disappears onmouseout

//No need to edit beyond here////////////////////////
dropmenuobj: null, ie: document.all, firefox: document.getElementById&&!document.all,

getposOffset:function(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
},

showhide:function(obj, e, visible, hidden){
if (this.ie || this.firefox)
this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px"
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
},

iecompattest:function(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
},

clearbrowseredge:function(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=this.ie && !window.opera? this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth
if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure)  //move menu to the left?
edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=this.ie && !window.opera? this.iecompattest().scrollTop : window.pageYOffset
var windowedge=this.ie && !window.opera? this.iecompattest().scrollTop+this.iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight
if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ //move up?
edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight
if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) //up no good either?
edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
},

dropit:function(obj, e, dropmenuID){
if (this.dropmenuobj!=null) //hide previous menu
this.dropmenuobj.style.visibility="hidden"
this.clearhidemenu()
if (this.ie||this.firefox){
obj.onmouseout=function(){cssdropdown.delayhidemenu()}
this.dropmenuobj=document.getElementById(dropmenuID)
this.dropmenuobj.onmouseover=function(){cssdropdown.clearhidemenu()}
this.dropmenuobj.onmouseout=function(){cssdropdown.dynamichide(e)}
this.dropmenuobj.onclick=function(){cssdropdown.delayhidemenu()}
this.showhide(this.dropmenuobj.style, e, "visible", "hidden")
this.dropmenuobj.x=this.getposOffset(obj, "left")
this.dropmenuobj.y=this.getposOffset(obj, "top")
this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px"
this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px"
}
},

contains_firefox:function(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
},

dynamichide:function(e){
var evtobj=window.event? window.event : e
//if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement))
this.delayhidemenu()
//else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
//this.delayhidemenu()
},

delayhidemenu:function(){
this.delayhide=setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden'",this.disappeardelay)
},

clearhidemenu:function(){
if (this.delayhide!="undefined")
clearTimeout(this.delayhide)
}
}

function openwin(theURL,winName,features) {
  	window.open(theURL,winName,features);
}



function removeChildNodes( ctrl ) {
  while ( ctrl.childNodes[ 0 ] ) {
	ctrl.removeChild( ctrl.childNodes[ 0 ] );
  }
}

function createAnchor( href, text ) {
	eAnchor = document.createElement( 'a' );
	eAnchor.setAttribute( 'href', href );
	eAnchor.appendChild( document.createTextNode( text ) );
	
	return eAnchor;
}

function constructNav() {
	
	// News
	removeChildNodes( document.getElementById( 'dropmenu1' ) );
	document.getElementById( 'dropmenu1' ).appendChild( createAnchor( '#', 'County' ) );
	document.getElementById( 'dropmenu1' ).appendChild( createAnchor( 'http://www.dailyherald.com/news/cook.asp', '\u2022 Cook' ) );
	document.getElementById( 'dropmenu1' ).appendChild( createAnchor( 'http://www.dailyherald.com/news/dupage.asp', '\u2022 DuPage' ) );
	document.getElementById( 'dropmenu1' ).appendChild( createAnchor( 'http://www.dailyherald.com/news/kane.asp', '\u2022 Kane' ) );
	document.getElementById( 'dropmenu1' ).appendChild( createAnchor( 'http://www.dailyherald.com/news/lake.asp', '\u2022 Lake' ) );
	document.getElementById( 'dropmenu1' ).appendChild( createAnchor( 'http://www.dailyherald.com/news/mchenry.asp', '\u2022 McHenry' ) );
	document.getElementById( 'dropmenu1' ).appendChild( createAnchor( 'http://www.dailyherald.com/news/illinois.asp', 'Illinois' ) );
	document.getElementById( 'dropmenu1' ).appendChild( createAnchor( 'http://www.dailyherald.com/news/world.asp', 'Nation & World' ) );
	document.getElementById( 'dropmenu1' ).appendChild( createAnchor( 'http://www.legacy.com/dailyherald/Obituaries.asp', 'Obituaries' ) );
	document.getElementById( 'dropmenu1' ).appendChild( createAnchor( 'http://www.dailyherald.com/opinion/index.asp', 'Opinion' ) );
	document.getElementById( 'dropmenu1' ).appendChild( createAnchor( 'http://www.dailyherald.com/special/election/index.asp', 'Politics' ) ); 
	document.getElementById( 'dropmenu1' ).appendChild( createAnchor( 'http://www.dailyherald.com/special', 'Special Reports' ) );

	// Business
	removeChildNodes( document.getElementById( 'dropmenu2' ) );
	document.getElementById( 'dropmenu2' ).appendChild( createAnchor( 'http://finance.dailyherald.com/dailyherald', 'Stocks / Market Info' ) );
	document.getElementById( 'dropmenu2' ).appendChild( createAnchor( 'http://www.dailyherald.com/business/investments.asp', 'Your Investments' ) );
	document.getElementById( 'dropmenu2' ).appendChild( createAnchor( 'http://www.dailyherald.com/business/calendar.asp', 'Local Calendar' ) );
	document.getElementById( 'dropmenu2' ).appendChild( createAnchor( 'http://www.dailyherald.com/business/briefs.asp', 'Local Briefs' ) );
	document.getElementById( 'dropmenu2' ).appendChild( createAnchor( 'http://dailyherald.mycapture.com/mycapture/index.asp?view=yes&groupingid=10934', 'Photo Reprints' ) );
	document.getElementById( 'dropmenu2' ).appendChild( createAnchor( 'http://www.dailyherald.com/business/index.asp', 'More Business...' ) );
	
	// Sports
	removeChildNodes( document.getElementById( 'dropmenu3' ) );
	document.getElementById( 'dropmenu3' ).appendChild( createAnchor( 'http://www.dailyherald.com/localsports/index.asp', 'Local' ) );
	document.getElementById( 'dropmenu3' ).appendChild( createAnchor( 'http://www.dailyherald.com/sports/bears.asp', 'Bears' ) );
	document.getElementById( 'dropmenu3' ).appendChild( createAnchor( 'http://www.dailyherald.com/sports/blackhawks.asp', 'Blackhawks' ) );
	document.getElementById( 'dropmenu3' ).appendChild( createAnchor( 'http://www.dailyherald.com/sports/bulls.asp', 'Bulls' ) );
	document.getElementById( 'dropmenu3' ).appendChild( createAnchor( 'http://www.dailyherald.com/sports/cubs.asp', 'Cubs' ) );
	document.getElementById( 'dropmenu3' ).appendChild( createAnchor( 'http://www.dailyherald.com/sports/fire.asp', 'Fire' ) );
	document.getElementById( 'dropmenu3' ).appendChild( createAnchor( 'http://www.dailyherald.com/sports/sky.asp', 'Sky' ) );
	document.getElementById( 'dropmenu3' ).appendChild( createAnchor( 'http://www.dailyherald.com/sports/whitesox.asp', 'White Sox' ) );
	document.getElementById( 'dropmenu3' ).appendChild( createAnchor( 'http://www.dailyherald.com/sports/wolves.asp', 'Wolves' ) );
	document.getElementById( 'dropmenu3' ).appendChild( createAnchor( 'http://dailyherald.mycapture.com/mycapture/index.asp?view=yes&groupingid=5974', 'Photo Reprints' ) );
	document.getElementById( 'dropmenu3' ).appendChild( createAnchor( 'http://www.dailyherald.com/sports/index.asp', 'More Sports...' ) );

	//Entertainment
	removeChildNodes( document.getElementById( 'dropmenu4' ) );
	document.getElementById( 'dropmenu4' ).appendChild( createAnchor( 'http://alliance.zap2it.com/zp_mt_front_page/?site_code=ilahhe', 'Movie Times' ) );
	document.getElementById( 'dropmenu4' ).appendChild( createAnchor( 'http://www.dailyherald.com/timeout/crossword.asp', 'Puzzles' ) );
	document.getElementById( 'dropmenu4' ).appendChild( createAnchor( 'http://www.dailyherald.com/timeout/crossword.asp', '\u2022 Crossword' ) );
	document.getElementById( 'dropmenu4' ).appendChild( createAnchor( 'http://www.dailyherald.com/timeout/crossword.asp', '\u2022 Sudoku' ) );
	document.getElementById( 'dropmenu4' ).appendChild( createAnchor( 'http://tvlistings.zap2it.com/partners/index.asp?partner_id=ilahhe', 'TV Listings' ) );
	//document.getElementById( 'dropmenu4' ).appendChild( createAnchor( 'http://www.people2people.com/?connect=dailyherald', 'Personals' ) );
	document.getElementById( 'dropmenu4' ).appendChild( createAnchor( 'http://www.dailyherald.com/timeout/index.asp', 'Time out!' ) );

	// Real Estate
	removeChildNodes( document.getElementById( 'dropmenu5' ) );
	document.getElementById( 'dropmenu5' ).appendChild( createAnchor( 'http://homes.dailyherald.com', 'Search for Homes' ) );
	document.getElementById( 'dropmenu5' ).appendChild( createAnchor( 'http://www.dailyherald.com/realestate/propertytransfers.asp', 'Property Transfers' ) );
	document.getElementById( 'dropmenu5' ).appendChild( createAnchor( 'http://chicago.dailyherald.il-foreclosure.com/', 'Foreclosures' ) );
	document.getElementById( 'dropmenu5' ).appendChild( createAnchor( 'http://homes.dailyherald.com/index.php#news', 'Real Estate Articles' ) );
	document.getElementById( 'dropmenu5' ).appendChild( createAnchor( 'http://dailyherald.interest.com', 'Mortgage Calculator' ) );
	document.getElementById( 'dropmenu5' ).appendChild( createAnchor( 'http://homes.dailyherald.com', 'More Real Estate...' ) );

	// LifeStyle
	removeChildNodes( document.getElementById( 'dropmenu6' ) );
	document.getElementById( 'dropmenu6' ).appendChild( createAnchor( 'http://www.dailyherald.com/commitments', 'Commitments' ) );
	document.getElementById( 'dropmenu6' ).appendChild( createAnchor( 'http://www.dailyherald.com/commitments/select.asp?wea=a', '\u2022 Anniversaries' ) );
	document.getElementById( 'dropmenu6' ).appendChild( createAnchor( 'http://www.dailyherald.com/commitments/select.asp?wea=e', '\u2022 Engagements' ) );
	document.getElementById( 'dropmenu6' ).appendChild( createAnchor( 'http://www.dailyherald.com/commitments/select.asp?wea=w', '\u2022 Weddings' ) );
	document.getElementById( 'dropmenu6' ).appendChild( createAnchor( 'http://www.dailyherald.com/commitments/forms/index.asp', '\u2022 Place a Commitment' ) );
	document.getElementById( 'dropmenu6' ).appendChild( createAnchor( 'http://www.dailyherald.com/food/index.asp', 'Food' ) );
	document.getElementById( 'dropmenu6' ).appendChild( createAnchor( 'http://www.dailyherald.com/health/index.asp', 'Health & Fitness' ) );
	document.getElementById( 'dropmenu6' ).appendChild( createAnchor( 'http://www.dailyherald.com/homegarden/index.asp', 'Home & Garden' ) );
	document.getElementById( 'dropmenu6' ).appendChild( createAnchor( 'http://www.dailyherald.com/suburbanliving/index.asp', 'Life & Entertainment' ) );
	document.getElementById( 'dropmenu6' ).appendChild( createAnchor( 'http://www.dailyherald.com/travel/index.asp', 'Travel' ) );

	// Marketplace
	removeChildNodes( document.getElementById( 'dropmenu7' ) );
	document.getElementById( 'dropmenu7' ).appendChild( createAnchor( 'http://www.dailyherald.com/classified/ad_index.asp', 'Place an Ad' ) );
	document.getElementById( 'dropmenu7' ).appendChild( createAnchor( 'http://www.dailyherald.com/classified/autos.asp', 'Autos' ) );
	document.getElementById( 'dropmenu7' ).appendChild( createAnchor( 'http://www.dailyherald.com/classified/autos.asp', '\u2022 Buy a Car' ) );
	document.getElementById( 'dropmenu7' ).appendChild( createAnchor( 'http://www.dailyherald.com/classified/ad_index.asp', '\u2022 Sell a Car' ) );
	document.getElementById( 'dropmenu7' ).appendChild( createAnchor( 'http://homes.dailyherald.com', 'Homes' ) );
	document.getElementById( 'dropmenu7' ).appendChild( createAnchor( 'http://homes.dailyherald.com', '\u2022 Find a Home' ) );
	document.getElementById( 'dropmenu7' ).appendChild( createAnchor( 'http://www.dailyherald.com/classified/ad_index.asp', '\u2022 Sell a Home' ) );
	document.getElementById( 'dropmenu7' ).appendChild( createAnchor( 'http://www.dailyherald.com/jobs/', 'Jobs' ) );
	document.getElementById( 'dropmenu7' ).appendChild( createAnchor( 'http://www.dailyherald.com/jobs/', '\u2022 Find a Job' ) );
	document.getElementById( 'dropmenu7' ).appendChild( createAnchor( 'http://www.dailyherald.com/jobs/post/', '\u2022 Post a Job' ) );
	document.getElementById( 'dropmenu7' ).appendChild( createAnchor( 'http://adsonline.dailyherald.com/AS/Home.aspx?advid=800021', 'Service Directory' ) );
	document.getElementById( 'dropmenu7' ).appendChild( createAnchor( 'http://www.dailyherald.com/classified/index.asp', 'More Classifieds' ) );
	document.getElementById( 'dropmenu7' ).appendChild( createAnchor( 'http://www.dailyherald.com/garagesales/', '\u2022 Garage Sales' ) );
	//document.getElementById( 'dropmenu7' ).appendChild( createAnchor( 'http://www.people2people.com/?connect=dailyherald', 'Personals' ) );
	document.getElementById( 'dropmenu7' ).appendChild( createAnchor( 'http://dailyherald.mycapture.com/mycapture/index.asp', 'Photo Reprints' ) );
}