
function performSearch()
{
    document.forms["frmFilter"].hdnAction.value = 'Search' ;
    document.forms["frmFilter"].submit();
}

function clearSearch()
{
    document.forms["frmFilter"].hdnAction.value = 'Clear' ;
    document.forms["frmFilter"].submit();
}            


/*

$.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;
  });
};  
       */
function clearDivForm(divName)
{
    divName = '#' + divName ;
    $(divName).children().find('input, select, checkbox, radio, textarea').each(function(){
        
       var type = this.type;
       var tag = this.tagName.toLowerCase();
       
      // alert(tag) ;
      if (type == 'text' || type == 'password' || tag == 'textarea')
        $(this).val('') ;
      else if (type == 'checkbox' || type == 'radio')
        this.checked = false;
      else if (tag == 'select')
       // $(this).selectedIndex = -1;
        this.selectedIndex = -1;   
      });    
}
  

function validate_email(field, alerttxt)
    {
    with (field)
      {
          apos = field.indexOf("@");
          dotpos = field.lastIndexOf(".");
          if (apos <1 || dotpos-apos < 2)  {
              if (alerttxt != "") alert(alerttxt);
              return false;
          } else {
              return true;
          }
      }
    }    

