function GeneralErrorPopup(newloc){
	var ie, winH, winW
	ie = (document.all)? true:false;
	winW = (ie)? (document.body.offsetWidth-20-300)/2 : (window.innerWidth-16-300)/2;
	winH = (ie)? (document.body.offsetHeight-150)/2 : (window.innerHeight-150)/2;
	if (ie) {
		winW = winW + window.screenLeft;
		winH = winH + window.screenTop;
		//newWind=window.open('/appl/generalerror.aspx','Error',"status=no,toolbar=no,scrollbars=no,directories=no,location=no,resizable=on,width=300,height=150,top=" + winH + ",left=" + winW);
		newWind=WindowOpen('/appl/generalerror.aspx','Error', 300, 150);
	} else {
		winW = winW + window.screenX;
		winH = winH + window.screenY;
		//newWind=window.open('/appl/generalerror.aspx','Error',"status=yes,toolbar=no,scrollbars=no,directories=no,location=no,resizable=on,width=300,height=150,screenY=" + winH + ",screenX=" + winW);
		newWind=WindowOpen('/appl/generalerror.aspx','Error', 300, 150);
	}
	window.location = newloc;
	return(true);
}
function GeneralErrorPopupChild(newloc){
	var ie, winH, winW
	ie = (document.all)? true:false;
	winW = (ie)? (document.body.offsetWidth-20-300)/2 : (window.innerWidth-16-300)/2;
	winH = (ie)? (document.body.offsetHeight-150)/2 : (window.innerHeight-150)/2;
	if (ie) {
		winW = winW + window.screenLeft;
		winH = winH + window.screenTop;
		//newWind=window.open('/appl/generalerror.aspx','Error',"status=no,toolbar=no,scrollbars=no,directories=no,location=no,resizable=on,width=300,height=150,top=" + winH + ",left=" + winW);
		newWind=WindowOpen('/appl/generalerror.aspx','Error', 300, 150);
	} else {
		winW = winW + window.screenX;
		winH = winH + window.screenY;
		//newWind=window.open('/appl/generalerror.aspx','Error',"status=yes,toolbar=no,scrollbars=no,directories=no,location=no,resizable=on,width=300,height=150,screenY=" + winH + ",screenX=" + winW);
		newWind=WindowOpen('/appl/generalerror.aspx','Error', 300, 150);
	}
	window.opener.location = newloc;
	window.close();
	return(true);
}

function WindowOpen(URL, windowName, width, height)
{
	return WindowOpen2(URL, windowName, width, height, false, false, false, false, false, false, true);
}

function ShowProductDetailPage(id)
{
	ShowProductDetailPage(id, 0);
}
function ShowProductDetailPage(id, iss)
{
	ShowProductDetailPage(id, 0, false);
}
function ShowProductDetailPage(id, iss, readonly)
{
	var url;
	url = '/appl/catalog/productdetail.aspx?productid=' + id;
	
	if(iss == 1)
		url = url + '&iss=';
		
	if(readonly)
		url = url + "&readonly=";
		
	window.location = url;

	return(false);
}


function WindowOpen2(URL, windowName, width, height, status, toolbar, location, menubar, directories, resizable, scrollbars)
{
	var windowFeatures = '';
	if(status)
		windowFeatures += 'status,';
	if(toolbar)
		windowFeatures += 'toolbar,';
	if(location)
		windowFeatures += 'location,';
	if(menubar)
		windowFeatures += 'menubar,';
	if(directories)
		windowFeatures += 'directories,';
	if(resizable)
		windowFeatures += 'resizable,';
	if(scrollbars)
		windowFeatures += 'scrollbars,';
	
	if(width != '' && width != null)
	{
		windowFeatures += 'width=' + width + ',';
		var left = (window.screen.width / 2) - (width / 2); 
		windowFeatures += 'left=' + left + ',';		
	}
	
	if(height != '' && height != null)
	{
		windowFeatures += 'height=' + height + ',';
		var top = (window.screen.height / 2) - (height / 2);
		windowFeatures += 'top=' + top + ',';
	}

	return WindowOpenWithPopupBlockerCheck(URL, windowName, windowFeatures, true);
}

function WindowOpenWithPopupBlockerCheck(URL, windowName, windowFeatures, CheckPopupBlocker)
{
	var wndPopup = window.open(URL, windowName, windowFeatures);
	if(CheckPopupBlocker && !wndPopup)
		alert('A popup blocker may be preventing ' + GetServer_Name() + ' from opening the page. If you have a popup blocker, try disabling it to open the window.');
	else
		wndPopup.focus();
		
	return wndPopup;
}


function GetServer_Name()
{
	var x = window.location.href.split('/');
	x.length = 3;
	return x.join('/');
}

//onkeypress="return isDigit(event,'decOK');
//onkeypress="return isDigit(event,'noDec');
function onlyDigits(e, decReq)
{
	//var isIE = document.all?true:false;
	//var isNS = document.layers?true:false;

	var key = (isIE) ? window.event.keyCode : e.which;
	var obj = (isIE) ? event.srcElement : e.target;
	var isNum = (key > 47 && key < 58) ? true:false;
	var dotOK = (key==46 && decReq=='decOK' && (obj.value.indexOf(".")<0 || obj.value.length==0)) ? true:false;

	if(key < 32)
		return true;
	return (isNum || dotOK);
}
function IsPageMode()
{				
	if(document.getElementById('MainTBL') != null || window.opener != null)
		return true;
		
	return false;
}