function showhide(e, itemnumber) {
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	// posx and posy contain the mouse position relative to the document
	// Do something with this information

//	alert ('X: '+posx+' Y: '+posy);
        posx = posx - 200;

	if (document.getElementById('basketbox').style.display != 'block') {
	document.getElementById('basketbox').style.display = 'block';

	document.getElementById('basketbox').style.top = posy+'px';
	document.getElementById('basketbox').style.left = posx+'px';

//dy = document.getElementById('basketbox').style.top;
//dx = document.getElementById('basketbox').style.left;
//alert ('X: '+dx+' Y: '+dy);



	itemvalue = document.getElementById('item'+itemnumber).value;
	//alert('itemvalue: '+itemvalue);
	document.getElementById('basketitem').firstChild.nodeValue = itemvalue;

	urlvalue = document.getElementById('r_url').value;
	//alert('urlvalue: '+urlvalue);
	document.getElementById('redirect_url').value = urlvalue;

	cartvalue = document.getElementById('cartid'+itemnumber).value;
	//alert('cartvalue: '+cartvalue);
	document.getElementById('cartvalue').name = cartvalue;

	} else {
		document.getElementById('basketbox').style.display = 'none';
		}
}

$.extend($.expr[":"], {
    "containsNC": function(elem, i, match, array) {
        return (elem.textContent || elem.innerText || "").toLowerCase
().indexOf((match[3] || "").toLowerCase()) >= 0;
    }
}); 
var pro;
var pro_id;
$(document).ready(function(){
	$("#probutton").click(function() {
		var vcountry = $("#ccountry").val();
		var vobl = $("#coblast").val();
		var vcity = $("#ccity").val();

		$("#propro option:selected").each(function() {
			  pro = $(this).text();
			pro_id = $(this).val();
		});
		$(".parpro").show();
		if (pro!="") { $(".propro:not(:containsNC("+pro+"))").parents('.parpro').hide(); } 
        if (pro=="--Выбрать--") { $(".parpro").show(); } 
		if (vcountry!="") {$(".procountry:not(:containsNC("+vcountry+"))").parents('.parpro').hide();}
		if (vobl!="") {$(".proobl:not(:containsNC("+vobl+"))").parents('.parpro').hide();}
		if (vcity!="") {$(".procity:not(:containsNC("+vcity+"))").parents('.parpro').hide();}		
	});
	$("#proall").click(function() {
		$(".parpro").show();
	});

});
