// --------------------------------------------
// checks the name of your browser
// isIE or isNN are boolean varibles identeficated this

isNN=navigator.appName.indexOf('Netscape')>=0;
isIE=navigator.appName.indexOf('Explorer')>=0;
 
var bV=parseInt(navigator.appVersion);
NS4=(document.layers) ? true : false;
IE4=((document.all)&&(bV>=4))?true:false;
ver4 = (NS4 || IE4) ? true : false;

// -------------------------------------------
// open extra window 
// usage: openWindow("test.htm") or openWindow("test.jpg", 200, 120)

function openWindow(filename, w, h)
{
    var nWidth;
	var nHeigth;
	
	if (h) nHeigth = h; else nHeigth = 500;
	if (w) nWidth = w; else nWidth = 700;
	
	var desktop = window.open(filename, "_blank", 
    "width="+nWidth+",height="+nHeigth+",toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
};

//-------------------------------------------
// inserts flash move into the document body
 
function insertFlash(filename, w, h)
{
	if (h) nHeigth = h; else nHeigth = 500;
	if (w) nWidth = w; else nWidth = 700;

 	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0"');
	document.write(' ID=24 WIDTH='+ nWidth + 'HEIGHT=' + nHeigth + '>');
 	document.write('<PARAM NAME=movie VALUE="33.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#003399>');
	document.write('<EMBED src=' + filename + ' quality=high bgcolor=#003399  WIDTH='+ nWidth + 'HEIGHT=' + nHeigth + ' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
	document.write('</EMBED></OBJECT>');
};

//--------------------------------------------
// timeout close the window. You can change the action
// to use it U have to place in your HTML timer initiation
// nTimer = setTimeout("leave();", nTimerExpired);

var nTimer;
var nTimerExpired = 15000; // U have to change this time
// window.focus();
function leave()
{
 if (nTimer) clearTimeout(nTimer);
 window.close();
};

//-------------------------------------------------
// go to URL. 
function goToURL(url)
 {
  var sURL;
  if (url) sURL=url; else sURL="/";
  location.href=sURL;
 };

// --------------------------------------------------

function PutToCart(num, id)
{
	var nCell = "amount"+num;
	
	if (!num && !id)
	{
		window.open('/cgi-bin/korzina.pl', "Korzina","width=600,height=550,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
	this.blur();

	} else
	{
	window.open('/cgi-bin/korzina.pl?amount='+ document.forms["shop"].elements[nCell].value+'&zakaz_id='+ id, "Korzina","width=600,height=550,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
	
 
	if (document.forms["iscart"].opd.value=="yes") 
	{
	  this.focus();
	  alert("Товар помещен в корзину. Для просмотра используйте ссылку «Ваша корзина»");
	}
		else 
		{ 
		 document.forms["iscart"].opd.value="yes";
		 this.focus();
	  	 alert("Товар помещен в корзину. Для просмотра используйте ссылку «Ваша корзина»");
		}
	}
 };

