/**
 * matches US phone number format 
 * 
 * where the area code may not start with 1 and the prefix may not start with 1 
 * allows '-' or ' ' as a separator and allows parens around area code 
 * some people may want to put a '1' in front of their number 
 * 
 * 1(212)-999-2345
 * or
 * 212 999 2344
 * or
 * 212-999-0983
 * 
 * but not
 * 111-123-5434
 * and not
 * 212 123 4567
 */
jQuery.validator.addMethod("phoneUS", 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");



jQuery(document).ready( function() {

		var answerSection = $('#get-fast-answers'),
		answerForm = $('#get-fast-answers'),
		trigger = $('#triggerContainer a'),
		overlay = $('#gray-overlay')
		
		var toggleRate = 1200;
	if(answerSection[0]){
		trigger.click(function(){
			//alert("you clicked me");
			answerSection.stop(true,true);
			var top = parseInt(answerSection.css('top'),10)
				
			if(top<0) {
				answerSection.animate({top:0},toggleRate,'easeOutExpo');
				trigger.addClass("triggered");
				overlay.addClass("show");
			} else {
				answerSection.animate({top:-387},toggleRate,'easeOutExpo');
				trigger.removeClass("triggered");
				overlay.removeClass("show");
				
			}
		});
		overlay.click(function() {
			answerSection.animate({top:-387},toggleRate,'easeOutExpo');
				trigger.removeClass("triggered");
				overlay.removeClass("show");
		});
	}
});
