  function ToggleRateMenu() {
    rateMenu = document.getElementById('RateMenu');
    rateButton = document.getElementById('RateButton');
    ToggleAny(rateMenu, rateButton);
  }

  function ToggleSearchMenu() {
    searchMenu = document.getElementById('SearchMenu');
    searchButton = document.getElementById('SearchButton');
    ToggleAny(searchMenu, searchButton);
  }

  function ToggleAny(target, dock) {
    if (target.style.visibility == "hidden") {

        var tmpleft = getposOffset(dock, "left");
        var tmptop = getposOffset(dock, "top") + dock.offsetHeight;
		
        target.style.left = tmpleft;
        target.style.top = tmptop;
        target.style.visibility = "visible";
        target.style.display = 'block';

        if (target.offsetParent != null) {
            target.style.left = 0;
            var tmpwidth = target.offsetWidth;
            tmpleft = tmpleft - getposOffset(target.offsetParent, "left");
            if (tmpleft + tmpwidth > target.offsetParent.offsetWidth) {
                tmpleft = target.offsetParent.offsetWidth-tmpwidth-10;
            }
            target.style.left = tmpleft + "px";
            target.style.top = tmptop - getposOffset(target.offsetParent, "top");
        }
    } else {
      target.style.visibility = "hidden";
      target.style.display = 'none';
    }
 }  	

function getposOffset(what, offsettype){
  var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
  var parentEl=what.offsetParent;
  while (parentEl!=null){
    totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
    parentEl=parentEl.offsetParent;
  }
  return totaloffset;
}

function ToggleMenuOnOff (menuName) {
    menu = document.getElementById(menuName);

    if (menu.style.display == 'none') {
      menu.style.display = 'block';
    } else {
      menu.style.display = 'none';
    }

}

function OpenWindow (target) { 
  window.open(target, "_Child", "toolbar=no,scrollbars=yes,resizable=yes,width=400,height=400"); 
}

function OpenPostWindow (target) { 
  window.open(target, "_Child", "resizable=yes,width=500,height=700"); 
}
