function displayShowsForPage(pg, cid){
	$.get("ajax_display_shows_for_page.php", {pg:pg, cid:cid}, function(data){
		$("#shows-ajax").html(data);
	});
}

function displayShowsForGroupsPage(pg){
	$.get("ajax_display_shows_for_groups_page.php", {pg:pg}, function(data){
		$("#shows-ajax").html(data);
	});
}

function displayMealDealsForPage(pg, cid){
	$.get("ajax_display_meal_deals_for_page.php", {pg:pg, cid:cid}, function(data){
		$("#shows-ajax").html(data);
	});
}

function displaySpecialOffersForPage(pg){
	$.get("ajax_display_special_offers_for_page.php", {pg:pg}, function(data){
		$("#shows-ajax").html(data);
	});
}

function displayAttractionsForPage(pg, cid){
	$.get("ajax_display_attractions_for_page.php", {pg:pg, cid:cid}, function(data){
		$("#shows-ajax").html(data);
	});
}

function displayOutletsForPage(pg){
	$.get("ajax_display_outlets_for_page.php", {pg:pg}, function(data){
		$("#shows-ajax").html(data);
	});
}

function showBlog(id){
	$.get("ajax_display_blog_for_id.php", {id:id}, function(data){
		$("#blog-item").html(data);
	});
}

function displayBlogListForPage(pg){
	$.get("ajax_display_blog_items_for_page.php", {pg:pg}, function(data){
		$("#blog-items").html(data);
	});
}

function submitBlogComment(){
	var title = $("[name=title]").val();
	var body = $("[name=body]").val();
	var blog_id = $("[name=blog_id]").val();

	if(title == '' || body == ''){
		displayPopup('You must enter something in both fields to post a comment');
	}else{
		$.post("ajax_create_blog_comment.php", {title:title, body:body, blog_id:blog_id}, function(data){
			if(data == 'TRUE'){
				$("[name=title]").attr('value', '');
				$("[name=body]").attr('value', '');
				displayPopup('Thank you<br />Your comment will appear after approval');
			}else{
				displayPopup('Sorry, an error occured processing your comment');
			}
		});
	}
}

function getNews(start){
	var start = (parseInt($('#current_page').val()) + 1);
	$.get("ajax_display_news_for_row.php", {start:start}, function(data){
		if(data != 'the end'){
			$('#news').append(data);
			$('#current_page').val(start);
		}else{
			$('#see_more').hide();
		}
	});
}

//########################
// PRIMITIVES
// ########################
function displayPopup(msg){
	$('#popup-message').dialog({
		autoOpen:false,
		buttons:{'Ok':function(){$(this).dialog("close");}},
		closeOnEscape:true,
		draggable:false,
		modal:true,
		resizable:false,
		title:'Information',
		width:480
	});
	$('#popup-message').html(msg);
	$('#popup-message').dialog('open');
}

function confirmDelete(){
	input_box=confirm("Are you sure you want to delete?\nClick OK to confirm or CANCEL to cancel.");
	if (input_box==true){
		document.admin_delete.submit();
	}
}

function jmMoveToByLngLat(lng, lat, zoom){
	$('#map').jmap('MoveTo',{
		'mapCenter':[lng,lat],
		'mapZoom':zoom,
		'centerMethod':'pan'
	});
}
