$(document).ready(function(){

 $("div.tn img").hover(
      function () {
        $(this).fadeTo("fast", 0.5);
      },
      function () {
        $(this).fadeTo("slow", 1);
      }
    );
    
 
    
    $(".ibutton").hover(
      function () {
        var id = $(this).attr("id");
        $(this).attr("src", "/i/"+id+"-over.png");
      }, 
      function () {
        var id = $(this).attr("id");
        $(this).attr("src", "/i/"+id+".png");
      });
    
    
    $("#registration").submit(function(){
      $("#registration input[name='spam']").val("2");
	});
    
    $(".action-delete").click(function(){
        return confirm('Are you sure you want to delete?');
    });
    
     dhidden = true;
     $(".toggle_directions").click(function (e) 
        {if(dhidden == false) {
            	$(".directions").slideUp(speed); 
              dhidden = true;
        } else {
             	$(".directions").slideDown(speed); 	
               dhidden = false;
        }
        e.preventDefault();
     });

    
    
    hidden = true;
    $(".toggler-trigger").click(function(e){
        $(".toggler-trigger span").toggle();
        var pid = $(this).parent().attr("id");
        
        if(hidden == false){
            $(".toggler-content").slideUp("fast");
            hidden = true;
        } else {
            $(".toggler-content").slideDown("fast");
            hidden = false;
        }
        e.preventDefault();
        
    });
    
   
    
  	$(function() {
  		      $("#datepicker").datepicker({
                dateFormat: 'yy-mm-dd',
                showAnim: 'slideDown',
                firstDay: 1
            });
  	});
  	
  	$(function() {
  		      $("#searchdate").datepicker({
                dateFormat: 'yy-mm-dd',
                showAnim: 'slideDown',
                firstDay: 1
            });
  	});
  	

    
    
    
});
