//Checks if the left mouse button is being clicked during a mousedown
// for IE
function assetHostBase(){
// Production?
if (window.location.href.match(/http(s)?:\/\/[^\/]*yellowpages\.com/)){
return "http://c66.yellowpages.com"
} else{
return ""
}
}
function getEvent(e){
return (window.event || e);
}
function leftClick(event) {
if(!event || event.type != "mousedown") return true;
isLeftClick = true;
if(event.which && event.button > 0) isLeftClick = false;
if(!event.which && event.button > 1) isLeftClick = false;
return isLeftClick;
}
function leftClickEvent(e) {
return leftClick(getEvent(e));
}
// TODO:  Move omniture stuff out of application.js.
function omniturePaidListingClickFire(clickType, listingType, clickTier, clickedOnPage, positionOfListingClicked, pageNameModifier, morevars) {
// TODO:  This logic will be moved into the ReportingHelper eventually, and
// a simplified omnitureOnClick will be used.
var linkTrackEvents;
if (listingType == '1' || listingType == '3') {
linkTrackEvents='event5,event7';
}
else {
linkTrackEvents='event6,event7';
}
var vars = {
eVar7: listingType, 
eVar8: clickTier,
eVar10: clickedOnPage,
eVar11: positionOfListingClicked,
linkTrackEvents: linkTrackEvents,
linkTrackVars: 'events,products,eVar6,eVar7,eVar8,eVar9,eVar10,eVar11,prop27',
trackExternalLinks: false
};
// If variables were explicitly passed in, we override the ones above.
if(morevars)
vars = jQuery.extend(vars, morevars);
omnitureOnClick(clickType, vars);
}
// Deprecated.  Use omnitureOnClick()
function omnitureClickFire(clickType, pageNameModifier, morevars){
omnitureOnClick(clickType, (morevars || {}));
}
// Takes a hash of variable/value pairs, and logs the variables named in it for
// omniture.
function omnitureOnClick(clickType, vars) {
// TODO:  This logic will be moved into the ReportingHelper eventually.
// All of the business logic for Omniture will end up in Ruby.
if(vars.jsEvent && !leftClick(vars.jsEvent)) return;
delete(vars.jsEvent);
//alert("omn logger");
s = s_gi(s_account);
var tracked = ['eVar6', 'prop27'];
var events = [];
s.eVar6 = s.prop27 = clickType;
if($('#download_platform') && s.prop27 == 176) { vars['prop28'] = $('#download_platform').val(); }
if(vars['prop36'] != null) { 
var survey_options = document.survey_form.rate_survey;
for(var i=0; i < survey_options.length; i++) {
if(survey_options[i].checked)
vars['prop36'] = survey_options[i].value;
}
delete survey_options;
}
if(vars['prop37'] != null) {
vars['prop37'] = window.location; 
}
jQuery.each(vars, function(name, value) {
tracked.push(name);
if(name.match(/^event/))
events.push(name);
s[name] = value;
});
if(events.length > 0) {
tracked.push('events');
if(events.join(',') != 'None') s.events = events.join(',');
}
if(s.linkTrackEvents && s.events!='None' && s.linkTrackEvents != 'None')
s.events = [s.events, s.linkTrackEvents].join(',');
s.linkTrackVars = tracked.join(',');
// Everything below this line is cargo cult to me:
s.pageName = null;
// This is a totally horrible race condition for ever and ever.  Blame Ben.  Pete says so, and he's Mr. Omniture (for now).
setTimeout(function(){s.trackExternalLinks=true; s.trackDownloadLinks=true;}, 1000)
void(s.tl(this, 'o', 'Omniture click'));
}
function omnitureFeaturedListingCountClickFire(count) {
var s = s_gi(s_account);
s.linkTrackVars='prop8,prop10';
s.prop8 = count;
s.prop10 = count;
s.pageName = null;
void(s.tl(this,'o','Omniture click'));
}
// Returns the search terms, sanitized to fit in an omniture variable.
function omnitureSearchTerms() {
var terms = searchTerms();
var find = terms[0];
var location = terms[1];
return find.toLowerCase() + '|' + 
location.toLowerCase().replace(/,\s*/, '-');
}
// Returns the search terms as [search_query, search_location].
function searchTerms() {
return [$("#search-find")[0].value, $("#search-location")[0].value];
}
function toggleOptionList(name) {
jQuery('#'+name).toggleClass('open');
}
function hideOptionList(name) {
jQuery('#'+name).removeClass('open');
}
function popupWindow(url, width, height) {
window.open(url, '', 'height='+ height +',width=' + width + ',status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes');
}
function getLoginBox(target) {
back_to = location.pathname + escape(location.search + location.hash);
jQuery.ajax({
type: "GET",
url: location.protocol + "//" + location.host + "/retrieve_login_status?back_to=" + back_to,
dataType: "html",
complete: function(xhr, message){ 
if (xhr.status == 200){
jQuery(target).html(xhr.responseText);
}
return false;
}
});
}
function assignOnClick(idHash) {
for( var item in idHash ){
if ($("#"+item)) $("#"+item).click(idHash[item]);
}
}
function updateOnClick(idHash, oldHash) {
for( var item in idHash ){
if ($("#"+item)) {
if (oldHash[item]) $("#"+item).unbind("click", oldHash[item]);
$("#"+item).click(idHash[item]);
}
}
}
function AjaxPostOnSubmit(form, successCallback, failureCallback) {
jQuery.ajax({
type: "POST",
data: jQuery(form).serialize(),
url: form.action,
complete: function(){alert('done');},
success: successCallback,
error: failureCallback
});
return false;
}
function clear_rating_form(){
document.getElementById('title').value = '';
document.getElementById('rating').value = 5;
document.getElementById('rating').checked = true;
document.getElementById('note').value = '';
return false;
}
// blurs tabs to fix IE CSS image loading issue
function change_tab(class_name, tab, tab_wrapper) {
jQuery('#'+tab_wrapper).removeAttr('class').addClass(class_name).blur();
return false;
}
// stupid IE fix that makes hidden forms submissible by clicking ENTER on an input
// possible other solution: DESTROY IE!
function assign_form_submission_on_enter_key(form_id) {
var selector = 'form#'+form_id+' input';
$(selector).unbind("keydown", handle_input_keydown_event);
$(selector).triggerHandler("keydown", null);// IE won't recognize the assigned keydown handler unlesss it is called once!
$(selector).keydown(handle_input_keydown_event);
}
// stupid IE fix that makes hidden forms submissible by clicking ENTER on an input
// possible other solution: DESTROY IE!
function assign_form_submission_on_enter_key_directions(form_id) {
var selector = 'form#'+form_id+' input';
$(selector).unbind("keydown", handle_input_keydown_event_directions);
$(selector).triggerHandler("keydown", null);// IE won't recognize the assigned keydown handler unlesss it is called once!
$(selector).keydown(handle_input_keydown_event_directions);
}
function handle_input_keydown_event(e) {
if (e.keyCode == 13) {
$(this).parents('form').attr("onsubmit")();// IE needs this to call the code in onsubmit as it isn't run by default!
$(this).parents('form').trigger('submit');
return false;
}
}
function handle_input_keydown_event_directions(e) {
if (e.keyCode == 13) {
get_route();
return false;
}
}
function switchSearchBox(current_tab){
jQuery('#yellowpages_search').removeAttr('class').addClass("on-" + current_tab);
assign_form_submission_on_enter_key("search-" + current_tab);
focusSearchField(current_tab)
return false;
}
function focusSearchField(fieldset_id){
$('#'+fieldset_id+' input:first').focus();
}
function request_id () {
var imgs = $('img');
for (var i = 0; i < imgs.length; ++i) {
if (m = imgs[i].src.match(/logging_requests\.gif\?rid=([^=&]+)/))
return m[1];
}
}
function log_click(src_params, morevars) {
if(morevars && morevars.jsEvent && !leftClick(morevars.jsEvent)) return;
//alert("img logger");
var img_src = '/images/logging_clicks.gif?';
img_src += 'rid=' + request_id();
if (src_params.length > 0)
img_src += '&' + src_params.replace(/;/g,'&');
(new Image()).src = img_src + '&cb=' + Math.floor(Math.random() * 1000);
}
var link_types = new Object();
link_types.edit_note             = 21;
link_types.get_directions        = 14;
link_types.map_it                = 13;
link_types.save_business_listing = 11;
link_types.search_nearby         = 12;
link_types.send_to_mobile        = 33;
link_types.send_to_email         = 3;
function log_tool_click(form, cmd, morevars) {
var action = form.listing_tool.value;
var link_type = link_types[action];
if (link_type) {
cmd = cmd.replace(/(lt=)(\d+)/, "$1" + link_type);
log_click(cmd, morevars);
}
}
function log_omniture_click(form, tier, type, page, morevars) {
var action = form.listing_tool.value;
var link_type = link_types[action];
omniturePaidListingClickFire(new String(link_type), tier, type, page, '12', morevars)
}
function log_omniture_category_validation_selections(form) {
var total = jQuery(form).find('.check').length;
var counter = 0;
var checked = [];
jQuery(form).find('.check').each(function() {
if (this.checked) {
counter++;
if(this.attributes['category_id']) {
checked.push(this.attributes['category_id'].value);
}
}
});
if (counter > 0) {
var link_type = 103;
if (counter > 1 && counter != total) {
link_type = 104;
} else if (counter == total) {
link_type = 105;
}
omnitureOnClick(link_type, { "prop18": checked.join(",") });
}
}
function convertToUrlFriendly(string){
var newString;
newString = string.replace(/\s/g,'-');
newString = newString.replace(/['"#]+/,'');
return newString;
}
function moreInfoSwitch(aTag) {
var tempArray = aTag.id.split('-');
tempArray.pop();
var sectionId = tempArray.join('-');
var section = jQuery('#'+sectionId);
if (section.hasClass('hidden-div')) {
// Handle hiding the sections, and displaying the newly selected section.
jQuery('.more-info-section').addClass('hidden-div');
section.removeClass('hidden-div');
// Handle the active state of the more info links, make the new link active.
var links = jQuery('.general-info');
var indexOfOnLink = null;		
links.each(function(index) {
if (aTag.parentNode == this) {
jQuery(this).addClass('on');
} 
else {
jQuery(this).removeClass('on');
}
});
}
return false;
}
function switchRefinements(select) {
jQuery('.options-menu').hide();
jQuery('#'+select.value).show();
jQuery('#refine-options').blur();
}
function check_java_for_audio_ad(url){
if (navigator.javaEnabled())
popupWindow(url, 625, 295);
else
popupWindow('/java_not_enabled.html', 495, 480);
}
//reset() does not work for a form which has been submitted with some values
//so this function can be used.
function cleartextboxes(frmname){
var frm=document.getElementById(frmname);
for(i=0; i<frm.length; i++){
if(frm.elements[i].type == "text" || frm.elements[i].type == "password"){
frm.elements[i].value = "";
}
}
}
function switch_to_map_directions(){
jQuery('#map-header').removeClass("on-map-location").addClass('on-map-directions');
jQuery("#canvas").removeClass('maps').addClass("directions");
jQuery("#send_to_mobile_li").show();
assign_form_submission_on_enter_key_directions("directions_form");
if($.trim($$("src").value) == 'send2email_map') {
$$("src").value = "";
}  
prepopulateEndAddress();
}
function switch_to_map_locations(init_maps){
jQuery('#map-header').removeClass('on-map-directions').addClass("on-map-location");
jQuery("#canvas").removeClass("directions").addClass('maps');
jQuery("#send_to_mobile_li").hide();
}
/* Used for feedback partial */
var asynchronousGuard = {feedback:new Array(), results: 0, isCleared:function(){return this.results == 2;}};
function getFeedbackFrom(urls) {
jQuery.each(urls, function() {
jQuery.ajax({
url: this,
method: 'get',
success: pushContent,
error: pushNull,
timeout: 5000
});
})
}
function pushContent(new_content) {
if (new_content.length == 0 || new_content.match(/^\s+$/)) {
pushNull();
return;
}
asynchronousGuard.feedback.push(new_content);
asynchronousGuard.results += 1;
tryUpdateFeedback();
}
/* a mini helper to replace prototoype_element.visible() call */
function visible(jquery_elem){
if (jquery_elem.css('visible') == 'visible' || jquery_elem.css('display') == 'none')
return false;
else
return true;
}
function pushNull(xhr, string, exception) {
asynchronousGuard.results += 1;
tryUpdateFeedback();   
}
function tryUpdateFeedback() {
var content = "";
if (asynchronousGuard.isCleared()) {
if (asynchronousGuard.feedback.length == 0) {
content = "";
} else {
content = 'See ' + asynchronousGuard.feedback.join(' or ') + '.';
updateFeedback(content);
}
}
}
function updateFeedback(content) {
jQuery('#feedback-text').html(content);
if (!visible(jQuery('#feedback-text'))) {
jQuery('#feedback-text').fadeIn('slow');
jQuery('.or-messaging').fadeIn('slow');
} else {
jQuery('#feedback-text').fadeIn('normal');
jQuery('.or-messaging').fadeIn('normal');
}
}
/* 
* Used for the side bar
*/
function getRightBanner(url){
jQuery.ajax({
type: "GET",
url: url,
complete: function(xhr, message){ 
if (xhr.status == 200){
jQuery('#promo-column').html(xhr.responseText).fadeIn('slow');				
}else{
jQuery('#promo-column').show();
displayBanner();
}
return false; 
},
error: function(xhr, string, exception){ displayBanner(); }
});	
}
function displayBanner() {jQuery('#promo-banner').fadeIn('normal');}
/* 
* Used for the recycling center zip code search
*/
function clear_zip_search_input(){
if(jQuery('#zip_code_input').val() == "Enter ZIP code"){
jQuery('#zip_code_input').val('');
}
}
function default_zip_search_input(){
if(jQuery('#zip_code_input').val() == ""){
jQuery('#zip_code_input').val('Enter ZIP code');
}	
}
getRecyclingCenters = function(){	
jQuery.ajax({
type: "POST",
url: "get_recycle_centers",
data: "zip="+jQuery('#zip_code_input').val(),
success: function(html){ jQuery('#ajax_indicator').hide();jQuery('#results').html(html).show(); },
error: function(xhr, string, exception){ alert('Error getting recycling centers'); },
beforeSend: function(xhr){
jQuery('#results').hide();
jQuery('#ajax_indicator').show();
jQuery('#zip_code').html(jQuery('#zip_code_input').val());
jQuery('#affiliates_label').show();
}
});
}
// These methods return true if the user is not logged in so that the href of the link 
// is followed rather than a popup being displayed.  The user will be prompted to
// login if the link is followed as a normal a tag.
function saveListingOnClick(href, listing_data, redirection_href) {
jQuery.ajax({
type: "POST",
url: href,
data: listing_data,
complete: function(xhr, message){ if (xhr.status == 200){alert('You saved this business information. \nView it anytime in your MY YELLOWPAGES.COM My Favorites.'); }return false; },
error: function(xhr, string, exception){ 
if(xhr.status == 401) {
location.href = redirection_href;
} else {
alert('We were unable to save your listing.');
}
}
});
return false;
}
function saveSearchOnClick(href, search_data, redirection_href) {
jQuery.ajax({
type: "POST",
url: href,
data: search_data,
complete: function(xhr, message){ if (xhr.status == 200){alert('You saved this search.  \nView it anytime on MY YELLOWPAGES.COM.'); }return false; },
error: function(xhr, string, exception){ 
if(xhr.status == 401) {
location.href = redirection_href;
} else {
alert('We were unable to save your search.');
}
}
});
return false;
}
function falseIfPopup(form, logged_in, url, redirection_url) {
var action = form.listing_tool.value;
var listing_id = form.listing_id.value;
var serializedForm = jQuery(form).serialize();
if (action == "send_to_mobile") {    
popupWindow(form.action + "?" + serializedForm, 425, 425);
return false;
} else if (action == "send_to_email") {    
popupWindow(form.action + "?" + serializedForm, 380, 717);
return false;
} 
if (!logged_in){return true;}
if (action == "edit_note") {
popupWindow(form.action + "?" + serializedForm, 700, 625);
return false;
} else if (action == 'save_business_listing') {
jQuery.ajax({
url: url,
data: {listing_id: listing_id},
type: "POST",
complete: function(xhr, message){if(xhr.status == 200){alert("You saved this business information. \nView it anytime in your MY YELLOWPAGES.COM My Favorites.");} },
error: function(xhr, string, exception){ 
if(xhr.status == 401) {
location.href = redirection_url;
} else {
alert('We were unable to save your search.');
}
}
});    	
return false;
}
return true;
}
function signInOrPopup(href, width, height) {
if (width == null) {width = 625;}
if (height == null) {height = 700;}
popupWindow(href, width, height);
return false;
}
function truePopup(href, width, height){
if (width == null) {width = 625;}
if (height == null) {height = 700;}
popupWindow(href, width, height);
return true;	
}
/* Used for the mobile page */
function merge_number_fields_into_number(){
var number = jQuery('#area_code').val() + jQuery('#local_exchange').val() + jQuery('#last_four').val();
jQuery('#download_number').val(number);
}
function alert_mobile(message){
jQuery('#server_response').html(message);
}
function validate(){
var error = mobile_form_errors();
if (error) {
alert(error);
return false;
}
return true;
}
function mobile_form_errors(){
if (jQuery('#download_platform').val() == ''){
return "Please select your phone model to continue.";
} else if (jQuery('#area_code').val().length < 3 || jQuery('#local_exchange').val().length < 3  || jQuery('#last_four').val().length < 4){
return 'Please fill out all fields for your phone number to continue.';
} else{
return false;
}
}
function remote_submit(url, data, callback){
if(!callback) callback = function(){return false;};
try{
//merge_number_fields_into_number();			
if (validate()){			
jQuery.ajax({
url: url,
type: "POST",
data: data,
beforeSend: function(xhr){xhr.setRequestHeader("Accept", "text/javascript");},
complete: function(xhr, message){callback( JSON.parse(xhr.responseText) );return false;},
error: function(xhr, string, exception){alert ("Error getting request")}
});
}
} catch(e) {
console.debug(e.message);
}
}
//category validation
function allSearch() {
var doCheckAll = true;
var allChecked = true;
var numChecked = 0;
jQuery('#bottom .check').each(function(){ if (this.checked) { doCheckAll = false; numChecked++; } else { allChecked = false; } });
if (doCheckAll)
checkAllToggle(true);
if (allChecked || doCheckAll)
all_top_cat;
else if (numChecked > 1)
multiple_top_cat;
else
matched_cat;
}
function checkAllToggle(checked) {
if (checked)
jQuery('#bottom .check').each(function(){this.checked = true});
else
jQuery('#bottom .check').each(function(){this.checked = false});	
}	
//footer
function setDisabled(){jQuery('.disabled').attr('href', 'javascript:void(0);');}
//search box stuff
function unCheckDefaultSearch(){jQuery('#default-standard').attr('checked', false);}
function changeDistanceSearch(a_element){
jQuery('#hidden-radius').val(unescapeHTML(a_element.innerHTML));
jQuery('#within-find').val(unescapeHTML(a_element.innerHTML));
//close the drop down
toggleOptionList('distance-radius'); 
}  
function searchBoxRecent(a_element){
var anchor = jQuery(a_element);
var input = anchor.parent().parent().parent().parent().children('input')[0];
if (input.id == 'search-location'){unCheckDefaultSearch();}
input.value = anchor.text();
//close the drop down
toggleOptionList(jQuery(input).parent().attr('id'));
input.focus();
}
//refinement
function moreRefinement(link_number){
jQuery('#more-refinements-container-'+link_number).show(); jQuery('#more-refinements-link-'+link_number).hide()
}
/* MapPoint*/
function map_point_init(center, init_lat, init_lon){
if(center != ''){
initial_latitude = Number(init_lat);
initial_longitude = Number(init_lon);
latitude  = initial_latitude;
longitude = initial_longitude;
}
}
function home(){
go_to_location(initial_latitude, initial_longitude);
}
function mapClick(e){
scale = 0.01;
var x = ((e.layerX * 100 / 515) - 50) / 100;
var y = ((e.layerY * 100 / 515) - 50) / 100;
latitude = latitude - (y * scale);
longitude = longitude + (x * scale);
go_to_location(latitude, longitude);
}
function go_to_location(lat, lon){
url = map_point_url+ '?center=' + [String(lat), String(lon)].join(',');
map = document.getElementById('map_image');
map.src = null;
map.src = url;	
}
function reverse_directions(){
if(jQuery('#direction').val() == 'forward'){
jQuery('#direction').val('reverse');
swap_inner_html('start_address', 'end_address');
} else {
jQuery('#direction').val('forward');
swap_inner_html('start_address', 'end_address');
}
}
function swap_inner_html(first, second){
var tmp = jQuery('#'+first).html();
jQuery('#'+first).html( jQuery('#'+second).html() );
jQuery('#'+second).html(tmp);
jQuery('#moreinformaps').submit();	
return true;
}
/* 
* helper / plugin stuff
*/
//stolen from prototype, used in the search boxes
function unescapeHTML(toRet){return toRet.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');}
function install_toolbar() {
if (window.navigator.userAgent.indexOf("Firefox") != -1) {
location.href = "/tools/toolbar/index_firefox.html";
}
else {  // IE
location.href = "/tools/toolbar/YPtoolbarIE6000.exe";
}
}
function install_shortcut() {
location.href = "/tools/shortcut/ypshortcutsetup.exe";
}
function yellowpagesAd(logscripts, url, e) {
eval(logscripts);							// evaluate scripts for omniture logging
alert(e.button);
if (window.navigator.userAgent.indexOf("Firefox") != -1) {
if (e.button == 0) {  			// left button -> new window
url += "&resize=1";
window.open(url,'mywindow','height=740,width=625,scrollbars=yes,resizable=yes');
} else if (e.button == 1){	// middle button -> new tab, no resize
url += "&resize=0";
window.open(url);
}
// else right button -> fall through to menu
}
else {  // IE has no tab
url += "&resize=1";
window.open(url,'mywindow','height=740,width=625,scrollbars=yes,resizable=yes');
}
}
//var survey_max_limit = 250;
var enableip = ""; 
var disableip = "";
// Works for IE Only
function showSurveyInquiryOnCloseMouse() {
// hack: distinguish close from refresh with X coordinate
if (document.all) {
e = window.event;
if (e.clientY < 0 && e.clientX > 200) {
showSurveyAbandonmentInquiryRandomly();
}
}
}
function showSurveyAbandonmentInquiryRandomly() {
if (Math.random() * survey_max_limit < 1) {
var wn = "new" + (Math.round(Math.random() * 1000000));
window.open('/contact_us/survey_abandonment', wn, 'toolbar=no,scrollbars=yes,resizable=yes,width=500,height=250,left=200,top=100');
}
}
function startSurveyAbandonmentPopup() {
var wn = "new" + (Math.round(Math.random() * 1000000));
window.open("http://www.keysurvey.com/survey/189076/d779/?Popup=1", wn, 'toolbar=yes,scrollbars=yes,resizable=yes,width=1000,height=650,left=150,top=50');
}
function showSurveySatisfactionInquiryRandomly() {
if (Math.random() * survey_max_limit < 1) {
var wn = "new" + (Math.round(Math.random() * 1000000));
w = window.open('/contact_us/survey_satisfaction', wn, 'toolbar=no,scrollbars=yes,resizable=yes,width=500,height=250');
if (window.focus) {
w.blur();
window.focus();
}
}
}
function startSurveySatisfactionPopup() {
var wn = "new" + (Math.round(Math.random() * 1000000));
window.open("http://www.keysurvey.com/survey/187103/1dc9/?Popup=1", wn, 'toolbar=no,scrollbars=yes,resizable=yes,width=1000,height=650,left=150,top=50');
}
function createRatingScore(link) {
parent_ul = jQuery(link.parentNode.parentNode)
link = jQuery(link)
if(link.hasClass("selected") == true) return false;
jQuery.ajax({
type: "POST",
url: '/rating_scores',
data: {'rating_score[rating_id]':parent_ul.attr('id'), 'rating_score[score]':(jQuery(link).hasClass('thumbup') ? '1' : '-1')},
complete: function(xhr, message){ 
if (xhr.status == 201){
parent_ul.children('li.rate_text').html("Thanks for your rating!");
parent_ul.children(".thumb").children('a').each(function() {
selected_link = jQuery(this);
if(selected_link.parent().hasClass("selected")) {
selected_link.parent().removeClass("selected");
selector = selected_link.hasClass("thumbup") ? ".thumbup" : ".thumbdown";
selected_link.parent().siblings(selector).html("(" + (parseInt(selected_link.parent().siblings(selector).html().match(/\((.+)\)/)[1]) - 1) + ")");
}
});
link.parent().addClass("selected");
count_selector = link.hasClass("thumbup") ? ".thumbup" : ".thumbdown";
link.parent().siblings(count_selector).html("(" + (parseInt(link.parent().siblings(count_selector).html().match(/\((.+)\)/)[1]) + 1) + ")");	  	
}
return false; 
},
error: function(xhr, string, exception){ 
alert('We were unable to save your rating.');
}
});
return false;
}
var ratesWords = new Array("Click a star to rate","I Would Not Recommend","Fair","Good","Very Good","Exceptional");
var sOver = 0;
function rateStar(n) {
document.getElementById("stars_ul").className = "star_rate_"+n;
sOver = n;
document.getElementById("rating_value").value = n;
window.focus();
}
function starOver(n) {
if (sOver == 0) {
document.getElementById("stars_ul").className = "star_rate_"+n;
}
document.getElementById("rate_words").innerHTML = ratesWords[n];
}
function starOut(n) {
if (sOver == 0) {
document.getElementById("stars_ul").className = "star_rate_0";
} else {
document.getElementById("stars_ul").className = "star_rate_"+sOver;
}
document.getElementById("rate_words").innerHTML = ratesWords[sOver];
}
// http://jira.yellowpages.com/browse/YP-5569 (Dennis)
function showNeighborhoodSearchBox() {
$('#promo_tile_1').append('<div class="overlay"></div>').fadeIn('fast');
if($.browser.msie) {
if($.browser.version < 7) {$('.overlay').css({height: $('#home-advertisements-container-double').height()})}
}
$('.neighborhood-search-location').fadeIn("fast");
}
// http://jira.yellowpages.com/browse/YP-5143 (Dennis)
function expandBreadcrumbCategories(txt) {
$('#breadcrumb_categories').html(txt);
$('#breadcrumb_expansion').remove();
}
function log_partner_api_result(options){
var query = []
$.each(options, function(k,v){ query.push(escape(k) + '=' + escape(v)) })
$('body').append("<img src='/images/api_result.gif?" + query.join('&amp;') + "' />")
}