function ajaxcomments () {
	var lcla = $('<a></a>').attr('href','#comment_div').addClass('pluslnk').click(function() {
		$('#comment_form_div > *').hide();
		$('#comment_form_div').addClass('loader');
		$.post('/_a/stories/ajax/photo_comment.php', { r: -1, comment: $('#i-comment').val(), photo_id: pid }, function (data) {
			$('#comment_div').html(data);
		});
	});	
	$("#commentsubmit").html(lcla.html('add comment'));
} // end function

function ajaxvotescast() {
	$('#castvote').attr('href','#pod_phototools').click(function() {
		$.get('/_a/stories/ajax/photo_votes.php', { r: -1, photo_id: pid, c: -1 }, function (oReq) {
			$('#vote_div').html(oReq);
		});
	});
} // end function

function ajaxvoteform () {	
	var lcla = $('<a></a>').attr('href','#pod_phototools').click(function() {
		$.post('/_a/stories/ajax/photo_votes.php', { r: -1, vote: true, photo_id: pid, vote_id: $("input[name='vote_id']:checked").val() }, function (data) {
			$('#vote_div').html(data);
		});
	});	
	$('#votesubmit').html(lcla.html('submit vote'));	
		
	var lcla2 = $('<a></a>').attr('href','#pod_phototools').click(function() {
		$.post('/_a/stories/ajax/photo_votes.php', { r: -1, cancel: true, photo_id: pid, vote_id: $("input[name='vote_id']:checked").val() }, function (data) {
			$('#vote_div').html(data);
		});
	});
	$('#votecancel').html(lcla2.html('cancel vote'));	
} // end function

function ajaxyumform () {
	if ($('#yumadd').length > 0) {
		var lcla = $('<a></a>').attr('href','#pod_phototools').addClass('pluslnk').click(function() {
			$.post('/_a/stories/ajax/photo_yums.php', { r: -1, addyum: true, photo_id: pid, form: 'yum' }, function (data) {
				$('#yum_div').html(data);
			});
		});	
		$('#yumadd').html(lcla.html('yum this photo'));
	} // end if
	
	if ($('#yumaddsec').length > 0) {
		var lcla = $('<a></a>').attr('href','#pod_phototools').addClass('pluslnk').click(function() {
			$.post('/_a/stories/ajax/photo_yums.php', { r: -1, addyumsec: true, photo_id: pid, form: 'yum' }, function (data) {
				$('#yum_div').html(data);
			});
		});	
		$('#yumaddsec').html(lcla.html('secret yum this photo'));
	} // end if
		
	if ($('#yumremove').length > 0) {
		var lcla = $('<a></a>').attr('href','#pod_phototools').addClass('minuslnk').click(function() {
			$.post('/_a/stories/ajax/photo_yums.php', { r: -1, removeyum: true, photo_id: pid, form: 'yum' }, function (data) {
				$('#yum_div').html(data);
			});
		});	
		$('#yumremove').html(lcla.html('remove my yum'));
	} // end if
	
	$(document).ready(function(){
		if ($('#yummies').length == 0) $('#photo_hold').append('<span id="yummies"></span>');
		var str_yums = '';
		for (i = 0; i < $('#yumcount').val(); i++) {
			str_yums += (i % 2 == 0) ? '<img src="/images/vip/yum-left.png" />' : '<img src="/images/vip/yum-right.png" />';		
		}
		$('#yummies').html(str_yums);
	});
} // end function

function ajaxtoolform () {
	if ($('#tooladdalbum').length > 0) {			
		var lcla = $('<a></a>').attr('href','#pod_phototools').addClass('pluslnk').click(function() {
			$.post('/_a/stories/ajax/photo_tools.php', { r: -1, addalbum: true, photo_id: pid, form: 'tools' }, function (data) {
				$('#tools_div').html(data);
			});
		});	
		$('#tooladdalbum').html(lcla.html('add to my album'));
	} // end if
		
	if ($('#toolremovealbum').length > 0) {
		var lcla = $('<a></a>').attr('href','#pod_phototools').addClass('minuslnk').click(function() {
			$.post('/_a/stories/ajax/photo_tools.php', { r: -1, removealbum: true, photo_id: pid, form: 'tools' }, function (data) {
				$('#tools_div').html(data);
			});
		});	
		$('#toolremovealbum').html(lcla.html('remove from my album'));
	} // end if
			
	if ($('#toolmainpic').length > 0) {
		var lcla = $('<a></a>').attr('href','#pod_phototools').addClass('pluslnk').click(function() {
			selectmainpic(pid);
		});
		$('#toolmainpic').html(lcla.html('use as my main pic'));
	} // end if	
} // end function


function ajaximinform () {
	if ($("#iminadd").length > 0) {	
		var lcla = $('<a></a>').attr('href','#pod_phototools').addClass('pluslnk').click(function() {
			$.post('/_a/stories/ajax/photo_imin.php', { r: -1, addme: true, photo_id: pid, form: 'imin' }, function (data) {
				$('#imin_div').html(data);
			});
		});	
		$('#iminadd').html(lcla.html('i\'m in this picture'));
	} // end if
		
	if ($('#iminremove').length > 0) {		
		var lcla = $('<a></a>').attr('href','#pod_phototools').addClass('minuslnk').click(function() {
			$.post('/_a/stories/ajax/photo_imin.php', { r: -1, removeme: true, photo_id: pid, form: 'imin' }, function (data) {
				$('#imin_div').html(data);
			});
		});		
		$('#iminremove').html(lcla.html('i\'m not in this picture'));
	} // end if
		
} // end function

