function browseIt()
{
	this.ver = navigator.appVersion.toLowerCase();
	this.verNum = parseInt(this.ver);
	this.agent = navigator.userAgent.toLowerCase();
	this.dom = (document.getElementById ? 1 : 0);
	this.opera = (this.agent.indexOf("opera") > -1 && this.dom ? 1 : 0);
	this.opera7 = (this.opera && this.verNum >= 7);
	this.ie = (this.ver.indexOf("msie") > -1 && this.dom && !this.opera ? 1 : 0);
	this.ieVer = 0;
	if (this.ie) {
		var pos = this.ver.indexOf("msie");
		if (pos != -1)
			this.ieVer = parseInt(this.ver.substr(pos + 5));
	}
	this.ie6 = (this.ie && (this.ieVer >= 6));
	this.ie6only = (this.ie && (this.ieVer >= 6) && (this.ieVer < 7));
	this.ie7 = (this.ie && (this.ieVer >= 7));
	this.macOS = (this.agent.indexOf("mac") > -1);
	this.mac = (this.macOS && this.verNum >= 7 ? 1 : 0);
	this.moz = (this.agent.indexOf("gecko") > -1);
	this.ns6 = (this.dom && this.agent.indexOf("netscape") > -1 && this.verNum >= 5 ? 1 : 0);
	this.ff = (this.agent.indexOf("firefox") > -1);
	this.b = (this.ie || this.ns6 || this.opera7 || this.mac || this.moz || this.dom);

	return this;
}
b=browseIt();
		function add_bookmark()
		{
			if(b.ie) {
			window.external.AddFavorite('http://opt.citytoys.ru/', 'CityToys - детские товары и игрушки оптом. Оптовая продажа игрушек');
			}
			else
			if(b.moz||b.ns6) {
			alert('Для того чтобы добавить эту страницу в избранное нажмите Ctrl-D'); return false;
			}
			else
			if(b.opera) alert('Для того чтобы добавить эту страницу в избранное нажмите Ctrl+T'); else return false;
		}
var request = false;
try {
request = new XMLHttpRequest();
} catch (trymicrosoft) {
try {
request = new ActiveXObject('Msxml2.XMLHTTP');
} catch (othermicrosoft) {
try {
request = new ActiveXObject('Microsoft.XMLHTTP');
} catch (failed) {
request = false;
}
}
}

if (!request)
alert('Error initializing XMLHttpRequest!');

var currentItem=0;
var currentText="";

function addtocart(item, quan, cost, name) {
if (currentItem!=0) return;
var url = "/ajax_cart.php?item=" + encodeURIComponent(item) + "&value=" + quan + "&cost=" + cost + "&name=" + encodeURIComponent(name);
request.open('GET', url, true);
request.onreadystatechange = updatePage;
request.send(null);
currentItem=item;
currentText=document.getElementById('item_'+item).innerHTML;
document.getElementById('item_'+item).innerHTML="<font size=+1>добавление позиции</font>";
}

function clear() {
 document.getElementById('item_'+currentItem).innerHTML=currentText;
 currentItem=0;
}

function updatePage() {
  if (request.readyState == 4)
  if (request.status == 200) {
    document.getElementById('cart_container').innerHTML=request.responseText;
    document.getElementById('item_'+currentItem).innerHTML="<font size=+1>позиция добавлена</font>";
    setTimeout('clear()', 1000);
  }

}


function img_OP(pic, w, h){
popupWin = window.open(pic,'1','directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,width='+w+',height='+h); popupWin.focus(); return false;
}
function win_OP(url){
popupWin =  window.open(url,'1','directories=no,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,width=600,height=400'); popupWin.focus(); return false;
}