$(document).ready( function(){

	$('div.quarantine').hide();
	
	$(".flag").click(function() {
        $(this).parent().next(".quarantine").toggle();
	    return false;
	});

//	$('.quarantine-form').ajaxForm({
//			target: '.quarantine'
//	});


// Form Validation

	$("form#contact").validate();	

	$("form#ask_ellen_to_speak").validate();

	$("form#comment_form").validate();

	$("form#dailykidsignup").validate();

	$("form#generalsignup").validate();

//	$("form.quarantine_form").validate();

// Additional validation methods

	$.validator.addMethod("time", function(value, element) {
		return this.optional(element) || /^((([0]?[1-9]|1[0-2])(:|\.)[0-5][0-9]((:|\.)[0-5][0-9])?( )?(AM|am|aM|Am|a.m.|PM|pm|pM|Pm|p.m.))|(([0]?[0-9]|1[0-9]|2[0-3])(:|\.)[0-5][0-9]((:|\.)[0-5][0-9])?))$/.test(value);
		}, "Please enter a valid time, e.g. 00:00 or 3:59 PM"
	);

	$.validator.addMethod("phone", function(phone_number, element) {
	    phone_number = phone_number.replace(/\s+/g, ""); 
		return this.optional(element) || phone_number.length > 9 &&
			phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
		}, "Please specify a valid phone number"
	);
	
	$.validator.addMethod("human", function(value, element) { 
		return this.optional(element) || value == "4"; 
		}, "Please enter the correct value"
	);
// weever

  $(function(){
    // Find all the "reply to" links and bind to the click event
    $('a[href^=/article/comment-form/]').click(function() {

      var url_array = $(this)    // The anchor object
        .attr('href')    // Fetch the value of the href attribute
        .split("/");    // Divide into chunks, using / as the divider

      var id = url_array[4];    // We want the fourth chunk

      // Change the value of weever-parent-id
      $('#weever-parent-id').val(id);
      
      // Now we'll move the form
      $('form#comment_form')
        .insertAfter(    // Insert the comment form after div.entry
          $(this)
          .parent()    // The containing p tag
          .parent()    // div.entry
          );

      return false;
    });
  });


//   IE 6 transparent png fix

	$('#cover').supersleight({shim: 'http://mindinthemaking.org/images/x.gif'});
		
		
});

