	nn4 = (document.layers)? true : false;
	ie4 = (document.all)? true : false;
	nn6 = (document.getElementById && !ie4)? true : false;
	img_empt = new Image();
	img_empt.src = 'img/x.gif';
	// style1
	img_pls = new Image();
	img_pls.src = 'img/open.gif';
	img_min = new Image();
	img_min.src = 'img/close.gif';
	// style2
	img_pls2 = new Image();
	img_pls2.src = 'img/open2.gif';
	img_min2 = new Image();
	img_min2.src = 'img/close2.gif';
	
function comparer(oid) {
	hot = window.open('/compare.phtml?action=add&oid='+oid, 'comparer', 'status=no, toolbar=no menubar=no, width=800, height=650');
	hot.focus();
}

function getPosition() {
    e = window.event;
    var cursor = {x:0, y:0};
    if (e.pageX || e.pageY) {
        cursor.x = e.pageX;
        cursor.y = e.pageY;
    } 
    else {
        var de = document.documentElement;
        var b = document.body;
        cursor.x = e.clientX + 
            (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
        cursor.y = e.clientY + 
            (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
    }
    return cursor;
}


function setItem(k,q)
{
	//showAlert();
	document.all['imgpost'].src='s.php?key='+k+'&q='+q;
	if (document.all['imgnot']){
		document.all['imgnot'].src='img/oform_2.gif';
	}else {
		document.all['imgnot2'].style.visibility = "visible";
		cc = getPosition(event);
		document.all['imgnot2'].style.left=cc.x+20;
		document.all['imgnot2'].style.top=cc.y+20;
	}
//	if (q>0)
//		alert('Товар успешно добавлен в корзину. Пожалуйста, перейдите в корзину для оформления заказа.');
//	else
//		alert('Товар удален из корзины.');
//	if(confirm('Товар успешно добавлен в корзину. Для того чтобы перейти к оформлению нажмите "ОК"')){
//		self.setTimeout('self.location=\'index.php?layout=basket&m=0\'', 100);
//	}
self.location='index.php?layout=basket&m=0';
}

function setItemR(k,q)
{
	document.all['imgpost'].src='s.php?key='+k+'&q='+q;
	self.setTimeout('self.location=\'index.php?layout=basket&m=0\'', 100);
}

function setItem2(k,q)
{
	document.all['imgpost'].src='s.php?key='+k+'&q='+q;
	self.setTimeout('self.location=\'index.php?layout=basket&m=1\'', 100);
}

function goBas() {
	self.location='index.php?layout=basket&m=0';
}

function setItem3(k)
{
	if (!document.all['i'+k].checked){
		document.all['imgpost'].src='s.php?key='+k;
		alert('Товар успешно добавлен в корзину. Пожалуйста, перейдите в корзину для оформления заказа.');
	}
}

function sb1(ff) {
	document.all.bpic.src=ff;
}

function sb(id, fn) {
	offW=20;
	offH=20;
	winH=550;
	winW = 600;
	winH = winH+50;
		if(screen.width<(winW+offW)){
			xW=screen.width-offW;
			winH=xW*winH/winW;
			winW=xW;
		}
		if(screen.height<(winH+offH)){
			xH=screen.height-offH;
			winW=xH*winW/winH;
			winH=xH;
		}
		var W=offW+winW
		H=offH+winH
		
		if (nn4 || ie4 || nn6) {
		posX = Math.round((screen.width - winW) / 2);
		posY = Math.round((screen.height - winH) / 2);
		posCode = (nn4 || nn6)? 'screenX='+posX+',screenY='+posY : 'left='+posX+',top='+posY;
		} else { posCode = ''; }
		cardWindow = window.open('/pic.php?id='+id+'&fn='+fn,'_blank','menubar=no,toolbar=no,scrollbars=no,status=no,width='+W+',height='+H+','+posCode);
}



function xsdrhek(node_oid)
{
	node_elmnt_lst = document.getElementById('node' + node_oid);
	node_ctrl_img = document.getElementById('node_ctrl_img' + node_oid);
	if (node_elmnt_lst.style.display == 'block') {
		node_elmnt_lst.style.display = 'none';
		node_ctrl_img.src = img_pls.src;
	} else {
		node_elmnt_lst.style.display = 'block';
		node_ctrl_img.src = img_min.src;
	}
}

function xsdrhek_style2(node_oid)
{
	node_elmnt_lst = document.getElementById('node' + node_oid);
	node_ctrl_img = document.getElementById('node_ctrl_img' + node_oid);
	if (node_elmnt_lst.style.display == 'block') {
		node_elmnt_lst.style.display = 'none';
		node_ctrl_img.src = img_pls2.src;
	} else {
		node_elmnt_lst.style.display = 'block';
		node_ctrl_img.src = img_min2.src;
	}
}

