/*****************************************\



* City of Mountlake Terrace Site driver   *



* By Stuart H. Schwartz                   *                                 



* syntaxerror1002@hotmail.com             *                               



\*****************************************/



// siteDriver.js



// Global variables, functions and includes for the site.







//var sitePath = "http://dell-precision/Mountlake_Terrace/"



var sitePath = "http://www.cityofmlt.com/"







var jsSupportPath = sitePath + "jsSupport/"



var imgPoolPath = sitePath +  "images/"



var imgBannerPath = imgPoolPath + "0807_std_hdr.jpg"

var imgBannerBGColor = "669ACC"

var imgBannerHeight = 208



var GetDirectionsPage = "http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=6100+219th+Street+SW,+Mountlake+Terrace,+WA&sll=37.0625,-95.677068&sspn=33.160552,58.447266&ie=UTF8&ll=47.801755,-122.317572&spn=0.006861,0.014269&z=16&iwloc=A"







var DisplayCityInfoCard = true



var DisplayCalendar = true



var DisplayFeaturedPhotographs = true







var CityInfoCardHTML = ""



CityInfoCardHTML += '<table width="139" cellpadding="0" cellspacing="1" bgcolor="#666666"><tr>'



CityInfoCardHTML += '<td class="mltPageBody" align="center" bgcolor="#CAD6E3"><div class="ContactCard"><font color="#0033CC"><strong>Mountlake Terrace<br>City Hall</strong></font><br>'



CityInfoCardHTML += '<a href="javascript:getDirections()">'



CityInfoCardHTML += '6100 219th Street SW, Suite 200<br>'



CityInfoCardHTML += 'Mountlake Terrace,<br>'



CityInfoCardHTML += 'WA 98043<br></a>'



CityInfoCardHTML += '<a href="http://www.cityofmlt.com/cityServices/cityServicesA-Z.htm">Phone Numbers</a><br>'



CityInfoCardHTML += 'Fax: 425-775-0420<br>'



CityInfoCardHTML += 'email: <a href="mailto:cityhall@ci.mlt.wa.us">cityhall@ci.mlt.wa.us</a><br>'



CityInfoCardHTML += 'Mon &#8211; Fri, 8am to 5pm <div></td>'



CityInfoCardHTML += '</tr></table></td>'







function getQueryString(queryName){var locationHref = document.location.href, queryStart = locationHref.lastIndexOf("?")



if(queryStart > 0)



{var queryStrings = locationHref.substring(queryStart + 1, locationHref.length)



var initQ = queryStrings.indexOf(queryName) + queryName.length + 1



var termQ = queryStrings.indexOf("&", initQ)



if(termQ == -1)  termQ = queryStrings.length



return(queryStrings.substring(initQ, termQ))



}else return("")}



function showImageForThumb(thumbnail, endText)



{var thumbPath = thumbnail.src 	



var fileInit = thumbPath.lastIndexOf("/")



var fileTerm = thumbPath.lastIndexOf(".")



if(fileTerm == -1) fileTerm = thumbPath.length



var fileName = thumbPath.substring(fileInit + 1, fileTerm - endText.length)



var fileExtention = thumbPath.substring(fileTerm, thumbPath.length)



var filePath = thumbPath.substring(0, fileInit + 1)



newWindow('', filePath + fileName + fileExtention)}



function newWindow(caption, path){ open(path, caption, "width=700,height=520,scrollbars=yes,menubar=yes,location=yes,status=yes,toolbar=yes,resizable=yes,dependent=true")}



function getFileTypeFromPath(path){return(path.substring(path.lastIndexOf(".") + 1, path.length))}



function getFileIconPathFromPath(path){switch(getFileTypeFromPath(path))



{case "pdf": return(sitePath + "images/typeIcons/pdf.gif")



case "doc": return(sitePath + "images/typeIcons/doc.gif")



case "xls": return(sitePath + "images/typeIcons/xls.gif")



case "txt": return(sitePath + "images/typeIcons/txt.gif")



case "bmp": return(sitePath + "images/typeIcons/bmp.gif")



case "gif": return(sitePath + "images/typeIcons/gif.gif")



case "jpg": return(sitePath + "images/typeIcons/jpg.gif")



case "htm": return(sitePath + "images/typeIcons/htm.gif")



case "html": return(sitePath + "images/typeIcons/htm.gif")



case "asp": return(sitePath + "images/typeIcons/htm.gif")}



return(sitePath + "images/typeIcons/unknown.gif")}



function MLTFileMenu(){var menuFiles = new Array(), menuFileCount = 0, d = document



this.addFile = function addFile(caption, hyperlink, date, size)



{var tempFile = new Object()



tempFile.caption = caption



tempFile.hyperlink = hyperlink



tempFile.date = date



tempFile.size = size



menuFiles[menuFileCount++] = tempFile};



this.writeMenu = function writeMenu()



{d.write('<table border="0" cellpadding="2" cellspacing="1" bgcolor="#000000">')



d.write('<tr bgcolor="666699">')



d.write('<td nowrap><div align="center"><strong><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">Date</font></strong></div></td>')



d.write('<td></td>')



d.write('<td nowrap><div align="center"><strong><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">Size</font></strong><div></td>')



d.write('<td nowrap><div align="center"><strong><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">File</font></strong></div></td>')



d.write('</tr>')



for(var cF = 0; cF < menuFileCount; cF++){d.write('<tr bgcolor="#FFFFFF"> ')



d.write('<td nowrap><font size="2" face="Arial, Helvetica, sans-serif">')



d.write(menuFiles[cF].date)



d.write('</font></td><td>')



d.write('<a href="' + menuFiles[cF].hyperlink + '" target="_top">')



d.write('<img alt="" src="' + getFileIconPathFromPath(menuFiles[cF].hyperlink) + '" width="18" height="18" border="0"></a></td>')



d.write('<td nowrap><font size="2" face="Arial, Helvetica, sans-serif"><div align="right">')



d.write(menuFiles[cF].size)



d.write('</dev></font></td><td>')



d.write('<a href="' + menuFiles[cF].hyperlink + '" target="_top">')



d.write(menuFiles[cF].caption)



d.write('</a></td></tr>')}



d.write('</table>')};}



function MLTListMenu(){var menuItems = new Array()



var menuItemCount = 0



var caption



this.setCaption = function setCaption(newCaption) { caption = newCaption };



this.getCaption = function getCaption() { return(caption) };



this.addItem = function addItem(caption, hyperlink)



{menuItems[menuItemCount] = new Object()



menuItems[menuItemCount].caption = caption



menuItems[menuItemCount].hyperlink = hyperlink



menuItems[menuItemCount++]



};



this.writeMenu = function writeMenu(d)



{ var hyperlinkPath, currentPath



var docPath = document.location.href



d.write('<table bgcolor="#666666" cellpadding="0" cellspacing="1" bgcolor="#333333"><tr><td align="left" valign="top" nowrap bgcolor="#DCDCDC">')



d.write(caption)



d.write('</td></tr><tr><td bgcolor="#FFFFFF" width="100%"><table width="100%" cellpadding="2" cellspacing="0">')



for(var cI = 0; cI < menuItemCount; cI++)



{d.write('<tr>')



var LinkHref = ""



if(menuItems[cI].hyperlink.length > 0)



{hyperlinkPath = menuItems[cI].hyperlink.toLowerCase()



currentPath = (docPath.substring(docPath.length - menuItems[cI].hyperlink.length, docPath.length)).toLowerCase() 



if(hyperlinkPath == currentPath) d.write('<td bgcolor="#AACCDD" class="mltLeftMenuLink" nowrap>')



else{d.write('<td nowrap onmouseover="this.bgColor=' + "'#66AACC'" + '" onmouseout="this.bgColor=' + "'#FFFFFF'" + '" ')



if(hyperlinkPath.substring(0, 4) == "http") d.write('onclick="document.location.href=' + "'" + (LinkHref = menuItems[cI].hyperlink) + "'" + '" style="cursor:pointer">')



else d.write('onclick="document.location.href=' + "'" + (LinkHref = sitePath + menuItems[cI].hyperlink) + "'" + '" class="mltLeftMenuLink" style="cursor:pointer">')}}else{d.write('<td nowrap onmouseover="this.bgColor=' + "'#66AACC'" + '" onmouseout="this.bgColor=' + "'#FFFFFF'" + '" ')



d.write('style="cursor:default">')}



if(LinkHref.length > 0) d.write('<a class="mltLeftMenuLink" href="' + LinkHref + '">')



d.write(menuItems[cI].caption)



if(LinkHref.length > 0) d.write('</a>')



d.write('</td></tr>')}



d.write('</table></td></tr></td></td></tr></table>')};}



function elementAbsolutePosition(ele)



{var tempPosition = null



if(ele != document && ele != null)



{tempPosition = elementAbsolutePosition(ele.parentNode)



if(ele.nodeName == "TD" || ele.nodeName == "TABLE"){tempPosition.x += ele.offsetLeft; tempPosition.y += ele.offsetTop}



}else{tempPosition = new Object(); tempPosition.x = 0; tempPosition.y = 0}



return(tempPosition)}



function elementWallSnap(targetPosition, ele){var tempPosition = new Object(), scrollLeft, scrollTop, docWidth, docHeight



if(navigator.appName == "Microsoft Internet Explorer"){var d = document



scrollLeft = d.body.scrollLeft



scrollTop = d.body.scrollTop



docWidth = d.body.clientWidth



docHeight = d.body.clientHeight}else{



if(window.scrollX) scrollLeft = window.scrollX



else scrollLeft = window.pageXOffset



if(window.scrollY) scrollTop = window.scrollY



else scrollTop  = window.pageYOffset



docWidth = window.innerWidth



docWidth = menuTables[0].clientTable.offsetWidth		



docHeight = window.innerHeight}



if(targetPosition.x + ele.offsetWidth > docWidth + scrollLeft ) tempPosition.x = docWidth - ele.offsetWidth + scrollLeft 



else if(targetPosition.x < scrollLeft) tempPosition.x = scrollLeft



else tempPosition.x = targetPosition.x



if(targetPosition.y + ele.offsetHeight > docHeight + scrollTop) tempPosition.y  = docHeight - ele.offsetHeight + scrollTop



else if(targetPosition.y < scrollTop) tempPosition.y = scrollTop



else tempPosition.y = targetPosition.y



return(tempPosition)}



function initPage(){document.write('<script language="JavaScript" src="' + jsSupportPath  + 'drivers/menuDriver.js" type="text/JavaScript"></script>')



document.write('<script language="JavaScript" src="' + jsSupportPath  + 'menu.js" type="text/JavaScript"></script>')



document.write('<script language="JavaScript" src="' + jsSupportPath  + 'drivers/calendarDriver.js" type="text/JavaScript"></script> ')



document.write('<script language="JavaScript" src="' + jsSupportPath  + 'calendar.js" type="text/JavaScript"></script>')



document.write('<script language="JavaScript" src="' + jsSupportPath  + 'drivers/featuredItemDriver.js" type="text/JavaScript"></script>')}



function writeSiteInterfaceTop(){var d = document



if(getQueryString("format") == "printable") return



d.write('<table cellpadding="0" cellspacing="0" style="width:100%; height:' + ((+imgBannerHeight) + 24) + 'px; background-color:' + imgBannerBGColor + '; background-position:left top; background-image:url(' + imgBannerPath + '); background-repeat:no-repeat">')



d.write('<tr><td valign="top">')



d.write('<table cellpadding="0" cellspacing="0" style="width:750px; height:' + imgBannerHeight + 'px" nowrap><tr><td>')



if(d.location.href.toLowerCase() != sitePath.toLowerCase()) d.write('<table cellpadding="0" cellspacing="0" title="Home" style="width:256px; height:' + imgBannerHeight + 'px; cursor:pointer" onclick="document.location.href=sitePath"><tr><td>&nbsp;</td></tr></table>')



else d.write('&nbsp;')



d.write('</td></tr></table>')



d.write('<form id="searchbox_009683377625280115243:1qbxjdlosua" action="http://www.google.com/search">')



d.write('<script language="JavaScript" type="text/JavaScript">writeMenu()</script>')



d.write('</form></td></tr></table>')}



function writeSiteInterfaceSide(){var d = document



if(getQueryString("format") == "printable") return



d.write('<table cellpadding="0" cellspacing="0" bgcolor="#000000">')



d.write('<tr><td bgcolor="#DCDCDC"><table width="139" cellpadding="0" cellspacing="0" bgcolor="#DCDCDC">')



d.write('<tr><td align="center" background="' +imgPoolPath + 'right-bar-seperator-white.jpg"><img src="http://www.google.com/coop/images/google_custom_search_smwide.gif" alt="Google Custom Search" /></td></tr>')



if(DisplayCalendar)



{d.write('<tr><td align="center" bgcolor="#DCDCDC">')



d.write('<script language="JavaScript" type="text/JavaScript">writeCalendar(); calendarSetMonth(currentMonthDelta)</script> ')



d.write('</td></tr>')}



d.write('<tr><td align="center" bgcolor="#DCDCDC">')



d.write('<img alt="" src="' +imgPoolPath + 'right-bar-seperator.jpg">')



d.write('<script language="JavaScript" type="text/JavaScript">writeCityInformationCard() </script>')



d.write('</td></tr>')



if(featuredItemCount > 0 && DisplayFeaturedPhotographs){d.write('<tr> <td align="center" bgcolor="DCDCDC">')



d.write('<img alt="" src="' +imgPoolPath + 'right-bar-seperator.jpg">')



d.write('<script language="JavaScript" type="text/JavaScript">writeFeaturedItems() </script>')



d.write('</td></tr>')}



d.write('</table></td></tr></table>')}



function writeCityInformationCard(){ if(DisplayCityInfoCard) document.write(CityInfoCardHTML)}



function writePrintable(){if(getQueryString("format") != "printable"){if(document.location.href.indexOf('?') < 0) document.write('<a style="font-size:11; font-family:Arial; font-color:666666 " href="' + document.location.href + '?format=printable' + '" target="_top">Printable Version</a>')



else document.write('<a style="font-size:11; font-family:Arial; font-color:666666 " href="' + document.location.href + '&format=printable' + '" target="_top">Printable Version</a>')}}



function getDirections(){open(GetDirectionsPage, "", "width=700,height=520,scrollbars=yes,menubar=yes,location=yes,status=yes,toolbar=yes,resizable=yes,dependent=true")}



// The following two blocks were produced by Macromedia Dreamweaver



function MM_reloadPage(init) {  //reloads the window if Nav4 resized



if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {



document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}



else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();}



MM_reloadPage(true);



function MM_findObj(n, d) { //v4.01



var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {



d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}



if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];



for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);



if(!x && d.getElementById) x=d.getElementById(n); return x;}



initPage()