
var CityPopup = {
	show : function() {
		//
		// Hide select boxes (IE 6 bug)
		//
		var elems = document.getElementsByTagName('select');
		if (elems) {
			for (i=0; i<elems.length; i++) {
				elems[i].style.visibility = 'hidden';
			}
		}
	
		//
		// Create faded overlay
		//
		var overlay = document.createElement('div');
		
		var height = $(document).height();
		if (height < $(window).height()) {
			height = $(window).height();
		}
		
		$(overlay).css({
			'position' : 'absolute',
			'background-color' : 'black',
			'top' : '0px',
			'left' : '0px',
			'width' : '100%',
			'height' : height + 'px',
			'opacity' : '0',
			'filter' : 'alpha(opacity = 0)',
			'z-index' : '10'
		});
	
		document.body.appendChild(overlay);
		
		//
		// Position popup container
		//
		var content = document.getElementById('citypopup');

		// Calculate and set position after all other styling
		var top = Math.round((($(window).height() - $(content).height())/3)) + 'px';
		var left = Math.round(($(window).width() - $(content).width())/2) + 'px';
		$(content).css({
			'top' : top,
			'left' : left
		});

		$(overlay).fadeTo("slow", 0.8);
	}
}

$(document).ready(function() {
	CityPopup.show();
});