/* includes/custom-form-elements.js */ /* CUSTOM FORM ELEMENTS Created by Ryan Fait www.ryanfait.com The only thing you need to change in this file is the following variables: checkboxHeight, radioHeight and selectWidth. Replace the first two numbers with the height of the checkbox and radio button. The actual height of both the checkbox and radio images should be 4 times the height of these two variables. The selectWidth value should be the width of your select list image. You may need to adjust your images a bit if there is a slight vertical movement during the different stages of the button activation. Visit http://ryanfait.com/ for more information. */ var checkboxHeight = "25"; var radioHeight = "25"; var selectWidth = "180"; /* No need to change anything after this */ document.write(''); var Custom = { init: function() { var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active; for(a = 0; a < inputs.length; a++) { if((inputs[a].type == "checkbox" || inputs[a].type == "radio") && $(inputs[a]).hasClassName("styled") && !$(inputs[a]).hasClassName("isStyled")) { $(inputs[a]).addClassName('isStyled'); span[a] = document.createElement("span"); span[a].className = inputs[a].type; if(inputs[a].checked == true) { if(inputs[a].type == "checkbox") { position = "0 -" + (checkboxHeight*2) + "px"; span[a].style.backgroundPosition = position; } else { position = "0 -" + (radioHeight*2) + "px"; span[a].style.backgroundPosition = position; } } inputs[a].parentNode.insertBefore(span[a], inputs[a]); inputs[a].onchange = Custom.clear; span[a].onmousedown = Custom.pushed; span[a].onmouseup = Custom.check; document.onmouseup = Custom.clear; } } inputs = document.getElementsByTagName("select"); for(a = 0; a < inputs.length; a++) { if($(inputs[a]).hasClassName("styled") && !$(inputs[a]).hasClassName("isStyled")) { $(inputs[a]).addClassName('isStyled'); option = inputs[a].getElementsByTagName("option"); active = option[0].childNodes[0].nodeValue; textnode = document.createTextNode(active); for(b = 0; b < option.length; b++) { if(option[b].selected == true) { textnode = document.createTextNode(option[b].childNodes[0].nodeValue); } } span[a] = document.createElement("span"); span[a].className = "select"; span[a].id = "select" + inputs[a].name; span[a].appendChild(textnode); inputs[a].parentNode.insertBefore(span[a], inputs[a]); inputs[a].onchange = Custom.choose; } } }, pushed: function() { element = this.nextSibling; if(element.checked == true && element.type == "checkbox") { this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px"; } else if(element.checked == true && element.type == "radio") { this.style.backgroundPosition = "0 -" + radioHeight*3 + "px"; } else if(element.checked != true && element.type == "checkbox") { this.style.backgroundPosition = "0 -" + checkboxHeight + "px"; } else { this.style.backgroundPosition = "0 -" + radioHeight + "px"; } }, check: function() { element = this.nextSibling; if(element.checked == true && element.type == "checkbox") { this.style.backgroundPosition = "0 0"; element.checked = false; } else { if(element.type == "checkbox") { this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px"; } else { this.style.backgroundPosition = "0 -" + radioHeight*2 + "px"; group = this.nextSibling.name; inputs = document.getElementsByTagName("input"); for(a = 0; a < inputs.length; a++) { if(inputs[a].name == group && inputs[a] != this.nextSibling) { inputs[a].previousSibling.style.backgroundPosition = "0 0"; } } } element.checked = true; } }, clear: function() { inputs = document.getElementsByTagName("input"); for(var b = 0; b < inputs.length; b++) { if(inputs[b].type == "checkbox" && inputs[b].checked == true && $(inputs[b]).hasClassName("styled")) { inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px"; } else if(inputs[b].type == "checkbox" && $(inputs[b]).hasClassName("styled")) { inputs[b].previousSibling.style.backgroundPosition = "0 0"; } else if(inputs[b].type == "radio" && $(inputs[b]).checked == true && inputs[b].hasClassName("styled")) { inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px"; } else if(inputs[b].type == "radio" && $(inputs[b]).hasClassName("styled")) { inputs[b].previousSibling.style.backgroundPosition = "0 0"; } } }, choose: function() { option = this.getElementsByTagName("option"); for(d = 0; d < option.length; d++) { if(option[d].selected == true) { document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue; } } } } Event.observe(window, 'load', function() { Custom.init(); }); /* language/language.js.php */ l_sub_categories='sub categories';l_loading_categories='Loading Categories';l_select='Select';l_form_submission='Form Submission';l_errors_found='We have found the following error(s):';l_review_form='Please review your form and try again.';l_required_flds_incorrect='Some required values are not correct. Please check the fields below and try again.';l_i_would_like='I would like to:';l_lost_password='Lost Password';l_load_lost_password='LOAD_LOST_PASSWORD';l_login='Login';l_loading_login='Loading Login';l_no_comments='There are no comments for this vendor!';l_loading_comments='Loading Comments';l_planner_no_events_found='No projects found. Please create a project in your profile area.';l_no_vendors_saved='
No vendors saved.

Browse the directory to save vendors.';l_no_vendors_saved_project='
No vendors saved.

Create your project, then browse the directory to save vendors.';l_deleting_saved_vendor='Deleting Saved Vendor';l_loading_saved_vendors='Loading Saved Venors';l_sa_remove_point='Remove this Point';l_sa_remove_all_points='Remove all Points';l_st_loading='Loading Statistics';l_sb_redirect_text='You are now being redirected to our secure payment form.\n\nUpon completion of the form you will be redirected back to this page.';l_sb_saving='Saving...';l_sa_box_title='Service Area';l_vendor_cat_er='Whoops!
To select your vendor categories click the Add a category to this vendor link in the green box.'; /* includes/jsvalidate.js */ // // +----------------------------------------------------------------------+ // | Unobtrusive Javascript Validation for Prototype. v2.0 (2007-03-04) | // | http://blog.jc21.com | // +----------------------------------------------------------------------+ // | Attaches Events to all forms on a page and checks their form | // | elements classes to provide some validation. | // +----------------------------------------------------------------------+ // | Copyright: jc21.com 2008 | // +----------------------------------------------------------------------+ // | Licence: Absolutely free. Don't mention it. | // +----------------------------------------------------------------------+ // | Author: Jamie Curnow | // +----------------------------------------------------------------------+ // // if (typeof(JSV) == 'undefined') { var JSV = false; /* :NOTE: All advanced JSV JS functionality is assumed to require the Prototype JS library */ if (typeof($) == 'function') { JSV = { Init: { }, Validate: { }, Lang: { } }; } if (JSV) { JSV.Init = { initialisers: [ ], unloaders: [ ], add: function(add_fn) { JSV.Init.initialisers.push(add_fn); }, addUnloader: function(add_fn) { JSV.Init.unloaders.push(add_fn); }, remove: function(remove_fn) { var last_init = JSV.Init.initialisers.length - 1; for (var i = last_init; i >= 0; i--) { if (JSV.Init.initialisers[i] === remove_fn) { JSV.Init.initialisers[i] = null; } } }, removeUnloader: function(remove_fn) { var last_unloader = JSV.Init.unloaders.length - 1; for (var i = last_unloader; i >= 0; i--) { if (JSV.Init.unloaders[i] === remove_fn) { JSV.Init.unloaders[i] = null; } } }, run: function() { var last_init = JSV.Init.initialisers.length - 1; for (var i = 0; i <= last_init; i++) { if (typeof(JSV.Init.initialisers[i]) == 'function') { JSV.Init.initialisers[i](); } } }, runUnload: function() { var last_unloader = JSV.Init.unloaders.length - 1; for (var i = 0; i <= last_unloader; i++) { if (typeof(JSV.Init.unloaders[i]) == 'function') { JSV.Init.unloaders[i](); } } } }; JSV.Validate = { initialised: false, init: function() { if (!JSV.Validate.initialised) { $$('form').each(function(elm) { Event.observe(elm, 'submit', JSV.Validate.checkForm); }); JSV.Validate.initialised = true; } }, checkForm: function(e) { var all_valid = true; var errs = new Array(); var frm = e.element(); var frm_elms = frm.getElements(); frm_elms.each(function(elm) { var apply_classes = true; var valid = true; // || elm.type == 'checkbox' added for custom checkboxes if (JSV.Validate.isVisible(elm) || elm.type == 'checkbox') { if (elm.nodeName.toLowerCase() == 'input') { var type = elm.type.toLowerCase(); if (type == 'text' || type == 'password') { valid = JSV.Validate.input(elm); } else if (type == 'radio' || type == 'checkbox') { valid = JSV.Validate.radio(elm, frm); } } else if (elm.nodeName.toLowerCase() == 'textarea') { valid = JSV.Validate.input(elm); } else if (elm.nodeName.toLowerCase() == 'select') { valid = JSV.Validate.select(elm); } else { apply_classes = false; } if (valid && apply_classes) { elm.removeClassName('validation-failed'); elm.addClassName('validation-passed'); } else if (apply_classes) { elm.removeClassName('validation-passed'); elm.addClassName('validation-failed'); //try to get title for error message if (elm.getAttribute('title')){ errs[errs.length] = elm.getAttribute('title'); } all_valid = false; } } }); if (!all_valid) { if (errs.length > 0){ custom_alert(JSV.Lang.getString('error_message_default') + "
"+JSV.Lang.getString('error_message_end'), JSV.Lang.getString('error_message_title')); } else { custom_alert(JSV.Lang.getString('error_message_default'), JSV.Lang.getString('error_message_title')); } Event.stop(e); } return all_valid; }, isVisible: function(elm) { if (typeof elm == "string") { elm = $(elm); } while (elm.nodeName.toLowerCase() != 'body' && elm.getStyle('display').toLowerCase() != 'none' && elm.getStyle('visibility').toLowerCase() != 'hidden') { elm = elm.parentNode; Element.extend(elm); } if (elm.nodeName.toLowerCase() == 'body') { return true; } else{ return false; } }, input: function(elm) { var text = elm.value.strip(); if (elm.hasClassName('required') && text.length == 0) { return false; } else if (elm.hasClassName('required')) { var m = elm.getAttribute('minlength'); if (m && Math.abs(m) > 0){ if (text.length < Math.abs(m)){ return false; } } } else if (text.length == 0) { return true; } //search for validate- if (elm.hasClassName('validate-number') && isNaN(text) && text.match(/[^\d]/)) { //number bad return false; } else if (elm.hasClassName('validate-digits') && text.replace(/ /,'').match(/[^\d]/)) { return false; } else if (elm.hasClassName('validate-alpha') && !text.match(/^[a-zA-Z]+$/)) { return false; } else if (elm.hasClassName('validate-alphanum') && !text.match(/\W/)) { return false; } else if (elm.hasClassName('validate-date')) { var d = new date(text); if (isNaN(d)) { return false; } } else if (elm.hasClassName('validate-email') && !text.match(/\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/)) { return false; } else if (elm.hasClassName('validate-url') && !text.match(/^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i)) { return false; } else if (elm.hasClassName('validate-date-au') && !text.match(/^(\d{2})\/(\d{2})\/(\d{4})$/)) { return false; } else if (elm.hasClassName('validate-currency-dollar') && !text.match(/^\$?\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}\d*(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/)) { return false; } else if (elm.hasClassName('validate-regex')) { var r = RegExp(elm.getAttribute('regex')); if (r && ! text.match(r)) { return false; } } return true; }, radio: function(elm, frm) { var valid = true; //search for required if (elm.hasClassName('validate-one-required')) { //check if other checkboxes or radios have been selected. valid = false; frm.select('input[name="'+elm.name+'"]').each(function(inp) { if (inp.checked) { valid = true; } }); } return valid; }, select: function(elm) { if (elm.hasClassName('validate-not-first') && elm.selectedIndex == 0) { return false; } else if (elm.hasClassName('validate-not-empty') && elm.options[elm.selectedIndex].value.length == 0) { return false; } return true; } }; JSV.Lang = { strings: { 'error_message_title': l_form_submission, 'error_message_start': l_errors_found, 'error_message_end': l_review_form, 'error_message_default': l_required_flds_incorrect }, getString: function(string_code, params) { var orig_code = string_code; if (typeof(JSV.Lang.strings[string_code]) != 'undefined') { return JSV.Lang.strings[string_code]; } else { return '(Unknown String: ' + (orig_code != string_code ? string_code + ' via ' : '') + orig_code + ')'; } } }; JSV.Init.add(JSV.Validate.init); Event.observe(window, 'load', JSV.Init.run); Event.observe(window, 'unload', JSV.Init.runUnload); } } /* includes/functions.js */ tabs = new Array(); function highlight_tab(i) { tab = $(i); tabs[tab.id] = !tabs[tab.id] ? tab.style.zIndex : tabs[tab.id]; tab.style.zIndex = 999; tab.onmouseout = function() { this.style.zIndex = tabs[this.id]; }; } function toggle_tab(new_tab, current_tab) { if(current_tab) { $(current_tab).removeClassName('selected'); current_tab.style.zIndex = 1; } if(new_tab) { new_tab = $(new_tab.parentNode); new_tab.style.zIndex = 999; $(new_tab).addClassName('selected'); current_tab = new_tab; } return current_tab; } // textarea, max, notice function count_textarea(ptr, ml, i) { if (ptr.value.length > ml) // if too long...trim it! ptr.value = ptr.value.substring(0, ml); // otherwise, update 'characters left' counter else $(i).innerHTML = ml - ptr.value.length + ' Characters Left'; return; } function toggle_faq_item(id) { clicker = $('faq_clicker_' + id); answer = $('faq_text_' + id); if(clicker.visible()) { Effect.BlindUp(clicker); Effect.BlindDown(answer); } else { Effect.BlindUp(answer); Effect.BlindDown(clicker); } } function stripslashes(str) { return (str + '').replace(/\0/g, '0').replace(/\\([\\'"])/g, '$1'); } state_list = new Array(); state_list["Austria"] = new Array("Burgenland","Kaernten","Niederoesterreich","Oberoesterreich","Salzburg","Steiermark","Tirol","Vorarlberg","Wien"); state_list["United States"] = new Array("Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","District Of Columbia","Florida","Georgia","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West Virginia","Wisconsin","Wyoming"); state_list["Germany"] = new Array("Baden-Wurttemberg","Bavaria","Berlin","Brandenburg","Bremen","Hamburg","Hessen","Mecklenburg-Vorpommern","Lower Saxony","North Rhine-Westphalia","Rhineland-Palatinate","Saarland","Saxony","Saxony-Anhalt","Schleswig-Holstein","Thuringia"); state_list["Netherlands"] = new Array("Drenthe","Flevopolder","Friesland","Gelderland","Groningen","Limburg","Noord Brabant","Noord Holland","Overijssel","Utrecht","Zeeland","Zuid Holland"); state_list["United Kingdom"] = new Array("Angolia","Borders","Central Scotland","Dumfries & Galloway","Fife","Grampian","Highlands & Islands","Highlands & Islands","Home Counties","London","Lothian","Midlands","North West","Northern Ireland","Scotland","South East/Southern","South West","Strathclyde","Tayside","Tyne-Tees","Wales","Yorkshire"); state_list["Spain"] = new Array("Andalusia","Aragon","Asturias, Principado de","Balearic Islands","Canary Isles","Cantabria","Catalonia","Ceuta, Ciudad de","Extremadura","Galicia","Madrid","Melilla, Ciudad de","Murcia","Navarre","New Castile","Old Castile","Rioja, La","The Basque Provinces","Valencia, Comunidad de"); state_list["Switzerland"] = new Array("Aargau","Appenzell Innerrhoden","Appenzell Ausserrhoden","Berne","Basel-Country","Basel-City","Fribourg","Geneva","Glarus","Grisons","Jura","Lucerne","Neuchâtel","Nidwalden","Obwalden","St. Gallen","Schaffhausen","Solothurn","Schwyz","Thurgau","Ticino","Uri","Vaud","Valais","Zug","Zurich"); state_list["Italy"] = new Array("Abruzzo","Basilicata","Calabria","Campania","Emilia-Romagna","Friuli-Venezia Giulia","Lazio","Liguria","Lombardia","Marche","Molise","Piemonte","Puglia","Sardegna","Sicilia","Tuscana","Trentino Alto Adige","Umbria","Valle d'Aosta","Veneto"); state_list["Canada"] = new Array("Alberta","British Columbia","Manitoba","New Brunswick","Newfoundland","Northwest Territories","Nova Scotia","Nunavut","Ontario","Prince Edward Island","Quebec","Saskatchewan","Yukon Territory"); state_list["Russia"] = new Array("Adygeya","Altaj","Altaysky kray","Amurskaya obl.","Arkhangelskaya obl.","Armeniya","Astrakhanskaya obl.","Azerbaidzhan","Bashkorostan","Belogorodskaya obl.","Belorussia","Bryanskaya obl.","Buryatiya","Chechnya","Chelyabinskaya obl.","Chitinskaya obl.","Chuvashiya","Dagestan","Estonia","Evreyskaya obl.","Habarovksy kray","Hakassiya","Ingushetiya","Irkutskaya obl.","Ivanoskaya obl.","Kabardino-Balkariya","Kaliningradskaya obl.","Kalmykiya","Kaluzhskaya obl.","Kamchatskaya obl.","Karachaevo-Cherkesia","Karelia","Kazahstan","Kemerovskaya obl.","Kirovskaya obl.","Komi","Kostromskaya obl.","Krasnodarskiy kray","Krasnoyarskiy kray","Kurganskaya obl.","Kurskaya obl.","Kyrgystan","Latvia","Lipetskaya obl.","Lithuania","Magadanskaya obl.","Mary-El","Moldova","Mordoviya","Moscow and Moscow Region","Murmanskaya obl.","Nizhegorodskaya obl.","Novgorodskaya obl.","Novosibirskaya obl.","Omskaya obl.","Orenburgskaya obl.","Orlovskaya obl.","Penzenskaya obl.","Permskaya obl.","Pskovskaya obl.","Rostovskaya obl.","Ryazanskaya obl.","Saha","Saint-Petersburg and St. Petersburg Region","Sakhalinskaya obl.","Samarskaya obl.","Saratovskaya obl.","Severnaya Osetiya - Alaniya","Smolenskaya obl.","Stavropolsky kray","Sverdlovskaya obl.","Tadjikistan","Tambovskaya obl.","Tatarstan","Tomskaya obl.","Tulskaya obl.","Turkmenistan","Tuva","Tverskaya obl.","Tyumenskaya obl.","Udmurtiya","Ukraine","Ulyanovskaya obl.","Uzbekistan","Vladimirskaya obl.","Volgogradskaya obl.","Vologodskaya obl.","Voronezhskaya obl.","Yaroslvaskaya obl."); state_list["Australia"] = new Array("Australian Capital Territory","New South Wales","Northern Territory","Queensland","South Australia","Tasmania","Victoria","Western Australia"); state_list["Hungary"] = new Array("Budapest","Central Hungarian Region","Central Transdanubian Region","North Alföld Region","South Transdubian Region","West Transdubian Region"); state_list["Ireland"] = new Array("Carlow","Cavan","Clare","Cork","Donegal","Dublin","Galway","Kerry","Kildare","Kilkenny","Laois","Leitrim","Limerick","Longford","Louth","Mayo","Meath","Monaghan","Northern Ireland","Offaly","Roscommon","Sligo","Teleworking","Tipperary","Waterford","Westmeath","Wexford","Wicklow"); state_list["India"] = new Array("Andaman & Nicobar","Andhra Pradesh","Arunchal Pradesh","Assam","Bihar","Chandigarh","Dadra & Nagar Haveli","Daman & Dui","Delhi","Goa","Gujarat","Haryana","Himachal Pradesh","Jammu & Kasmir","Karnataka","Kerala","Lakshadweep","Madhya Pradesh","Maharashtra","Manipur","Meghalaya","Mizoram","Nagaland","Orissa","Pondicherry","Punjab","Rajasthan","Sikkim","Tamilnadu","Tripura","Uttar Pradesh","West Bengal"); state_list["Romania"] = new Array("Romania"); function update_state_select(country_select, value) { country = $F(country_select); state_select = $('state'); // reset the state select box value if(!state_list[country]) { $('select' + state_select.name).innerHTML = $F(state_select); state_select.selectedIndex = 0; return; } // clear the select box while(state_select.options.length) state_select.remove(0); // set the fancy select cover to the new default value $('select' + state_select.name).innerHTML = l_select; //state_list[country][0]; state_select.options[state_select.options.length] = new Option(l_select); // repopulate the select box for(x = 0; x < state_list[country].length; x++) { the_state = state_list[country][x]; state_select.options[state_select.options.length] = new Option(the_state); if(the_state == value) { state_select.options[state_select.options.length - 1].selected = true; state_select.onchange(); } } } function launch_lw_url(url, bn) { window.open(url,'mywindow','width=800,height=500,toolbar=no,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes,copyhistory=no,resizable=yes'); } function validate_dates(d1, d2) { d1 = d1.split('/'); d2 = d2.split('/'); for(x = 0; x < d1.length; x++) d1[x] = parseInt(d1[x]); for(x = 0; x < d2.length; x++) d2[x] = parseInt(d2[x]); var d1_date = new Date(); d1_date.setFullYear(d1[2], d1[1], d1[0]); var d2_date = new Date(); d2_date.setFullYear(d2[2], d2[1], d2[0]); return d2_date < d1_date ? false : true; } /* toolbox/js_base/xml_handler.js */ function create_xml_doc(t) { try { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async = "false"; xmlDoc.loadXML(t); } catch(e) { try { parser = new DOMParser(); xmlDoc = parser.parseFromString(t,"text/xml"); } catch(e) { alert(e.message); return; } } return xmlDoc; } function getText(xml, node) { try { return xml.getElementsByTagName(node)[0].childNodes[0].nodeValue; } catch (ex) {return '';} } function getNodeText(xml) { try { return xml.childNodes[0].nodeValue; } catch (ex) {return '';} } /* toolbox/js_base/ajax_xml.js */ function custom_alert(msg, title) { scroll_offsets = document.viewport.getScrollOffsets(); window_dimensions = document.viewport.getDimensions(); alert_box = $('custom_alert'); if(!alert_box) { // the positioned element alert_box = $(document.createElement('div')); alert_box.addClassName('custom_alert'); alert_box.setAttribute('id', 'custom_alert'); // body alert_body = $(document.createElement('div')); alert_body.setAttribute('id', 'alert_body'); alert_box.appendChild(alert_body); // header alert_header = $(document.createElement('div')); alert_header.setAttribute('id', 'alert_header'); alert_header.onclick = function() { $('custom_alert').hide(); }; alert_body.appendChild(alert_header); // content alert_content = $(document.createElement('div')); alert_content.setAttribute('id', 'alert_content'); alert_body.appendChild(alert_content); document.body.appendChild(alert_box); } title = !title ? 'Message' : title; $('alert_header').innerHTML = title; $('alert_content').innerHTML = msg; alert_box.setStyle({ left: (scroll_offsets.left + (window_dimensions.width - alert_box.getWidth()) / 2) + "px", top: (scroll_offsets.top + (window_dimensions.height - alert_box.getHeight()) / 2) + "px" }); if(!$('custom_alert').visible()) $('custom_alert').show(); Effect.Shake('custom_alert', { duration: 0.25, distance: 2 }); setTimeout("$('custom_alert').hide()", 4000); } function check_alert_click(event) { if(!$('custom_alert') || !$('custom_alert').visible) return false; var e = Event.element(event); while(e != document.body) { e = e.parentNode; if(e.id == 'custom_alert') return true; } $('custom_alert').hide(); return false; } Event.observe(document, 'click', check_alert_click); // ajax submits a form to it's action function form_handler(frm, callback) { f = function(o) { if(callback) callback(o); else { xmlDoc = create_xml_doc(o.responseText); id = getText(xmlDoc, 'id'); message = getText(xmlDoc, 'message'); redirect = getText(xmlDoc, 'redirect'); delay = getText(xmlDoc, 'wait'); if(redirect.length && delay.length) setTimeout("window.location='" + redirect + "'", parseInt(delay) * 1000); if(message) custom_alert(message, 'Form Submission'); if(id && frm.elements['id']) frm.elements['id'].value = id; } } new Ajax.Request(frm.action + '&j=' + ut(), { postBody: $(frm).serialize(), method: 'post', onSuccess: f } ); } function dbg(t) { d = $('dbg'); if(!d) { d = $(document.createElement('div')); document.body.appendChild(d); d.setAttribute('id', 'dbg'); d.setStyle({ position: 'absolute', bottom: '5px', left: '5px', width: '600px', padding: '4px', backgroundColor: 'white', border: '1px solid red' }); } d.innerHTML += t.replace(//g,">") + '
'; } function ut() { var foo = new Date; var unixtime_ms = foo.getTime(); var unixtime = parseInt(unixtime_ms / 1000); return unixtime; } /* includes/selector/selector.js */ category_file = "includes/directory/categories.php"; category_select_image = '/images/planner/select_category.png'; category_deselect_image = '/images/planner/deselect_category.png'; show_category_selector = function(id) { c_parent = 0; show_box('category_selector'); setTimeout(function() { load_categories(); }, 500); } close_category_selector = function() { close_box('category_selector'); } selector_msg = function(msg) { show_msg(msg, 'selector_msg'); } max_selections = 999; c_parent = 0; function load_categories() { f = function(o) { xmlDoc = create_xml_doc(o.responseText); crumbs = xmlDoc.getElementsByTagName('bread_crumbs')[0].getElementsByTagName('crumb'); for(x = 0; x < crumbs.length; x++) { div1 = $(document.createElement('div')); span1 = $(document.createElement('span')); cid = getText(crumbs[x], 'id'); title = getText(crumbs[x], 'title'); div1.innerHTML = title; div1.setAttribute('cid', cid); div1.setAttribute('id', 'bc_' + cid); $('bread_crumbs').appendChild(div1); span1.innerHTML = ' \\ '; $('bread_crumbs').appendChild(span1); $('bc_' + cid).onclick = function() { c_parent = this.getAttribute('cid'); load_categories(); } } categories = xmlDoc.getElementsByTagName('category'); if(!categories.length) $('category_list').innerHTML = 'No categories found!'; else { for(x = 0; x < categories.length; x++) { div1 = $(document.createElement('div')); div1.addClassName('category_item'); div2 = $(document.createElement('div')); span = $(document.createElement('span')); select = getText(categories[x], 'selected'); img = new Image(); img.src = parseInt(select) ? category_deselect_image : category_select_image; cid = getText(categories[x], 'id'); title = getText(categories[x], 'title'); sub = getText(categories[x], 'sub'); div2.innerHTML = title; span.innerHTML = '  (' + sub + ' ' + l_sub_categories + ')'; div2.appendChild(span); div1.setAttribute('cid', cid); if(!parseInt(sub)) { div1.addClassName('dead'); div2.onclick = function() { selector_msg('Sorry! This category is empty.') }; } else { div1.onmouseover = function() { $(this).addClassName('activate') }; div1.onmouseout = function() { $(this).removeClassName('activate') } div2.onclick = function() { c_parent = this.parentNode.getAttribute('cid'); load_categories(); }; } img.onclick = function() { select_category(this); }; img.onmouseover = function() { $(this).shake({duration: 0.1, distance: 2 }) }; $('category_list').appendChild(div1); div1.appendChild(img); div1.appendChild(div2); } } setTimeout(function() { loading_div.hide(); }, loader_wait * 1000); } $('category_list').innerHTML = ''; $('bread_crumbs').innerHTML = ''; loading_div = loader(l_loading_categories, 'category_list'); sids = $('sids').value; new Ajax.Request(category_file, { postBody: 'a=list_categories&parent=' + c_parent + '&sids=' + sids + '&j=' + ut(), method: 'post', onSuccess: f } ); } current_selected = 0; function select_category(el) { f = function(o) { xmlDoc = create_xml_doc(o.responseText); msg = getText(xmlDoc, 'msg'); $('sids').value = ''; $('selected_categories').innerHTML = ''; $('selected_categories').hide(); categories = xmlDoc.getElementsByTagName('category'); current_selected = categories.length; if(categories.length) { $('selected_categories').show(); $('selected_categories').innerHTML = 'Selected Categories: '; for(x = 0; x < categories.length; x++) { div1 = $(document.createElement('div')); cid = getText(categories[x], 'id'); title = getText(categories[x], 'title'); div1.onclick = function() { select_category(this); } div1.id = 'category_' + cid; div1.innerHTML = title; div1.setAttribute('cid', cid); $('sids').value += cid + ','; $('selected_categories').appendChild(div1); } } if(el.tagName == 'IMG' && $('category_selector').visible()) { selector_msg(msg); el.src = el.src.indexOf(category_select_image) > -1 ? category_deselect_image : category_select_image; } } if(el && el.tagName == 'IMG' && el.src.indexOf(category_select_image) > -1) { if(current_selected >= max_selections) { selector_msg('Please select at most ' + max_selections + ' categories.'); return false; } } id = !el ? 0 : el.tagName == 'IMG' ? el.parentNode.getAttribute('cid') : el.getAttribute('cid'); sids = $('sids').value; new Ajax.Request(category_file, { postBody: 'a=toggle_category&id=' + id + '&sids=' + sids + '&j=' + ut(), method: 'post', onSuccess: f } ); } /* toolbox/js_base/loader.js */ loader_width = 150; loader_margin = 1; function loader(t, p, m) { p = $(p); m = m ? m : loader_margin; p_width = p.getWidth(); p_height = p.getHeight(); d_width = Math.floor(p_width * m); d_height = Math.floor(p_height * m); div1 = $(document.createElement('div')); div2 = $(document.createElement('div')); div1.setStyle({ position: 'absolute', left: Math.floor((p_width - d_width) / 2) + 'px', top: Math.floor((p_height - d_height) / 2) + 'px', height: d_height + 'px', width: d_width + 'px', backgroundColor: '#ffffff', zIndex: 999 }); div2.innerHTML = t + '
'; img = new Image(); img.src = "/images/loading.gif"; div2.setStyle({ position: 'absolute', width: loader_width + 'px', top: Math.floor(p_height / 3) + 'px', left: Math.floor((p_width - loader_width) / 2) + 'px', fontSize: '16px', fontWeight: 'bold', textAlign: 'center' }); div2.appendChild(img); div1.appendChild(div2); p.appendChild(div1); p.style.overflowX = 'hidden'; return div1; } /* includes/directory/configuration.js */ loader_wait = 1; msg_wait = 2; show_box = function(id) { parent_dimensions = $($(id).parentNode).getDimensions(); if($(id).zIndex != 999) { $(id).setStyle({ left: (50 + Math.floor(Math.random() * 100)) + 'px', top: (50 + Math.floor(Math.random() * 50)) + 'px', zIndex: 888 }); } new Effect.Appear(id, { duration: 0.25 }); } center_box = function(id) { parent_dimensions = $($(id).parentNode).getDimensions(); box_dimensions = $(id).getDimensions(); $(id).setStyle({ left: Math.floor((parent_dimensions.width - box_dimensions.width) / 2) + 'px', top: Math.floor((parent_dimensions.height - box_dimensions.height) / 2) + 'px' }); } shade_parent = function(id) { parent_box = $($(id).parentNode); shade_box = parent_box.getElementsByClassName('shade')[0]; if(!shade_box) { shade_box = $(document.createElement('div')); parent_box.appendChild(shade_box); } parent_box.setStyle({ overflow: 'hidden' }); shade_box.setOpacity(0); shade_box.show(); shade_box.addClassName('shade'); new Effect.Opacity(shade_box, { from: 0.0, to: 0.5, duration: 0.5 }); } hide_parent_shade = function(id) { parent_box = $($(id).parentNode); shade_box = parent_box.getElementsByClassName('shade')[0]; if(!shade_box) return; parent_box.setStyle({ overflow: '' }); new Effect.Opacity(shade_box, { from: 0.5, to: 0.0, duration: 0.5 }); setTimeout(function() { shade_box.hide(); }, 600); } close_box = function(id) { new Effect.Fade(id, { duration: 0.25 }); } msg_fade_timer = false; show_msg = function(msg, id) { error_msg = $(id); error_msg.innerHTML = msg; parent_dimensions = $(error_msg.parentNode).getDimensions(); error_msg.setStyle({ left: Math.floor((parent_dimensions.width - error_msg.getWidth()) / 2) + 'px', top: Math.floor((parent_dimensions.height - error_msg.getHeight()) / 2) + 'px' }); error_msg.appear( {duration: 0.2 } ); clearTimeout(msg_fade_timer); msg_fade_timer = setTimeout(function() { error_msg.fade( {duration: 0.2 } ) }, msg_wait * 1000); } // click settings click_file = '/includes/directory/clicks/save_click.php'; click_save_timeout = 2000; // comment settings comment_file = '/includes/directory/comments/comments.php'; share_file = '/includes/directory/share/share.php'; planner_file = '/includes/directory/planner/planner.php'; contact_file = '/includes/directory/contact/contact.php'; save_vendor_file = '/includes/directory/save_vendor/save_vendor.php'; // rating settings rating_file = '/includes/directory/ratings/ratings.php'; rating_puff_wait = 0.3; // how quickly the stars puff rating_reset_wait = 3; // how quickly the msg and stars reset to default rating_blind_wait = 1; // how quickly the blind moves gold_star = '/images/directory/star.png'; grey_star = '/images/directory/star_blank.png'; /* includes/directory/search.js */ function handle_search(frm) { for(x = 0; x < frm.elements.length; x++) { if(frm.elements[x].type == 'text') { $(frm.elements[x]).addClassName('search_loader'); break; } } setTimeout(function() { if(frm.id == 'filter_form') frm.submit(); else window.location = frm.action + escape($F(frm.search)); }, loader_wait * 1000); return false; } /* includes/directory/contact/contact.js */ show_contact_box = function() { show_box('contact_box'); center_box('contact_box'); shade_parent('contact_box'); } close_contact_box = function() { close_box('contact_box'); hide_parent_shade('contact_box'); } contact_msg = function(msg) { show_msg(msg, 'contact_msg'); } function send_contact(frm) { f = function(o) { xmlDoc = create_xml_doc(o.responseText); msg = getText(xmlDoc, 'msg'); success = getText(xmlDoc, 'success'); if(parseInt(success)) hide_parent_shade('contact_box'); contact_msg(msg); } new Ajax.Request(contact_file, { postBody: $(frm).serialize() + '&j=' + ut(), method: 'post', onSuccess: f } ); } /* includes/mini_functions.js */ function setup_mini_box(pfx, title, ofs_anchor) { if($('mini_' + pfx)) { update_mini_title(pfx, title); m = $('mini_' + pfx) if(!m.visible()) m.appear(); return m; } m = $(document.createElement('div')); m.setAttribute('id', 'mini_' + pfx); m.setStyle({ display: 'none' }); m.className = 'mini_box'; div1 = document.createElement('div'); div1.className = 'title_bar'; div1.innerHTML = '

' + title + '

'; m.appendChild(div1); div2 = document.createElement('div'); div2.className = 'close'; div2.onclick = function() { Effect.Fade('mini_' + pfx) } div1.appendChild(div2); div3 = document.createElement('div'); div3.setAttribute('id', pfx + '_content'); m.appendChild(div3); document.body.appendChild(m); if(ofs_anchor) { pos = $(ofs_anchor).cumulativeOffset(); m.setStyle({ top: (pos.top + 30) + 'px', left: pos.left + 'px', zIndex: '999' }); } m.appear(); return m; } function update_mini_title(pfx, title) { h4s = $$('#mini_' + pfx + ' h4'); h4s[0].innerHTML = title; } function mini_guide(id) { mg = setup_mini_box('guide', l_i_would_like, id); f = function(o) { $('guide_content').innerHTML = o.responseText; setTimeout(function() { loading_div.hide(); }, loader_wait * 500); } loading_div = loader('Loading Guide', 'guide_content'); new Ajax.Request('pages/mini_guide.php?j=' + ut(), { method: 'post', onSuccess: f } ); } function mini_bind_form(id, ld, o) { $(id).innerHTML = o.responseText; frms = $$('#' + id + ' form'); if(frms.length) Event.observe(frms[0].id, 'submit', function(e) { if(JSV.Validate.checkForm(e)) form_handler(e.element()); Event.stop(e); }); setTimeout(function() { ld.hide(); }, loader_wait * 500); } function mini_lost_password(id) { mlp = setup_mini_box('login', l_lost_password, id); f = function(o) { mini_bind_form('login_content', loading_div, o) } loading_div = loader(l_load_lost_password, 'login_content'); new Ajax.Request('pages/login/lost_password.php?j=' + ut(), { method: 'post', onSuccess: f } ); } function mini_login(id) { ml = setup_mini_box('login', l_login, id); f = function(o) { mini_bind_form('login_content', loading_div, o); Custom.init(); } loading_div = loader(l_loading_login, 'login_content'); new Ajax.Request('pages/login/login.php?j=' + ut(), { method: 'post', onSuccess: f } ); } /* includes/mapping.js */ var smap; var active_marker; var active_info_window; var old_marker; var service_area_poly; map_callback = false; show_markers = true; location_list = new Array(); marker_list = new Array(); function load_service_map(gid, address) { geocoder = new google.maps.Geocoder(); geocoder.geocode({ address: address, partialmatch: true }, function(results, status) { if (status == google.maps.GeocoderStatus.OK && results.length) { if (status != google.maps.GeocoderStatus.ZERO_RESULTS) { // draw the map with the geocoded coordinates var myOptions = { zoom: 3, center: results[0].geometry.location, mapTypeId: google.maps.MapTypeId.ROADMAP }; smap = new google.maps.Map(document.getElementById(gid), myOptions); if(show_markers) google.maps.event.addListener(smap, 'click', function(event) { placeMarker(event.latLng); }); if(map_callback && typeof map_callback == 'function') map_callback(); } } else { custom_alert('Sorry! Address not found.'); } }); } function fit_map_bounds(z) { the_bounds = new google.maps.LatLngBounds(); for(x = 0; x < marker_list.length; x++) { pos = marker_list[x].getPosition(); the_bounds.extend(pos); } //smap.fitBounds(the_bounds); smap.setCenter(the_bounds.getCenter()); if(z) smap.setZoom(z); } function close_info_window() { try { active_info_window.close(); } catch(er) {} } function placeMarker(location) { var clickedLocation = location; //new google.maps.LatLng(location); var marker = new google.maps.Marker({ position: location, map: smap, draggable: true, visible: show_markers }); marker_list[marker_list.length] = marker; google.maps.event.addListener(marker, 'dragstart', function() { old_marker = marker.getPosition(); }); google.maps.event.addListener(marker, 'dragend', function() { swap_loctions_in_list(old_marker, marker.getPosition()); plot_area_points(); }); google.maps.event.addListener(marker, 'click', function() { active_marker = marker; close_info_window(); active_info_window = new google.maps.InfoWindow({ content: '

' + '   ' + '' }); active_info_window.open(smap, marker); }); location_list.push(location); plot_area_points(); } function swap_loctions_in_list(old_marker, new_marker) { old_position = old_marker; new_position = new_marker; for(x = 0; x < location_list.length; x++) { if(location_list[x] == old_position) { location_list[x] = new_position; break; } } plot_area_points(); } function remove_location_from_list(marker) { for(x = 0; x < location_list.length; x++) { if(location_list[x] == marker.getPosition()) { location_list.splice(x, 1); break; } } plot_area_points(); } function remove_all_markers() { for(x = 0; x < marker_list.length; x++) { try { marker_list[x].setMap(); } catch(er) {} } marker_list = new Array(); location_list = new Array(); remove_overlay(); close_info_window(); } function remove_marker() { remove_location_from_list(active_marker); try { active_info_window.close(); } catch(er) {} try { active_marker.setVisible(false); } catch(er) {} active_marker = false; plot_area_points(); close_info_window(); } function plot_area_points() { if(!location_list.length) return; location_list_formatted = new Array(); for(x = 0; x < location_list.length; x++) { location_list_formatted.push(location_list[x]); } location_list_formatted.push(location_list[0]); remove_overlay(); service_area_poly = new google.maps.Polygon({ paths: location_list, strokeColor: "#FF0000", strokeOpacity: 0.8, strokeWeight: 2, fillColor: "#FF0000", fillOpacity: 0.35 }); service_area_poly.setMap(smap); } function remove_overlay() { if(service_area_poly) { try { service_area_poly.setMap(); } catch(er) {} } } function save_vendor_service_area() { f = function(o) { xmlDoc = create_xml_doc(o.responseText); message = getText(xmlDoc, 'message'); custom_alert(message); } l = ''; for(x = 0; x < location_list.length; x++) l += location_list[x] + ','; new Ajax.Request('index.php?a=form&f=update_service_area&j=' + ut(), { postBody: 'm=' + escape(l) + '&z=' + smap.getZoom(), method: 'post', onSuccess: f }); } function hide_service_map_box() { service_map = $('service_map_box'); map_parent = $(service_map.parentNode); new Effect.Parallel([ new Effect.Fade('service_map_box', { sync: true }), new Effect.Morph(map_parent, { style: 'height: ' + map_parent.getAttribute('orig_height') + 'px;', sync: true }) ], { duration: 0.25, afterFinish: function() { hide_parent_shade('service_map_box'); } }); } function create_service_map_box(btitle, address, pnode) { service_map = $('service_map_box'); if(!service_map) { service_map = Builder.node('div', { style: 'display: none;', id: 'service_map_box', className: 'service_map_box' }, [ Builder.node('div', { className: 'heading' }, btitle + ' ' + l_sa_box_title), Builder.node('div', { id: 'service_map' }), Builder.node('div', { className: 'close', onclick: 'hide_service_map_box()' }) ]); $(pnode).appendChild(service_map); } shade_parent('service_map_box'); service_map.show(); center_box(service_map); service_map.parentNode.removeChild(service_map); $(pnode).appendChild(service_map); if(!smap) { show_markers = false; load_service_map('service_map', address); } parent_height = parseInt($(pnode).getStyle('height')); service_map_height = parseInt($(service_map).getStyle('height')); if(parent_height < service_map_height) { new Effect.Parallel([ new Effect.Morph(pnode, { style: 'height: ' + (service_map_height + 60) + 'px;', sync: true }), new Effect.Move(service_map, { y: Math.floor((service_map_height - parent_height + 60) / 2), sync: true }) ], { duration: 0.8 }); $(pnode).setAttribute('orig_height', parent_height); } }