   var feedback_box = "in";

 $(document).ready(function(){

   $("table#mainbox").wrap('<div style="background:#ffffff"><div class="gray_b_shadow"><div class="gray_l"><div class="gray_r"><div class="gray_bl_shadow"><div class="gray_br_shadow">'+
     '</div></div></div></div></div></div>');

   $("td[@id^='tabmore_id_']").click(function() {
     var thetab = this.id.split("_")[2];
     $("ul[@id^='tab_submnu_']").hide();
     var ul_obj = $("#tab_submnu_"+thetab);
     ul_obj.show();
     $(document).unbind("click");
     setTimeout(function() {
     $(document).click(function() {
       ul_obj.hide()
       $(this).unbind("click");
     });
     }, 100);
   }).mouseover(function() {
     jQuery(this).find("#more_img").attr("src", "/images/arrow_down_hover.gif");
   }).mouseout(function() {
     jQuery(this).find("#more_img").attr("src", "/images/arrow_down.gif");
   });


   $(".tabmore_li").mouseover(function() {
     $(this).css({"background": "#D0EEF7"});
   }).mouseout(function() {
     $(this).css({"background": "#FFFFFF"});
   }).click(function() {
     if(jQuery(this).attr("href") == "search") {
       search_opt_sel($(this).text());
     } else {
       if(jQuery(this).attr("target") == "_blank") {
         window.open(jQuery(this).attr("href"));
       } else {
         location.href = jQuery(this).attr("href");
       }
     }
   });

function search_opt_sel(opt) {
  $("#search_opt_text").text(opt);
  if(opt == "People")
    $("#search_opt_input").val("users");
  else if(opt == "Companies")
    $("#search_opt_input").val("companies");
  else if(opt == "Jobs")
    $("#search_opt_input").val("jobs");
}


/*    $("#feedback_send").click(function() {
     var fb = $("#feedback_ip_feedback").val();
     var subj = $("#feedback_ip_subject").val();
     if(fb != "") {
       $("#feedback_mb").html("<b>Sending Feedback...</b><br><br><br><br>");
       $.post("/feedback/", { "msg": fb, "subject": subj }, function(data) {
         if(data == "sent") {
           $("#feedback_mb").html("<b>Thank you! <br>We have recieved your feedback.</b><br><br><br><br>");
         }
         setTimeout("$(\"#feedback_btn\").click()", 500);
       });
     } else {
       $("#facebook_msg").html("<span style='color:red;padding:2px;'>Please enter feedback and send.</span>");
     }
   }); */

   //new feedfetch("http://blog.mosambe.com/?feed=rss2", 4, mosambe_blog);
   $("#mosambe_blog").html("Loading...");

/*    var fb_top = (document.documentElement.clientHeight / 2) - 68;
   $("#feedback_div").css("top", fb_top + "px");

   $("#feedback_btn").click(function () {
     if(feedback_box == "in") {
       $("#feedback_div").animate({"left": "+=255px"}, 400);
       feedback_box = "out";
     } else {
       $("#feedback_div").animate({"left": "-=255px"}, 400);
       feedback_box = "in";
     }

   }); */
});


//google.load("feeds", "1");

function feedfetch(url, noi, cb){
  var fp = new google.feeds.Feed(url);
  fp.setNumEntries(noi);
  fp.load(cb);
}


function mosambe_blog(r) {
  if (!r.error){
    $("#mosambe_blog").html("");
    $.each(r.feed.entries, function(i, e) {
      $("#mosambe_blog").append("<div style='padding:1px;'><a href='"+e.link+"' class='footlinks'>"+e.title+"</a></div>");
    });
    } else {
      $("#mosambe_blog").html("");
    }

}


function get_metadata(md) {
      var metadata_ic = md.split(";");
      var metadata = new Object;
      for(var i=0;i<metadata_ic.length;i++) {
        kvp = metadata_ic[i].split(":")
        var name = kvp[0]
        metadata[name] = kvp[1]
      }
      return metadata;
}

 var msg_tracker;
 var n_lock = 0;

  function show_msg(msg, prompt, msgtype) {
    if(n_lock == 0) {
      n_lock = 1;
      if(!msgtype) msgtype = "success";
      msg_html = "<center><table cellspacing='0' cellpadding='0' border='0'><tr><td class='"+msgtype+"' id='notifications' colspan='3'> \
                 <div class='msg_l'><div class='msg_r'><div class='msg_cont' id='msg_text'> \
                 "+ msg +"</div></div></div></div></div></div> \
                 <div class='msg_bl_shadow'><div class='msg_br_shadow'><div class='msg_b_shadow'>&nbsp;</div></div></div> \
                 </td></tr></table></center>";
      $("#msg_div").hide().css("top", "-100px");
      clearTimeout(msg_tracker);
      $("#msg_div").html(msg_html).show().animate({"top": "+=100px"}, 800);
      if(prompt != "yes" && msgtype == "success")
        msg_tracker = setTimeout("$(\"#msg_div\").animate({\"top\": \"-=100px\"}, 1300,function(){$(this).html(\"\");n_lock = 0;})", 5000);

      $("#msg_close").click(function() {
        close_msg();
      }).mouseover(function() {
        this.src = "/images/close_hover.gif";
      }).mouseout(function() {
        this.src = "/images/close.gif";
      });
    } else {
      $("#msg_text").html(msg);
    }
  }

 function close_msg() {
   $("#msg_div").animate({"top": "-=100px"}, 800, function(){$(this).html("");n_lock = 0;});
 }

 function show_msg_at(msg) {
    show_msg(msg);
 }








function labelfields() {
   $(":input").each(function() {
     aoff = $(this).offset();
     if($(this).attr("label") != undefined && aoff.top != 0) {
       lbl = $(this).attr("name") + "_lbl";
       hlbl = "#" + lbl
       if($(hlbl).text() == "") {
         $($(this).parent()).append("<span class='field_label' id='" + lbl +"'>" + $(this).attr("label") + "</span>");
       }
       roff = $(this).position();
       $(hlbl).css({ "top":roff.top+3, "left": roff.left+5 });
       //$(this).removeAttr("label");
       $(this).attr("id", $(this).attr("name"));

       $(hlbl).click(function() {
         id = this.id.substring(0,this.id.length-4);
         $(this).show();
         $("#"+id).focus();
       });

       $(this).focus(function() {
         if($(this).val().length == 0) {
           hlbl = "#" + $(this).attr("name") + "_lbl";
           $(hlbl).show();
           $(hlbl).css("color", "#cccccc");
         }
       }).blur(function() {
         if($(this).val() == "") {
           hlbl = "#" + $(this).attr("name") + "_lbl";
           $(hlbl).show();
           $(hlbl).css("color", "#999999");
         }
       }).keydown(function() {
         if($(this).val() != "") {
           hlbl = "#" + $(this).attr("name") + "_lbl";
           $(hlbl).hide();
         }
       }).keyup(function() {
         if($(this).val() != "") {
           hlbl = "#" + $(this).attr("name") + "_lbl";
           $(hlbl).hide();
         }
       });

       if($(this).val().length > 0) {
         hlbl = "#" + $(this).attr("name") + "_lbl";
         $(hlbl).hide();
       }
     }
   });

}

