/* mail functions */

function UnCryptMailto( s )
{
    var n = 0;
    var r = "";
    for( var i = 0; i < s.length; i++)
    {
      n = s.charCodeAt( i );
      if( n >= 8364 )
      {
        n = 128;
      }
      r += String.fromCharCode( n - 1 );
    }
    return r;
}

function sendMailTo( s )
{
  location.href=UnCryptMailto( s );
}


/* product functions */

function toggleProduct(element, itemNumber)
{
  var close = false;
  if(element.parentNode.className == 'product-item-opened')
    close = true;
    
  var divs = document.getElementsByTagName("a");

  for (var i = 0; i < divs.length; i++) {
  	var div = divs[i];
  	if(div.parentNode.className == "product-item-opened") {
  		div.parentNode.className = "product-item";
  	}
  }

  if(close)
    element.parentNode.className = 'product-item';
  else {
    element.parentNode.className = 'product-item-opened';
    document.getElementById('items').scrollTop = itemNumber * 25 + (itemNumber - 1) * 5;
  }
}


/* scrollbar functions */

function scrollUp(divName)
{
  document.getElementById(divName).scrollTop -= 60;
}

function scrollToTop(divName)
{
  document.getElementById(divName).scrollTop = 0;
}

function scrollDown(divName)
{
  document.getElementById(divName).scrollTop += 60;
}
