
var isNN4 = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) == 4)

function popwin(url,winname,width,height) {
	var newwin
	var leftPo = (screen.availWidth-width)/2
	var topPo = (screen.availHeight-height)/2
	window.open(url, winname, "scrollbars=yes,toolbar=no,status=no,location=no,menubar=no,resizable=yes,height="+(height-20)+",width="+(width-10)+",left="+leftPo+",top="+topPo)
	return false;
}

/*
	format:
	return popUniqueWin (win, '', width, height)
*/


var posteditpreviewWidth = (screen.availWidth)*0.75
var posteditpreviewHeight= (screen.availWidth)*0.5

function adminwin(win) { // admin panel
	return popwin(win,'admin',screen.availWidth,screen.availHeight);
}

function addresswin(win) { // quick Address; PM read status
	if (isNN4) return popwin(win,'address',250,470);
	return popwin(win,'',250,470)
}

function uplwin(win) { // upload
	if (isNN4) return popwin(win,'uplwin',400,400);
	return popwin(win,'',400,400)
}

function previewwin(win) { // preview
	if (isNN4) return popwin(win,'previewwin',posteditpreviewWidth,posteditpreviewHeight);
	return popwin(win,'',posteditpreviewWidth,posteditpreviewHeight)
}

function pgdwin(win) { // pgd code helper window
	if (isNN4) return popwin(win,'pgdwin',posteditpreviewWidth,posteditpreviewHeight);
	return popwin(win,'',posteditpreviewWidth,posteditpreviewHeight)
}

function URLwin(win) { // PGDCode URL
	if (isNN4) return popwin(win,'URLlink',400,200);
	return popwin(win,'',400,200)
}

function powin(win) { // post
	return popwin(win,'',posteditpreviewWidth,posteditpreviewHeight);
}

function popcalwin(win) { // popup calendar
	return popwin(win,'',320,220);
}

function ewin(win) { // forward
	return popwin(win,'',600,380);
}

function fwdwin(win) { // forward
	return popwin(win,'',500,150);
}

function logwin(win) { // login; thread management window
	return popwin(win,'',400,300);
}
function whowin(win) { // who posted window
	return popwin(win,'',240,600);
}
function photoreport(win) { // login; thread management window
	return popwin(win,'',600,300);
}
function slidewin(win) { // login; thread management window
	return popwin(win,'',screen.availWidth,screen.availHeight);
}

function popWinProduct(file,x,y,passVar,name,inValue, action, nw) {

	if (nw == 1) {
		if (self != null && !self.closed) {
			if (action == "add" || action == "poll" ) {
				self.location.href="tt.asp?forumid="+inValue;
			}
			else {
				self.location.href="fb.asp?m="+inValue;
			}
		}
	}
	else {
		if (opener != null && !opener.closed) {
			if (action == "add" || action == "poll" ) {
				opener.location.href="tt.asp?forumid="+inValue;
			}
			else {
				opener.location.href="fb.asp?m="+inValue;
			}
		}
	}

	var dum = Math.random() * 10000
	if(document.all)
		var xMax = screen.width, yMax = screen.height;
	else
		if(document.layers)
			var xMax = window.outerWidth, yMax = window.outerHeight;
		else
			var xMax=800, yMax=600;

	xOffset = (xMax - x) / 2;
	yOffset = 50;
	var pageLocation = location.pathname;
	var completeURL = file + "?message="+escape(passVar);
	//alert(nw);
	if (nw == 1)
		newwindow = window.open(completeURL,name,'scrollbars=yes,toolbar=no,directories=no,menubar=no,resizable=yes,status=yes,width='+x+',height='+y+',screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+'');
	else {
		self.resizeTo(x,y);
		self.moveTo(xOffset, yOffset);
		self.location.href = completeURL;
		self.focus();
	}
}

