var cmTimer;
$(document).ready(function(){
	$('.compMenuBlock').hover(function() { clearTimeout(cmTimer) }, function() { cmTimer=setTimeout((function(){$('.compMenuBlock').hide();}),1500); });
});


function showPopup(popup) {
    $('#black').height($('.mainwrapper').height());
    currentOffset2 = 0;
    currentOffset = document.documentElement.scrollTop || document.documentElement.scrollTop;
    var windowHeight;
    if (!($.browser.opera)) { windowHeight = document.documentElement.clientHeight } else { windowHeight = document.body.clientHeight }
    if (windowHeight < $('#'+popup).height()) {
        currentOffset = (currentOffset + 10);
    } else {
        currentOffset2 = parseInt((windowHeight - $('#'+popup).height()) / 2);
	}
	pLeft = (document.body.clientWidth - $('#'+popup).width()) / 2;
	$('#black').show();
	$('#'+popup).css({top:currentOffset+currentOffset2,left:pLeft}).show();
}


function imgPopup(popup,src) {
    $('#black').height($('.mainwrapper').height());
    currentOffset2 = 0;
    currentOffset = document.documentElement.scrollTop || document.documentElement.scrollTop;
    var windowHeight;
    if (!($.browser.opera)) { windowHeight = document.documentElement.clientHeight } else { windowHeight = document.body.clientHeight }
    if (windowHeight < $('#'+popup).height()) {
        currentOffset = (currentOffset + 10);
	} else {
		currentOffset2 = parseInt((windowHeight - $('#'+popup).height()) / 2);
	}
	pLeft = (document.body.clientWidth - $('#'+popup).width()) / 2;
	$('#black').show();
	$("#image").attr("src", src);
	$('#'+popup).css({top:currentOffset+currentOffset2,left:pLeft}).show();

}

function reqPopup(popup) {
	currentOffset2 = 0;
	currentOffset = document.documentElement.scrollTop || document.documentElement.scrollTop;
	var windowHeight;
	if (!($.browser.opera)) { windowHeight = document.documentElement.clientHeight } else { windowHeight = document.body.clientHeight }
	if (windowHeight < $('#'+popup).height()) {
		currentOffset = (currentOffset + 10);
	} else {
		currentOffset2 = parseInt((windowHeight - $('#'+popup).height()) / 2);
	}
	pLeft = (document.body.clientWidth - $('#'+popup).width()) / 2;
	$('#'+popup).css({top:currentOffset+currentOffset2,left:pLeft}).show();
}

