/*
 * SimpleModal Confirm Modal Dialog
 * http://www.ericmmartin.com/projects/simplemodal/
 * http://code.google.com/p/simplemodal/
 *
 * Copyright (c) 2009 Eric Martin - http://ericmmartin.com
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Revision: $Id: confirm.js 185 2009-02-09 21:51:12Z emartin24 $
 *
 */

$(document).ready(function () {
							
							$("#confirmModalOverlay").click(function(){
																	  
															$.modal.close();		  
																	  });
	$('.confirm').click(function (e) {
								  
						$(".cls").hide();
						
					$("#confirm_"+this.id).show();
					//  alert('a');
					$('ul.portfolio').innerfade({
				speed: 1000,
				timeout: 3000,
				type: 'sequence',
				containerheight: '240px'
			});
		$('#confirm').modal({
		close:false,
		position: ["5%",],
		overlayId:'confirmModalOverlay',
		containerId:'confirmModalContainer', 
		onShow: function (dialog) {
			
								$("#confirmModalOverlay").click(function(){
																	  
															$.modal.close();		  
																	  });
			// if the user clicks "yes"
			dialog.data.find('.yes').click(function () {
				// call the callback
				if ($.isFunction(callback)) {
					callback.apply();
				}
				// close the dialog
				$.modal.close();
			});
		}
	});
	});
	
	//popup
	
	
	$('.button_menu').click(function (e) {
									  
		 var id=this.id.split('button_');
			/*$.ajax({
		type: "POST", 
		data:'id='+id[1],
		url:'food.php?action=popupmenu',
		success:function(responce)
		{
			//alert(responce)
		$("#pane_up").html(responce);
		$("#pane_up").height('auto');
		}
		});		*/				
							$('#confirm2_'+id[1]).modal({
		close:true,
		position: ["5%",],
		overlayId:'confirmModalOverlay',
		containerId:'confirmModalContainer', 
		onShow: function (dialog) {
			 $('#pane_up_'+id[1]).jScrollPane({showArrows:true});
			$("#confirmModalOverlay").click(function(){
																	  
															$.modal.close();		  
																	  });
			 
			$(".simplemodal-wrap").attr('style','overflow:hidden;');
		$(".close").click(function(){
									 //  window.open('popupmenu.php?id='+id[1],'','width=600,height=200,scrollbars=yes');
							   $.modal.close();
							   });
			
			$(".close1").click(function(){
									   
									   window.open('/popupmenu.php?id='+id[1],'Menu','width=600,height=700,scrollbars=yes');
							  // $.modal.close();
							   });
			//$(".jScrollPaneDrag").attr('style','400px');
			
				
		}
	});
								  });
	
});

function confirm(message, callback) {
	$('#confirm').modal({
		close:false,
		position: ["5%",],
		overlayId:'confirmModalOverlay',
		containerId:'confirmModalContainer', 
		onShow: function (dialog) {
			dialog.data.find('.message').append(message);

			// if the user clicks "yes"
			dialog.data.find('.yes').click(function () {
				// call the callback
				if ($.isFunction(callback)) {
					callback.apply();
				}
				// close the dialog
				$.modal.close();
			});
		}
	});
}
