// BAKE AND EAT COOKIES function setCookie(name, value) { var date = new Date(); date.setTime(date.getTime() + (1 * 24 * 60 * 60 * 1000)); var expires = "; expires=" + date.toGMTString(); d.cookie = name + "=" + value + expires + "; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = d.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); } return null; } // DEFAULT VALUES var W = 0; //placeholder for document width var H = 0; //placeholder for document height var d = document; var workAreaWidth = 720; var vert = 275; var gM = 0.618; // SWITCH FOR IE VS. DOM COMPLIANT (to get around any weirdness there might be between browser css differences) var detect = navigator.userAgent.toLowerCase(); var ie = (getElm && d.all); var mie = (d.all && (detect.indexOf("mac")!=-1)); var dom = (getElm && !d.all); var op = (detect.indexOf("opera")!=-1); if (window.innerWidth) { W = window.innerWidth; H = window.innerHeight; } else if (d.documentElement.offsetWidth) { W = d.documentElement.offsetWidth; H = d.documentElement.offsetHeight; } else if (d.body) { W = d.body.offsetWidth; H = d.body.offsetHeight; } // INIT ROUTINE - PRE 'DRAWING', post load window.onload = function(e) { if (getElm) { if (getElm("article")) { tameThisList("article"); } } } function tameThisList(mode) { var liNode = d.getElementsByTagName('li'); var previewW = W * .62 * .15; for (var i = 0; i < liNode.length; i++) { if (liNode[i].getElementsByTagName('img')[0]){ // store orig image dims var imgNode = liNode[i].getElementsByTagName('img')[0]; var imgW = imgNode.getAttribute('width'); var imgH = imgNode.getAttribute('height'); //listImageWidths.push(imgW); //listImageHeights.push(imgH); liNode[i].getElementsByTagName('var')[0].innerHTML = imgW; liNode[i].getElementsByTagName('var')[1].innerHTML = imgH; // deal with large images if (mode == "article") { // use the image as a background var imgSrc = imgNode.getAttribute('src'); //alert(imgSrc); //liNode[i].style.backgroundImage = "url(" + imgSrc + ");"; //imgNode.className = "displayOff"; //imgNode.style.width = getElm("flash").getAttribute('width') + "px"; } else { // remove image float if a large image is being used to maintain copy legibility if (imgW > 350) { liNode[i].getElementsByTagName('div')[0].className = "listEntryDetail clearBoth"; } } } // only trigger if there are too many list items if (liNode.length >= 10) { // hide the body of each list item liNode[i].getElementsByTagName('div')[0].className = "displayOff"; // add an opening button graphic liNode[i].getElementsByTagName('h3')[0].className = "buttonShow"; // add the hover function onmouseover and onmouseout liNode[i].getElementsByTagName('h3')[0].onmouseover=function() { if (this.className == "buttonShow") { this.className = "buttonShow hoverH3"; } } liNode[i].getElementsByTagName('h3')[0].onmouseout=function() { if (this.className == "buttonShow hoverH3") { this.className = "buttonShow"; } } // resize image to thumbnail preview size var imgNode = liNode[i].getElementsByTagName('img')[0]; if (imgNode) { var imgW = imgNode.getAttribute('width'); var imgH = imgNode.getAttribute('height'); // store the real dims //listImageWidths.push(imgW); //listImageHeights.push(imgH); //listW = liNode[i].getAttribute('width'); //var targW = imgNode.getAttribute('width') * 0.15; var targW = previewW; var targH = imgH * (targW / imgW); imgNode.setAttribute('width',targW); imgNode.setAttribute('height',targH); } // set up triggering button liNode[i].getElementsByTagName('h3')[0].onclick = function () { // revert the size the image var imgNode = this.parentNode.getElementsByTagName('img')[0]; if (imgNode) { var varNode = this.parentNode.getElementsByTagName('var'); var imgW = varNode[0].innerHTML; var imgH = varNode[1].innerHTML; imgNode.setAttribute('width',imgW); imgNode.setAttribute('height',imgH); } this.className = 'clean'; // display it this.parentNode.getElementsByTagName('div')[0].className = "displayOn"; }; } } } function getElm (elm) { var e = d.getElementById(elm); if (e) { return e; } else { return null; } } function checkform(of) { var reqfields,em,i,f,ty; if(d.getElementById('required')) { reqfields=d.getElementById('required').value.split(','); if(d.getElementById('errormsg')){ em=d.getElementById('errormsg'); em.parentNode.removeChild(em); } for(i=0;i< reqfields.length;i++) { f=d.getElementById(reqfields[i]); if(f.previousSibling && /img/i.test(f.previousSibling.nodeName)){ f.parentNode.removeChild(f.previousSibling); } f.style.background='transparent'; if(f){ ty=f.type.toLowerCase(); switch(ty) { case 'text': if(f.value==''){adderr(f.id,of)} break; case 'textarea': if(f.value==''){adderr(f.id,of)} break; case 'checkbox': if(!f.checked){adderr(f.id,of)} break; /* extend as needed */ } } } } if(d.getElementById('errormsg')) { return false; } } function adderr(id,of) { var se,i,nli,na; i=d.createElement('img'); i.src='images/contactFieldAlert.png'; i.alt='Error'; i.title='This field has an error!'; se=d.getElementById(id); se.parentNode.insertBefore(i,se) // se.style.background='#fcc'; if(!d.getElementById('errormsg')){ var em=d.createElement('p'); em.id='errormsg'; em.appendChild(d.createTextNode('Please enter or change the fields marked with a ')) i=d.createElement('img'); i.src='images/contactFieldAlert.png'; i.alt='Error'; i.title='This field has an error!'; em.appendChild(i); for(var i=0;i< of.getElementsByTagName('input').length;i++) { if(/submit/i.test(of.getElementsByTagName('input')[i].getAttribute('type'))) { var sb=of.getElementsByTagName('input')[i]; break; } } /* em.style.border='2px solid #c00'; */ em.style.padding='5px'; em.style.width='40em'; sb.parentNode.insertBefore(em,sb); } if(id=='email' && !isEmailAddr(d.getElementById(id).value)){ pn=d.createElement('p'); pn.appendChild(d.createTextNode('before trying again')) d.getElementById('errormsg').appendChild(pn); } } function isEmailAddr(str) { return str.match(/^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/); } /* * QTObject embed * http://blog.deconcept.com/2005/01/26/web-standards-compliant-javascript-quicktime-detect-and-embed/ * * by Geoff Stearns (geoff@deconcept.com, http://www.deconcept.com/) * * v1.0.2 - 02-16-2005 * * Embeds a quicktime movie to the page, includes plugin detection * * Usage: * * myQTObject = new QTObject("path/to/mov.mov", "movid", "width", "height"); * myQTObject.altTxt = "Upgrade your Quicktime Player!"; // optional * myQTObject.addParam("controller", "false"); // optional * myQTObject.write(); * */ QTObject = function(mov, id, w, h) { this.mov = mov; this.id = id; this.width = w; this.height = h; this.redirect = ""; this.sq = d.location.search.split("?")[1] || ""; this.altTxt = "This content requires the QuickTime Plugin. Download QuickTime Player."; this.bypassTxt = "

Already have QuickTime Player? Click here.

"; this.params = new Object(); this.doDetect = getQueryParamValue('detectqt'); } QTObject.prototype.addParam = function(name, value) { this.params[name] = value; } QTObject.prototype.getParams = function() { return this.params; } QTObject.prototype.getParam = function(name) { return this.params[name]; } QTObject.prototype.getParamTags = function() { var paramTags = ""; for (var param in this.getParams()) { paramTags += ''; } if (paramTags == "") { paramTags = null; } return paramTags; } QTObject.prototype.getHTML = function() { var qtHTML = ""; if (navigator.plugins && navigator.plugins.length) { // not ie qtHTML += ''; this.addParam("src", this.mov); if (this.getParamTags() != null) { qtHTML += this.getParamTags(); } qtHTML += ''; } return qtHTML; } QTObject.prototype.getVariablePairs = function() { var variablePairs = new Array(); for (var name in this.getVariables()) { variablePairs.push(name + "=" + escape(this.getVariable(name))); } if (variablePairs.length > 0) { return variablePairs.join("&"); } else { return null; } } QTObject.prototype.write = function(elementId) { if(isQTInstalled() || this.doDetect=='false') { if (elementId) { d.getElementById(elementId).innerHTML = this.getHTML(); } else { d.write(this.getHTML()); } } else { if (this.redirect != "") { d.location.replace(this.redirect); } else { if (elementId) { d.getElementById(elementId).innerHTML = this.altTxt +""+ this.bypassTxt; } else { d.write(this.altTxt +""+ this.bypassTxt); } } } } function isQTInstalled() { var qtInstalled = false; qtObj = false; if (navigator.plugins && navigator.plugins.length) { for (var i=0; i < navigator.plugins.length; i++ ) { var plugin = navigator.plugins[i]; if (plugin.name.indexOf("QuickTime") > -1) { qtInstalled = true; } } } else { execScript('on error resume next: qtObj = IsObject(CreateObject("QuickTimeCheckObject.QuickTimeCheck.1"))','VBScript'); qtInstalled = qtObj; } return qtInstalled; } /* get value of querystring param */ function getQueryParamValue(param) { var q = d.location.search; var detectIndex = q.indexOf(param); var endIndex = (q.indexOf("&", detectIndex) != -1) ? q.indexOf("&", detectIndex) : q.length; if(q.length > 1 && detectIndex != -1) { return q.substring(q.indexOf("=", detectIndex)+1, endIndex); } else { return ""; } } /* * FlashObject embed * by Geoff Stearns (geoff@deconcept.com, http://www.deconcept.com/) * * v1.1.1 - 05-17-2005 * * writes the embed code for a flash movie, includes plugin detection * * Usage: * * myFlash = new FlashObject("path/to/swf.swf", "swfid", "width", "height", flashversion, "backgroundcolor"); * myFlash.write("objId"); * * for best practices, see: * http://blog.deconcept.com/2005/03/31/proper-flash-embedding-flashobject-best-practices/ * */ var FlashObject = function(swf, id, w, h, ver, c) { this.swf = swf; this.id = id; this.width = w; this.height = h; this.version = ver; this.align = "middle"; this.params = new Object(); this.variables = new Object(); this.redirect = ""; this.sq = d.location.search.split("?")[1] || ""; this.bypassTxt = "

Already have Macromedia Flash Player? Click here if you have Flash Player "+ this.version +" installed.

"; if (c) this.color = this.addParam('bgcolor', c); this.addParam('quality', 'high'); // default to high this.doDetect = getQueryParamValue('detectflash'); } var FOP = FlashObject.prototype; FOP.addParam = function(name, value) { this.params[name] = value; } FOP.getParams = function() { return this.params; } FOP.getParam = function(name) { return this.params[name]; } FOP.addVariable = function(name, value) { this.variables[name] = value; } FOP.getVariable = function(name) { return this.variables[name]; } FOP.getVariables = function() { return this.variables; } FOP.getParamTags = function() { var paramTags = ""; for (var param in this.getParams()) { paramTags += ''; } return (paramTags == "") ? false:paramTags; } FOP.getHTML = function() { var flashHTML = ""; if (navigator.plugins && navigator.mimeTypes.length) { // netscape plugin architecture flashHTML += ''; flashHTML += ''; if (this.getParamTags()) { flashHTML += this.getParamTags(); } if (this.getVariablePairs() != null) { flashHTML += ''; } flashHTML += ''; } return flashHTML; } FOP.getVariablePairs = function() { var variablePairs = new Array(); for (var name in this.getVariables()) { variablePairs.push(name + "=" + escape(this.getVariable(name))); } return (variablePairs.length > 0) ? variablePairs.join("&"):false; } FOP.write = function(elementId) { if(detectFlash(this.version) || this.doDetect=='false') { if (elementId) { d.getElementById(elementId).innerHTML = this.getHTML(); } else { d.write(this.getHTML()); } } else { if (this.redirect != "") { d.location.replace(this.redirect); } else if (this.altTxt) { if (elementId) { d.getElementById(elementId).innerHTML = this.altTxt +""+ this.bypassTxt; } else { d.write(this.altTxt +""+ this.bypassTxt); } } } } /* ---- detection functions ---- */ function getFlashVersion() { var flashversion = 0; if (navigator.plugins && navigator.mimeTypes.length) { var x = navigator.plugins["Shockwave Flash"]; if(x && x.description) { var y = x.description; flashversion = y.charAt(y.indexOf('.')-1); } } else { result = false; for(var i = 15; i >= 3 && result != true; i--){ execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript'); flashversion = i; } } return flashversion; } function detectFlash(ver) { return (getFlashVersion() >= ver) ? true:false; } /* add Array.push if needed */ if(Array.prototype.push == null){ Array.prototype.push = function(item) { this[this.length] = item; return this.length; } } function writeGallery(target,src,width,height,ranOrSeq,timer,fadetime,scale,quality,pictograms) { var fo = new FlashObject("galleryCrossfade.swf", "gallery", width, height, 6, "#FFFFFF"); fo.addVariable("src", src); fo.addVariable("mode", ranOrSeq); if (pictograms == "true") { fo.addVariable("timer", 5); fo.addVariable("fadetime", 4); } else { fo.addVariable("timer", timer); fo.addVariable("fadetime", fadetime); } fo.addParam("scale", scale); fo.addParam("quality", quality); if (getElm("list")) { d.write(''); fo.write(target); } else if (getElm("home") && (pictograms == "true")) { var split = 4; var fW = getElm("flash").offsetWidth -6; // the -6 is needed for Firefox var fH = getElm("flash").offsetHeight; for (var i=0;i< split; i++) { d.write(''); fo.write(target + i); } } else { fo.write(target); } }