
jq(document).ready(function() {
	
	jq("[alt|=webbradio]").live("hover", function(e) {
		jq(this).css("cursor", "pointer");
	});

	jq("[alt|=webbradio]").live("click", function(e) {
		//var url = jq(this).attr("url");
		var url = "http://player.emunityedge.net/player/index.php?playerkey=stadium_se";
		window.open(url,"popup","menubar=no,location=no,resizable=no,scrollbars=no,status=no,width=310,height=386");
	});
	
	jq("#testgimlet").live("click", function(e) {
		e.preventDefault();
		var url = jq("#gimleturl").val();
		//var senddata = 
		jq.post(url, { 'products': ["101045","102525", "097466"], locale : "se" }, function(data) {
			alert(data["097466"].price_normal);
		},"json");
	});
	
	jq("#bonuspaymentslink").live("click", function(e) {
		e.preventDefault();
		new LITBox(jq(this).attr("href"), {type:'window', overlay:true, height:480, width:800, resizable:true, opacity:1, header: "Bonusudbetalinger", top:276});
	});
	
	jq("#pointshistorylink").live("click", function(e) {
		e.preventDefault();
		new LITBox(jq(this).attr("href"), {type:'window', overlay:true, height:480, width:800, resizable:true, opacity:1, header: "Pointhistorik", top:276});
	});
	
	jq("#submit_member_card").live("click", function(e) {
		e.preventDefault();
		jq("#become_member").append('<input type="hidden" name="RegForm_SendStadiumCard" id="RegForm_SendStadiumCard" value="1" />');
		sumbmitMembership();
	});

	jq("#submit_cardless_member").live("click", function(e) {
		e.preventDefault();
		var url = jq("#check_civic_url").val();
		var civicNumber = jq("#SocialSecNr").val();
		var country = jq("#check_civic_country").val();
		jq.post(url, {'SocialSecNr' : civicNumber, 'Country' : country}, function(data) {
			if(data) {
				jq("#RegForm_CivicNumber").val(data.civic_number_first);
				jq("#RegForm_CivicNumberLast").val(data.civic_number_last);
				jq("#CardlessMemberUpdate").val("true");
				sumbmitMembership();
			}
			else {
				
				jq("#ssn_helper").css("color","red");
				jq("#ssn_error_div").show();
			}
		},"json");
	});
	
	jq("#printOffers").live("click", function(e) {
		jq("#middle_container").printElement({printMode:'popup',pageTitle:'Medlemstilbud'});
	});
	
	jq("#printPurchases").live("click", function(e) {
		jq("#middle_container").printElement({printMode:'popup',pageTitle:'Mine køb i Stadium'});
	});
	
	jq("input:checkbox[name^='RegForm_Com']").live("click", function(e) {
		if(jq(this).attr("checked")) {
			jq(this).val("1");
		}
		else {
			jq("#become_member").append('<input type="hidden" name="'+jq(this).attr("name")+'" id="'+jq(this).attr("name")+'" value="0" />');
		}
	});

});
