/*
	'****************************************************************
  	'*
   	'*  # PROGRAM TITLE : Bible Javascript
	'*
	'*  # PROGRAMER : smalldevil
	'*
	'*  # FILE CREATE DAY : 2010-02-23
   	'*
   	'*  # PROGRAM CONT : Bible Javascript File
	'*
   	'*  # FILE NAME : /sitelib/js_common_bible.js
   	'*
   	'*	# MODIFICATIONS
	'*
   	'****************************************************************
*/

	//go pageing
	function goBiblePage(encP, fName){
		var frm = document.frmBible;
		if (frm != undefined){
			if(encP != undefined){
				if(fName != undefined){
					frm.action = fName + "?p=" + encP;
					frm.submit();
				}else{
					frm.action = document.location.pathname + "?p=" + encP;
					frm.submit();
				}
			}else{
				frm.action = document.location.pathname;
				frm.submit();
			}
		}else{
			if(encP != undefined){
				document.location.href=document.location.pathname + "?p=" + encP;
			}else{
				document.location.href=document.location.pathname;
			}
		}
	}

	//go digimonbible search
	function goBibleSearch(uVal) {
		var frm = document.frmBible;

		if (frm != undefined) {
			var intSchType = document.getElementById("intSchType");
			var strSchWord = document.getElementById("strSchWord");
			if (intSchType != undefined && strSchWord != undefined) {
				if (strSchWord.value.length < 2 || strSchWord.value == "Please Enter Key Word & Press Search") {
					alert("You must enter at least two characters.");strSchWord.focus(); return false;
				} else {
					frm.aType.value = "S";
					frm.txtBibleC1d.value = "0";
					frm.txtBibleC2d.value = "0";
					frm.txtBibleC3d.value = "0";
					frm.txtBibleC4d.value = "0";
					frm.txtSchType.value = intSchType.value;
					frm.txtSchWord.value = strSchWord.value;
					frm.action = uVal;
					frm.submit();

					//검색로그 저장
					document.getElementById("strWord").value = escape(strSchWord.value);
					setBibleSchLog();
				}
			} else {alert("Unable to use the search function."); return false;}
		} else {alert("Unable to use the search function."); return false;}
	}


	//go digimonbible list
	function goBibleList(uVal, c1d, c2d, c3d, c4d, sVal, intT, strW) {
		var frm = document.frmBible;
		if (frm != undefined) {

			frm.txtSchType.value = intT;
			frm.txtSchWord.value = strW;
			frm.txtBibleC1d.value = c1d;
			frm.txtBibleC2d.value = c2d;
			frm.txtBibleC3d.value = c3d;
			frm.txtBibleC4d.value = c4d;
			frm.txtEncLSeq.value = sVal;

			frm.action = uVal;
			frm.submit();
		} else {
			alert("Please try again."); return false;
		}
	}


	//get category list
	function getBibleCategoryList(aVal, c1d, c2d, c3d, c4d){
		var strParams = "a="+ aVal +"&d1="+ c1d +"&d2="+ c2d +"&d3="+ c3d +"&d4="+ c4d;
		var str_Url =  "get_bible_category_list.asp";
		var strDivName;
		switch (aVal){
			case "D1" : strDivName = setBibleCate1Depth; break;
			case "D2" : strDivName = setBibleCate2Depth; break;
			case "D3" : strDivName = setBibleCate3Depth; break;
			case "D4" : strDivName = setBibleCate4Depth; break;
		}
		var arrDivName = document.getElementsByName("disBibleCateList");
		if(arrDivName.length ==0){
			arrDivName[0] = document.getElementById("disBibleCate1Depth");
			arrDivName[1] = document.getElementById("disBibleCate2Depth");
			arrDivName[2] = document.getElementById("disBibleCate3Depth");
			arrDivName[3] = document.getElementById("disBibleCate4Depth");
		}
		for(var i = 0; i < 4; i++){
			if ( i == (parseInt(aVal.substring(1,2), 10)-1) ){
				arrDivName[aVal.substring(1,2)-1].style.display = 'block';
			}else{
				if (arrDivName[i] != undefined) {
					arrDivName[i].style.display = 'none';
				}
			}
		}
		var myAjax = new net.ContentLoader(str_Url, strDivName, null, "POST", strParams);
	}
	function setBibleCate1Depth(){
		if(this.req.readyState == 4) {if(this.req.status == 200) {document.getElementById("disBibleCate1Depth").innerHTML = this.req.responseText;}}
	}
	function setBibleCate2Depth(){
		if(this.req.readyState == 4) {if(this.req.status == 200) {document.getElementById("disBibleCate2Depth").innerHTML = this.req.responseText;}}
	}
	function setBibleCate3Depth(){
		if(this.req.readyState == 4) {if(this.req.status == 200) {document.getElementById("disBibleCate3Depth").innerHTML = this.req.responseText;}}
	}
	function setBibleCate4Depth(){
		if(this.req.readyState == 4) {if(this.req.status == 200) {document.getElementById("disBibleCate4Depth").innerHTML = this.req.responseText;}}
	}