/* Simple AJAX Code-Kit (SACK) v1.6.1 */ /* ©2005 Gregory Wild-Smith */ /* www.twilightuniverse.com */ /* Software licenced under a modified X11 licence, see documentation or authors website for more details */ function sack(file) { this.xmlhttp = null; this.resetData = function() { this.method = "GET"; this.queryStringSeparator = "&"; this.argumentSeparator = "&"; this.URLString = ""; this.encodeURIString = true; this.execute = false; this.element = null; this.elementObj = null; this.requestFile = file; this.vars = new Object(); this.responseStatus = new Array(2); }; this.resetFunctions = function() { this.onLoading = function() { }; this.onLoaded = function() { }; this.onInteractive = function() { }; this.onCompletion = function() { }; this.onError = function() { }; this.onFail = function() { }; }; this.reset = function() { this.resetFunctions(); this.resetData(); }; this.createAJAX = function() { try { this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e1) { try { this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e2) { this.xmlhttp = null; } } if (! this.xmlhttp) { if (typeof XMLHttpRequest != "undefined") { this.xmlhttp = new XMLHttpRequest(); } else { this.failed = true; } } }; this.setVar = function(name, value){ this.vars[name] = Array(value, false); }; this.encVar = function(name, value, returnvars) { if (true == returnvars) { return Array(encodeURIComponent(name), encodeURIComponent(value)); } else { this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true); } } this.processURLString = function(string, encode) { encoded = encodeURIComponent(this.argumentSeparator); regexp = new RegExp(this.argumentSeparator + "|" + encoded); varArray = string.split(regexp); for (i = 0; i < varArray.length; i++){ urlVars = varArray[i].split("="); if (true == encode){ this.encVar(urlVars[0], urlVars[1]); } else { this.setVar(urlVars[0], urlVars[1]); } } } this.createURLString = function(urlstring) { if (this.encodeURIString && this.URLString.length) { this.processURLString(this.URLString, true); } if (urlstring) { if (this.URLString.length) { this.URLString += this.argumentSeparator + urlstring; } else { this.URLString = urlstring; } } // prevents caching of URLString this.setVar("rndval", new Date().getTime()); urlstringtemp = new Array(); for (key in this.vars) { if (false == this.vars[key][1] && true == this.encodeURIString) { encoded = this.encVar(key, this.vars[key][0], true); delete this.vars[key]; this.vars[encoded[0]] = Array(encoded[1], true); key = encoded[0]; } urlstringtemp[urlstringtemp.length] = key + "=" + this.vars[key][0]; } if (urlstring){ this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator); } else { this.URLString += urlstringtemp.join(this.argumentSeparator); } } this.runResponse = function() { eval(this.response); } this.runAJAX = function(urlstring) { if (this.failed) { this.onFail(); } else { this.createURLString(urlstring); if (this.element) { this.elementObj = document.getElementById(this.element); } if (this.xmlhttp) { var self = this; if (this.method == "GET") { totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString; this.xmlhttp.open(this.method, totalurlstring, true); } else { this.xmlhttp.open(this.method, this.requestFile, true); try { this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded") } catch (e) { } } this.xmlhttp.onreadystatechange = function() { switch (self.xmlhttp.readyState) { case 1: self.onLoading(); break; case 2: self.onLoaded(); break; case 3: self.onInteractive(); break; case 4: self.response = self.xmlhttp.responseText; self.responseXML = self.xmlhttp.responseXML; self.responseStatus[0] = self.xmlhttp.status; self.responseStatus[1] = self.xmlhttp.statusText; if (self.execute) { self.runResponse(); } if (self.elementObj) { elemNodeName = self.elementObj.nodeName; elemNodeName.toLowerCase(); if (elemNodeName == "input" || elemNodeName == "select" || elemNodeName == "option" || elemNodeName == "textarea") { self.elementObj.value = self.response; } else { self.elementObj.innerHTML = self.response; } } if (self.responseStatus[0] == "200") { self.onCompletion(); } else { self.onError(); } self.URLString = ""; break; } }; this.xmlhttp.send(this.URLString); } } }; this.reset(); this.createAJAX(); } /************************************************************************************************************ (C) www.dhtmlgoodies.com, April 2006 This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website. Terms of use: You are free to use this script as long as the copyright message is kept intact. However, you may not redistribute, sell or repost it without our permission. Thank you! www.dhtmlgoodies.com Alf Magne Kalleland ************************************************************************************************************/ var ajaxBox_offsetX = 0; var ajaxBox_offsetY = 0; var ajax_list_externalFile = '/bin/ajax-dynamic-list.php'; // Path to external file var minimumLettersBeforeLookup = 1; // Number of letters entered before a lookup is performed. var ajax_list_objects = new Array(); var ajax_list_cachedLists = new Array(); var ajax_list_activeInput = false; var ajax_list_activeItem; var ajax_list_optionDivFirstItem = false; var ajax_list_currentLetters = new Array(); var ajax_optionDiv = false; var ajax_optionDiv_iframe = false; var ajax_list_MSIE = false; if(navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('Opera')<0)ajax_list_MSIE=true; // if(navigator.userAgent.indexOf('Safari')>=0)ajax_list_MSIE=true; function ajax_getTopPos(inputObj) { var returnValue = inputObj.offsetTop; while((inputObj = inputObj.offsetParent) != null){ returnValue += inputObj.offsetTop; } return returnValue; } function ajax_list_cancelEvent() { return false; } function ajax_getLeftPos(inputObj) { var returnValue = inputObj.offsetLeft; while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft; return returnValue; } function ajax_option_setValue(e,inputObj) { if(!inputObj)inputObj=this; ajax_list_activeInput.value = inputObj.innerHTML; if(document.getElementById(ajax_list_activeInput.name + '_hidden'))document.getElementById(ajax_list_activeInput.name + '_hidden').value = inputObj.id; autosearch(); ALLOWSUBMIT = 0; ajax_options_hide(); } function ajax_options_hide() { if ( ajax_optionDiv.style ) ajax_optionDiv.style.display='none'; if(ajax_optionDiv_iframe)ajax_optionDiv_iframe.style.display='none'; } function ajax_options_rollOverActiveItem(item,fromKeyBoard) { // Set the class name for the previously selected item, if any // if(ajax_list_activeItem)ajax_list_activeItem.className='optionDiv'; if(ajax_list_activeItem) { if(ajax_list_activeItem.type == 'title') { ajax_list_activeItem.className='optionDiv_title'; } else { ajax_list_activeItem.className='optionDiv'; } } item.className='optionDivSelected'; ajax_list_activeItem = item; if(fromKeyBoard){ if(ajax_list_activeItem.offsetTop>ajax_optionDiv.offsetHeight){ ajax_optionDiv.scrollTop = ajax_list_activeItem.offsetTop - ajax_optionDiv.offsetHeight + ajax_list_activeItem.offsetHeight + 2 ; } if(ajax_list_activeItem.offsetTop function populate_address( tofrom, f ) { if ( f.value ) { var addy = f.value.split("|"); } else { var addy = [ '', '', '', '' ]; } if ( tofrom == 'From' ) { document.forms[0].Directions_From_Addr.value = addy[0]; document.forms[0].Directions_From_City.value = addy[1]; document.forms[0].Directions_From_State.value = addy[2]; document.forms[0].Directions_From_Zip.value = addy[3]; } else { document.forms[0].Directions_To_Addr.value = addy[0]; document.forms[0].Directions_To_City.value = addy[1]; document.forms[0].Directions_To_State.value = addy[2]; document.forms[0].Directions_To_Zip.value = addy[3]; } } function Directions_updateQuery() { document.forms[0].q.value = 'directions ' + document.forms[0].Directions_From_Addr.value + ', ' + document.forms[0].Directions_From_City.value + ', ' + document.forms[0].Directions_From_State.value + ' ' + document.forms[0].Directions_From_Zip.value + ' to ' + document.forms[0].Directions_To_Addr.value + ', ' + document.forms[0].Directions_To_City.value + ', ' + document.forms[0].Directions_To_State.value + ' ' + document.forms[0].Directions_To_Zip.value; } function Directions_updateForms() { q = document.forms[0].q.value; if ( m = q.match( /directions (\d+ [^,]+)\s*,\s*([^,]+)\s*,\s*([^,]+)\s*(\d*) to (\d+ [^,]+)\s*,\s*([^,]+)\s*,\s*([^,]+)\s*(\d*)/ ) ) { document.forms[0].Directions_From_Addr.value = m[1]; document.forms[0].Directions_From_City.value = m[2]; document.forms[0].Directions_From_State.value = m[3]; document.forms[0].Directions_From_Zip.value = m[4]; document.forms[0].Directions_To_Addr.value = m[5]; document.forms[0].Directions_To_City.value = m[6]; document.forms[0].Directions_To_State.value = m[7]; document.forms[0].Directions_To_Zip.value = m[8]; } } function YellowPages_updateQuery() { document.forms[0].q.style.color = '#666666'; document.forms[0].YellowPages_BusinessName.style.color = '#003366'; document.forms[0].YellowPages_CityStateZip.style.color = '#003366'; document.forms[0].q.value = 'yp ' + document.forms[0].YellowPages_BusinessName.value + ' near ' + document.forms[0].YellowPages_CityStateZip.value } function YellowPages_updateForms() { document.forms[0].q.style.color = '#003366'; document.forms[0].YellowPages_BusinessName.style.color = '#666666'; document.forms[0].YellowPages_CityStateZip.style.color = '#666666'; q = document.forms[0].q.value; if ( m = q.match( /yp (.*) near (.*)/ ) ) { document.forms[0].YellowPages_BusinessName.value = m[1]; document.forms[0].YellowPages_CityStateZip.value = m[2]; } else if ( m = q.match( /yp (.*)/ ) ) { document.forms[0].YellowPages_BusinessName.value = m[1]; } } function Restaurants_updateQuery() { document.forms[0].q.style.color = '#666666'; document.forms[0].Restaurants_Name.style.color = '#003366'; document.forms[0].Restaurants_CityStateZip.style.color = '#003366'; document.forms[0].q.value = 'restaurants ' + document.forms[0].Restaurants_Name.value + ' near ' + document.forms[0].Restaurants_CityStateZip.value } function Restaurants_updateForms() { document.forms[0].q.style.color = '#003366'; document.forms[0].Restaurants_Name.style.color = '#666666'; document.forms[0].Restaurants_CityStateZip.style.color = '#666666'; q = document.forms[0].q.value; if ( m = q.match( /restaurants? (.*) near (.*)/ ) ) { document.forms[0].Restaurants_Name.value = m[1]; document.forms[0].Restaurants_CityStateZip.value = m[2]; } else if ( m = q.match( /restaurants? (.*)/ ) ) { document.forms[0].Restaurants_Name.value = m[1]; } } function Maps_updateQuery() { document.forms[0].q.style.color = '#666666'; document.forms[0].Maps_Address.style.color = '#003366'; document.forms[0].Maps_CityStateZip.style.color = '#003366'; if ( document.forms[0].Maps_Address.value && document.forms[0].Maps_CityStateZip.value ) { document.forms[0].q.value = 'map ' + document.forms[0].Maps_Address.value + ', ' + document.forms[0].Maps_CityStateZip.value; } else if ( document.forms[0].Maps_Address.value && !document.forms[0].Maps_CityStateZip.value ) { document.forms[0].q.value = 'map ' + document.forms[0].Maps_Address.value; } else if ( ! document.forms[0].Maps_Address.value && document.forms[0].Maps_CityStateZip.value ) { document.forms[0].q.value = 'map ' + document.forms[0].Maps_CityStateZip.value; } } function Maps_updateForms() { document.forms[0].q.style.color = '#003366'; document.forms[0].Maps_Address.style.color = '#666666'; document.forms[0].Maps_CityStateZip.style.color = '#666666'; q = document.forms[0].q.value; // ## Zip only if ( m = q.match( /maps? (\d\d\d\d\d)$/ ) ) { document.forms[0].Maps_Address.value = ''; document.forms[0].Maps_CityStateZip.value = m[1]; } // ## City/State/Zip if ( m = q.match( /maps? ([^,]+\s*,\s*[^,]+\s*\d*)$/ ) ) { document.forms[0].Maps_Address.value = ''; document.forms[0].Maps_CityStateZip.value = m[1]; } // ## City/State/Address if ( m = q.match( /maps? (\d+ [^,]+)\s*,\s*([^,]+\s*,\s*[^,]+)$/ ) ) { document.forms[0].Maps_Address.value = m[1]; document.forms[0].Maps_CityStateZip.value = m[2]; } } function Weather_updateQuery() { document.forms[0].q.style.color = '#666666'; document.forms[0].Weather_CityStateZip.style.color = '#003366'; document.forms[0].q.value = 'weather ' + document.forms[0].Weather_CityStateZip.value } function Weather_updateForms() { document.forms[0].q.style.color = '#003366'; document.forms[0].Weather_CityStateZip.style.color = '#666666'; q = document.forms[0].q.value; if ( m = q.match( /weather (.*)/ ) ) { document.forms[0].Weather_CityStateZip.value = m[1]; } } function Movies_updateQuery() { document.forms[0].q.style.color = '#666666'; document.forms[0].Movies_Title.style.color = '#003366'; document.forms[0].q.value = 'movies ' + document.forms[0].Movies_Title.value } function Movies_updateForms() { document.forms[0].q.style.color = '#003366'; document.forms[0].Movies_Title.style.color = '#666666'; q = document.forms[0].q.value; if ( m = q.match( /movies (.*)/ ) ) { document.forms[0].Movies_Title.value = m[1]; } } function Jobs_updateQuery() { document.forms[0].q.style.color = '#666666'; document.forms[0].Jobs_Keywords.style.color = '#003366'; document.forms[0].Jobs_CityStateZip.style.color = '#003366'; document.forms[0].q.value = 'jobs ' + document.forms[0].Jobs_Keywords.value + ' near ' + document.forms[0].Jobs_CityStateZip.value } function Jobs_updateForms() { document.forms[0].q.style.color = '#003366'; document.forms[0].Jobs_Keywords.style.color = '#666666'; document.forms[0].Jobs_CityStateZip.style.color = '#666666'; q = document.forms[0].q.value; if ( m = q.match( /jobs? (.*) near (.*)/ ) ) { document.forms[0].Jobs_Keywords.value = m[1]; document.forms[0].Jobs_CityStateZip.value = m[2]; } else if ( m = q.match( /jobs? (.*)/ ) ) { document.forms[0].Jobs_Keywords.value = m[1]; } } function Site_updateQuery() { document.forms[0].q.style.color = '#666666'; document.forms[0].Site_Keywords.style.color = '#003366'; document.forms[0].Site_URL.style.color = '#003366'; document.forms[0].q.value = 'site ' + document.forms[0].Site_Keywords.value + ' on ' + document.forms[0].Site_URL.value } function Site_updateForms() { document.forms[0].q.style.color = '#003366'; document.forms[0].Site_Keywords.style.color = '#666666'; document.forms[0].Site_URL.style.color = '#666666'; q = document.forms[0].q.value; if ( m = q.match( /site (.*) on (.*)/ ) ) { document.forms[0].Site_Keywords.value = m[1]; document.forms[0].Site_URL.value = m[2]; } else if ( m = q.match( /site (.*)/ ) ) { document.forms[0].Site_Keywords.value = m[1]; } } // /************************************************************************************************************ (C) www.dhtmlgoodies.com, March 2006 This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website. Terms of use: You are free to use this script as long as the copyright message is kept intact. However, you may not redistribute, sell or repost it without our permission. Thank you! www.dhtmlgoodies.com Alf Magne Kalleland ************************************************************************************************************/ var enableCache = false; var jsCache = new Array(); var dynamicContent_ajaxObjects = new Array(); function ajax_showContent(divId,ajaxIndex,url) { document.getElementById(divId).innerHTML = dynamicContent_ajaxObjects[ajaxIndex].response; if(enableCache){ jsCache[url] = dynamicContent_ajaxObjects[ajaxIndex].response; } dynamicContent_ajaxObjects[ajaxIndex] = false; } function ajax_loadContent(divId,url) { if(enableCache && jsCache[url]){ document.getElementById(divId).innerHTML = jsCache[url]; return; } var ajaxIndex = dynamicContent_ajaxObjects.length; // document.getElementById(divId).innerHTML = 'Loading content - please wait'; document.getElementById(divId).innerHTML = ''; dynamicContent_ajaxObjects[ajaxIndex] = new sack(); dynamicContent_ajaxObjects[ajaxIndex].requestFile = url; // Specifying which file to get dynamicContent_ajaxObjects[ajaxIndex].onCompletion = function(){ ajax_showContent(divId,ajaxIndex,url); }; // Specify function that will be executed after file has been found dynamicContent_ajaxObjects[ajaxIndex].runAJAX(); // Execute AJAX function } function makeHttpRequest(url, callback_function, return_xml) { var http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { alert('Unfortunately you browser doesn\'t support this feature.'); return false; } http_request.onreadystatechange = function() { if (http_request.readyState == 4) { if (http_request.status == 200) { if (return_xml) { eval(callback_function + '(http_request.responseXML)'); } else { eval(callback_function + '(http_request.responseText)'); } } else { // Removed, not sure if this is necessary // alert('There was a problem with the request.(Code: ' + http_request.status + ')'); } } } HTTP2 = http_request; http_request.open('GET', url, true); http_request.send(null); }