
function setCenter(item) {
	
	windowHeight = document.documentElement.clientHeight;
	currentOffset = document.documentElement.scrollTop;
	currentOffset = currentOffset + parseInt((windowHeight - $(item).height()) / 2);
	pLeft = (document.body.clientWidth - $(item).width()) / 2;
	$(item).css({top:currentOffset,left:pLeft}).show();
}

function closep() {
	$('.popup').hide();
	if ($.browser.msie) {
		$('.iframe').remove();
	}
}

function showp(item) {
	item = $('#'+item);
	iframe = $('<iframe class="iframe" frameborder="0"></iframe>');
	windowHeight = document.documentElement.clientHeight;
	currentOffset = document.documentElement.scrollTop;
	currentOffset = currentOffset + parseInt((windowHeight - item.height()) / 2);
	currentOffset = (currentOffset < 190) ? 190 : currentOffset;
	pLeft = (document.body.clientWidth - item.width()) / 2;
	item.css({top:currentOffset,left:pLeft}).show();
	if ($.browser.msie) {
		iframe.css({
			top:currentOffset+10,
			left:pLeft+10,
			width:item.width()-20,
			height:item.height()-20
		}).appendTo('body');
	}
	return false;
}

function showPopup(popup) {

	currentOffset2 = 0;
	currentOffset = 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;
	$('.iframe').show();
	$('#black').show();
	$('#'+popup).css({top:currentOffset+currentOffset2,left:pLeft}).show();
}

function showBox(box) {
  $('#'+box).show();
  $('body').mousedown(function(e){
    t = $(e.target);
    if ((t.attr('id')!=box) && (!t.parents('#'+box).length)) {
      $('#'+box).hide();
      $('body').unbind('mousedown');
    };
    return false;
  });
};
