function closeMessageArea(){
	$("#messagearea, #messagearea2, #messagarea3").hide();
}

function bindClose(){
	$('#closeMessage').click(function(e){
		e.preventDefault();
		closeMessageArea();
	});
}

function bindPulse(){
	$('.pulseLogin').click(function(e){
		e.preventDefault();
		pulseLogin();
	});
};

function alertGuest() {
	//Pull down div message and scroll to top
	closeMessageArea();
	$("#messagearea").html('<img src="/media/membersinterface/images/notice.gif" class="successIcon" alt="" /><div class="mContent"><p><strong>Thanks for your interest!</strong></p><p>You must be a member to take advantage of this offer.</p><p>Please <a href="#" class="pulseLogin">login</a> or <a href="/membersinterface.html?action=registration">create a new account</a> to continue.</p></div><a href="#" id="closeMessage"><img src="/media/membersinterface/images/close.gif" alt="Close Message" /></a><div class="clear"><!-- --></div>');
	bindPulse();
	bindClose();
	$("#messagearea").fadeIn(1400);
	$('html,body').animate({scrollTop: 0}, 800);
}

function pulseLogin() {
	$("#accountarea_loggedout_in").fadeOut(200, function() {
		$("#accountarea_loggedout_in").fadeIn(1000);
	});
}

function updatePathLinks(email, pathlinkclassname) {
	$("."+pathlinkclassname).each(function(i) {
		//parse id and path name
		var pid = this.id.replace(/pid_(.*)/g, "$1");
		$(this).after('<form action="landing.html" method="post" id="form_'+pid+'" style="display:none" target="_blank"><input type="hidden" name="pathId" value="'+pid+'"><input type="hidden" name="email" value="'+email+'"></form>');
		$(this).bind("click", {"pid":pid}, function(e) {
			$("#form_"+e.data.pid).submit();
			return false;
		});
	});
}

$().ready(function(){
	$('.offerImage, .detImage').click(function(e){
		e.preventDefault();
		alertGuest();
	});
	bindPulse();
	bindClose();
});