
/************************************************************/
/******** Utill  Start **********************************/
/************************************************************/

	function propertyTest(objId){
		var obj = document.getElementById(objId);
		
		alert("[OBJECT:\n\ntagName="+obj.tagName+",\n\nid="+obj.id+",\n\nname="+obj.name+",\n\nvalue="+obj.value+",\n\ntype="+obj.type+" ]");
	}

/************************************************************/
/******** Utill  END ************************************/
/************************************************************/
	
	/**
	 * 팝업 윈도우 공통모듈 윈도우 팝업 참조
	 */
	function winPopup(url, name, width, height) {
		  var wi = screen.width - width;
		  var hi = screen.height - height;
	
		  if( wi < 0 ) wi = 0;
		  if( hi < 0 ) hi = 0;
	
		  var info = 'left=' + (wi/2) + ',top=' + (hi/2) + ',width='  + width + ',height=' + height + ',resizable=no, scrollbars=no,menubars=no,status=no';
		  var newWin = window.open(url, name, info);
		  
		  return newWin;
	}


	/* selectbox */
	function gameSelectBox(containerID, listID) {
		var lstID = listID||containerID+"_list";//// div object
		
		var container = document.getElementById(containerID);
		var selectBoxTitle = container.getElementsByTagName("span").item(0);
	//	var selectBoxList = container.getElementsByTagName("ul").item(0); 
		var selectBoxList = document.getElementById(lstID);//// style 깨짐으로 인해
	
		selectBoxList.style.display = "none";
	
		selectBoxTitle.onmouseover = function() {
			selectBoxList.style.display = "block";
		}
		selectBoxList.onmouseover = function() {
			selectBoxList.style.display = "block";
		}
	
		selectBoxTitle.onmouseout = function() {
			selectBoxList.style.display = "none";
		}
		selectBoxList.onmouseout = function() {
			selectBoxList.style.display = "none";
		}
	}

/************************************************************************
	Game Mall function - added by dev	Start 
************************************************************************/

	/**
	 * @desc : 섬네일 리스트 Form submit function
	 * @param formId		: form id
	 * @param type 			: 호출되는 위치 - 정렬방식(sort), 출력건수(limit), 페이지인덱스(page)[paging] 
	 * @param dpCatNo 		: 전시 카테고리 번호
	 * @param currentPage 	: 현재 페이지 인덱스
	 * @param rowsPerPage : 출력 아이템 최대 개수(rowsPerPage)
	 * @param sortType		 : 정렬방식(rowsPerPage)
	 **/
	function sendForm(formId, type, dpCatNo, currentPage, rowsPerPage, sortType){
		if(false)alert(	"formId[호출 폼 ID]		: "+ formId 
				+"\n,type[호출위치]		: "+ type 
				+"\n,dpCatNo[전시카테고리번호]		: "+ dpCatNo 
				+"\n,currentPage[현재 페이지]		: "+ currentPage 
				+"\n,rowsPerPage[페이지당 레코드수]	: "+ rowsPerPage 
				+"\n,sortType[정렬방식]		: "+ sortType);//debug
		
		try{
			
			
			var oForm = document.getElementById(formId);
			
			if(type=="sort"||type=="limit"){
				currentPage = "1";
			}
			
			
			//document.getElementById("dpCatNo").value = dpCatNo;
			//document.getElementById("currentPage").value = currentPage;
			//document.getElementById("sortType").value = sortType;
			//document.getElementById("rowsPerPage").value = rowsPerPage;
			
			oForm.method="POST";
			
			//if(formId=="frmGameThumbnail"){///// 이미지형 보드 form id

			/** 2010.03.08 추가 작업 : 엔텔스 추가 ***/
			if(formId=="DP000514"){///// comic 추가
				location.href = "./comicList.omp?t_top="+formId+"&dpCatNo="+dpCatNo+"&sortType="+sortType+"&currentPage="+currentPage+"&rowsPerPage="+rowsPerPage;
			}
			else if(formId=="DP000513"){///// e-Book 추가
				location.href = "./ebookList.omp?t_top="+formId+"&dpCatNo="+dpCatNo+"&sortType="+sortType+"&currentPage="+currentPage+"&rowsPerPage="+rowsPerPage;
			}
			else if(formId=="DP000509"){///// 이미지형 보드 form id
				location.href = "./videoList.omp?t_top="+formId+"&dpCatNo="+dpCatNo+"&sortType="+sortType+"&currentPage="+currentPage+"&rowsPerPage="+rowsPerPage;
			}else{
				location.href = "./viewGameThumbnail.omp?t_top="+formId+"&dpCatNo="+dpCatNo+"&sortType="+sortType+"&currentPage="+currentPage+"&rowsPerPage="+rowsPerPage;
			}
			//}
			//if(formId == "frmAppThumbnail"){///// 리스트형 보드 form id
			//	oForm.action = "./viewAppThumbnail.omp";
			//}
			//else{
			//	oForm.action = "./viewGameThumbnail.omp?dpCatNo="+dpCatNo;//// default
			//}
			
			//if(true)oForm.submit();
			
		}catch(err){
			alert("[JS:"+formId+"] error : " + err.message);
		}
		
	}///////sendIt
	
	
	/**
	 * @desc : 이전 , 다음 버튼 활성화 여부 [음수 필터링]
	**/
	function isPageNaviActive(page){
		var active = parseInt(page,10);
		return (active > 0)?true:false;
	}
	
	/**
	 * @desc : form ID를 기준으로 - 페이징 index link 클릭 이벤트
	 * @param formId
	 * @param currentPage
	 * @return
	 */
	function movePagingList(formId, currentPage, dpCatNo){
		try{
			var oForm = document.getElementById(formId);
			document.getElementById("currentPage").value = currentPage;
			if(dpCatNo=="DP01000"){
				dpCatNo = "DP01000";
			}
			if(dpCatNo=="DP02000"){
				dpCatNo = "DP02000";
			}
			if(dpCatNo=="DP03000"){
				dpCatNo = "DP03000"; 
			}
			if(dpCatNo=="DP04000"){
				dpCatNo = "DP04000";
			}
			if(dpCatNo=="DP05000"){
				dpCatNo = "DP05000";
			}
			if(dpCatNo=="DP06000"){
				dpCatNo = "DP06000";
			}
			if(dpCatNo=="DP07000"){
				dpCatNo = "DP07000";
			}
			if(dpCatNo=="DP08000"){
				dpCatNo = "DP08000";
			}
			
		
			document.getElementById("insDpCatNo").value = dpCatNo;
			document.getElementById("t_top").value = formId;
			oForm.target="_self";
			oForm.method="POST";
			
//			if(formId=="frmGameThumbnail"){///// 이미지형 보드 form id
			

			/** 2010.03.08 추가 작업 : 엔텔스 추가 ***/
			if(formId=="DP000514"){///// comic 추가
				oForm.action = "./comicList.omp";			
			}else if(formId=="DP000513"){///// e-book 추가
				oForm.action = "./ebookList.omp";			
			}else if(formId=="DP000509"){///// 이미지형 보드 form id
				oForm.action = "./videoList.omp";
			}else{
				oForm.action = "./viewGameThumbnail.omp";
			}
			
//			}
//			if(formId == "frmAppThumbnail"){///// 리스트형 보드 form id
//				oForm.action = "./viewAppThumbnail.omp";
//			}
//			else{
//				oForm.action = "./viewGameThumbnail.omp";//// default
//			}
			
			if(true)oForm.submit();
			
			return false;/// s tag 중복 submit 방지 
		}catch(err){
			alert("[JS:"+formId+"] error : " + err.message);
		}
	}//////// END movePagingList
	
	function moveList(currentPage){
		try{
			var oForm = document.tstylelist;
			oForm.action = "./tlist.omp";
			document.getElementById("currentPage").value = currentPage;
			if(true)oForm.submit();
		}catch(err){
			alert("error : " + err.message);
		}
	}
	/**
	 * @desc : form ID를 기준으로 - 페이징 index link 클릭 이벤트
	 * @param formId
	 * @param pagingAction 이동할 페이징 action URI
	 * @param currentPage
	 * @return
	 */
	function movePagingAction(formId, pagingAction, currentPage, svcGrpCd){
		try{
			if(false)alert("pagingAction["+pagingAction+"]");
			
			var oForm = document.getElementById(formId);
			document.getElementById("currentPage").value = currentPage;
			
			oForm.target="_self";
			oForm.method="POST";
			
			oForm.action = pagingAction+"?svcGrpCd="+svcGrpCd;
			if(true)oForm.submit();
			return;/// s tag 중복 submit 방지 
		}catch(err){
			alert("[JS:"+formId+"]\n error : " + err.message + "\n action : "+pagingAction);
		}
	}//////// END movePagingAction

	/**
	 * - 관심 상품 등록
	 * @param formId : form id
	 * @param prodId : product id
	 * @param prodNm : product name
	 * @param dpCatNo : display category number
	 */
	function regDpInterProd(formId, pageType, prodId, prodNm, dpCatNo){
		
		try{
			var self = this;
			this.mbrNo = "test01";
			this.mbrNoDesc = "회원번호";
			this.mbrCatCd = "US0002";
			this.mbrCatCdDesc = "회원분류코드";
			this.hpType = "";
			this.hpTypeDesc = "";
			this.objForm = document.getElementById(formId);
			
			if(this.mbrNo == null || this.mbrNo._omp_trim()== "" || this.mbrNo == "undefined"){
				alert("유효하지 않는 사용자입니다. 회원번호가 없습니다.");
			}
			if(this.mbrCatCd == null || this.mbrCatCd._omp_trim()== "" || this.mbrCatCd == "undefined"){
				alert("유효하지 않는 사용자입니다. 회원분류코드가 없습니다.");
			}
			else{
				
				document.getElementById("insMbrNo").value = this.mbrNo;
				document.getElementById("insDpCatNo").value = dpCatNo;
				document.getElementById("insProdId").value = prodId;
				document.getElementById("insProdNm").value = encodeURI(prodNm);
				
				if(true){
					this.objForm.method = "POST";
					////this.objForm.target = "_self";///
					
					if(pageType == "thumbnail"){
						this.objForm.target = "ifrResult";///
						this.objForm.action = "./regDpInterProd1.omp";//// + params;
					} 
					if(pageType == "detail_01"){
						
						this.objForm.target = "ifrResult";///
						this.objForm.action = "./regDpInterProd2.omp";//// + params;
					}
					if(pageType == "detail_02"){
						this.objForm.target = "ifrResult";///
						this.objForm.action = "./regDpInterProd3.omp";//// + params;
					}
					this.objForm.submit();
					
					////return;/// s tag 중복 submit 방지 
				}
			}
			
		}catch(err){
			alert("[JS:"+formId+"] error : " + err.message);
		}
		
	}///// END regDpInterProd
	
	
	/**
	 * - 사용 후기 IFrame body 높이 조절 
	 **/
	function resizeIF(Id){
	        var obj = document.getElementById(Id);
	        var Body;
	        var H, Min;

	        // 최소 높이 설정 (너무 작아지는 것을 방지)
	        Min = 200;

	        // DOM 객체 할당
	        try
	        {
	                if (!document.all && obj.contentWindow.document.location.href == 'about:blank') {
	                        setTimeout("resizeIF('"+Id+"')", 10);
	                        return;
	                }

	                Body = obj.contentWindow.document.getElementsByTagName('BODY');
	                Body = Body[0];

	                if (this.Location != obj.contentWindow.document.location.href) {
	                        H = Body.scrollHeight + 5;
	                        obj.style.height =  (H<Min?Min:H) + 'px';

	                        this.Location = obj.contentWindow.document.location.href;
	                }
	        }
	        catch(e)
	        {
	                setTimeout("resizeIF('"+Id+"')", 10);
	                return;
	        }

	        setTimeout("resizeIF('"+Id+"')", 100);
	}
	
	
	/**
	 * - 구매하기 버튼 처리 
	 * @param formId
	 * @param prodId
	 * @param prodNm
	 * @param ctxPath
	 * @return
	 */
	function buyItem(formId, prodId, prodNm, ctxPath, mbrNo, catId, prodGrdCd){
		
		if(mbrNo == null || mbrNo == "undefined" || mbrNo == ""){
			alert("로그인 후 이용하세요.\n\n로그인페이지로 이동합니다.");
			window.location.href="../user/login.omp";
			return;
		}
		
		var objForm = document.getElementById(formId);
		
		document.getElementById("purchaseProdId").value = prodId;
		document.getElementById("purchaseProdName").value = prodNm;
		document.getElementById("purchaseCatId").value = catId;
		document.getElementById("purchaseReqCd").value = 'OR001403';
		document.getElementById("prodGrdCd").value = prodGrdCd;
		popup = winPopup('about:blank','buy_popup', '450', '370');
		//////popup = window.open('about:blank','buy_popup','width=450,height=370,scrollbars=no,menubars=no,status=no');
		objForm.target = "buy_popup";
		objForm.action= ctxPath + "/auth/popupGotoBuyPage.omp";	 
		objForm.submit();
		count = 0;
		
	}////// END buyItem
	
	/**
	 * - EVENT가 추가되면서 체크를 하고 구매하기 버튼 처리 
	 * @param formId
	 * @param prodId
	 * @param prodNm
	 * @param ctxPath
	 * @return
	 */
	function buyItem2(formId, prodId, prodNm, ctxPath, mbrNo, catId, prodGrdCd){
		
		if(mbrNo == null || mbrNo == "undefined" || mbrNo == ""){
			alert("로그인 후 이용하세요.\n\n로그인페이지로 이동합니다.");
			window.location.href="../user/login.omp";
			return;
		}
		
		var objForm = document.getElementById(formId);
		
		document.getElementById("purchaseProdId").value = prodId;
		document.getElementById("purchaseProdName").value = prodNm;
		document.getElementById("purchaseCatId").value = catId;
		document.getElementById("purchaseReqCd").value = 'OR001406';
		document.getElementById("prodGrdCd").value = prodGrdCd;
		
		popup = winPopup('about:blank','buy_popup', '450', '370');
		//////popup = window.open('about:blank','buy_popup','width=450,height=370,scrollbars=no,menubars=no,status=no');
		objForm.target = "buy_popup";
		objForm.action= ctxPath + "/auth/popupGotoBuyPage.omp";
		objForm.submit();
		count = 0;
	}////// END buyItem

	/**
	 * - 선물하기 버튼 처리 
	 * @param formId
	 * @param prodId
	 * @param prodNm
	 * @param ctxPath
	 * @return
	 */
	function buyItem3(formId, prodId, prodNm, ctxPath, mbrNo, catId, prodGrdCd){
		
		if(mbrNo == null || mbrNo == "undefined" || mbrNo == ""){
			alert("로그인 후 이용하세요.\n\n로그인페이지로 이동합니다.");
			window.location.href="../user/login.omp";
			return;
		}
		
		var objForm = document.getElementById(formId);
		
		document.getElementById("purchaseProdId").value = prodId;
		document.getElementById("purchaseProdName").value = prodNm;
		document.getElementById("purchaseCatId").value = catId;
		document.getElementById("purchaseReqCd").value = 'OR001414';
		document.getElementById("prodGrdCd").value = prodGrdCd;
		
		popup = winPopup('about:blank','buy_popup', '450', '370');
		//////popup = window.open('about:blank','buy_popup','width=450,height=370,scrollbars=no,menubars=no,status=no');
		objForm.target = "buy_popup";
		objForm.action= ctxPath + "/auth/popupGotoBuyPage.omp";
		objForm.submit();
		count = 0;
	}////// END buyItem
/************************************************************************
	Game Mall function - added by dev	END 
************************************************************************/	
	
