﻿var winW = 630, winH = 460;
//---------------------------------------------------------------------------------------------------
function WSizeW() {	
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			winW = window.innerWidth-16;
			}
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			winW = document.body.offsetWidth-20;
			}
	return winW;
	}
}
//---------------------------------------------------------------------------------------------------
function WSizeH() {	
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			winH = window.innerHeight-20;
			}
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			winH = document.body.offsetHeight-20;
			}
	return winH;
	}
}
//---------------------------------------------------------------------------------------------------
function OrigModalSize(Modal) {
	var ScrollTop = document.body.scrollTop;
	if (ScrollTop == 0){
		if (window.pageYOffset)
			ScrollTop = window.pageYOffset;
		else
			ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
	}
	
	DivH = document.getElementById(Modal).style.height;
	DivH = DivH.replace(/px/,"")
	
	DivW = document.getElementById(Modal).style.width;
	DivW = DivW.replace(/px/,"")
	
	winW = (WSizeW() / 2) - (DivW / 2);
	winH = ((WSizeH() / 2) - (DivH / 2)) + ScrollTop;

	document.getElementById(Modal).style.top = winH;
	document.getElementById(Modal).style.left = winW;
	document.getElementById(Modal).style.position = "absolute";
}
//---------------------------------------------------------------------------------------------------
//function showdeadcenterdiv(Modal) {
function ModalSize(Modal) {
	Xwidth = document.getElementById(Modal).style.width;
	Xwidth = Xwidth.replace(/px/,"");
	
	Yheight = document.getElementById(Modal).style.height;
	Yheight = Yheight.replace(/px/,"");
	
	
	// First, determine how much the visitor has scrolled
	
	var scrolledX, scrolledY;
	if( self.pageYOffset ) {
		scrolledX = self.pageXOffset;
		scrolledY = self.pageYOffset;
	} else if( document.documentElement && document.documentElement.scrollTop ) {
		scrolledX = document.documentElement.scrollLeft;
		scrolledY = document.documentElement.scrollTop;
	} else if( document.body ) {
		scrolledX = document.body.scrollLeft;
		scrolledY = document.body.scrollTop;
	}
	
	// Next, determine the coordinates of the center of browser's window
	
	var centerX, centerY;
	if( self.innerHeight ) {
		centerX = self.innerWidth;
		centerY = self.innerHeight;
	} else if( document.documentElement && document.documentElement.clientHeight ) {
		centerX = document.documentElement.clientWidth;
		centerY = document.documentElement.clientHeight;
	} else if( document.body ) {
		centerX = document.body.clientWidth;
		centerY = document.body.clientHeight;
	}
	
	// Xwidth is the width of the div, Yheight is the height of the
	// div passed as arguments to the function:
	var leftOffset = scrolledX + (centerX - Xwidth) / 2;
	var topOffset = scrolledY + (centerY - Yheight) / 2;
	
	// The initial width and height of the div can be set in the
	// style sheet with display:none; divid is passed as an argument to // the function
	document.getElementById(Modal).style.top = topOffset;
	document.getElementById(Modal).style.left = leftOffset;
	document.getElementById(Modal).style.position = "absolute";
}
//---------------------------------------------------------------------------------------------------
function ModalOKURL(modURL) {
	document.getElementById('modOKLink').href=modURL;
}
function ModalContent(mTitle,mMessage) {
	document.getElementById('modalTitle').innerHTML=mTitle;
	document.getElementById('modalMessage').innerHTML=mMessage;
}