// JavaScript Document

function limitC(obj){
	var maxChar = 140;
	while(obj.value.length>maxChar){
		obj.value=obj.value.replace(/.$/,'')
	}
	document.getElementById('fieldCounter').innerHTML = maxChar - obj.value.length + ' characters left';
}

$(document).ready(function() { 
var options = { 
target:        '#alert',
}; 
$('#contactForm').ajaxForm(options); 
});

$(document).ready(function() { 
var options = { 
target:        '#listAlert',
}; 
$('#listForm').ajaxForm(options); 
});

$.fn.clearForm = function() {
  return this.each(function() {
	var type = this.type, tag = this.tagName.toLowerCase();
	if (tag == 'form')
	  return $(':input',this).clearForm();
	if (type == 'text' || type == 'password' || tag == 'textarea')
	  this.value = '';
	else if (type == 'checkbox' || type == 'radio')
	  this.checked = false;
	else if (tag == 'select')
	  this.selectedIndex = -1;
  });
};