/**
 * menus Script
 * 
 * 1) listen for a click on the "MENUS" link; when that happens,
 * 2) build the dialog box - only have to do this once.  Thereafter, we can 
 *    just reopen the existing dialog.
 *
 * Generated this map with this link: 
 *
 * Written by James Revillini <james@revillini.com>.  E-mail for support.
 **/

jQuery(function ($) {

	//register event listeners. listen for whenever visitor clicks a link with class 'menus'
	$('a[href^=http://www.billygrant.com/billygrant_new101209/chefs-market-menu.html]').click(function (evt) {
	
		//cancel default action
		evt.preventDefault();
		
		//capture the giftcards LINK HREF - NOTE: this means the link MUST have the exact giftcard link for what you want to show!
		var url = $(this).attr('href');
		var iframe_url = url;
	
		//check if we already built the contact dialog
		if (!$('#menus-dialog').length) {
			//no dialog has been built yet; build it!
			$('head').append('<link rel="stylesheet" type="text/css" href="css/food-menus.css">');
			$('body').append('<div id="menus-dialog" title="Please keep in mind that these are sample menus reflecting the season.<br/> Our actual menus change frequently and feature the highest quality ingredients."><iframe name="menus" width="100%" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+iframe_url+'"></iframe></div>');
			$('#menus-dialog').dialog({
				autoOpen	: true,

				width		: 900,
				height		: 600,

				modal		: true,
				zIndex		: 999999,
				buttons: {
					"Close": function() { 

						$(this).dialog("close"); 

					},
					"Open Full-Screen": function() { 

						window.open(url);

					} 

				}
				
			});
			return;
		
		}
		
		
		//ok, dialog HAS been built, so just reload the iframe in there and then show it
		$('#menus-dialog').dialog('open');
		$('#menus-dialog iframe').attr('src', url);
		
		return;
	});

});

