	var scroll;
	var clientWidth, clientHeight;
	var popup_left, popup_height;
    var popup_id;
//--------------------------------------------------------- Высота документа --
	var ua = navigator.userAgent.toLowerCase();
	var isOpera = (ua.indexOf('opera')  > -1);
	var isIE = (!isOpera && ua.indexOf('msie') > -1);
	
	function getDocumentHeight() {
		return Math.max(document.compatMode != 'CSS1Compat' ? document.body.scrollHeight : document.documentElement.scrollHeight, getViewportHeight());
	}
	
	function getViewportHeight() {
		return ((document.compatMode || isIE) && !isOpera) ? (document.compatMode == 'CSS1Compat') ? document.documentElement.clientHeight : document.body.clientHeight : (document.parentWindow || document.defaultView).innerHeight;
	}
//---------------------------------------------------------		
	function getNewSizes(){
		clientWidth = $(window).width();
		clientHeight = $(window).height();

		popup_left = (clientWidth - $('#'+popup_id).width())/2;
		popup_height = (clientHeight - $('#'+popup_id).height())/2;
		
		$('#outer_shadow').css('height', getDocumentHeight());
	}
	function ShowPopUp(id){
		if(!id)id="export_pop";
        popup_id=id;getNewSizes();
        
		$('body').css('overflow', 'hidden');
		$('#outer_shadow').css('display', 'block');
		$('#'+id).css('left', popup_left);
		$('#'+id).css('top', scroll + popup_height);
	}	
	function ClosePopUp(){
		$('#outer_shadow').css('display', 'none');
		$('.popup').css('left', '-999999px');
		$('#big_pop').attr('src', '');
		$('body').css('overflow', 'auto');
	}
	$('document').ready(function() {
		getNewSizes();
		$(window).resize(function(){getNewSizes();});
		scroll = document.documentElement.scrollTop || document.body.scrollTop;
		window.onscroll = function () {
			scroll = document.documentElement.scrollTop || document.body.scrollTop;
			$('.popup').css('top', 30);
		};
	});	
