function fOrder(id){	$.ajax({		type: "GET",		url: 'g_order.php?id='+id,		dataType: "json",		success: function (result) {					var pageSize = fGetPageSize();			var scrollPosition = fGetScrollPosition();			var $puback = $("#puback");			var $publock = $("#publock");						$puback.width(pageSize[0] + "px");			$puback.height(pageSize[1] + "px");			$puback.show();					$publock.html(result.txt);						$publock.addClass("order");						$publock.css('left',(pageSize[0]-300)/2 + scrollPosition[0] + "px");			$("#close").css('left',285 + scrollPosition[0] + "px");			$publock.css('top',(pageSize[2]-100)/3 + scrollPosition[1] + "px");				$publock.show("fast");			$("input[@name=cnt"+id+"]").focus();					}	});}function fOrder2(id){	var cnt = $("input[@name=cnt"+id+"]").val();	if (!cnt)		alert('Ââåäèòå êîëè÷åñòâî!!!');	else		$.ajax({			type: "GET",			url: 'g_order.php?id='+id+'&cnt='+cnt,			dataType: "json",			success: function (result) {				$("#publock").html(result.txt);				$("#bagcnt").html(result.cnt);				var scrollPosition = fGetScrollPosition();				$("#close").css('left',285 + scrollPosition[0] + "px");			}		});}function fCloseOrder(){	$("#puback").hide();	var $publock = $("#publock");	$publock.hide("fast");	$publock.removeClass("order");}function fGetScrollPosition(){	var xScrollPosition = 0	var yScrollPosition = 0;	if (window.pageXOffset)		xScrollPosition = window.pageXOffset;	else if (document.documentElement && document.documentElement.scrollLeft)		xScrollPosition = document.documentElement.scrollLeft;	else if (document.body && document.body.scrollLeft)		xScrollPosition = document.body.scrollLeft;	if (window.pageYOffset)		yScrollPosition = window.pageYOffset;	else if (document.documentElement && document.documentElement.scrollTop)		yScrollPosition = document.documentElement.scrollTop;	else if (document.body && document.body.scrollTop)		yScrollPosition = document.body.scrollTop;	return [xScrollPosition,yScrollPosition];}function fGetPageSize() {	var xScroll, yScroll;		if (window.innerHeight && window.scrollMaxY) 	{			xScroll = window.innerWidth + window.scrollMaxX;		yScroll = window.innerHeight + window.scrollMaxY;	} 	else if (document.body.scrollHeight > document.body.offsetHeight)	{ 		// all but Explorer Mac		xScroll = document.body.scrollWidth;		yScroll = document.body.scrollHeight;	} 	else 	{ 		// Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari		xScroll = document.body.offsetWidth;		yScroll = document.body.offsetHeight;	}		var windowWidth, windowHeight;		if (self.innerHeight) 	{			// all except Explorer		if(document.documentElement.clientWidth)			windowWidth = document.documentElement.clientWidth; 		else 			windowWidth = self.innerWidth;		windowHeight = self.innerHeight;	} 	else if (document.documentElement && document.documentElement.clientHeight) 	{ 		// Explorer 6 Strict Mode		windowWidth = document.documentElement.clientWidth;		windowHeight = document.documentElement.clientHeight;	} 	else if (document.body) 	{ 		// other Explorers		windowWidth = document.body.clientWidth;		windowHeight = document.body.clientHeight;	}			if(yScroll < windowHeight)		pageHeight = windowHeight;	else 		pageHeight = yScroll;	if(xScroll < windowWidth)			pageWidth = xScroll;		else		pageWidth = windowWidth;	return [pageWidth,pageHeight,windowHeight];}
