	//기정희

	//window.open('pz_notice_pop.jsp', 'mp_res_pop1', 'width=492, height=268');

	
   	// 定义request对象
	var request = false;
	try {
	  request = new XMLHttpRequest();
	} catch (trymicrosoft) {
	  try {
	    request = new ActiveXObject("Msxml2.XMLHTTP");
	  } catch (othermicrosoft) {
	    try {
	      request = new ActiveXObject("Microsoft.XMLHTTP");
	    } catch (failed) {
	      request = false;
	    }
	  }
	}
	
	var addDB = function(userid, loginid) {
		if(confirm('패자부활전에 응모하시겠습니까')) {
			superman.show_bg();
			document.getElementById("load").style.display="block";
			// 异步请求

			var url = "/CheckOpenServlet?ecuserId="+userid+"&num=500&loginid="+loginid;
			request.open("GET", url);

			request.onreadystatechange = returnMoviePz;

			request.send(null);

			//window.open('mp_res_pop2.jsp', 'mp_res_pop1', 'width=492, height=268');

		}
	}
	
	// 回调函数
	function returnMoviePz() {
		if (request.readyState == 4) {
			//alert(request.status);
			if (request.status == 200) {
				var response = '0';
				response = request.responseText;
				//alert(response);
				
				if(response == '1') {
					//alert('活动未开始')이벤트기간이 아님니다.;
					window.open('mp_res_pop2.jsp', 'mp_res_pop1', 'width=492, height=268');
				}else if(response == '2') {
					//alert('参加活动已2000人')2000명 마감;
					//window.open('mp_res_pop3.jsp', 'mp_res_pop1', 'width=492, height=268');
					window.open('mp_res_pop3.jsp', 'mp_res_pop1', 'width=492, height=268');
				}else if(response == '3') {
					//alert('无权限')구너한없음;
					window.open('mp_res_pop1.jsp', 'mp_res_pop1', 'width=492, height=268');
				}else if(response == '4') {
					//alert('你已当选')이미당첨;
					window.open('mp_res_pop5.jsp', 'mp_res_pop1', 'width=492, height=268');
				}else if(response == '5'){
					//alert('保存成功')당첨축아;
					window.open('mp_res_pop4.jsp', 'mp_res_pop1', 'width=492, height=268');
				}else if(response == '0') {
					alert('시스템 접속인수가 많으므로 잠시후 재시도해주세요');
				//}else if(response == '6') {
				//	alert('미등록');
				}else {
					alert('시스템 접속인수가 많으므로 잠시후 재시도해주세요!');
				}
				superman.hide_bg();
				document.getElementById("load").style.display="none";
			}else {
				alert('시스템 접속인수가 많으므로 잠시후 재시도해주세요.');
				superman.hide_bg();
				document.getElementById("load").style.display="none";
			}
		}
	}
	
function getPageSizeWithScroll(){   
    if (window.innerHeight && window.scrollMaxY) {// Firefox   
        yWithScroll = window.innerHeight + window.scrollMaxY;   
        xWithScroll = window.innerWidth + window.scrollMaxX;   
    } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac   
        yWithScroll = document.body.scrollHeight;   
        xWithScroll = document.body.scrollWidth;   
    } else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari   
        yWithScroll = document.body.offsetHeight;   
        xWithScroll = document.body.offsetWidth;   
    }   
    return [xWithScroll, yWithScroll];   
} 

function SuperMan()   
{   
    var de = document.documentElement;   
    return {   
        show_bg: function(){
            var size = getPageSizeWithScroll();
			document.getElementById("bg").style.left="0";
			document.getElementById("bg").style.top="0";
			document.getElementById("bg").style.width=size[0];
			document.getElementById("bg").style.height=size[1];
			document.getElementById("bg").style.display="block";
        },   
        hide_bg: function(){
			document.getElementById("bg").style.display="none";
        }
    }
}

window.superman = SuperMan();