/* ===============================
function name : fnSlideView
description : ½½¶óÀÌµå¼î º¸±â
================================ */
function fnSlideView(slide_req){
	Url="/photo/open_slide.php?"+slide_req;
	window.open(Url,"OpenWin","fullscreen=yes,help=no,resizable=no,scroll=no,status=no");
}

/* ===============================
function name : fnDelCounsel
description : ¼±ÅÃÇÑ 1:1 °³ÀÎ»ó´ã »èÁ¦ÇÏ±â
================================ */
function fnDelCounsel()
{
	
	var f=document.form1;
	var listcnt = f.elements.length;
	var chkflag = 0;
	var code;

	for (i=0; i < listcnt; i++) {
		var j = f.elements[i].name;
		if (j.substring(0,11) == "article_idx" && f.elements[i].type == "checkbox") {
			
			if(f.elements[i].checked == true) {
				chkflag++;
				code=f.elements[i].value;
			}
		}
	}
	
	if (chkflag == 0) {
		alert("»èÁ¦ÇÒ °Ô½Ã¹°À» ¼±ÅÃÇÏ½Ê½Ã¿À");
		return;
	}
	if (confirm("¼±ÅÃÇÑ °Ô½Ã¹°À» »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?")) {
		f.ct_func.value="delcounsels";
		f.action="/mypage/counsel_ok.php";		
		f.submit();	
	}

}

/* ===============================
function name : fnCommSend
description : ÄÚ¸àÆ® ´Þ±â
================================ */
function fnCommSend() {
	var f = document.form1;
	if(!f.f_comment.value) {
		alert("ÄÚ¸àÆ®¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿À.");
		return;
	}
	if(f.ct_func.value!="mod_comment") { 
		f.ct_func.value="add_comment";
	}
	if(f.page.value=="counsel"){
		f.action="/mypage/counsel_ok.php";
	}else {
		f.action="news_ok.php";
	}
	f.submit();

}

/* ===============================
function name : fnCommDel
description : ÄÚ¸àÆ® »èÁ¦
================================ */
function fnCommDel(idx) {
	var f = document.form1;
	f.ct_func.value="del_comment";
	if(f.page.value=="counsel"){
		f.action="/mypage/counsel_ok.php?f_idx="+idx;
	}else {
		f.action="news_ok.php?f_idx="+idx;
	}
	f.submit();

}


/* ===============================
function name : fnCommMod
description : ÄÚ¸àÆ® ¼öÁ¤
================================ */
function fnCommMod(idx) {
	var f = document.form1;
	f.ct_func.value="mod_comment";
	if(f.page.value=="counsel"){
		f.action="/mypage/counsel_read.php?f_idx="+idx;
	}else {
		f.action="news_read.php?f_idx="+idx;
	}
	f.submit();
	return;

}



/* ===============================
function name : fnBbsSend()
description : °Ô½ÃÆÇ ÀÔ·Â»çÇ× Ã¼Å©
================================ */

function fnBbsSend() {
	var f=document.form;
	if(!f.f_title.value){
		alert("Á¦¸ñÀ» ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿À.");
		f.f_title.focus();
		return;
	}
	if(!f.f_q_type.value){
		alert("Áú¹®±¸ºÐÀ» ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿À.");
		f.f_q_type.focus();
		return;
	}
	if(!f.f_content.value){
		alert("³»¿ëÀ» ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿À.");
		f.f_content.focus();
		return;
	}
	if(f.ct_func.value=="addcounsel"){
		f.action="/mypage/counsel_ok.php";
	} 
	if(f.ct_func.value=="modcounsel"){
		f.action="/mypage/counsel_ok.php";
	}
	f.submit();
}

/* ===============================
function name : fnGoList()
description : ¸®½ºÆ® ÆäÀÌÁö·Î ÀÌµ¿
================================ */
function fnGoList() {
	var f=document.form1;
	if(f.page.value=="counsel"){
		f.action = "/mypage/counsel.php";
	}else if(f.page.value=="qa"){
		f.action = "/customer/qa_list.php";
	}else if(f.page.value=="up_info"){
		f.action = "/customer/up_info_list.php";
	}else if(f.page.value=="news"){
		f.action = "/customer/news_list.php";
	}else if(f.page.value=="event1"){
		f.action = "/event/event.php";
	}else {
		f.action = "/event/event2.php";
	}
	f.ct_func.value="";
	f.submit();
	f.action = "";
}

/* ===============================
function name : fnModify()
description : °Ô½Ã¹° ¼öÁ¤
================================ */
function fnModify() {
	var f=document.form1;
	if(f.page.value="counsel"){
		f.action = "/mypage/counsel_modify.php";
	}else {
		f.action = "news_modify.php";
	}
	f.ct_func.value="modify";
	f.submit();
	f.action = "";
}

/* ===============================
function name : fnDeleteArticle()
description : °Ô½Ã¹° »èÁ¦
================================ */
function fnDeleteArticle() {
	if (confirm("°Ô½Ã¹°À» »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?")) {
		var f=document.form1;
		if(f.page.value=="counsel"){
			f.action = "/mypage/counsel_ok.php";
			f.ct_func.value="delcounsel";	
		}else {
			f.action = "news_ok.php";
			f.ct_func.value="removearticle";	
		}
		
		
		f.submit();
		f.action = "";
	}
}
		

/* ===============================
function name : fnShow
description : ¸®½ºÆ® Á¦¸ñ Å¬¸¯
================================ */
function fnShow(idx) {
	var f=document.form1;
	f.f_index.value=idx;
	if(f.page.value=="counsel"){
		f.action = "/mypage/counsel_read.php";
	}else if(f.page.value=="qa"){
		f.action = "/customer/qa_read.php";
	}else if(f.page.value=="news"){
		f.action = "/customer/news_read.php";
	}else if(f.page.value=="event1") {
		f.action = "/event/event_read.php";
	}else if(f.page.value=="event2") {
		f.action = "/event/event_read.php";
	}else if(f.page.value=="event3") {
		f.action = "/event/event_read.php";
	}else if(f.page.value=="event4") {
		f.action = "/event/event_read.php";
	}else if(f.page.value=="up_info") {
		f.action = "/customer/up_info_read.php";
	}
	f.submit();
	f.action = "";
}

/* ===============================
function name : fnShow2
description : ¸¶ÀÌÆäÀÌÁö¿¡¼­ »ó¼¼ º¸±â·Î ÀÌµ¿
================================ */
function fnShow2(idx, where) {
	var f=document.form1;
	f.f_index.value=idx;
	if(where=="counsel"){
		f.action = "/mypage/counsel_read.php";
	}else if(where=="history"){
		f.action = "/customer/qa_read.php";
	}
	f.submit();
	f.action = "";
}
		
/* ===============================
function name : fnBbsSearch
description : °Ô½ÃÆÇ °Ë»ö Å¬¸¯½Ã È£Ãâ
================================ */
function fnBbsSearch()
{
	var f=document.form1;

	if(!f.srh_word.value) {
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¿© ÁÖ½Ê½Ã¿À!!.");
		f.srh_word.focus();
		return;
	}
	if(jf_CheckSrhString(f.srh_word.value) == false) {
		alert("°Ë»ö¾î¿¡ '(single quot), \"(double quot) ¸¦ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.");
		f.srh_word.focus();
		return;
	}

	f.ct_page.value=1;
	if(f.page.value=="counsel") {
		f.action = "/mypage/counsel.php";
	}else if(f.page.value=="qa") {
		f.action = "/customer/qa_list.php";
	}else if(f.page.value=="news") {
		f.action = "/customer/news_list.php";
	}else if(f.page.value=="faq") {
		f.action = "/customer/faq.php";
	}else if(f.page.value=="event1") {
		f.action = "/event/event2.php";
	}else if(f.page.value=="event2") {
		f.action = "/event/event2.php?f_page=event2";
	}else if(f.page.value=="event3") {
		f.action = "/event/event2.php?f_page=event3";
	}else if(f.page.value=="event4") {
		f.action = "/event/event2.php?f_page=event4";
	}	
	f.submit();
	f.action = "";
}





/* ===============================
function name : fnDelete
description : ¼±ÅÃÇÑ °Ô½Ã¹° »èÁ¦
================================ */
function fnDelete()
{
	var f = document.form1;

	if (!fnSelectAll(0)) {
		alert("»èÁ¦ÇÒ °Ô½Ã¹°À» ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿À.");
		return;
	}

	if (confirm("¼±ÅÃÇÑ °Ô½Ã¹°À» »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?")) {
		f.action = "news_ok.php";
		f.ct_func.value = "removelist";
		f.submit();
		f.action = "";
	}
}

function fnSameSearch() {
	document.form_srh_cd.search.value=document.form_srh.search.value;
}

function fnSrhList(gubun){
	switch(gubun){
		case 12 :
			document.tab_srh.tab_type.value="ALL";
			//alert(document.tab_srh.tab_type.value);
			document.tab_srh.submit();
			break;
		case 1 :
			document.tab_srh.tab_type.value="RF";
			//alert(document.tab_srh.tab_type.value);
			document.tab_srh.submit();
			break;
		case 2 :
			document.tab_srh.tab_type.value="RM";
			//alert(document.tab_srh.tab_type.value);
			document.tab_srh.submit();
			break;
		case 3 :
			document.tab_srh_cd.tab_type.value="CD";
			if(document.tab_srh_cd.action.value=="cate_list"){
				document.tab_srh_cd.action.value="search";
			}
			document.tab_srh_cd.submit();
			break;
		case 7 :
			document.tab_srh_lp.tab_type.value="LP";
			if(document.tab_srh_lp.action.value=="cate_list"){
				document.tab_srh_lp.action.value="search";
			}
			document.tab_srh_lp.submit();
			break;		
	}
}

function fnSrhListM(gubun){
	switch(gubun){
		case 46 :
			document.tab_srh.tab_type.value="ALL";
			break;
		case 4 :
			document.tab_srh.tab_type.value="RM";
			break;
		case 6 :
			document.tab_srh.tab_type.value="RF";
			break;
	}
	document.tab_srh.submit();
}
	
function checked_lp(){
	i=0;
	j=0;
	while (i < document.form_srh.elements.length){
		if(document.form_srh.elements[i].name.substring(0,6) == 'check['){
			j++;
			if(j==1 || j==2 || j==3 ){
				document.form_srh.elements[i].checked=false;
			}
		}
		i++;
	}
}

function checked_cd(){
	i=0;
	j=0;
	while (i < document.form_srh.elements.length){
		if(document.form_srh.elements[i].name.substring(0,6) == 'check['){
			j++;
			if(j==1 || j==2 || j==4 ){
				document.form_srh.elements[i].checked=false;
			}
		}
		i++;
	}
}


function checked_rfrm(){
	i=0;
	j=0;
	while (i < document.form_srh.elements.length){
		if(document.form_srh.elements[i].name.substring(0,6) == 'check['){
			j++;
			if(j==3 || j==4){
				document.form_srh.elements[i].checked=false;
			}
		}
		i++;
	}
}



function submit_check(chk){
	var f = document.form_srh;
	var chk_cd, chk_lp;
	f.search.value=f.search.value.replace(/(^\s*)|(\s*$)/g, "");
	if(f.search.value=="Å°¿öµå³ª ÀÌ¹ÌÁö ¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä."){
		f.search.value="";
	}
	if(!f.search.value){
		alert("Å°¿öµå¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		f.search.focus();
		return;
	}
	
	i=0;
	j=0;
	while(i < f.elements.length){
		if(f.elements[i].name.substring(0,6) == 'check['){
			j++;
			
			
			if(f.elements[i].checked==true && j==3){
				chk_cd=1;
			}else if(f.elements[i].checked==true && j==4){
				chk_lp=1;
			}
		}
		i++;
	}
	
	if(chk_lp){
		f.gourl.value="/low/list_request_lp.php";
	}else if(chk_cd){
		if(chk=='ill'){
			f.gourl.value="/illust/list_request_illust_cd.php";
		}else{
			f.gourl.value="/photo/list_request_cd.php";
		}
	}else {
		if(chk=='ill'){
			f.gourl.value="/illust/list_request_illust.php";
		}else if(chk=='art'){
			f.gourl.value="/art/list_request_art.php";
		}else if(chk=='motion'){
			f.gourl.value="/motion/list_request_motion.php";
		}else if(chk=='flash'){
			f.gourl.value="/flash/list_request_flash.php";		
		}else{
			f.gourl.value="/photo/list_request_single.php";
		}
	}
	
	f.submit();
}

function search_detail(){
	var f = document.form_srh;
	if(f.search.value=="Å°¿öµå³ª ÀÌ¹ÌÁö ¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä."){
		f.search.value="";
	}
	document.detail_search.search.value=f.search.value;
	i=0;
	j=0;
	while (i < f.elements.length){
		if(f.elements[i].name.substring(0,6) == 'check['){
			j++;
			k="";
			
			if(f.elements[i].checked==true){
				if(j==1){
					document.detail_search.elements[j].value=2;
				}else if(j==2){
					document.detail_search.elements[j].value=1;
				}
			}
		}
		i++;
	}
	document.detail_search.submit();
}

function bluring(){ 
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") {
		document.body.focus(); 
	}
} 
document.onfocusin=bluring; 

function fnGoStart(f){
	f.page.value=1;
	f.submit();
} 

function fnGoPre(f){
	if(parseInt(f.ori_page.value)>1){
		f.page.value=parseInt(f.ori_page.value)-1;
		f.submit();
	}else {
		//alert('Ã¹ÆäÀÌÁö ÀÔ´Ï´Ù!');
		return;
	}
} 

function fnGoNext(f){
	if(parseInt(f.ori_page.value) < parseInt(f.ori_total_page.value)){
		f.page.value=parseInt(f.ori_page.value)+1;
		f.submit();
	}
} 

function fnGoEnd(f){
	f.page.value=parseInt(f.ori_total_page.value);
	f.submit();
} 