GLOBALS.left_menu_boxes = [];
  
function recalcCart()
{
  var i, qty, price;
  var total_price_rub = 0.00;
  var total_price_eur = 0.00;
  var total_qty = 0;
  var rate = GLOBALS['rate_of_exchange'];
  
  for (var i in cart_bank) {
    qty = parseInt($('qty_'+ i).value);
    price_eur = parseFloat(cart_bank[i].price).toFixed(2);
    price_rub = parseFloat(price_eur * rate).toFixed(2);
    
    $('price_rub_' + i).innerHTML = price_rub;

    total_price_eur += price_eur * qty;
    total_price_rub += price_rub * qty;
    total_qty += qty;
  }
    
  $('top_goods_count').innerHTML = total_qty;
  $('top_total_price').innerHTML = total_price_rub.toFixed(2);
  $('total_price_rub').innerHTML = total_price_rub.toFixed(2);
  $('TotalPriceRub').value = total_price_rub.toFixed(2);
  $('total_price_eur').innerHTML = total_price_eur.toFixed(2);
  $('total_qty').innerHTML = total_qty;
}
    
function openMenuBlock(n)
{
    $('left_menu_block_' + GLOBALS['cur_opened']).style.display = 'none';
    $('left_menu_block_' + n).style.display = 'block';
    GLOBALS['cur_opened'] = n;
}

function collapseMenu()
{ 
  var i, n;
  if (!(GLOBALS.cur_opened)) {
    GLOBALS.cur_opened = GLOBALS.left_menu_boxes[0];
  }
  for (i = 0; i < GLOBALS.left_menu_boxes.length; i++) {
    n = GLOBALS.left_menu_boxes[i];
    if (n == GLOBALS.cur_opened) {
      $('left_menu_block_' + n).style.display = 'block';
    } else {
      $('left_menu_block_' + n).style.display = 'none';
    }
  }
}
    
function switchCartForm(n, checked)
{
  if (n == 1) {
    if (checked) {
      $('natural_person_form').style.display = 'block';
      $('legal_person_form').style.display = 'none';
    } else {
       $('natural_person_form').style.display = 'none';
       $('legal_person_form').style.display = 'block';
    }
  } else {
    switchCartForm(1, !checked);     
  }
}
    
awp="";
sg_js="1.0";
sg_r=""+Math.random()+"&r="+escape(document.referrer)+"&pg="+escape(window.location.href);
document.cookie="sg=1; path=/";
sg_r+="&c="+(document.cookie?"1":"0");
if (self!=top) {fr=1;} else {fr=0;}
sg_r+="&fr="+fr;
mt=(new Date()).getTimezoneOffset();
sg_r+="&mt="+mt;



nn4 = (document.layers)? true : false;
ie4 = (document.all)? true : false;
nn6 = (document.getElementById && !ie4)? true : false;
  
function New_wind(cardName, winW, winH, winTitle) {
  
if (nn4 || ie4 || nn6) {
posX = Math.round((screen.width - winW) / 2);
posY = Math.round((screen.height - winH) / 2);
posCode = (nn4 || nn6)? 'screenX='+posX+',screenY='+posY : 'left='+posX+',top='+posY;
} else { posCode = ''; }
cardWindow = window.open('','_blank','menubar=no,toolbar=no,scrollbars=no,status=yes,width='+winW+',height='+winH+','+posCode);
cardWindow.document.open();
cardWindow.document.write('<html><head><title>'+winTitle+'<\/title><\/head>');
cardWindow.document.write('<body marginwidth=0 marginheight=0 topmargin=0 leftmargin=0 rightmargin=0 bottommargin=0>');
cardWindow.document.write('<img src="'+cardName+'" width="'+winW+'" height="'+winH+'" /><\/body><\/html>');
cardWindow.document.close();
cardWindow.focus();
}    
  
  
   function OpenMB(name){
   
     document.getElementById(name).style.display = 'block';
  }
     function CloseMB(name){
      document.getElementById(name).style.display = 'none';
  }
