
var lcgopop = false;
var bagopop = false;
var gopop = false;

$(document).click(function(e)
{
	if (lcgopop == true) {
		pp = "livechatpopup";
	}
	
	if (bagopop == true) {
		pp = "buyaccpopup";
	}
	
	if (gopop == true) {
		pp = "popup_god";
	}
	
	var height = $('#'+pp).height();
	var width = $('#'+pp).width();
	leftVal=e.pageX-(width/2)+"px";
	topVal=e.pageY-(height/2)+"px";
	
	if (lcgopop == true || bagopop == true || gopop == true) {
		leftVal = e.pageX-(width/2);
		
		if (lcgopop == true) {
			leftVal -= 600;
		}
		
		if (bagopop == true) {
			leftVal -= 100;
		}
		
		leftVal += "px";
		$('#'+pp).css({left:leftVal,top:topVal}).fadeIn('slow');
		lcgopop = false;
		bagopop = false;
	}
	
	if (typeof gopop != "undefined") {
		if (gopop == true) {
		  $('#popup').css({left:leftVal,top:topVal}).fadeIn('slow');
		  gopop = false;
		}
	}
});    

function showlivechat() {
	lcgopop = true;
	return false;
}

function showBuyAcc() {
	bagopop = true;
	return false;
}

function closelivechat() {
	$('#livechatpopup').fadeOut('slow');
}

function closeBuyAcc() {
	$('#buyaccpopup').fadeOut('slow');
}

function showlivechat() {
	lcgopop = true;
	//$("#pur").html(val);
	return false;
}

function openLiveHelp() {
  window.open('livechat/chat.php?code=U0VSVkVSUEFHRQ__','','width=590,height=610,left=0,top=0,resizable=yes,menubar=no,location=yes,status=yes,scrollbars=yes');
}
