$(function(){
	if($.cookie('nd_org') == null)
	{
		var diag = new Boxy($('#eap-login-dialog')[0], {'title':'Login', 'closeable':false, 'modal':true});
		$($('#eap-login-close')[0]).bind('click', function()
			{
				if($('#eap-login-select')[0].value!= "")
				{
					var date = new Date();
                    date.setTime(date.getTime() + (365 * 24 * 60 * 60 * 1000));
					$.cookie('nd_org', $('#eap-login-select')[0].value, { path: '/', expires: date });
					$.post('/tracker', {"org":$('#eap-login-select')[0].value, "url":window.location.href}, function(){}, 'json');
					diag.hideAndUnload();
				}
			});
		$($('#eap-login-cancel')[0]).bind('click', function(e)
		{
			e.preventDefault();
			var date = new Date();
            date.setTime(date.getTime() + (365 * 24 * 60 * 60 * 1000));
			$.cookie('nd_org', 43, { path: '/', expires: date });
			$.post('/tracker', {"org":43, "url":window.location.href}, function(){}, 'json');
			diag.hideAndUnload();
		});
	}
	else
		$.post('/tracker', {"url":window.location.href}, function(){}, 'json');
});

$.each($(".service-link"), function()
{
	$(this).bind("click", function()
	{
		$.post("/tracker", {"ser_id":$(this).attr("serviceid")});
	});
});
