');
}
}
}
function loadAfs(url) {
var head = document.getElementsByTagName("head")[0];
var script = document.createElement("script");
script.type = "text/javascript";
script.charset = "utf-8";
script.src = url;
// add code to notice when this is done and
// enable gadsense use
head.appendChild(script);
}
LocalSearch.selectedStyle = [];
LocalSearch.adFacts = {
"inline" : {
afsIndex : 12,
status : "done",
width : 234,
height : 60,
format : "234x60_as",
colors : "results",
parent : "results"
},
"skyscraper" : {
afsIndex : 2,
status : "done",
width : 120,
height : 600,
format : "120x600_as",
colors : "map",
parent : "map"
},
"wide_skyscraper" : {
afsIndex : 3,
status : "done",
width : 160,
height : 600,
format : "160x600_as",
colors : "map",
parent : "map"
},
"button" : {
afsIndex : -1,
status : "done",
width : 125,
height : 125,
format : "125x125_as",
colors : "map",
parent : "map"
},
"vertical_banner" : {
afsIndex : -1,
status : "done",
width : 120,
height : 240,
format : "120x240_as",
colors : "map",
parent : "map"
}
}
LocalSearch.colorSchemes = {
"results" : {
color_border : "f9f9f9",
color_text : "878787",
color_url : "878787",
color_line : "878787",
color_link : "7777cc"
},
"map" : {
color_border : "f0f0f0",
color_text : "878787",
color_url : "008000",
color_line : "878787",
color_link : "7777cc"
}
}
GenerateAds();
// an inline ads object
function InlineAds() {
this.root = null;
this.adDiv = document.getElementById("_gmls_inline_ads_div_");
this.facts = LocalSearch.selectedStyle[0];
this.searcher = null;
// On IE, we have a little problem... The ad block that
// we wrote out is not attached in the dom correctly. Its
// parent is body, not this.adDiv so now we go on a little
// fishing expedition...
if (br_IsIE() && !afsMode) {
var adDiv = this.adDiv;
this.adDiv = null;
var asu = window['google_dynamic_adsense_units']['_gmls_inline_ads_asid_'];
if (asu) {
// now whip through the object looking for our lost div...
for (var p in asu) {
if (asu[p] && asu[p].nodeType && asu[p].nodeType == 1 ) {
var node = asu[p];
if (node.parentNode.id != '_gmls_inline_ads_div_') {
// we have a little problem. The node got
// attached incorrectly, so now lift it and mode it
node.parentNode.removeChild(node);
this.adDiv = adDiv;
this.adDiv.appendChild(node);
}
}
}
}
}
// detach from the dom. This will be re-attached
// during super structure build out
if (this.adDiv != null) {
this.adDiv.parentNode.removeChild(this.adDiv);
}
}
InlineAds.prototype.show = function() {
this.root.style.display = "block";
// only needed once, but we do it here until we decide
// otherwise
this.adDiv.style.display = "block";
}
InlineAds.prototype.hide = function() {
this.root.style.display = "none";
}
InlineAds.prototype.fetch = function(q, results) {
var query = q;
var options = null;
if (results.length > 1) {
// if the view port was computed (meaning there is no near city, etc.)
// in the query, then append on the phrase "near city" in hopes that
// this will result in better targetting
if (results[0].viewportmode && results[0].viewportmode == "computed") {
if (results[0].city) {
options = {
google_city : results[0].city
}
if (results[0].region) {
options.google_region = results[0].region;
}
}
}
}
if (this.searcher == null) {
var adId = null;
if (!afsMode) {
adId = "_gmls_inline_ads_asid_";
}
this.searcher = new GadSenseSearch(adId);
}
// todo - pass options when its fully supported
this.searcher.execute(query);
}
function ExternalAds(adBlock) {
this.adDiv = null;
//
// if we have been given a container then
// we manage the visibility of the ad block. Note,
// this will cause the ad block to flash
if (adBlock.container) {
this.adDiv = adBlock.container;
}
// note, no id passed for afs
var id = null;
if ( adBlock.adsense_id ) {
id = adBlock.adsense_id;
}
this.searcher = new GadSenseSearch(id);
}
ExternalAds.prototype.show = function() {
if (this.adDiv) {
this.adDiv.style.display = "block";
}
}
ExternalAds.prototype.hide = function() {
if (this.adDiv) {
this.adDiv.style.display = "none";
}
}
ExternalAds.prototype.fetch = function(q, results) {
var query = q;
var options = null;
if (results.length > 1) {
// if the view port was computed (meaning there is no near city, etc.)
// in the query, then append on the phrase "near city" in hopes that
// this will result in better targetting
if (results[0].viewportmode && results[0].viewportmode == "computed") {
if (results[0].city) {
options = {
google_city : results[0].city,
google_language : UDS_CurrentLocale
}
if (results[0].region) {
options.google_region = results[0].region;
}
}
}
}
// todo - pass options when its fully supported
this.searcher.execute(query);
}
// classes used throughout
css = {};
// major states are
// active: search results are visible
// idle: search results are not showing, control is idle
css.control_root = "gmls";
css.app = "gmls-app";
css.app_compact_mode = "gmls-app-compact-mode";
css.app_full_mode = "gmls-app-full-mode";
css.app_active = "gmls-app gmls-active";
css.app_no_results = "gmls-app gmls-active gmls-no-results";
css.app_idle = "gmls-app gmls-idle";
css.app_external_results = "gmls-external-results";
// search form contains input box, search button, and branding
css.search_form_active = "gmls-search-form gmls-search-form-active";
css.search_form_idle = "gmls-search-form gmls-search-form-idle";
css.attribution = "gmls-attribution";
// results
css.results_popup = "gmls-results-popup";
css.results_list = "gmls-results-list";
css.results_table = "gmls-results-table";
css.results_ads_box = "gmls-results-ads-box";
css.results_controls = "gmls-results-controls";
css.result_list_item = "gmls-result-list-item";
css.result_list_item_selected = "gmls-result-list-item gmls-selected";
css.result_list_item_key = "gmls-result-list-item-key";
css.result_wrapper = "gmls-result-wrapper";
css.gs_title = "gs-title";
css.gs_street = "gs-street";
css.result_list_item_warning_symbol = "gmls-result-list-item-warning-symbol";
css.result_list_item_warning_text = "gmls-result-list-item-warning-text";
// scroll controls
css.prev_next = "gmls-prev-next";
css.prev_next_active = "gmls-prev-next gmls-prev-next-active";
css.prev_next_idle = "gmls-prev-next gmls-prev-next-idle";
css.prev_next_center = "gmls-prev-next-center";
css.prev = "gmls-prev";
css.prev_active = "gmls-prev gmls-prev-active";
css.prev_idle = "gmls-prev gmls-prev-idle";
css.next = "gmls-next";
css.next_active = "gmls-next gmls-next-active";
css.next_idle = "gmls-next gmls-next-idle";
// more/clear
css.more_results = "gmls-more-results";
css.clear_results = "gmls-clear-results";
// ads classes
css.ads = {
"234x60_as" : "gmls-ads-box-234x60_as", // inline
"468x15_0ads_al" : "gmls-ads-box-468x15_0ads_al", // strip
"120x600_as" : "gmls-ads-box-120x600_as", // skyscraper
"160x600_as" : "gmls-ads-box-160x600_as", // wide_skyscraper
"125x125_as" : "gmls-ads-box-125x125_as", // button
"120x240_as" : "gmls-ads-box-120x240_as", // vertical_banner
"120x90_0ads_al" : "gmls-ads-box-120x90_0ads_al" // links_120x90
}
}