////////////////////////////////////
// Metamucil - Pledge JS Code 
// v 1.0.0
//
// Bridge Worldwide
////////////////////////////////////
						
function confirm_pledge(uid)
{
	$("#pledge_div_uid").val(uid);
	tb_show("Take the Pledge", "#TB_inline?height=270&width=450&inlineId=pledge_div_container&modal=true", "");
}

function take_pledge(uid)
{
	if(($("#FirstName").val() != "") && ($("#LastName").val() != "")){
		var url = "ajax/take_pledge.php";
		var uid = $("#pledge_uid").val();
		var firstname = $("#FirstName").val();
		var lastname = $("#LastName").val();
		
		$.post(url, { user_id : uid, first_name : firstname, last_name : lastname }, function(data) {
			if (data != "##error##")
			{
				tb_remove();
				$("#pledgeTxt").html('Thanks for taking the pledge to get your cholesterol screened and live heart smart. <br /><br />Print out your heart-health pledge as a reminder to keep you motivated.<br /><br /><a href="pdf/heartsmart_pledge.pdf" target="_blank" class="orange_link">Print Pledge</a><br /><br />See how the Metamucil Beautify Your Heart program can help you lower your cholesterol.<br /><br /><a href="about-program-tour.php" class="orange_link">Take the tour.</a><br /><br /><a href="" target="_blank" class="orange_link">Learn more about cholesterol and your heart health.</a>');	
				$("#pledge_btn").html(data);
			}
			else
			{
				//Do Nothing
			}
		});
	}else{
		$("#requried_show").html('<b style="color:red;">First and last name are required.</b>')
	}
	
}