
//####################### 장바구니에 입력 #########################
/*
fn_basketGo(
f: form 객체
s: lecture:과정,product:도서
m: basket:장바구니 담기,order:바로주문하기
k: list:리스트에서, detail:상세에서
)

*실행예*

' 2011-02-23
<input type="checkbox" name="Lec_IDX" value="100001|0|0" /> <!--Lec_IDX|LivIDX?|Service_Type--> Service_Type 1:웹, 2:모바일, 4:웹+모바일

<form name="frm" >
    <input type="checkbox" name="Lec_IDX" value="100001|0" /> <!--강좌아이디-->
    <input type="button" value="전송" onclick="fn_basketGo (document.frm,'lecture','basket','list')"/>
</form>
<form name="frm" >
    <input type="hidden" name="Lec_IDX" value="100001|0" /> <!--강좌아이디-->
    <input type="button" value="전송" onclick="fn_basketGo (document.frm,'lecture','order','detail')"/>
</form>
<form name="frm" >
    <input type="checkbox" name="ProductID" value="1000000001|1" /> <!--도서아이디|도서수량-->
    <input type="button" value="전송" onclick="fn_basketGo (document.frm,'product','basket','list')"/>
</form>
<form name="frm" >
    <input type="hidden" name="ProductID" value="1000000001|2" /> <!--도서아이디|도서수량-->
    <input type="button" value="전송" onclick="fn_basketGo (document.frm,'product','order','detail')"/>
</form>
*/
//플래시 사이즈조정
function large(){ 
 document.all['pyunib_gnb'].style.height = 197; //확장사이즈 
} 
function small(){ 
 document.all['pyunib_gnb'].style.height = 37; //축소사이즈 
} 

function VodOpen(strCourseID,strType) {

	//gFnc_PopOpen("/Global/Gbl_Skin/DPlayer/Player_Check.asp?vCourseID="+strCourseID+"&PlayType="+strType,'VOD',990,650,'auto')
	// 2011-05-16 변경 될 drm
	gFnc_PopOpen("/Global/Gbl_Skin/DPlayer_Ver2/Player_Check.asp?vCourseID="+strCourseID+"&PlayType="+strType,'VOD',990,650,'auto');

}


function VodOpen_NM(strCourseID,strType,strDPType,strOL_Code,strLec_IDX,strPartID,strChapterID,strSectionID,strFILEID) {

	//gFnc_PopOpen("/Global/Gbl_Skin/DPlayer/Player_Check.asp?vCourseID="+strCourseID+"&PlayType="+strType+"&DPType="+strDPType+"&vOL_Code="+strOL_Code+"&vLec_IDX="+strLec_IDX+"&vPartID="+strPartID+"&vChapterID="+strChapterID+"&vSectionID="+strSectionID+"&vFILEID="+strFILEID,'VOD',990,650,'auto')
	// 2011-05-16 변경 될 drm
	gFnc_PopOpen("/Global/Gbl_Skin/DPlayer_Ver2/Player_Check.asp?vCourseID="+strCourseID+"&PlayType="+strType+"&DPType="+strDPType+"&vOL_Code="+strOL_Code+"&vLec_IDX="+strLec_IDX+"&vPartID="+strPartID+"&vChapterID="+strChapterID+"&vSectionID="+strSectionID+"&vFILEID="+strFILEID,'VOD',990,650,'auto');


}

function fn_basketGo (f,s,m,k){
    var frm = f;
    var ccnt = 0;
    if (s=='lecture')
    {
        var control = frm.Lec_IDX;
		var kind_text = "과정을";
    }
    else if(s=='product')
    {
         var control = frm.ProductID;
		 var kind_text = "도서를";
    }
   
    else if(s=='exam')
    {
         var control = frm.Lec_IDX;
		 var kind_text = "시험을";
    }
	
	
    if(k=='list')
    {
        if(control!=null)
        {
            if (control.length==undefined)
            {
                if(control.checked)
                {
                    ccnt++
                }
            }
            else
            {
                for (var cnt = 0 ; cnt < control.length ; cnt++) {
	                if(control[cnt].checked)
	                {
	                    ccnt++
	                }
                }
            }
        }
        else
        {
          ccnt=0;
        }
    }
    else if(k=='detail')
    {
        if(control!=null)
        {
            if (control.length==undefined)
            {
				// 2011-03-29	
				// checkbox 가 아닐 때 ( hidden 일 때) 
				// 값이 입력되었는지 체크;
				if (control.value != "")
				{
					ccnt++;
				}
				else
				{
					kind_text = "수강료 구분을";
				}
            }
            else
            {
                for (var cnt = 0 ; cnt < control.length ; cnt++) {
                 ccnt++
                }
            }
        }
        else
        {
            ccnt=0;
        }
    }    
    
    
    if (ccnt<1)
    {
        alert(kind_text+" 선택하세요.");
        return;
    }
    
    if (m=='basket')
    { 
        window.open('about:blank','pop_basket','toolbar=no,resizable=no,width=400,height=300');
        frm.method="post";
        frm.target="pop_basket";
        frm.action="/Mypage/cart/cart_insert_process.asp?popup_flag=y&gubun="+s;
        frm.submit();
    }
    
    if (m=='order')
    {
        if (confirm('선택한 '+kind_text+' 바로구매 하시겠습니까?'))
        {
            
            frm.method="post";
            frm.target="_self";
            frm.action="/Mypage/cart/cart_insert_process.asp?popup_flag=n&gubun="+s;
            frm.submit();
        }
    }

}


//도서 수량 더하기 빼기
//적용대상,더하기빼기
//ex(document.form,"+")
function adjustBasketCnt(target,kind,v_productid,object_f)
{
    if(target!=null)
    {
        if (target.length==undefined)
        {
            if(kind=="+")
            {
                target.value = Number(target.value)+1;
				if (object_f!=null)
				{
					object_f.value=v_productid+'|'+target.value;
				}
				
            }
            else if(kind=="-")
            {
                if(Number(target.value)>1)
                {
                    target.value = Number(target.value)-1;
					if (object_f!=null)
					{
					object_f.value=v_productid+'|'+target.value;
					}
                }
            }
        }        
    }
    else
    {
        alert("적용할 대상이 없습니다.");
    }
}

//장바구니 삭제
function fn_basketDelete(f,v)
{
    var frm = f;
    frm.indi_basketid.value=v;
    frm.method="post";
    frm.action="/Mypage/cart/cart_delete_process.asp"
    frm.submit();
}

//장바구니 수량 조정
function fn_basketCntEdit(f,basketid,productCnt)
{
    var frm = f;
    frm.indi_basketid.value=basketid;
    frm.indi_productCnt.value=productCnt;
    frm.method="post";
    frm.action="/Mypage/cart/cart_cntEdit_process.asp"
    frm.submit();
}


//관련교재 장바구니 입력
function fn_basketRInsert(f,productID)
{
    var frm = f;
    frm.indi_productID.value=productID;
    frm.method="post";
    frm.action="/Mypage/cart/cart_insert_r_process.asp"
    frm.submit();
}

//장바구니에서 쿠폰할인 적용 제거하기
function fn_cart_coupon_delete(f,bCuIdx)
{
    var frm = f;
    frm.action="/Mypage/cart/cart_couponDelete_process.asp?bCuIdx="+bCuIdx;
    frm.method="post";
    frm.submit();
}

//장바구니에서 캐쉬할인 적용 제거하기
function fn_cart_cash_delete(f,bCaIdx)
{
    var frm = f;
    frm.action="/Mypage/cart/cart_cashDelete_process.asp?bCaIdx="+bCaIdx;
    frm.method="post";
    frm.submit();
}

//주문하기 버튼 클릭시
function fn_OrderInsert(f)
{
    var frm = f;
    frm.method="post";
    frm.action="/Global/Gbl_Ini/plugin_check.asp";
    frm.submit();
}
function fn_Order2Insert(f)
{
    var frm = f;
    frm.method="post";
    frm.action="/Global/Gbl_Dacom/plugin_check.asp";
    frm.submit();
}






//전체메뉴 

function openView(Objid) {
	var Obj = document.getElementById(Objid);
	if (Obj.style.display == "none") {
	Obj.style.display = "";
	}
}

function closeView(Objid) {
	var Obj = document.getElementById(Objid);
	if (Obj.style.display == "") {
	Obj.style.display = "none";
	}
}


// png 파일

function setPng24(obj) { 
    obj.width=obj.height=1; 
    obj.className=obj.className.replace(/\bpng24\b/i,''); 
    obj.style.filter = 
    "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');" 
    return ''; 
} 

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


