$(document).ready(function(){
    
    $("img.clear").click(function () {
      $(this).prev().val("");
    });

    $("img.submit").click(function () {
      $(this).parent().parent().trigger("submit");
    });

//     $("table.tabs").hide();
//     $("input.tab").click(function () {
//       $("table.tabs").hide();
//       $("#t_" + this.id).show();
//     });

    fieldcount = 1;
    $("img.addfield").click(function () {
      fieldcount++;
      $("#t_" + this.id + " tr:last").after("\n\t<tr><td><label for=\"field" + fieldcount + "\">Search " + fieldcount + ":</label></td><td><input id=\"field" + fieldcount + "\" name=\"field" + fieldcount + "\" type=\"text\" value=\"\" />&nbsp;<select \"select" + fieldcount + "\" name=\"select" + fieldcount + "\"><option value=\"itemsearch\">Item Search</option><option value=\"feedsearch\">Feed Search</option></select></td></tr>");
    });

    x = 2;
    $(".hidedesc").click(function () {
      if(x == 0){
	$("span.desc").show();
	$("img.hidedesc").attr("src","/images/previous.png");
	x=1;
      }else{
	$("span.desc").hide();
	$("img.hidedesc").attr("src","/images/next.png");
	x=0;
      }
    });

  });
