function saveCurrentUri()
{
  createCookie("currentUri",this.location.href,7);
  return null;
}
function loadLastUri()
{
  history.back();
}


function getLastUri()
{
  var lastUri = readCookie("currentUri");
  eraseCookie("currentUri");
  return lastUri;
}

function openImageLoad(url)
{
  this.location.href= this.location.href;
  window.open(url,"neu","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=400");
  return null;
}

function showBBLastPosts()
{
  if($("BBLastPosts")!= null)
  {
    if($("BBLastPosts").style.display == "none")
    {
      $("BBLastPosts").style.display = "block";
      if($("BBLastPostArrowDown") != null && $("BBLastPostArrowUp") != null)
      {
        $("BBLastPostArrowDown").style.display = "none";
        $("BBLastPostArrowUp").style.display = "block";
      }
    }
    else
    {
      $("BBLastPosts").style.display = "none";
      if($("BBLastPostArrowDown") != null && $("BBLastPostArrowUp") != null)
      {
        $("BBLastPostArrowDown").style.display = "block";
        $("BBLastPostArrowUp").style.display = "none";
      }
    }
  }
  return null;
}


function changeBBVisible(first, second)
{
  eraseCookie("BBPersonal");
  for($countfirst = 1; $countfirst<=10; $countfirst++)
  {
    if($("bbpersonal"+ $countfirst ) != null)
    {
      if($countfirst == first)
      {
           $("bbpersonal"+$countfirst ).style.display = "block";
           $("bbpersonalli"+$countfirst ).className = "active";
      }else
      {
           $("bbpersonal"+$countfirst ).style.display = "none";
           $("bbpersonalli"+$countfirst).className = "";
      }
    }
    for($countsecond = 1; $countsecond<=10; $countsecond++)
    {
      if($("bbpersonal"+ $countfirst + $countsecond) != null)
      {
         if($countfirst == first && $countsecond == second)
         {
           $("bbpersonal"+$countfirst + $countsecond ).style.display = "block";
           if($("bbpersonalli"+$countfirst + $countsecond ) != null)
           {
             $("bbpersonalli"+$countfirst + $countsecond ).className = "active";
           }
           createCookie("BBpersonal",$countfirst.toString() + $countsecond.toString(),7);
         }else
         {
           $("bbpersonal"+$countfirst + $countsecond ).style.display = "none";
           if($("bbpersonalli"+$countfirst + $countsecond ) != null)
           {
             $("bbpersonalli"+$countfirst + $countsecond ).className = "";
           }
         } 
      }
    }
  }
  return null;
}

function loadVisibleBBCookie()
{
  var cookie= readCookie("BBpersonal");
  if(cookie != null)
  {
    var first = cookie.charAt(0);
    var second = cookie.charAt(1);
    changeBBVisible(first,second);
  }else
  {
    createCookie("BBpersonal","11",7);
    loadVisibleBBCookie();
  }
  return null;
}

function createCookie(name,value,days) {
if (days) {
  var date = new Date();
  date.setTime(date.getTime()+(days*24*60*60*1000));
  var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
  var c = ca[i];
  while (c.charAt(0)==' ') c = c.substring(1,c.length);
  if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}

function eraseCookie(name) {
createCookie(name,"",-1);
}

