function add2basket(id, typeid, colorid) {

  var wdt=380;
  var hgt=250;
  var browserWnd;
  var htmltext;

  xPos = (screen.width-wdt)/2;
  yPos = (screen.height-hgt)/2;

  var num=parseInt(document.getElementById(id).value*1);

  if (document.getElementById(typeid)) {
    typetext=document.getElementById(typeid).value;
  }
  else {
    typetext="";
  }

  if (document.getElementById(colorid)) {
    colortext=document.getElementById(colorid).value;
  }
  else {
    colortext="";
  }

  browserWnd=window.open("add2basket.php?modid="+id+"&num="+num+"&type="+typetext+"&color="+colortext,'_blank','width='+wdt+',height='+hgt+',top='+yPos+',left='+xPos+',resizable=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no');
}



function showcolors(id) {
  var url="File/colors_"+id+".html";
  var ccwin1;

  var wdt=750;
  var hgt=450;

  xPos = (screen.width-wdt)/2;
  yPos = (screen.height-hgt)/2;

  ccwin1=window.open(url, '_blank','width='+wdt+',height='+hgt+',top='+yPos+',left='+xPos+',resizable=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no');
  ccwin1.focus();

}


function showmodels(id) {
  var url="File/models_"+id+".html";
  var ccwin2;

  var wdt=750;
  var hgt=450;

  xPos = (screen.width-wdt)/2;
  yPos = (screen.height-hgt)/2;

  ccwin2=window.open(url, '_blank','width='+wdt+',height='+hgt+',top='+yPos+',left='+xPos+',resizable=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no');
  ccwin2.focus();

}


function newwin(aaa) {
  var wdt=500;
  var hgt=450;
  var browserWnd;
  var htmltext;

  xPos = (screen.width-wdt)/2;
  yPos = (screen.height-hgt)/2;

  browserWnd=window.open("",'_blank','width='+wdt+',height='+hgt+',top='+yPos+',left='+xPos+',resizable=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no');

   var htmltext="<html><head><META HTTP-EQUIV='Content-Type' content='text/html; charset=windows-1251'><title>Детализация товара</title></head><body bgcolor=#ffffff>"+aaa+"</body></html>";
   browserWnd.document.write(htmltext);


}

function checkord(id, typeid, colorid) {
   if (parseInt(document.getElementById(id).value*1)!=document.getElementById(id).value*1 || document.getElementById(id).value*1<=0) {
       alert("Укажите количество заказываемой продукции!");
       return false;
   }

   add2basket(id, typeid, colorid);
   return false;
}

function repl(id) {
   if (parseInt(document.getElementById(id).value*1)!=document.getElementById(id).value*1) {
      document.getElementById(id).value=0;
   }

}