function close_modal() {
    $('modal_overlay').hide();
    $('modal_container').hide();
}

function position_modal() {
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
		var ieversion = new Number(RegExp.$1); // capture x.x portion and store as a number
	} else {
		var ieversion = 99;
	}

    if ($('modal_container')) {
		if (ieversion >= 7) {
			var width = (document.body.offsetWidth - $('modal_container').offsetWidth)/2;
			var height = (document.body.offsetHeight - $('modal_container').offsetHeight)/2;

			if(document.body.offsetWidth > $('modal_container').offsetWidth)
				$('modal_container').style.left = width + (document.all ? document.documentElement.scrollLeft : window.pageXOffset) + 'px';
			if(document.body.offsetHeight > $('modal_container').offsetHeight)
				$('modal_container').style.top = height + (document.all ? document.documentElement.scrollTop : window.pageYOffset) + 'px';
		} else {
			$('modal_container').style.left = '225px';
			$('modal_container').style.top = '175px';
		}
    }
}

function open_modal() {
    window.onresize = position_modal;
    window.onscroll = position_modal;

    if($('modal_overlay')) {
        $('modal_overlay').show();
    }
    if ($('modal_container')) {
        $('modal_container').show();
        position_modal();
    }
}
