$(function(){
	$(".code-reveal span").html("code appears here");	
	$("a.button-clicked").click(function(){
		var discount_id=$(this).attr ("name");	
		var discount_code=$(this).attr("code");
		$("#before-click-" + discount_id).hide();
		$("#after-click-" + discount_id).show();
		$("#discount-code-" + discount_id).html("<span>"+discount_code+"</span>");
		$("#reveal-" + discount_id).show();
	});	
});

	function toggle ( type )
	{
		$(function(){
			
			if ( type == 'online' ) 
			{
				$("#links-div").html('<span class="links"><a href="#" title="PHPME" onclick="toggle(\'local\')">Local discounts</a><span>Online Discounts</span></span>');
				$("#local").hide();
				$("#online").show();
			}
			else
			{
				$("#online").hide();
				$("#local").show();
			}
			
		});
		
	}
	
	$(function(){
		$(".terms-click").click(function(){
			var id = $(this).attr('rel');
			if($("#terms-"+id).css('display') == 'none'){
				$("#terms-"+id).slideDown();
			} else {
				$("#terms-"+id).slideUp();
			}
		});
	});
