function openCartWindow(url){ 
  if(url=="") url = '/cart/';
  if(url=="!") url = "";
  window.open(url, 'cart', 'width=650, height=350, scrollbars=yes, resizable=yes');
}

function doAddToCart(formid){
  var qty = parseInt(document.forms['orderFrm'+formid].elements['qty'].value);
  var min = parseInt(document.forms['orderFrm'+formid].elements['mo'].value);
  if(qty.toString()=="NaN") alert("Количество должно быть числом!");
  else if(qty<min) alert("Минимальное количество для заказа - "+min.toString()+" шт.");
  else {
    document.forms['orderFrm'+formid].elements['a1'].value = "add";
    openCartWindow("!");
    document.forms['orderFrm'+formid].submit();
  }
}


function showVTour(what) {
	window.open('/vtour/'+what, 'vtour', 'width=800,height=440, scrollbars=no, resizable=no');
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function music(){
window.open('/music.htm', 'music', 'width=300, height=80');
}

function enlargePhoto(what) {
  if(what.isGallery==1) {
    var s = what.src;
//	alert(s);
	var s1 = s.substr(s.lastIndexOf("_")+1);
//	alert(s1);
    window.open("/pcat/?gal="+gallery.toString()+"&code="+s1, "pcat", "width=400,height=400,scrollbars=auto,resizable=yes");
  }
}
