
function newWindow(theURL) {
var portionFloat = .6;
var features='menubar=yes,scrollbars=yes,buttonbar=yes,status=yes,toolbar=yes,resizable=yes,location=yes,';

winName = 'contentWindow';
windowCoord = setWindowValues();

var windowWidth = windowCoord.shift();
var windowHeight = windowCoord.shift();
var screenWidth = windowCoord.shift();
var screenHeight = windowCoord.shift();
var calcTop = windowCoord.shift();
var calcLeft = windowCoord.shift();

newWidth = parseInt(windowWidth * portionFloat);
newHeight = parseInt(windowHeight * portionFloat);

newXOffset = parseInt((windowWidth - newWidth) * .5) + calcLeft;
newYOffset = parseInt((windowHeight - newHeight) * .5) + calcTop;

if (navigator.appName == 'Microsoft Internet Explorer'){
	offsetString = ',top=' + newYOffset + ', left=' + newXOffset;
	}
	else {
	offsetString = ',screenX=' + newYOffset + ', screenY=' + newXOffset;
	}

features = features + 'width=' + newWidth + ',height=' + newHeight + offsetString;

windowName = self.open(theURL,winName,features);
}

//Popup Window functions
function setWindowValues(){
 
	windowWidth = getWindowWidth(self); // or you could just apply some value here
  windowHeight = getWindowHeight(self); // or you could just apply some value here
	screenWidth = screen.availWidth ? screen.availWidth : screen.width;
	screenHeight = screen.availHeight ? screen.availHeight : screen.height;
	
	calcTop = window.screenY ? window.screenY : self.screenTop;
	calcLeft = window.screenX ? window.screenX : self.screenLeft;
	
	return (windowCoord = new Array(windowWidth,windowHeight,screenWidth,screenHeight,calcTop,calcLeft));
}
function getWindowWidth (windowObject) {
		var windowWidth = 0

		if (windowObject.innerWidth)
		{
			windowWidth = windowObject.innerWidth;
		}
		else if (windowObject.document.documentElement && windowObject.document.documentElement.clientWidth)
		{
			windowWidth = windowObject.document.documentElement.clientWidth;
		}
		else if (windowObject.document.body)
		{
			windowWidth = windowObject.document.body.clientWidth;
		}
		if (windowWidth < 500){
			windowWidth = 500;
			}
		return windowWidth;
	}

	function getWindowHeight (windowObject) {
		
		if (windowObject.innerHeight)
		{
			windowHeight = windowObject.innerHeight;
		}
		else if (windowObject.document.documentElement && windowObject.document.documentElement.clientHeight)
		{
			windowHeight = windowObject.document.documentElement.clientHeight;
		}
		else if (windowObject.document.body)
		{
			windowHeight = windowObject.document.body.clientHeight;
		}
		if (windowHeight < 325){
			windowHeight = 325;
			}
		return windowHeight;
	}
	//END Popup Window Functions
