function insert_store(store) { var sc = new Element('div').addClassName('store'); sc.insert(new Element('span').addClassName('name').update(store.name)) sc.insert(new Element('span').addClassName('address').update(checkForNull(store.address) + ' ' + checkForNull(store.suburb) + ' ' + store.country + ' ' + ' ' + checkForNull(store.state) + ' ' + checkForNull(store.postcode))) if(store.phone != 'NULL' && !store.phone.blank()) sc.insert(new Element('span').addClassName('phone').update(store.phone)) if(store.url != 'NULL' && !store.url.blank()) sc.insert(new Element('span').addClassName('url').update(store.url)) $('two-col-right').insert(sc) } function insertNoResults(msg) { var sc = new Element('div').addClassName('store') sc.insert(new Element('span').addClassName('name').update(msg)) $('two-col-right').insert(sc) } function checkForNull(str) { var string = ''; if(str != 'NULL' && !str.blank()) { string = str; } else { string = ''; } return string; } function insert_prev_page_link(page_link) { var link = new Element('a', {'href': 'javascript:void(0)'}).addClassName('pagination').update('Previous Page') Event.observe(link, 'click', function() { var s = new Element('script', {'type': 'text/javascript', 'src': 'http://seafolly.steam-bank.com/search/' + page_link}) setTimeout(function() {$('two-col-left').insert(s)}, 0.5) }) $('two-col-right').insert(link) } function insert_next_page_link(page_link) { var link = new Element('a', {'href': 'javascript:void(0)'}).addClassName('pagination').update('Next Page') Event.observe(link, 'click', function(){ var s = new Element('script', {'type': 'text/javascript', 'src': 'http://seafolly.steam-bank.com/search/' + page_link}) setTimeout(function() {$('two-col-left').insert(s)}, 0.5) }) $('two-col-right').insert(link) } function insert_country(country) { $('country').insert(new Element('option', {'value': country}).update(country)) } function insert_state(state) { $('state').insert(new Element('option', {'value': state}).update(state)) } function insert_region(region) { $('region').insert(new Element('option', {'value': region}).update(region)) } function clear_states() { var index = 0 $$('#state option').each(function(option) { if(index > 0) option.remove() index += 1 }) } function clear_regions() { var index = 0 $$('#region option').each(function(option) { if(index > 0) option.remove() index += 1 }) } function clear_store_entries() { $('two-col-right').replace(new Element('div', {'id': 'two-col-right'})) } function clear_stores() { clear_states() clear_regions() } function change_country() { $('country').observe('change', function() { clear_stores() if($('postcode') != null) { $('postcode').clear() } if(!$F('country').blank()) { var s = new Element('script', {'type': 'text/javascript', 'src': 'http://seafolly.steam-bank.com/states/' + $F('country')}) $('two-col-left').insert(s) } }) } function change_state() { $('state').observe('change', function() { clear_regions() if(!$F('state').blank()) { var s = new Element('script', {'type': 'text/javascript', 'src': 'http://seafolly.steam-bank.com/regions/' + $F('state')}) $('two-col-left').insert(s) } }) } function showExpandedForm() { $('state-select').setStyle({'display':'block'}); $('region-select').setStyle({'display':'block'}); } insert_country('Australia') insert_country('Austria') insert_country('Belgium') insert_country('Canada') insert_country('Caribbean') insert_country('Cyprus') insert_country('Denmark') insert_country('Dubai') insert_country('Fiji') insert_country('Finland ') insert_country('France') insert_country('Germany') insert_country('Greece') insert_country('Guadeloupe') insert_country('Hong Kong') insert_country('Hungary') insert_country('Iceland') insert_country('Ireland') insert_country('Japan') insert_country('La Reunion') insert_country('Lebanon') insert_country('Luxembourg') insert_country('Maldives') insert_country('Martinique') insert_country('Mimat') insert_country('Monaco') insert_country('Netherlands Antilles') insert_country('New Zealand') insert_country('Norfolk Island') insert_country('Norway') insert_country('Philippines') insert_country('Phillipines') insert_country('Poland') insert_country('Saudi Arabia') insert_country('Seychelles') insert_country('Singapore') insert_country('Slovenia') insert_country('South Africa') insert_country('South Africa ') insert_country('Spain') insert_country('Sweden') insert_country('Switzerland') insert_country('Tahiti') insert_country('The Netherlands') insert_country('UK') insert_country('UK & Ireland') insert_country('USA') insert_country('United Arab Emirates') change_country() change_state()