var i=0;
function centerWindow() {
	i=0;
	if (window.navigator.userAgent.indexOf('MSIE 6.0') != -1 && window.navigator.userAgent.indexOf('SV1') != -1) {
		i=30; //This browser is Internet Explorer 6.x on Windows XP SP2
	} else if (window.navigator.userAgent.indexOf('MSIE 6.0') != -1) {
		i=0; //This browser is Internet Explorer 6.x
	} else if (window.navigator.userAgent.indexOf('Firefox') != -1 && window.navigator.userAgent.indexOf("Windows") != -1) {
		i=25; //This browser is Firefox on Windows
	} else if (window.navigator.userAgent.indexOf('Mozilla') != -1 && window.navigator.userAgent.indexOf("Windows") != -1) {
		i=45; //This browser is Mozilla on Windows
	} else {
		i=80; //This is all other browsers including Mozilla on Linux
	}
	if (document.documentElement && document.documentElement.clientWidth) {
		var screenWidth = screen.width;
		var screenHeight = screen.height;
		var windowWidth = getWinWidth();
		var windowHeight = getWinHeight();
		var leftpos = screenWidth / 2 - windowWidth / 2;
		var toppos = screenHeight / 2 - windowHeight / 2;
		window.moveTo(leftpos, toppos);
	}
	self.focus();
}

function getWinWidth() {
	isNav = (document.all) ? false : true;
	isIE = (document.all) ? true : false;
	if (isNav && !isIE) {
		return(window.innerWidth);
	} else if (isIE && !isNav) {
		return(document.body.clientWidth);
	} else {
		return(100);
	}
}

function getWinHeight() {
	isNav = (document.all) ? false : true;
	isIE = (document.all) ? true : false;
	if (isNav && !isIE) {
		return(window.innerHeight);
	} else if (isIE && !isNav) {
		return(document.body.clientHeight);
	} else {
		return(100);
	}
}
function readCookie(name) {
	var cookieValue = "";
	var search = name + "=";
	if(document.cookie.length > 0) {
		offset = document.cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = document.cookie.indexOf(";", offset);
			if (end == -1) end = document.cookie.length;
			cookieValue = unescape(document.cookie.substring(offset, end))
		}
	}
	return cookieValue;
}
function writeCookie(name, value, hours) {
	var expire = "";
	if(hours != null) {
		expire = new Date((new Date()).getTime() + hours * 3600000);
		expire = "; expires=" + expire.toGMTString();
	}
	document.cookie = name + "=" + escape(value) + expire;
}
