﻿
$(document).ready(function(){

    //초기에 수준별 강좌리스트를 초급으로 셋팅한다.
    ajax_lecture_of_level('1');   
    
    $('#btnApyCancel').click(function() {
        $('#div_apply').hide();
    }); 
    
    

    //아이디, 패스워드 초기화
    if(!$('#txtMemID').val())
        $('#txtMemID').addClass('id_load_loginbox');
        
    $('#txtPasswd').addClass('pw_load_loginbox');
    
    
    //아이디, 패스워드 백그라운드 이미지 클리어
    $('.loginbox').click(function() {
        $('#txtMemID').addClass('clear_loginbox');
        $('#txtPasswd').addClass('clear_loginbox');
    });


    
             

}); //document ready ~~


function ajax_intro(a, b)
{ 
    if (a == "la_intro1")
    {
        document.getElementById("img_intro1").src = "images/intro_btn_01_on.gif";
        document.getElementById("img_intro2").src = "images/intro_btn_05.gif";
    }
    else
    {
        document.getElementById("img_intro1").src = "images/intro_btn_01.gif";
        document.getElementById("img_intro2").src = "images/intro_btn_05_on.gif";
    }
   	
	$('#div_intro_result').load('ajax_intro.aspx?field=' + a + '&la_id=' + b, function() {});        
}

function ajax_lec_list(la_id)
{
    document.getElementById("img_intro1").src = "images/intro_btn_01.gif";
    document.getElementById("img_intro2").src = "images/intro_btn_02.gif";
    document.getElementById("img_intro3").src = "images/intro_btn_03_on.gif";      

    $('#div_intro_result').load('ajax_lec_list.aspx?la_id=' + la_id, function() {});
}


function ajax_lecture_of_level(level)
{
    if(level == "2")
    {        
        $('#tab_level1').removeClass('left_level').removeClass('left_level_spot').addClass('left_level');
        $('#tab_level2').removeClass('left_level').removeClass('left_level_spot').addClass('left_level_spot');       
        $('#tab_level3').removeClass('left_level').removeClass('left_level_spot').addClass('left_level');
    }
    else if(level == "3")
    {
        $('#tab_level1').removeClass('left_level').removeClass('left_level_spot').addClass('left_level');
        $('#tab_level2').removeClass('left_level').removeClass('left_level_spot').addClass('left_level');       
        $('#tab_level3').removeClass('left_level').removeClass('left_level_spot').addClass('left_level_spot');
    }
    else
    {
        $('#tab_level1').removeClass('left_level').removeClass('left_level_spot').addClass('left_level_spot');
        $('#tab_level2').removeClass('left_level').removeClass('left_level_spot').addClass('left_level');       
        $('#tab_level3').removeClass('left_level').removeClass('left_level_spot').addClass('left_level');
    }

    
    $('#div_lecture_level_result').load('ajax_lec_of_level.aspx?la_level=' + level, function() {});
}
    
 
//수강신청   
function apply_ok(la_id, ichk)
{
    //로그인 상태가 false면..
    if (ichk == 0)
    {
        location.href='/membership/Login.asp?Prev_URL=/cyberlecture/introduction.aspx?la_id=' + la_id;
        return;
    }
    else
    {
        //확인창을 거쳐 수강신청이 가능하게..
        $('#div_apply').show();
    
        /*
        if(confirm('수강신청을 진행 하시겠습니까?'))
        {
            location.href="Lectureapply.aspx?la_id=" + la_id;
        }
        else
        {
            return;
        }
        */
    }
}

function jsApyAct(la_id)
{
    location.href="Lectureapply.aspx?la_id=" + la_id;
}


function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';
  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

function smartxOpen(ch_num, path,widthstr,heightstr,ap_num,la_id,ch_order){
	g_intCurrChNum = ch_num ;
	window.open(path,"smartx","scrollbars=0,menubar=0,resizable=0,status=0,toolbar=0,width="+widthstr+",height="+heightstr);
}

function smartxOpen_WBT(path){
	window.open(path,"smartx","scrollbars=0,menubar=0,resizable=0,status=0,toolbar=0,width=500,height=450");
	
//	takeConfirmation(ap_num,la_id,ch_order);
}

function sample_lecture()
{
    window.open('smartxview/WebmmpD.asp?ap_num=&ch_num=511&usermode=1','sample','width=960,height=580');    
}


// 위치지정에 따른 새창띄우기

var win=null;

function NewWindow(mypage,myname,w,h,scroll,pos){

if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}

if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}

else if((pos!="center" && pos!="random") || pos==null){LeftPosition=(screen.width-w)/2;TopPosition=20}

settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';

win=window.open(mypage,myname,settings);

if(win.focus){win.focus();}}



function CantView () {
	alert ("더 이상 강의를 수강할 수 없습니다") ;
}


function takeConfirmation(ch_num,ap_num,la_id,ch_order){
	self.location.href="/cyberlecture/TakeConfirmation.aspx?ch_num=" + ch_num + "&ap_num=" + ap_num + "&la_id=" + la_id + "&ch_order=" + ch_order + "&currpage=1" ;
}

function takeConfirmation2(ap_num,la_id,ch_order,ch_num){
	self.location.href="/cyberlecture/TakeConfirmation.aspx?ch_num=" + ch_num + "&ap_num=" + ap_num + "&la_id=" + la_id + "&ch_order=" + ch_order + "&currpage=1" ;
}

