//-------------------------------- 1.부평,부산대,N파고다 결제분리 메시지 보이기, 숨기기 ----------------------------------------------//
var franchise = $H({'06':'구로', '09':'NPAGODA', '12':'부평', '30':'부산대', '08':'여의도'});
function show_noti(brancode) {
	if(typeof(franchise.get(brancode)) == "undefined") {
		//$('popUp363').hide();
	} else {
		if(brancode == "09") {
			$('franchise').update("<b>" + franchise.get(brancode));
		} else {
			$('franchise').update("파고다 <b>" + franchise.get(brancode));
		}
		$('popUp363').show();
	}
}

function hideDiv(divid) {
	$(divid).hide();
}

function getOffset() {
	var offset = 0;
	var webblasare=navigator.appVersion;
	if (webblasare.indexOf("NT 6.1")!=-1) {
		offset = document.documentElement.scrollTop;
	} 

	return offset;
}

var ajaxstatus = "Y";
//-------------------------------- 2.과목정보 보이기, 숨기기 ----------------------------------------------//
function get_classinfo_ajax(yymm, brancode, classcode, classterm, classtime, timeseq, levlgb, x, y, from) {
	if(ajaxstatus == "N") return;

	try {
		var classinfo = $F("classinfo_yymm")+"/"+$F("classinfo_classcode")+"/"+$F("classinfo_classterm")+"/"+$F("classinfo_classtime")+"/"+$F("classinfo_timeseq");
		var ajaxinfo = yymm+"/"+classcode+"/"+classterm+"/"+classtime+"/"+timeseq;
		if(classinfo == ajaxinfo) {
			if($('popUp550').style.display == "none") $('popUp550').show();
			return;
		}
	} catch(e) {}

	if(from == "cart" || from == "worker" || from == "timeall")$('popUp550').style.left=parseInt(skn.left)-120;
	else $('popUp550').style.left=parseInt(skn.left);
	$('popUp550').style.top=parseInt(skn.top)+20;
	$('popUp550').hide();

	var url = "/register/class/getClassInfo.do";
	var pars = 'yymm='+yymm+'&brancode='+brancode+'&classcode='+classcode+'&classterm='
				+classterm+'&classtime='+classtime+'&timeseq='+timeseq+'&levlgb='+levlgb+'&from='+from;
	ajaxstatus = "N";

	var myAjax = new Ajax.Request(
		url,
		{
			method: 'post',
			parameters: pars,
			onComplete: show_classinfo
		});
}

function show_classinfo(originalRequest) {
	$('popUp550').update(originalRequest.responseText);
	$('popUp550').style.display = 'inline';
	$('popUp550').show();
	ajaxstatus = "Y";
}

//-------------------------------- 3.과목상세 정보 보이기----------------------------------------------//
function get_classdetailinfo_ajax(yymm, brancode, classcode, x, y) {
	if(ajaxstatus == "N") return;
	$('popUp603').style.left=parseInt(skn.left)-120;//
	$('popUp603').style.top=parseInt(skn.top)+30;//
	$('popUp603').hide();//

	var url = "/register/class/getClassDetailInfo.do";
	var pars = 'yymm='+yymm+'&brancode='+brancode+'&classcode='+classcode;
	ajaxstatus = "N";

	var myAjax = new Ajax.Request(
		url,
		{
			method: 'post',
			parameters: pars,
			onComplete: show_classdetailinfo
		});
}

function show_classdetailinfo(originalRequest) {
	$('popUp603').update(originalRequest.responseText);
	$('popUp603').style.display = 'inline';//
	$('popUp603').show();
	ajaxstatus = "Y";
}


//-------------------------------- 2.과목정보 보이기, 숨기기 ----------------------------------------------//
function get_teacherinfo_ajax(lectcode, x, y, from) {
	if(ajaxstatus == "N") return;

	try {
		var classinfo = $F("teacher_lectcode");
		if($F("teacher_lectcode") == lectcode) {
			if($('popUp550').style.display == "none") $('popUp550').show();
			return;
		}
	} catch(e) {}

	if(from == "cart" || from == "worker")$('popUp550').style.left=parseInt(skn.left)-120;
	else $('popUp550').style.left=parseInt(skn.left)-250;
	$('popUp550').style.top=parseInt(skn.top)+30;
	$('popUp550').hide();

	var url = "/register/class/getTeacherInfo.do";
	var pars = 'lectcode='+lectcode+'&from='+from;
	ajaxstatus = "N";

	var myAjax = new Ajax.Request(
		url,
		{
			method: 'post',
			parameters: pars,
			onComplete: show_classinfo
		});
}

//---------------------------------- 교재구입 --------------------------------//
function goBook(code1, gubn) {
	if(gubn == 'INTERPARK') {
		if (confirm("인터파크에서 교재구입시 배송기간이 다소 소요될수 있습니다.구입하시겠습니까?"  )) {
			strurl = "http://book.interpark.com/gate/WinWinManager.jsp?shop_id=*&biz_cd=W01387&goods_no="+code1;
			window.open(strurl, "interpark","width=800,height=600,resizable=yes,scrollbars=yes,status=yes,toolbar=yes,menubar=yes,location=yes,titlebar=yes,top=50,left=50");
		}
	} else if(gubn == 'PAGODAMALL') {
		if (confirm("파고다몰에서 교재구입시 배송기간이 다소 소요될수 있습니다.구입하시겠습니까?"  )) {
			strurl = "http://www.npagoda.com/mall/goods_detail.php?goodsIdx="+code1;
			window.open(strurl, "pagodamall","width=800,height=600,resizable=yes,scrollbars=yes,status=yes,toolbar=yes,menubar=yes,location=yes,titlebar=yes,top=50,left=50");
		}
	}
}

//------------------------------------- 교재 레이어창
function open_booklayer(totalcnt, currentno) {
	for(i=0; i<totalcnt; i++) {
		$("booklayer"+i).hide();
	}

	$("booklayer"+currentno).toggle();
}
