// basic page move
function goMhf(page, _blank){

	var _url = getURL(page);
	
	if (_url == '') {
		alert('점검중입니다.');
	}
	else if (_blank == '_blank') {
		window.open(_url);
	}
	else if (_url == 'function') {	
	}
	else {
		top.location.href = _url;
	}
}

// 테스터 당첨 확인
function viewEventWinner(){
	//alert('오후 4시 당첨자 발표를 기대해주세요.');
	window.open("/index.nhn?m=checkTester", "", "width=380 height=250");
}

// 마이페이지 캐릭 정보
function viewMyPage(){
	window.open("/mypage.nhn?m=userinfo", "mypage", "width=680 height=420");
}

// 내가 쓴글 보기
function myBBS(){
	window.open("/mypage.nhn?m=mybbs", "mypage", "width=680 height=420");
}

// 개인정보보기 - 대표캐릭터 있을 때 
function viewMyPrivateInfoTab(){
	window.open("/mypage.nhn?m=privateinfo", "mypage", "width=680 height=420");
}

// 개인정보보기 - 대표캐릭터 없을 때 
function viewMyPrivateInfo(){
	window.open("/mypage.nhn?m=privateinfo&option=notmainchar", "mypage", "width=680 height=420");
}

// 구매정보보기 
function viewMyShopInfo(mode){
	if(mode == null)
		window.open("/mypage.nhn?m=shopinfo", "mypage", "width=680 height=420");
	else
		window.open("/mypage.nhn?m=shopinfo&mode="+mode, "mypage", "width=680 height=420");
}

// 엑스트라 서비스 상세 정보 보기
function openExtraInfo(mode)
{
	if(mode == null) {
		window.open("/popup/extraInfo.nhn", "extraInfo", "width=560 height=740");
	}
	else {
		window.open("/popup/extraInfo.nhn?mode="+mode, "extraInfo", "width=560 height=740");
	}
}

// other
function goPcCheck(){
	WindowLeft = (screen.width - 593)/2;
	WindowTop = (screen.height - 188)/2;
	window.open("/common/publish/popupSpecAnalyzer.jsp?action=/download/download.nhn?m=specAnalyze","pccheck","scrollbars=no,width=550, height=400, top="+WindowTop+", left="+WindowLeft);
}

// 게시판 세부 글보기
function goBoardView(boardid, bbsid, docid){
		
	var url = getBoardURL(boardid);
	if (url != '') 
		top.location.href(url+'?bbsid='+bbsid+'&docid='+docid);
}

function manualDownload( memberId ){
	
	var objFrameDown = document.getElementById("client_down");
	if( objFrameDown ) {
		objFrameDown.src = downUrl; 
	} else {
		window.open(downUrl);
	}
	
	// 웹베르스 호출 - 다운로드 카운트
	var wbersUrl = "http://lcs.wbers.hangame.com/log.html?project=K_MHF&value=160&id=" + memberId;
	var objFrame = document.getElementById("wbers_lcs_dn");
	if( objFrame ) {
		objFrame.src = wbersUrl;
	}
}

function clickStartHunter(){
	openWin("/popup/startHunter.nhn?option=click", "startHunter", 800, 600);
}

function copyClipBoard(x){
	window.clipboardData.setData('Text', x);
	alert('복사되었습니다. Ctrl + V 키로 붙여넣기 하세요.');
}

function popupGallery(imgname, order){
	openWin("/popup/gallerypopup.nhn?imgname="+imgname+"&order="+order, "gallery", 650, 500);
}

function applyBetaTester(flag, popup){
	if(flag == 'auto'){
		if(popup){
			openWin("/common/publish/popupSpecAnalyzer.jsp?action=/applyBetaTester.nhn?m=autoPcCheck", "betaTester", 585, 690);
		}else{
			location.href = "/common/publish/popupSpecAnalyzer.jsp?action=/applyBetaTester.nhn?m=autoPcCheck";
		}
	}else if(flag == 'passive'){
		if(popup){
			openWin("/applyBetaTester.nhn?m=passivePcCheck", "betaTester", 585, 690);
		}else{
			location.href = "/applyBetaTester.nhn?m=passivePcCheck";
		}
	}else{
		if(popup){
			openWin("/applyBetaTester.nhn", "betaTester", 585, 690);
		}else{
			location.href = "/applyBetaTester.nhn";
		}
	}
}

//내 질문 보기 
function goMyQuestion()
{
	if(loginChk == 'true')		
		top.location.href = _MYQUESTION;
	else 
	{	
		var cur = escape(host + _MYQUESTION);			
		window.open(ids + '/wlogin.nhn?popup=true&popclose=Y&closemove=Y&nxtURL='+cur , 'loginpop', 'width=400, height=500');	
		return;
	}	
}

//이메일 문의 
function goEmail()
{
	if(loginChk == 'true')	
		top.location.href = _EMAIL;
	else 
	{			
		var cur = escape(host + _EMAIL);
		window.open(ids + '/wlogin.nhn?popup=true&popclose=Y&closemove=Y&nxtURL='+cur , 'loginpop', 'width=400, height=500');	
		return;
	}	
}

function downloadPdf(){
	document.getElementById('onlinemanul').style.display='block';
}

function goLogout(){
	top.location.href= "/logout.nhn?nexturl="+ document.URL;
}

function goLogoutUrl(url){
	top.location.href= "/logout.nhn?nexturl="+ url;
}

function isBetaTester(){
	alert("CBT 테스터가 종료되었습니다. 더 좋은 게임으로 찾아뵙겠습니다.");
	//openWin("/applyBetaTester.nhn?m=betaTesterConfirmCheck", "isBetaTester", 430, 410);
}

function popQuestSchedule(){
	window.open('/popup/questSchedule.nhn', 'popQuestSchedule', 'scrollbars=yes,toolbar=yes,location=yes,status=yes,menubar=yes,resizable=yes, fullscreen');
}

function popPremiumHuntingTicket() {
	window.open('/event/amdTicket.nhn', 'popPremiumHuntingTicket', 'scrollbars=yes,toolbar=yes,location=yes,status=yes,menubar=yes,resizable=yes, fullscreen');
}

function popMagazine(url){
	if(loginChk == 'true')	
		openWin('/magazine.nhn','popMagazine', 525, 545,'yes');
	else 
	{	
		alert('로그인 후 신청이 가능합니다.');			
		var cur = escape(host + url);
		window.open(ids + '/wlogin.nhn?popup=true&popclose=Y&closemove=Y&nxtURL='+cur , 'loginpop', 'width=400, height=500');	
		return;
	}	
}

//한코인 충전
function goCharge() {
	if (isHangameLogined() == false) {
		alert("먼저 로그인 해 주세요.");
		return;
	}
	var f = document.chargeForm;
	if (typeof(f) == "object") {
		window.open("","hancoin_input", "width=340 height=460");
		f.target = "hancoin_input";
		f.submit();
	}
}
	
function closeOnlineManual(){
	document.getElementById('onlinemanul').style.display='none';
}


//for main
function checkStartHunter(){
	if( getCookie( "startHunterPopOBT" ) != "yes" ) 
	{				 
		openWin("/popup/startHunter.nhn?mode=2", "startHunter", 800, 600);
	}
}

function checkDDayEvent(){
	if( getCookie( "MHF-dDayEvent" ) != "yes" ) 
	{				
		openWin("/event/staticevent.nhn?pageurl=/event/dDayEvent.jsp", "MHF-dDayEvent", 460, 750);
	}
}

function eventView(seq, _blank) {
	var evtUrl = "/news/event.nhn?m=view&amp;seq=" + seq;
	if (_blank == '_blank') {
		window.open(evtUrl);
	} else {
		top.location.href = evtUrl;
	}
}

function goLogout(nxturl) {
	top.location.href = '/logout.nhn?nexturl='+escape('http://'+location.host + nxturl);
}


