
function sb(draw)
{
  var sW = screen.width;
  var sH = screen.height;
  
  sW = (sW/100)*60;
  sH = (sH/100)*60;
  
  //var newTarg = draw.split(" ").join("_");
  options="toolbar=0, status=0, menubar=1, location=0, scrollbars=1, resizable=1, top=10, left=0, width=" + sW + ", height=" + sH;
  OpenWindow=open("", draw, options);
  OpenWindow.focus();
  //OpenWindow.document.close();
  self.name="main";
  //self.location.reload();
}

function sb_prodmgr(draw)
{
  var sW = screen.width;
  var sH = screen.height;
  
  sW = (sW/100)*70;
  sH = (sH/100)*60;
  
  //var newTarg = draw.split(" ").join("_");
  options="toolbar=0, status=0, menubar=0, location=0, scrollbars=1, resizable=1, top=50, left=50, width=" + sW + ", height=" + sH;
  OpenWindow=open("", draw, options);
  OpenWindow.focus();
  //OpenWindow.document.close();
  self.name="main";
  //self.location.reload();
}

function sb_invc(draw)
{
  var sW = screen.width;
  var sH = screen.height;
  
  sW = 680 //(sW/100)*60;
  sH = (sH/100)*80;
  
  options="toolbar=0, status=0, menubar=1, location=0, scrollbars=1, resizable=1, top=0, left=0, width=" + sW + ", height=" + sH;
  OpenWindow=open("", draw, options);
  OpenWindow.focus();
  self.name="main";
}

function add_item(pos_price)
{
  var strPage = window.opener.location.href;
  var opnr = window.opener;
  var crt_count = opnr.document.getElementById("cart_count");
  var crt_sum = opnr.document.getElementById("cart_sum");
  
  count = parseInt(crt_count.innerHTML);
  _oprice = crt_sum.innerHTML
  _oprice = _oprice.replace(/,/, ".")
  _oprice = _oprice.replace(/&nbsp;/, "")
  old_price = parseFloat(_oprice);
  old_price += parseFloat(pos_price.replace(/,/, ".").replace(/\s/, ""));
  
  var price = String(old_price); //.toFixed(2)
  
  crt_count.innerHTML = ++count;
  crt_sum.innerHTML = price.replace(/\./, ",");
}

function round(number, plc) {
  plc = (!plc ? 2 : plc);
  return Math.round(number * Math.pow(10, plc)) / Math.pow(10, plc);
}


function opWin(trg, imWs, imHs)
{
  var shConst = 37;
  /*
  var sW = screen.width;
  var sH = screen.height;
  var wth = (sW/100) * shConst;
  var hgt = (sH/100)*60;
  var hrShift = ((sW/100) * (100 - shConst) - 10);
  */
  var wth = imWs + imWs/7;
  var hgt = imHs + imHs/7;
  var x = document.body.clientWidth - wth;
  var y = document.body.scrollTop+document.body.clientHeight/10;
   
  options="toolbar=0, status=0, menubar=0, location=0, scrollbars=0, resizable=1, top=" + y + ", left=" + x + ", width=" + wth + ", height=" + hgt;
  OpenWindow=open("", trg, options);
  OpenWindow.focus();
}

function sb_add()
{
  var sW = screen.width;
  var sH = screen.height;
  
  sW = (sW/100)*70;
  sH = (sH/100)*60;
  
  options="toolbar=0, status=0, menubar=1, location=0, scrollbars=1, resizable=1, top=10, left=10, width=" + sW + ", height=" + sH;
  OpenWindow=window.open("", "drawing", options);
  OpenWindow.focus();
  OpenWindow.document.close();
  self.name="main";
}

function sb_addmap(trg)
{
  var sW = screen.width;
  var sH = screen.height;
  
  sW = (sW/100)*30;
  sH = (sH/100)*20;
  
  options="toolbar=0, status=0, menubar=0, location=0, scrollbars=0, resizable=1, top=10, left=10, width=" + sW + ", height=" + sH;
  OpenWindow=window.open("", trg, options);
  OpenWindow.focus();
  OpenWindow.document.close();
  self.name="main";
}

function set_currdate()
{
  var DA = (document.all)? 1 : 0;
  var CurrDate = new Date();
  var year = CurrDate.getYear();
  var month = CurrDate.getMonth();
  var date = CurrDate.getDate();

  var opt_obj = document.forms[1].date_day;
  opt_obj[opt_obj.selectedIndex].value = 10;
}
