//Travis, I'm using a script at //http://www.codeandcoffee.com/2006/10/02/compress-your-javascript/ //to compress this file a bit. Saves an extra 1k of space, but //makes it uneditable. Change this file and run it through the script //if you want to update gloabl.js var IE = document.all; var compatable = (IE || parseInt(navigator.appVersion) >= 5); var debug = []; var cWin = null; function scrollToTop() { setTimeout("window.scroll(0,0);",200); } var noFocus; var reserveObj = null; var keepLooking = true; if (!noFocus && document.forms.length) { // Go through all the forms while we're still looking for (j=0; j < document.forms.length && keepLooking; j++) { var foundField = false; for (i=0; i < document.forms[j].length && !foundField; i++) { var thisObj = document.forms[j][i]; if (thisObj.length) thisObj = thisObj[0]; if (thisObj.type == "text" && thisObj.focus) { if (reserveObj) { // If we have one in reserve and found another in a new form thisObj.focus(); if (thisObj.select) thisObj.select(); scrollToTop(); keepLooking = false; } else { // Save this as the reserve for afterwards reserveObj = thisObj; } foundField = true; } } } } // If we're supposed to keep looking but haven't found it yet, try reserve.... if (keepLooking && reserveObj) { reserveObj.focus(); if (reserveObj.select) reserveObj.select(); scrollToTop(); } function nothing () { return; } function changeImg (id, src, set) { if (document.images && document.images[id]) { if (src) { if (set) document.images[id].lastSrc = src; else document.images[id].lastSrc = document.images[id].src; //debug.push("Setting " + id + " to '" + src + "'"); document.images[id].src = src; } else if (document.images[id].lastSrc) { //debug.push("Setting " + id + " to last src: '" + document.images[id].lastSrc + "'"); document.images[id].src = document.images[id].lastSrc; } } } function getObject(oid) { var obj = null; if (document.getElementById) obj = document.getElementById(oid); else if (document.all) obj = document.all[oid]; return obj; } function setProperty (objID, sProp) { if (!compatable) { return null; } if (IE) eval('document.all("' + objID + '").'+sProp+';'); else eval('document.getElementById("'+objID+'").'+sProp+';'); } function getProperty(objID,sProp) { if (!compatable) { return null; } return eval('document.getElementById("'+objID+'").'+sProp+';'); } function jsWin(prp) { if (cWin && !cWin.closed) cWin.close(); cWin = window.open('/printJS.php?'+prp,'jsWin','width=500,height=350,top=100,left=100'); } function stableWin(prp) { if (cWin && !cWin.closed) cWin.close(); cWin = window.open('/stableJS.php','jsWin','width=500,height=420,top=100,left=100'); } function newWin(loc, w, h) { if (cWin && !cWin.closed) cWin.close(); cWin = window.open(loc,'jsWin','width='+ w +',height='+ h +',top=10,left=10,menubar,scrollbars'); } function link(url) { //document.referer = 'http://www.equinenow.com/'; setTimeout("location.href = '"+ url +"';", 200); return; } function buildUrl(frm,ext) { if (!frm) return; var str = ''; for (i=0; i < frm.elements.length; i++) { var elVal = frm.elements[i].type.match(/select/i) ? frm.elements[i][frm.elements[i].selectedIndex].value : frm.elements[i].value; if (frm.elements[i].type.match(/(hidden|select|text)/) && !frm.elements[i].name.match(/PHPSESSID/) && !frm.elements[i].name.match(/gPage/) && !frm.elements[i].name.match(/tabletype/)) { if (elVal || frm.elements[i].type.match(/select/i)) str += '-'+ frm.elements[i].name +'-'+ elVal; } } if (ext) str += ext; if (str) location.href = '/' + frm.gPage.value + str; return; } function showDebug() { for (var i=0; i < debug.length; i++) alert(debug[i]); } function swapPhotoDiv (prefix, idx, tot) { for (var i=1; i <= tot; i++) { if (obj = document.getElementById(prefix + i)) obj.style.display = 'none'; if (obj = document.images['img' + prefix + i]) obj.className = 'photoThumb'; } if (obj = document.getElementById(prefix + idx)) obj.style.display = 'block'; if (obj = document.images['img' + prefix + idx]) obj.className = 'photoSelected'; } var ajax = null; function initAJAX (h) { // branch for native XMLHttpRequest object if (window.XMLHttpRequest && !(window.ActiveXObject)) { try { ajax = new XMLHttpRequest(); } catch(e) { ajax = null; } // branch for IE/Windows ActiveX version } else if (window.ActiveXObject) { try { ajax = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { ajax = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { ajax = null; } } } if(ajax) { ajax.onreadystatechange = h; } } function showLayerNumber(b,n) { var i = 1; // Hide all the elements while (o = document.getElementById(b + i)) { o.style.display = 'none'; i++; } if (o = document.getElementById(b + n)) { o.style.display = 'block'; } } function tabDiv (idx) { var divs = ['contact','friend','map']; for (var i=0; i < divs.length; i++) { setTimeout("changeImg('"+divs[i]+"Tab','/images/"+divs[i]+"Tab.gif', true);", i * 50); setProperty(divs[i]+'Div',"style.display='none'"); } setTimeout("changeImg('"+divs[idx]+"Tab','/images/"+divs[idx]+"Tab_on.gif', true);", i * 50); setProperty(divs[idx]+'Div',"style.display='block'"); } function ddReset() { for (var i=0; i < ddList.length; i++) { if (d = document.getElementById('dd' + ddList[i])) { d.isOn = false; d.style.display = 'none'; } } } function ddCheck(idx) { if (d = document.getElementById('dd' + idx)) { if (!d.isOn) { d.style.display = 'none'; if (d.ddTimer) { clearInterval(d.ddTimer); d.ddTimer = 0; } } } } function ddOn(idx) { if (d = document.getElementById('dd' + idx)) { d.style.display = 'block'; d.isOn = true; if (!d.ddTimer) d.ddTimer = setInterval('ddCheck('+ idx +');',250); } } function ddOff(idx) { if (d = document.getElementById('dd' + idx)) { d.isOn = false; } } function setDist(obj) { if (obj.loc.value) { obj.dsf.value = obj.loc.value.replace(/,/g,'_') + ':' + obj.dst.value; } else { obj.dsf.value = ''; } obj.loc.value = obj.loc.value.replace(/,/g,''); }