var emailRegEx = new RegExp("^[\\w\\.-]+@(?:[\\w-]+\\.)*[\\w-]+\\.\\w+$"); String.prototype.trim = function () { return this.replace(/^\s*|\s*$/,""); } function getElement (obj) { if (typeof obj == "string") { return document.all ? document.all(obj) : document.getElementById ? document.getElementById(obj) : document.layers ? document.layers[obj] : null; } else { return obj; } } function getSelectedValue (box) { return (box.selectedIndex >= 0) ? box[box.selectedIndex].value : "" ; } function isValidEmail (email) { return emailRegEx.test(email); } function AGOnload () { initDHTMLAPI(); //alert(document.body); //alert("isCSS: " + isCSS + ", isW3C: " + isW3C + ", isIE4: " + isIE4 + ", isNN4: " + isNN4 + ", isIE6CSS: " + isIE6CSS); if (getElement('ri_box') && getElement('ri_content') && getElement('footercontainer')) { var riw = getObjectWidth('ri_box'); var rih = getObjectHeight('ri_box'); var ril = getOffsetLeft('ri_box'); var rit = getOffsetTop('ri_box'); var ric = getObjectHeight('ri_content'); //alert("RI Box: W = " + riw + ", H = " + rih + ", T = " + rit + ", C = " + ric); //alert("RI Box: L = " + ril + ", T = " + rit + ", H = " + rih); //alert("RI Content: H = " + ric); //var cl = getObjectLeft('footercontainer'); //var ct = getObjectTop('footercontainer'); var cl = getOffsetLeft('footercontainer'); var ct = getOffsetTop('footercontainer'); //alert("Footer Area: L = " + cl + ", T = " + ct); var newheight = ct - rit - rih + ric; //if (navigator.appName!="Netscape") if (navigator.appName=="Microsoft Internet Explorer") { newheight -= 5; } //alert("Newheight: " + newheight); getElement('ri_content').style.height=newheight+'px'; } } function validateSearch (form) { if (form.zip.value=="") { alert("Please enter your zip code."); return false; } //if (form.zip.value.match(/[^0-9]/i)) { alert("Please enter your zip code."); return false; } if (form.zip.value.match(/[^0-9\-]/i)) { alert("Please enter your zip code."); return false; } return true; } function validateCitySearch (form) { if (form.city.value=="" || form.city.value=="Enter City") { alert("Please enter your city."); return false; } if (form.state.selectedIndex==0) { alert("Please enter your state."); return false; } return true; } function validateQuery (form) { if (form.query.value=="" || form.query.value=="Search") { alert("Please enter a search term."); return false; } return true; } function validateEmailForm (form) { if (form.to.value=="") { alert("Please enter the recipient's email address."); return false; } var errs = 0; var addrs = form.to.value.split(","); for (var i = 0; i < addrs.length; i++) { if (!isValidEmail(addrs[i].trim())) { errs++; } } if (errs) { alert("You have entered an invalid recipient email address"); return false; } if (form.from.value=="") { alert("Please enter your email address."); return false; } if (!isValidEmail(form.from.value)) { alert("You have entered an invalid From address"); return false; } return true; } function activateTab (tabnum, tabcount) { var v = document.getElementsByTagName("td"); for (var i = 0; i < v.length; i++) { curid = v[i].id; if (curid.indexOf("tab_") != -1) { curstate = curid.substring(4,5); curtab = curid.substring(5,6); if (curtab == tabnum) { v[i].className = (curstate=="m") ? "tabon_"+curstate+tabcount : "tabon_"+curstate; getElement("tabcontent"+curtab).style.display = "inline"; } else { v[i].className = (curstate=="m") ? "taboff_"+curstate+tabcount : "taboff_"+curstate; getElement("tabcontent"+curtab).style.display = "none"; } } } } function activatePhoto (photonum) { var v = document.getElementsByTagName("a"); for (var i = 0; i < v.length; i++) { curid = v[i].id; if (curid.indexOf("photolink_") != -1) { curnum = curid.substring(10); if (curnum == photonum) { v[i].className = "photo_on"; getElement("photoimg_"+curnum).style.display = ""; } else { v[i].className = "photo_off"; getElement("photoimg_"+curnum).style.display = "none"; } } } } function toggleDiv (id) { getElement(id).style.display = (getElement(id).style.display=="none") ? "" : "none" ; } function ShowLayer (id) { getElement(id).style.visibility = "visible"; } function ShowLayerCMG (link, id, offset, top) { //alert(link.offsetLeft); positionMenu(link, id); getElement(id).style.visibility = "visible"; } function HideLayer (id) { getElement(id).style.visibility = "hidden"; } function OpenPrintVersion (url) { //window.open(url,'','width=700,height=600,scrollbars=1'); window.open('/printver.html?url='+escape(url),'','width=700,height=600,scrollbars=1'); } function OpenEmailID (cid) { window.open('/emailfriend.html?cid='+cid,'','width=500,height=600,scrollbars=1'); } function OpenEmail (url, title) { window.open('/emailfriend.html?url='+url+'&title='+title,'','width=500,height=400,scrollbars=1'); } function positionMenu (link, menuid) { var offsetLeft = getOffsetLeft(link); var offsetTop = getOffsetTop(link); // Account for height of text link offsetTop += getElement(link).offsetHeight; setDivLeftTop(menuid, offsetLeft, offsetTop); } function toggleGlossary (obj, id) { var offsetLeft = parseInt(getOffsetLeft(obj)); var offsetTop = parseInt(getOffsetTop(obj)); var divWidth = parseInt(getDivWidth(id)); var scrollWidth = 16; // Width of right scrollbar var addlPadding = 10; // Additional right side padding // Account for height of text link offsetTop += getElement(obj).offsetHeight; // Adjust for glossary entry that goes off right side of screen //alert("Right side of div: " + (offsetLeft+divWidth)); if (offsetLeft+divWidth > screen.width-scrollWidth-addlPadding) { offsetLeft -= (offsetLeft+400-screen.width+scrollWidth+addlPadding); } setDivLeftTop(id, offsetLeft, offsetTop); getElement(id).style.display = (getElement(id).style.display=="none") ? "" : "none" ; } function setDivLeftTop (id, left, top) { //alert("Setting '" + id + "' at " + left + ", " + top); getElement(id).style.left = left + "px"; getElement(id).style.top = top + "px"; } function getDivWidth (id) { var w = getElement(id).style.width.replace(/px$/i, ""); return (isNaN(w)) ? 0 : w; } function getOffsetLeft (obj) { var theObj = getElement(obj); var offsetTrail = theObj; var offsetLeft = 0; //var lstr = ""; while (offsetTrail) { //if (offsetTrail.style.position != "relative") { offsetLeft += offsetTrail.offsetLeft; } offsetLeft += offsetTrail.offsetLeft; //if (lstr!="") { lstr += ","; } //lstr += offsetTrail.offsetLeft; offsetTrail = offsetTrail.offsetParent; } if (navigator.userAgent.indexOf("Mac")!=-1 && typeof document.body.leftMargin!="undefined") { offsetLeft += document.body.leftMargin; } //alert("OffsetTrail: " + lstr); return offsetLeft; } function getOffsetTop (obj) { var theObj = getElement(obj); var offsetTrail = theObj; var offsetTop = 0; //var offsetTop = theObj.offsetHeight; // To account for height of text //var hstr = ""; while (offsetTrail) { //if (offsetTrail.style.position != "relative") { offsetTop += offsetTrail.offsetTop; } offsetTop += offsetTrail.offsetTop; //if (hstr!="") { hstr += ","; } //hstr += offsetTrail.offsetTop; offsetTrail = offsetTrail.offsetParent; } if (navigator.userAgent.indexOf("Mac")!=-1 && typeof document.body.leftMargin!="undefined") { offsetTop += document.body.topMargin; } //alert("OffsetTrail: " + hstr); return offsetTop; }