// Cufon setup
Cufon.set('fontFamily', 'ITC Stone Serif').replace('#promos h3')('#content-main h2');

$(function() {
  // Self-labeled form fields
	$("input[title], textarea[title]").each(function() {
		if($(this).val() === "") {
			$(this).val($(this).attr("title"));	
		}

		$(this).focus(function() {
			if($(this).val() == $(this).attr("title")) {
				$(this).val("").addClass("focused");	
			}
		});
		
		$(this).blur(function() {
			if($(this).val() === "") {
				$(this).val($(this).attr("title")).removeClass("focused");	
			}
		});
	});
  
  // Homepage slideshow
  $('#slideshow').cycle({
    fx: 'fade',
    timeout: 5000
  });
  
  // Select all links with lightbox class
  $('#lightbox-1 a.lightbox').lightBox();
  $('#lightbox-2 a.lightbox').lightBox();
  $('#lightbox-3 a.lightbox').lightBox();
  $('#lightbox-4 a.lightbox').lightBox();
  $('#lightbox-5 a.lightbox').lightBox();
  
  // Open Table Reservation modal
  $("a#open-table-form").fancybox({
  	'padding'         : 0,
  	'margin'          : 0,
  	'overlayOpacity'	: 0.54,
  	'speedIn'         : 300,
  	'speedOut'        : 300,
  	'overlayColor'    : '#000',
  	'titleShow'       : false,
  	'autoDimensions'  : false,
  	'width'           : 300,
  	'height'          : 234,
  	'centerOnScroll'  : true
  });
  
  // Mailing List modal
  $("a#email-form").fancybox({
  	'padding'         : 0,
  	'margin'          : 0,
  	'overlayOpacity'	: 0.54,
  	'speedIn'         : 300,
  	'speedOut'        : 300,
  	'overlayColor'    : '#000',
  	'titleShow'       : false,
  	'autoDimensions'  : false,
  	'width'           : 430,
  	'height'          : 419,
  	'centerOnScroll'  : true
  });
  
  // Curvy Corners setup
  var settings = {
    tl: { radius: 20 },
    tr: { radius: 20 },
    bl: { radius: 20 },
    br: { radius: 20 },
    antiAlias: true
  }

  curvyCorners(settings, ".rounded");
  
});	 

function clear_form_elements(ele) { 
  $(ele).find(':input').each(function() {
    switch(this.type) {
      case 'password':
      case 'select-multiple':
      case 'select-one':
      case 'text':
      case 'textarea':
          $(this).val('');
          break;
      case 'checkbox':
      case 'radio':
          this.checked = false;
    }
  });
}

