$(document).ready(function() {
//add class to each second tr
$("table tr:nth-child(odd)").addClass("farbe");

//hide last background from each table td
$("table").each(function() {$(this).find("tr:last td").css({"background":"none"});});
									

//Start Tabs
$(".tab_content").hide();
//$(".boxheader ul.tabs li:first").addClass("active").show();
//$(".tab_content:first").show();
$(".boxheader ul.tabs li.active").show();
var activeTab = $(".boxheader ul.tabs li.active a").attr("href");
$(activeTab).fadeIn();


$(".boxheader ul.tabs li").click(function() {
$(".boxheader ul.tabs li").removeClass("active");
$(this).addClass("active");
$(".tab_content").hide();
var activeTab = $(this).find("a").attr("href");
$(activeTab).fadeIn();
return false;
});
//End Tabs


$('a#friends').click(function(){
if ($(this).attr("id")!="") {
$(this).attr("id", "");
$.ajax({
type: "POST",
url: "../structure/fb_friends.php",
cache: false,
async: true,
success: function(result) {
$("#tab3").html(result);
},
error: function(result) {
alert("some error occured, please try again later");
}
});
}
});








});








function ge(elem) {
  return document.getElementById(elem);
}

/*
 * Simple Ajax call method.
 *
 * From http://en.wikipedia.org/wiki/XMLHttpRequest
 */
function ajax(url, vars, callbackFunction) {
  var request =  new XMLHttpRequest();
  request.open("POST", url, true);
  request.setRequestHeader("Content-Type",
                           "application/x-www-form-urlencoded");

  request.onreadystatechange = function() {
    if (request.readyState == 4 && request.status == 200) {
      if (request.responseText) {
        callbackFunction(request.responseText);
      }
    }
  };
  request.send(vars);
}
