var references = { "why-gbg" :"31px",
		   "our-story":"27px",
		   "awards":"36px", 
		   "new-items":"27px", 
		   "get-the-menu":"23px"
}


  jQuery(document).ready( function() {
      $('.basic').click(function (e) {
	  setTimeout(htmlGen,1000);
	  $('#basic-modal-content').modal({onClose: function (dialog) {
		dialog.data.fadeOut('fast', function () {
		    dialog.container.slideUp('fast', function () {
			dialog.overlay.fadeOut('fast', function () {
			    $.modal.close(); // must call this!
			    $(".ketchup-error").css("opacity",0).fadeOut("fast");
			  });
		      });
		  });
	      }});
	  return false;
	});
      $('#take-out-catering').click(function (e) {
	  $('#basic-modal-content2').modal();
	  return false;
	});
      //$('#contact-form').ketchup({}, {'.required': 'required', '#email': 'required,email'});
      contactUsSetter();
      mainMenuSetter();
      setTwitterStream();
      fakeIEValidations();
    });

function fakeIEValidations() { 
// // "top: 493.15px; left: 810.167px; opacity: 1;"
//   if(jQuery.browser.msie==true && jQuery.browser.version=="7.0") { 
//     jQuery("#name").position().top +"px";
//     var html='<div id="name-error" class="ketchup-error"><ul><li>This field is required.</li></ul><span></span></div>';
//   }
}

function setTwitterStream() { 
  $('#twitter-stuff').liveTwitter('gbgsanantonio', {limit: 5, refresh: true, mode: 'user_timeline'}, function() {
      $('#twitter-stuff').cycle({
	  fx: 'scrollUp',
	    timeout: 6000
	    });
      $("#twitter-stuff a").attr("target","_blank");
      jQuery("#loading-tweets").remove();
    });
}
function mainMenuSetter() { 
  $("#menu li").mouseover( function() {
      jQuery(this).animate({"font-size": getItemFontSize(this.id) }, 100);
    }
    ).mouseout ( 
		function() {
		  jQuery(this).animate({"font-size": "21px" }, 100);
		}

		 );

}

function getItemFontSize(reference) {
  return references[reference];
}

function contactUsSetter() { 

  jQuery(".contact-us").click(function() { 
      jQuery("#contact-us").click();
      return false;
    });
  jQuery("#contact-form").submit( function() { 
      var error = 0;
      if(form_validation()==true) {
	var post_object =  { 
	  name : jQuery("#name").val(),
	  email : jQuery("#email").val(),
	  phone : jQuery("#phone").val(),
	  message : jQuery("#message").val()
	};
	jQuery.post("contact-form.php" , post_object, function(response) {
	    jQuery("#send").fadeOut("fast", function() { 
		jQuery("#ajax-message").html('<h4 class="font27 trebuchet" style="padding-left:68px;padding-top:80px;font-size:27px;">Thank you, we will contact you soon</h4>').fadeIn("slow");
		jQuery("#name, #email, #phone,#message").val(null);
	      });
	  });
      }
      return false;
    });
  jQuery("#submit-contact-form").click( function() {
      jQuery("#contact-form").submit();
      return false;
    });
}


function runContactValidation() {
  var post_object =  { 
    name : jQuery("#name").val(),
    email : jQuery("#email").val(),
    phome : jQuery("#phone").val(),
    message : jQuery("#message").val()
  }; 
  return true;
}

