var total = 0;

function tomato_hit(x,y){
	var vars =
	{
		w:"add_hit",
		id:$('#id').val(),
		x:x,
		y:y
	};
	$.ajax({
		type: "POST",
		url: "/php/ajax.php",
		data: vars,
		success: function(msg){
		}
	});
}
function AJAX_add_hits(){
	var vars =
	{
		w:"add_hits",
		g:$('#guid').val(),
		t:total
	};	
	$.ajax({
		type: "POST",
		url: "/php/ajax.php",
		data: vars,
		success: function(msg){
		}
	});
}
function AJAX_insert(title,message,color,file){
	var vars =
	{
		w:"insert",
		title:title,
		message:message,
		color:color,
		file:file
	};
	$.ajax({
		type: "POST",
		url: "/php/ajax.php",
		data: vars,
		success: function(msg){
			document.location.href = msg+".html";
		}
	});
}
function get_photos_ajax(page){
	var vars =
	{
		w:"get_photos",
		page:page
	};
	$.ajax({
		type: "POST",
		url: "/php/ajax.php",
		data: vars,
		success: function(msg){
			$("#get_photos").html(msg)
		}
	});
}

function toggle_showcase_ajax(showcased,id){
	var vars =
	{
		w:"toggle_showcase",
		showcased:showcased,
		id:id
	};
	$.ajax({
		type: "POST",
		url: "/php/ajax.php",
		data: vars,
		success: function(msg){
			alert(msg)
			document.location.href = "index.php";
		}
	});
}
function toggle_photo_ajax(active,id){
	var vars =
	{
		w:"tomato_toggle",
		active:active,
		id:id
	};
	$.ajax({
		type: "POST",
		url: "/php/ajax.php",
		data: vars,
		success: function(msg){
			alert(msg)
			document.location.href = "index.php";
		}
	});
}
$(document.body).ready(function(){
	get_photos_ajax(1);
});
