function chgRSVP(eid, pos) {
	if (pos) {
		$.ajax({
			type: "POST",
			url: "rsvp.php",
			data: "eid=" + eid,
			success: function(data){
				window.location.reload();
			}
		});
	} else {
		$('#ft-rsvp').html('<img src="images/loader.gif" /> Processing...');
		$.ajax({
			type: "POST",
			url: "rsvp.php",
			data: "eid=" + eid,
			success: function(data){
				$('#ft-rsvp').html(data);
			}
		});
	}
}

function postPhoto(nid, aid, img) {
		$('#post-photo-btn').css({marginTop: '-22px'});
		$.ajax({
			type: "POST",
			url: "post-photo.php",
			data: "nid=" + nid + "&aid=" + aid + "&img=" + img,
			success: function(data){
				$('#post-photo-btn').css({marginTop: '-44px'});
			}
		});
}

function sharePhoto(nid, aid, img) {
			if (params.nid != '') {
				$('#friend-photo-btn').css({marginTop: '-44px'});
				$.ajax({
					type: "POST",
					url: "share-photo.php",
					data: "nid=" + nid + "&aid=" + aid + "&img=" + img + "&fid=" + fid,
					success: function(data){
						$('#friend-photo-btn').css({marginTop: '-66px'});
						return false;
					}
				});
			} else {
				alert('wrong!');
				return false;	
			}
			return false;
}

function chkPerms(perm) {
	FB.login(function(response) {
		if (response.session) {
			if (response.perms) {
				  // user is logged in and granted some permissions.
				  // perms is a comma separated list of granted permissions
				  return true;
			} else {
				  alert('To perform this task you must allow an extended permission. Please retry and accept the prompts.');
				  return false;
			}
		} else {
			alert('The request you are trying to make requires that you be signed into Facebook and accept the required extended permission. Please login and accept through our site.');
			return false;
		}
	}, {perms: perm});
}


$(document).ready(function() {
						   
	$('#share-photo-btn').click(function() {
										 $('#share-photo-btn').css({marginTop: '-22px'});
										 $('#friend-select').show();
										 })
	
	var error = $('#share-error');
	if (error) {
		setTimeout("$('#share-error').fadeOut('slow')", 5000);	
	}
	
	$('.alb-evt-wrapper').mouseover(function() {
											 
										     $('div',this).css({backgroundColor: '#000', borderColor: '#000', color: '#666'});
											 $('span',this).css({color: '#fff'})
										   })
	
	$('.alb-evt-wrapper').mouseout(function() {
										     $('div',this).css({backgroundColor: '#666', borderColor: '#666', color: '#fff'});
											 $('span',this).css({color: '#000'})
										   })
	
	$('#alb-past-wrapper li').mouseover(function() {
												  $('a',this).css({color: '#fff'});
												  })
	
	$('#alb-past-wrapper li').mouseout(function() {
												  $('a',this).css({color: '#666'});
												  })
	
	$('.alb-rec').mouseover(function() {
									 $('div',this).css({backgroundColor: '#000', borderColor: '#000'});
									 $('span',this).css({color: '#666'});
									 })
	
	$('.alb-rec').mouseout(function() {
									 $('div',this).css({backgroundColor: '#666', borderColor: '#666'});
									 $('span',this).css({color: '#000'});
									 })
	
	$('.rec-albums').mouseover(function() {
										$('div',this).css({backgroundColor: '#000', borderColor: '#000', color: '#fff'})
										})
	
	$('.rec-albums').mouseout(function() {
										$('div',this).css({backgroundColor: '#666', borderColor: '#666', color: '#000'})
										})
						   
	if ($('.venue-img')) {
		$('.venue-img').tipsy({gravity: 'nw'});
	}
	
	
	

})

$(window).load(function() {
						
	$('.like_button_no_like').bind('click', function() {
      alert($(this).text());
    });
    var t = setTimeout("$('.like_button_no_like').trigger('click')", 5000);
	console.log(t);
						
						})