
var browserType = '?';
var browserVersion = '?';

var objPopup;
objPopup = null;

var vupW, vupH;

function goHome() {
	document.location.href = 'http://www.missionmeeting.org/';
}

function getBrowser() {

	var ua, s, i;

	this.isIE    = false;  // Internet Explorer
	this.isOP    = false;  // Opera
	this.isNS    = false;  // Netscape
	this.version = null;

	ua = navigator.userAgent;
	
	s = 'Opera';
	if ((i = ua.indexOf(s)) >= 0) {
		this.isOP = true;
		this.version = parseFloat(ua.substr(i + s.length));
		browserType = 'Opera';
		browserVersion = this.version;
		return;
	}

	s = 'Netscape6/';
	if ((i = ua.indexOf(s)) >= 0) {
		this.isNS = true;
		this.version = parseFloat(ua.substr(i + s.length));
		browserType = 'Netscape';
		browserVersion = this.version;
		return;
	}

	s = 'Firefox/';
	if ((i = ua.indexOf(s)) >= 0) {
		this.isNS = true;
		this.version = parseFloat(ua.substr(i + s.length));
		browserType = 'Firefox';
		browserVersion = this.version;
		return;
	}

	// Treat any other "Gecko" browser as Netscape 6.1.

	s = 'Gecko';
	if ((i = ua.indexOf(s)) >= 0) {
		this.isNS = true;
		this.version = 6.1;
		browserType = 'Gecko';
		browserVersion = '(treated as Netscape 6.1)';
		return;
	}

	s = 'MSIE';
	if ((i = ua.indexOf(s))) {
		this.isIE = true;
		this.version = parseFloat(ua.substr(i + s.length));
		browserType = 'Microsoft IE';
		browserVersion = this.version;
		return;
	}
}

var objBrowser = new getBrowser();

function getWinHeight() {
	var winH = 0;
	if (typeof(window.innerHeight) == 'number') {
		winH = window.innerHeight;
		if (document.documentElement && document.documentElement.clientHeight) {
			winH2 = document.documentElement.clientHeight;
		}
		else {
		    if (document.body && document.body.clientHeight) {
				winH2 = document.body.clientHeight;
		    }
		}
		if (winH2 > 0 && winH2 < winH) { winH = winH2 }
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			winH = document.documentElement.clientHeight;
		}
		else {
		    if (document.body && document.body.clientHeight) {
				winH = document.body.clientHeight;
		    }
		}
	}
	return winH;
}

function getWinWidth() {
	var winW = 0;
	if (typeof(window.innerWidth) == 'number') {
		winW = window.innerWidth;
		if (document.documentElement && document.documentElement.clientWidth) {
			winW2 = document.documentElement.clientWidth;
		}
		else {
		    if (document.body && document.body.clientWidth) {
				winW2 = document.body.clientWidth;
		    }
		}
		if (winW2 > 0 && winW2 < winW) { winW = winW2 }
	}
	else {
		if (document.documentElement && document.documentElement.clientWidth) {
			winW = document.documentElement.clientWidth;
		}
		else {
		    if (document.body && document.body.clientWidth) {
				winW = document.body.clientWidth;
		    }
		}
	}
	return winW;
}

function popWinResizeable(popPath, popName, w, h, scroll, pos) {
	maxH = screen.availHeight;
	maxW = screen.availWidth;
	if (w > screen.availWidth) {
		w = screen.availWidth;
	}
	if (h > maxH) {
		h = maxH;
	}
	if (pos == "random") {
		leftPos = (maxW) ? Math.floor(Math.random()*(maxW-w)) : 100;
		topPos = (maxH) ? Math.floor(Math.random()*((maxH-h)-75)) : 100;
	}
	if (pos == "center") {
		leftPos = (maxW) ? (maxW-w)/2 : 100;
		topPos = (maxH) ? (((maxH-h)/2) - (screen.height - maxH)) : 100;
	}
	else if ((pos != "center" && pos != "random") || pos == null) {
		leftPos = 0;
		topPos = 20;
	}
	popParams = 'width=' + w + ', height=' + h + ', top=' + topPos + ', left=' + leftPos + ', scrollbars=' + scroll + ', location=no, directories=no, status=no, menubar=no, toolbar=no, resizable=yes, fullscreen=no';
	objPopup = window.open(popPath, popName, popParams);
}

function addLoadEvent(func) {
	if (window.addEventListener) {
		window.addEventListener("load", func, false);
	} 
	else if (window.attachEvent) {
		window.attachEvent("onload", func);
	}
	else if (document.getElementById) {
		window.onload=func; 
	}
	else {
		document.location = '/unsupported.asp?e=eventsJS'; 
	}
}

function dropShadow() {
	if (document.getElementById) {
		noscriptEl = document.getElementById('noscript');
		if (noscriptEl) {
			noscriptEl.style.display = 'none';
		}
		containerEl = document.getElementById('contentContainer');
		if (containerEl) {
			cTags = containerEl.getElementsByTagName('h1');
			if (cTags[0]) {
				bt = cTags[0].innerHTML;
				if (bt != '') {
					btEl = document.getElementById('bannerText');
					dsEl = document.getElementById('dropShadow');
					if (btEl && dsEl) {
						btEl.innerHTML = bt;
						dsEl.innerHTML = bt;
						cTags[0].innerHTML = '';
					}
				}
			}
		}
	}
}

function pHover(el) {
	if (document.getElementById) {
		containerEl = document.getElementById(el);
		if (containerEl) {
			cTags = containerEl.getElementsByTagName('p');
			for (j = 0 ; j < cTags.length ; j++ ) {
				cTags[j].onmouseover=function() {
					this.className+=" pHover";
				}
				cTags[j].onmouseout=function() {
					this.className=this.className.replace(new RegExp(" pHover\\b"), "");
				}
			}
		}
	}
}

function setPhover() {
	if (objBrowser.isIE == true) {
		pHover('container');
		pHover('main');
	}
}

addLoadEvent(dropShadow);
addLoadEvent(setPhover);

