function getElementsByClassName(classname,tag) {
 if(!tag) tag = "*";
 var anchs =  document.getElementsByTagName(tag);
 var total_anchs = anchs.length;
 var regexp = new RegExp('\\b' + classname + '\\b');
 var class_items = new Array()
 
 for(var i=0;i<total_anchs;i++) { //Go thru all the links seaching for the class name
  var this_item = anchs[i];
  if(regexp.test(this_item.className)) {
   class_items.push(this_item);
  }
 }
 return class_items;
}

function showTab(tab_name) {
  var tab_show = document.getElementsByName(tab_name);
  var tab_color = document.getElementsByName('tab');
  var tab_hide = getElementsByClassName("show"); 

  for (var i = 0; i < tab_hide.length; i++) {
    tab_hide[i].className = 'hidden';
  }
  for (var i = 0; i < tab_show.length; i++) {
    tab_show[i].className = 'show';
  }
  for (var i = 0; i < tab_color.length; i++) {
    tab_color[i].style.background = '#eee';
    tab_color[i].style.color = '#415a68';
  }
}


//functions for positioning the 'blanket' div

function toggle(div_id) {
  var el = document.getElementById(div_id);
  if ( el.style.display == 'none' ) {	el.style.display = 'block';}
  else {el.style.display = 'none';}
}
function blanket_size() {
  if (typeof window.innerWidth != 'undefined') {
    viewportheight = window.innerHeight;
  } else {
    viewportheight = document.documentElement.clientHeight;
  }
  if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) {
    blanket_height = viewportheight;
  } else {
    if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {
      blanket_height = document.body.parentNode.clientHeight;
    } else {
      blanket_height = document.body.parentNode.scrollHeight;
    }
  }
  var blanket = document.getElementById('blanket');
  blanket.style.height = blanket_height + 'px';
}


function window_pos() {
  if (typeof window.innerWidth != 'undefined') {
    viewportwidth = window.innerHeight;
  } else {
    viewportwidth = document.documentElement.clientHeight;
  }
  if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) {
    window_width = viewportwidth;
  } else {
    if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) {
      window_width = document.body.parentNode.clientWidth;
    } else {
      window_width = document.body.parentNode.scrollWidth;
    }
  }
  var sendafriend = document.getElementById('sendafriend');
  window_width=window_width/2-162;
  sendafriend.style.left = window_width + 'px';
}