﻿$(document).ready(function(){
	
	//------------------------------   
    // Function to reset forms.
    // Created: 20080822, Jonas Norrby
    //------------------------------
    // Reset all forms : $('form').clearForm() 
    // Reset only input-fields : $(':input').clearForm() 
    // Reset part of form within  : $('div.warning').clearForm(); 
    // For more info: http://www.learningjquery.com/2007/08/clearing-form-data
    $.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;
      });
    }; 
});
