
 new Ajax.PeriodicalUpdater('top_notifications', '/aj_notifications', {
  method: 'get', frequency: 3, decay: 2
 });
function nospam(a, b, c, d) {
 var text;  
 var tg='<';
 var at='@';
 var dest=a+at+b+'.'+c;
 if(d=='' || !d) { text = dest; }
 else { text = d; }
 document.write(tg+'a hr'+'ef="mai'+'lto:'+dest+'">'+text+tg+'/a>');
}
function nospam_v2(a, b, c, d, linkClass) {
 var text;  
 var tg='<';
 var at='@';
 var dest=a+at+b+'.'+c;
 var link_class = (linkClass) ? 'class="'+linkClass+'"' : '';
 if(d=='' || !d) { text = dest; }
 else { text = d; }
 document.write(tg+'a hr'+'ef="mai'+'lto:'+dest+'" '+link_class+'>'+text+tg+'/a>');
}
function stumbleupon_submit() {  
 u=location.href;
 t=document.title;
 window.open('http://www.stumbleupon.com/submit?url='+encodeURIComponent(u)+'&title='+encodeURIComponent(t),'stumbleupon','toolbar=no,width=700,height=400');
 return false;
}
function delicious_post() {  
 u=location.href;
 t=document.title;
 window.open('http://del.icio.us/post?v=4&noui&jump=close&url='+encodeURIComponent(u)+'&title='+encodeURIComponent(t),'delicious','toolbar=no,width=700,height=400');
 return false;
}
function facebook_share() {  
 u=location.href;
 t=document.title;
 window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
 return false;
}
function adimpression(adid) {
 document.write('<img src="http://www.chattanoogabridge.com/_images/generic/tracker.php?adid='+encodeURIComponent(adid)+'" width="100" height="100" alt=""/>');
}
function count_comment_text(input_id,show_count_id,count_limit) {
 var count = $(input_id).value.length;
 $(show_count_id).update(count);
 $(show_count_id).innerHTML;

 if(count > count_limit) {
  var the_input_value = $(input_id).value;
  var limited_the_input_value = the_input_value.substring(0,count_limit);
  $(input_id).value = limited_the_input_value;
 }
}
function confirm_my_action(alert_text, end_url) {
 if(confirm(alert_text)) {
  location.replace(end_url);
 }
}
function show_map() {
 $('hover_map').style.visibility = 'visible';
}
function hide_map() {
 $('hover_map').style.visibility = 'hidden';
}
function ajaxUpdater(id,url) {  new Ajax.Updater(id,url,{asynchronous:true, onLoading: showLoad, onComplete: hideLoad, pragma: 'no-cache'});  }
function ajaxUpdater2(id,url,formid) {  new Ajax.Updater(id,url,{method:'post',asynchronous:true,parameters: Form.serialize(formid),onLoading: showLoad, onComplete: hideLoad, pragma: 'no-cache'});  }

function ajaxUpdater_comments(id,url) {  new Ajax.Updater(id,url,{asynchronous:true, onLoading: showLoad2, onComplete: hideLoad2, pragma: 'no-cache'});  }
function ajaxUpdater2_comments(id,url,formid) {  new Ajax.Updater(id,url,{method:'post',asynchronous:true,parameters: Form.serialize(formid),onLoading: showLoad2, onComplete: hideLoad2, pragma: 'no-cache'});  }

function ajaxRequest(id,url) {
new Ajax.Request('url', {
  parameters: Form.serialize('id')
  });
}
function populate(x) {   // function not used
 var f = document.forms.event_submit;
 f.contact.value = x;
}
showLoad = function() { $('loading').style.display = 'block'; $('done').style.display = 'none'; }
hideLoad = function() { $('loading').style.display = 'none'; $('done').style.display = 'block'; }

showLoad2 = function() { $('post_refresh_loading_img').style.display = 'block'; $('post_refresh_controls').style.display = 'none'; }
hideLoad2 = function() { $('post_refresh_loading_img').style.display = 'none'; $('post_refresh_controls').style.display = 'block'; }

function populate2(a,b,c,d,e,f,g,h) {
 var fv = document.forms.event_submit;
 fv.contactnumber.value = a;
 fv.venuename.value = b;
 fv.venueid.value = c;
 fv.street.value = d;
 fv.city.value = e;
 fv.state.value = f;
 fv.zip.value = g;
 fv.website_tickets.value = h;
}
function populate3(x) {  // not used yet
 var fo = document.forms.event_submit;
 if(fo.cat.value !== "") var fn = fo.cat.value + ', ' + x;
 if(fo.cat.value == "") var fn = x;
 fo.cat.value = fn;
}
function populate4(x,y) {
 var f = document.forms.event_submit;
 f.price.value = y;
}

function stopRKey(evt) {
  var evt = (evt) ? evt : ((event) ? event : null);
  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
  if ((evt.keyCode == 13) && (node.type=="text"))  {return false;}
}

// document.onkeypress = stopRKey;

function textCounter(field, countfield, maxlimit) {
 if (field.value.length > maxlimit) // if too long...trim it!
  field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
 else 
  countfield.value = maxlimit - field.value.length;
}
/* onKeyDown="textCounter(this.form.message,this.form.remLen,125);" onKeyUp="textCounter(this.form.message,this.form.remLen,125); ...use this with it */

