var windowWidthHeight=new Array();
var popup_top=150;

function getViewableWindowSize() {
	
	if (window.innerHeight) {
		windowWidthHeight[0]=window.innerWidth;
		windowWidthHeight[1]=window.innerHeight;
	}
	else if (document.documentElement.clientHeight) {
		windowWidthHeight[0]=document.documentElement.clientWidth;
		windowWidthHeight[1]=document.documentElement.clientHeight;
	}
	else {
		windowWidthHeight[0]=document.body.clientWidth;
		windowWidthHeight[1]=document.body.clientHeight;
	}
	
	return windowWidthHeight;
	
}

function resizePopup (popup) {
	var ViewableWindowSizes=getViewableWindowSize();
	var popup_left=Math.round((ViewableWindowSizes[0]/4));
	var popup_width=Math.round((ViewableWindowSizes[0]/2));
	
	var popup_top=Math.round((ViewableWindowSizes[1]/10));
	var popup_height=Math.round((ViewableWindowSizes[1]/10)*8);
	
	if (document.getElementById(popup)) {
		document.getElementById(popup).style.top = popup_top+"px";
		document.getElementById(popup).style.left = popup_left+"px";
		document.getElementById(popup).style.width = popup_width+"px";
		document.getElementById(popup).style.height = popup_height+"px";
	}
	else {
		alert("no element: '"+popup+"'");
	}
}

function pop(popup,filetoload) {
	
	// load file contents into div \\
	loadXMLDoc(filetoload, 'popupinner');
	resizePopup (popup);
	document.getElementById(popup).style.visibility='visible';
	document.getElementById(popup).style.display='block';
	document.getElementById(popup).style.zIndex=100;
	
	fade(popup,0,90,5);
}

function close(popup) {
	fadeandgo(popup,90,0,3);
}