
//=========== 내그림창고 ================
function btnMyPicture_onclick(imgid) {
	var result = "";
	var URL = "/userpicture/upic_done_01.php?imgid="+imgid;
	result = AjaxUpdate("GET", URL, true, "");

	if (confirm("내 그림창고에 담았습니다. 내 그림창고로 이동합니다.")) {
		self.location.href = "/mypage/my_list_01.php";
	}
}

function btnPictureExp_onclick(imgID, imgWidth, imgHeight) {
	if (imgWidth > "1024" || imgHeight > "768") {
		imgWidth = "1000";
		imgHeight = "700";
	}
	url = "/userpicture/upic_view_exp_01.php?imgid="+imgID;
	attr = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,width="+imgWidth+",height="+imgHeight+",left=10,top=100";
	expWindow  =  window.open(url,'upicture',attr);
	if (expWindow) {
		expWindow.opener = self;
	}
}
//=========== 내그림창고 끝 ================

function test123() {
	ifileid.document.frmFile.submit();
}

function upload_check() {
	var tmpFileName = ifileid.document.frmFile.txtUploadFile.value;

	if(document.getElementById('upload_result').value == "FALSE") {
		alert("이미지를 업로드하세요.");
		return false;
	}

	win = new new_popup();
	win.dialog_close();

	bg_iframe.document.getElementById('txtTagFileName').value = document.getElementById('realfilename').value;
	bg_iframe.document.getElementById('txtUploadTagFileName').value = document.getElementById('uploadfilename').value;
}

function btnHardship_onclick() {
	var doc = document.getElementById("HardshipForm");

	var chkCnt = 0;
	objHardshipCase = document.getElementsByName("HardshipCase");
	for (var i=0; i < objHardshipCase.length ; i++) {
		if (objHardshipCase[i].checked) chkCnt++;
	}

	if (chkCnt < 1) {
		alert("신고 이유를 선택하세요.");
		return;
	}

	objHardshipOpinion = document.getElementById("txtReason");
	if (Trim(objHardshipOpinion.value) == "") {
		alert("신고 사유를 입력하세요.");
		return;
	}

	var ReturnValue = AjaxUpdate("POST", doc.action, true, doc);
	btnHardship_process_return();
}

// 신고처리 DB 작업
function btnHardship_process_return() {
	if (result == "" && loofcnt < 100) {
		loofcnt++;
		var ComDelTimeoutID = setTimeout("btnHardship_process_return()", 100);
	} else {
		clearTimeout(ComDelTimeoutID);
		if (result == "TRUE") {
			win = new new_popup();
			alert("신고 처리가 되었습니다.");
			document.getElementById("message").innerHTML = "";
			win.dialog_close();

			var doc = bg_iframe.frmComment;

			var OPINION_FLAG = "" ;
			var GENRE = Trim(doc.genre.value) ;
			var STORY = Trim(doc.story.value) ;
			var STORYNAME = "" ;
			var EVENTYN = "" ;

			var TOON_URL = Trim(doc.toonurl.value) ;
			var LOGSERVER = Trim(doc.logserver.value) ;

			var tmpTest = new BaltoonStatLog();
			var tmpQuery = tmpTest.insertUserActiveLog('P', OPINION_FLAG, GENRE, STORY, (STORYNAME), EVENTYN, TOON_URL) ;

			bg_iframe.ifLog.location.href = decodeURIComponent(LOGSERVER)+"/collector/log_collector.php?json="+tmpQuery ;
		} else if(result == "EXIST") {
			alert("이미 신고한 카툰입니다.");
			document.getElementById("message").innerHTML = "";
			win.dialog_close();
		} else if(result == "FALSE") {
			alert("신고 처리가 실패했습니다.");
		}

		result = "";
		loofcnt = 1;
	}
}
