+$(document).ready(function(){
+ $('nav').bind('nav-update', function(e,data){
+ var notifCount = $(data).find('notif').attr('count');
+ var intro = $(data).find('intro').text();
+ var mail = $(data).find('mail').text();
+
+ console.log(intro,mail);
+
+ if (notifCount > 0 ) {
+ Tinycon.setBubble(notifCount);
+ } else {
+ Tinycon.setBubble('');
+ }
+
+ if (intro>0){
+ $("#nav-introductions-link").addClass("on");
+ } else {
+ $("#nav-introductions-link").removeClass("on");
+ }
+
+ if (mail>0){
+ $("#nav-messages-link").addClass("on");
+ } else {
+ $("#nav-messages-link").removeClass("on");
+ }
+
+ });
+
+ /*
+ * show and hide contact action buttons in
+ * contacts page on contacts' checkbox selection
+ */
+ $('.contact-select').bind('click', function(e) {
+ var y = e.clientY;
+ var elm = $("#contacts-actions");
+ y=y-40;
+ if (y<0) y=0;
+ if (y+elm.height() > $("html").height()) y=$("html").height()-elm.height();
+ elm.css('top', y+"px");
+ if ($(".contact-select:checked").length > 0) {
+ elm.show();
+ } else {
+ elm.hide();
+ }
+ });
+});
+