// Drop Down Menu - Head Script
// copyright Stephen Chapman, 4th March 2005, 5th February 2006
// you may copy this menu provided that you retain the copyright notice

var fix = 0; var delay = 2000; var modd = 0;
var bar = new menuBar();
bar.addMenu('Home');
bar.addItem('index.htm','Main Page');
bar.addItem('youth_services.htm','Youth Services');
bar.addItem('http://perrotlibrary.blogspot.com/','Perrot Library Blog');
bar.addItem('http://www.facebook.com/pages/Old-Greenwich/Perrot-Memorial-Library/389151177914','Perrot on Facebook');
bar.addItem('http://twitter.com/perrotlibrary','Perrot on Twitter');
bar.addItem('http://foursquare.com/venue/147666','Perrot on foursquare');
bar.addItem('sitemap.htm','Site Map/Site Search');
bar.addItem('http://www.greenwichlibrary.org/','Greenwich Library');

bar.addMenu('Catalog');
bar.addItem('perrotcatalog.htm','Library Catalog');
bar.addItem('http://www.greenwichlibrary.org/Downloadable Library/','Downloadable Library');
bar.addItem('http://pac.greenwichlibrary.org/patroninfo','My Library Account');


bar.addMenu('Library Information');
bar.addItem('libraryhours.htm#libraryhours','Library Hours');
bar.addItem('libraryhours.htm#directions','Directions');
bar.addItem('events.htm','Events');
bar.addItem('technology.html','Technology');
bar.addItem('libraryinfo.htm#librarycards','Library Cards');
bar.addItem('libraryinfo.htm#lendingpolicies','Lending Policies');
bar.addItem('libraryinfo.htm#ill','Inter-Library Loans');
bar.addItem('libraryinfo.htm#conduct','Code of Conduct');
bar.addItem('libraryinfo.htm#longrangeplan','Long-Range Plan');
bar.addItem('libraryinfo.htm#boardofdirectors','Library Board Members');
bar.addItem('libraryinfo.htm#briefhistory','History');
bar.addItem('howdoi.html','How Do I...?');
bar.addItem('supportus.htm','Support the Library');
bar.addItem('contactus.htm','Contact Us');


bar.addMenu('Reference');
bar.addItem('http://www.perrotlibrary.org/askperrot.html','Ask Perrot');
bar.addItem('librarydatabases.html','Library Databases');
bar.addItem('http://www.iconn.org','iConn.org');
bar.addItem('links.htm','Helpful Links');

bar.addMenu('Youth Services');
bar.addItem('youth_services.htm','Youth Services Main');
bar.addItem('ys_current_programs.htm','Programs');
bar.addItem('ys_events.htm','Events');
bar.addItem('maywerecommend.html','Book Recommendations');
bar.addItem('ys_photos.htm','Photos');
bar.addItem('kidshistory1.htm','A History of the Library for Kids');
bar.addItem('bookclubsmain.htm','Book Clubs');
bar.addItem('perrot_museum_passes_2011.pdf','Museum Passes [PDF]');

bar.addMenu('New and Recommended');
bar.addItem('new_to_view.htm','New & Recommended');
bar.addItem('greatreads.htm','What We Are Reading at Perrot');
bar.addItem('http://pac.greenwichlibrary.org/search/ftlist','New Acquisitions');
bar.addItem('maywerecommend.html','Recommended for Kids');









// do not change anything below this line
var blc = '#339999';var blh = '#339999';var bla = '#339999';var lc = '#ffffff';var lh = '#000000';var la = '#000000';
function menuBar() {this.jj = -1;this.kk = 0;this.mO = new Array();this.addMenu = addMenu;this.addItem = addItem;this.writeBar = writeBar;this.writeDrop = writeDrop;}function addMenu(main) {this.mO[++this.jj] = new Object();this.mO[this.jj].main = main;this.kk = 0;this.mO[this.jj].link = new Array();this.mO[this.jj].name = new Array();}function addItem(link,name) {this.mO[this.jj].link[this.kk] = link;this.mO[this.jj].name[this.kk++] = name;}function writeBar() {for (var i=1;i <= this.mO.length; i++){document.write('<span id="navMenu'+i+'" class="mH">'+this.mO[i-1].main+'<\/span>');}}function writeDrop() {for (var i=1;i <= this.mO.length; i++){document.write('<div id="dropMenu'+i+'" class="mD">\r\n');for (var h=0;h < this.mO[i-1].link.length; h++){document.write('<a class="mL" href="'+this.mO[i-1].link[h]+'">'+this.mO[i-1].name[h]+'<\/a>\r\n');}document.write('<\/div>\r\n');}}
if (fix) window.onscroll=sMenu;window.onload=iMenu;var onm = null;var ponm = null;var podm = null;var ndm = bar.mO.length;
function posY() {return typeof window.pageYOffset != 'undefined' ? window.pageYOffset:document.documentElement.scrollTop? document.documentElement.scrollTop: document.body.scrollTop?document.body.scrollTop:0;}
function sMenu() {document.getElementById('mB').style.top = posY() + 'px'; for (i=1; i<=ndm; i++) {menuName = 'dropMenu' + i;odm = document.getElementById(menuName); if (onm) {var yPos = onm.offsetParent.offsetTop + onm.offsetParent.offsetHeight;odm.style.top = yPos + 'px';}}}
function iMenu() {if (document.getElementById) {document.onclick = mHide; for (i=1; i<=ndm; i++) {menuName = 'dropMenu' + i; navName = 'navMenu' + i; odm = document.getElementById(menuName); onm = document.getElementById(navName); odm.style.visibility = 'hidden'; onm.onmouseover =  mHov; onm.onmouseout = mOut;} onm = null;} return;}
function  mHov(e) {if (modd) clearTimeout(modd);document.onclick = null; honm = document.getElementById(this.id); if (honm != onm) {honm.style.color = lh; honm.style.backgroundColor = blh;} menuName = 'drop' + this.id.substring(3,this.id.length); odm = document.getElementById(menuName); if (podm == odm) {mHide(); return;} if (podm != null) mHide(); onm = document.getElementById(this.id); if ((ponm != onm ) || (podm == null)) {onm.style.color = la; onm.style.backgroundColor = bla;} if (odm) {xPos = onm.offsetParent.offsetLeft + onm.offsetLeft; yPos = onm.offsetParent.offsetTop + onm.offsetParent.offsetHeight; odm.style.left = xPos + 'px'; odm.style.top = yPos + 'px'; odm.style.visibility = 'visible'; odm.onmouseover = omov; odm.onmouseout = omot; podm = odm; ponm = onm;}}
function omov() {if (modd) clearTimeout(modd);}
function omot() {modd = setTimeout('mHide()',delay);}
function mOut(e) {modd = setTimeout('mHide()',delay);document.onclick = mHide;oonm = document.getElementById(this.id); if (oonm != onm) {oonm.style.color = lc; oonm.style.backgroundColor = blc;}}
function mHide() {document.onclick = null; if (podm) {podm.style.visibility = 'hidden'; podm = null; ponm.style.color = lc; ponm.style.backgroundColor = blc;} onm = null;}
if (fix) {var ag = navigator.userAgent.toLowerCase();var isG = (ag.indexOf('gecko') != -1);var isR=0;if (isG) {t = ag.split("rv:"); isR = parseFloat(t[1]);}if (isR && isR<1) setInterval('sMenu()',50);}



