/***
1. checkbox ¸ðµÎ Ã¼Å©/Ãë¼Ò
2. checkbox Ã¼Å© °¹¼ö ±¸ÇÏ±â
3. ¿µ¹®°ú ¼ýÀÚ·Î¸¸ ±¸¼ºµÈ ¹®ÀÚ¿­ Ã¼Å©
4. ¼ýÀÚ·Î¸¸ ±¸¼ºµÈ ¹®ÀÚ¿­ Ã¼Å©
5. ÇÑ±Û·Î¸¸ ±¸¼ºµÈ ¹®ÀÚ¿­ Ã¼Å©
6. ÆäÀÌÁö ÀÌµ¿
7. ¹®ÀÚ¿­ÀÇ ¾çÂÊ(¿ÞÂÊ, ¿À¸¥ÂÊ) °ø¹é Á¦°Å > Return : °ø¹éÁ¦°ÅÈÄ ¹®ÀÚ
8. À¯´ÏÆû °ßÀû¼­ ÁÖ¹®»óÇ° ÀÌ¹ÌÁöÁ¤º¸ º¸±â
9. »ó´ÜÀÇ ÀüÃ¼ Ä«Å×°í¸® º¸±â
10. »ó´ÜÀÇ ÀüÃ¼ Ä«Å×°í¸® ·¹ÀÌ¾î °¡Á®¿À±â
11. »ó´ÜÀÇ ÀüÃ¼ Ä«Å×°í¸® ajaxÀ¸·Î ·¹ÀÌ¾î »ý¼ºÇÏ±â
12. 3Â÷ Ä«Å×°í¸® ·¹ÀÌ¾î Y À§Ä¡ ¹× ³ôÀÌ ¼³Á¤ÇÏ±â
13. °¡¿îµ¥ »ó´Ü Ä«Å×°í¸® ¸¶¿ì½º ¿À¹ö½Ã
14. °¡¿îµ¥ »ó´Ü Ä«Å×°í¸® ¸¶¿ì½º ¾Æ¿ô½Ã
***/

// 1. ÇØ´ç ÆäÀÌÁöÀÇ checkbox ¸ðµÎ Ã¼Å©/Ãë¼Ò(n_frm : form name / n_chk : checkbox name / v_val : Ã¼Å©°ª)
function allCheck(n_frm, n_chk, v_val){
	var frm=document.getElementById(n_frm);
	var chkBox=frm.getAttribute(n_chk);
	var chkLen=chkBox.length;
//	alert("chkLen : "+chkLen+" / v_val : "+v_val);
	if(chkBox){
		if(chkLen){	//--´Ù¼öÀÏ °æ¿ì
			for(i=0; i<chkLen; i++){
				chkBox[i].checked=v_val;
			}
		}
		else{	//--ÇÑ°³ÀÏ °æ¿ì
			chkBox.checked=v_val;
		}
	}
}

// 2. ÇØ´ç ÆäÀÌÁöÀÇ checkbox Ã¼Å© °¹¼ö ±¸ÇÏ±â/Ãë¼Ò(n_frm : form name / n_chk : checkbox name)
function allCheckCnt(n_frm, n_chk){
	var frm=document.getElementById(n_frm);
	var chkBox=frm.getAttribute(n_chk);
	var chkLen=chkBox.length;
	var chkCnt=0
//	alert("chkLen : "+chkLen+");
	if(chkBox){
		if(chkLen){	//--´Ù¼öÀÏ °æ¿ì
			for(i=0; i<chkLen; i++){
				if(chkBox[i].checked){
					chkCnt++;
				}
			}
		}
		else{	//--ÇÑ°³ÀÏ °æ¿ì
			if(chkBox.checked){
				chkCnt++;
			}
		}
	}
	return chkCnt;
}

// 3. ¿µ¹®°ú ¼ýÀÚ·Î¸¸ ±¸¼ºµÈ ¹®ÀÚ¿­ Ã¼Å©
function abc_num_charCheck(v_string){
	if (v_string.length <= 3 || v_string.length >= 20){
		return true;
	}
	Counter = 0;
	for (i = 0; i < v_string.length; i++){
		if ((v_string.charAt(i) < '0' || v_string.charAt(i) > '9') && (v_string.charAt(i) < 'a' || v_string.charAt(i) > 'z')
			&& (v_string.charAt(i) < 'A' || v_string.charAt(i) > 'Z')	&& v_string.charAt(i) != '-' && v_string.charAt(i) != '_'){
			Counter++;
		}
	}
		
	if (Counter > 0){
		return true;
	}
}

// 4. ¼ýÀÚ·Î¸¸ ±¸¼ºµÈ ¹®ÀÚ¿­ Ã¼Å©
function numeric_charCheck(v_num){
    cnt = 0;
	for (i = 0; i < v_num.length; i++){
		if (v_num.charAt(i) < '0' || v_num.charAt(i) > '9'){
			return true;
		}
		cnt++;
	}
}

// 5. ÇÑ±Û·Î¸¸ ±¸¼ºµÈ ¹®ÀÚ¿­ Ã¼Å©
function kor_charCheck(v_string){
	for (i = 0; i < v_string.length; i++)
		if (v_string.charAt(i) < '°¡' || v_string.charAt(i) > 'Èþ'){
			return true;
		}     
}

// 6. ÆäÀÌÁö ÀÌµ¿
function goto_page(v_page){
	var frm = document.pageFrm;

	if(frm.act_url) frm.action=frm.act_url.value;
	if(frm.act_target) frm.target=frm.act_target.value;
	if(frm.act_method) frm.method=frm.act_method.value;

	frm.page.value = v_page;
	frm.submit();
}

// 7. ¹®ÀÚ¿­ÀÇ ¾çÂÊ(¿ÞÂÊ, ¿À¸¥ÂÊ) °ø¹é Á¦°Å > Return : °ø¹éÁ¦°ÅÈÄ ¹®ÀÚ
function trim_side(pstr) {
	var search = 0
	while (pstr.charAt(search) == " ") {
		search = search + 1
	}
	pstr = pstr.substring(search, (pstr.length))
	search = pstr.length - 1
	while (pstr.charAt(search) ==" ")
	{
		search = search - 1
	}
	return pstr.substring(0, search + 1)         
}

// 8. À¯´ÏÆû °ßÀû¼­ ÁÖ¹®»óÇ° ÀÌ¹ÌÁöÁ¤º¸ º¸±â
function get_goods_view(v_g_idx, v_oes_idx){
	var oes_idx_chk = 0;
	var strScript;
	
	if(v_oes_idx != 0){
		oes_idx_chk = 1;
	}
	strScript = "/goods/zoom.asp?num="+v_g_idx+"&oes_idx_chk="+oes_idx_chk;
	window.open(strScript, "zoom", "height=546,width=700,left=0,top=0,scrollbars=no,toolbar=0,location=0,directories=0,status=0,menubar=0,copyhistory=0");
}

// 9. »ó´ÜÀÇ ÀüÃ¼ Ä«Å×°í¸® º¸±â
function get_all_cate_out(v_id){
	var cate_obj = document.getElementById(v_id).style
	var div_cate1_obj = document.getElementById("divMainMenuLayer");
	var div_cate2_obj = document.getElementById("div_cate2");
	var div_cate3_obj = document.getElementById("div_cate3");
	if(div_cate1_obj){
		if(div_cate1_obj.style.display == "block"){
			div_cate1_obj.style.display = "none";
		}
	}
	if(div_cate2_obj){
		if(div_cate2_obj.style.display == "block"){
			div_cate2_obj.style.display = "none";
		}
	}
	if(div_cate3_obj){
		if(div_cate3_obj.style.display == "block"){
			div_cate3_obj.style.display = "none";
		}
	}

	if(cate_obj.display == "none"){
		cate_obj.display = "block";
		document.getElementById("btn_all_cate_img").src = "/images/common/btn_all_cate_close.gif"
	}
	else{
		cate_obj.display = "none";
		document.getElementById("btn_all_cate_img").src = "/images/common/btn_all_cate_view.gif"
	}
}

// 10. »ó´ÜÀÇ ÀüÃ¼ Ä«Å×°í¸® ·¹ÀÌ¾î °¡Á®¿À±â
function get_all_cate_info(v_id){
	var cate_obj;
	
	cate_obj = document.getElementById(v_id);
	cate_obj.innerHTML = XMLStr;
}

// 11. »ó´ÜÀÇ ÀüÃ¼ Ä«Å×°í¸® ajaxÀ¸·Î ·¹ÀÌ¾î »ý¼ºÇÏ±â
function set_all_cate_ajax(v_id){
	var str_fnc;
	str_fnc = "get_all_cate_info('"+ v_id +"')";
	if(document.getElementById(v_id).style.display == "none"){
		setXML_load_post("/lib/class/cate_all_ajax.asp", str_fnc);
	}
}

// 12. 3Â÷ Ä«Å×°í¸® ·¹ÀÌ¾î Y À§Ä¡ ¹× ³ôÀÌ ¼³Á¤ÇÏ±â
function set_cate3_obj_top_height(v_obj, v_top, v_height){
	if(v_obj.style.top != 0){
		v_obj.style.top = v_top;
	}
	else{
		v_obj.style.top = -5;
	}
	
	if(v_obj.style.height != 0){
		v_obj.style.height = v_height;
	}
	else{
		v_obj.style.height = 463;
	}

	return;
}

// 13. °¡¿îµ¥ »ó´Ü Ä«Å×°í¸® ¸¶¿ì½º ¿À¹ö½Ã
function a_gray_color_over(v_obj, v_color){
	v_obj.style.backgroundColor = v_color;
//	v_obj.style.color = "#f74750";
}

// 14. °¡¿îµ¥ »ó´Ü Ä«Å×°í¸® ¸¶¿ì½º ¾Æ¿ô½Ã
function a_gray_color_out(v_obj, v_color){
	v_obj.style.backgroundColor = v_color;
	v_obj.style.color = "";
}
