var Page = new function(){}

Page.Init = function(){
	$.ajaxSetup({
		type: 'POST',
		timeout: 5000,
		dataType: 'html',
		cache: false,
		async: false,
		error: function(xhr) {
			if( xhr.status >=300 ) {				
				
			}
		}
	})	
 	
}

Page.Link = function( strUrl ){
	if( strUrl != null ) {
		$.ajax( 
	      	{ 
	        url: strUrl,             
	        cache: false, 
	        type: 'GET',
	        data: '',
	        success: function(message) {   		        		
	            $('.content').empty().append(message); 	            
	          } ,
	          error: function(xhr, desc, exceptionobj)
	          {
	          	alert('Teknisk fejl (reqHdl)\n\n'+ xhr.responseText);          	
	          }
	      	}); 	
	}	
}

Page.OpenPopUpWin = function( strURL ){
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(strURL, '" + id + "', 'toolbar=1	,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=1,width=1024,height=768,left = 0,top = 0');");
}

Page.ResetMenu = function(){
	$('.menu .js_link').each( function(){
		$(this).removeClass("selected");
	});
}

$(document).ready(function(){	
	Page.Init();
	
	Page.Link('welcome.html');
	
	$('.menu .js_link').each( function(){
		
		$(this).bind('click', function(){

			Page.ResetMenu();
											
			menuID = $(this).attr('id');
			
			if( menuID == 'menucard') { Page.Link('menucard.html'); }
			if( menuID == 'online') { Page.Link('orderOnline.html'); }
			if( menuID == 'open') { Page.Link('openingtime.html'); }
			if( menuID == 'contact') { Page.Link('contact.html'); }
			
			$(this).addClass("selected");
		});	
		
		$(this).mouseover(function(){
			$(this).addClass('over');
		}).mouseout(function(){
			$(this).removeClass('over');
		});
			
		
	});
	
	$('#home').click(function(){
		Page.ResetMenu();
		Page.Link('welcome.html');	
	})
	
});

/*************************************************************************/





