var cache = { };
$(document).ready(function() {
cache["loadimg"] = $("
").attr("src", "http://image.eduhouse.net/2009_iae/image/loadinfo_s.gif");
jQuery.historyInit(actionHandler);
$("a[rel='history_unisch_prog']").live("click", function() {
$("#unisch_prog").hide();
$("#unisch_prog_loading").show().append(cache["loadimg"]);
return dvf_historyHandler(this.href);
});
$("#btn_sch_counsel").click(fnrequser_sel_counsel);
$("#btn_schbr_req").click(fnrequser_sel_request);
unisch_prog_view();
});
function actionHandler(p_hash){
// hash doesn't contain the first # character.
//trace("hash=" + p_hash);
var arrHashToken;
if(p_hash)
{
arrHashToken = p_hash.split("_");
}
else
{
arrHashToken = $("#init_param").val().split("_");
}
if (arrHashToken.length > 0)
{
$("#natCd").val(arrHashToken[0]);
if (arrHashToken.length > 1)
$("#chkInitInfoSq").val(arrHashToken[1]);
if (arrHashToken.length > 2)
$("#cat_li1").val(arrHashToken[2]);
if (arrHashToken.length > 3)
$("#cat_li2").val(arrHashToken[3]);
unisch_prog_view();
var natIdEnd = $("#natCd").val();
// 기타국가의 li tag id값이 "nat_tab_etc" 이므로 코드값이 "0,1,2.." 형태(컴마가 있음)이면 "etc"로 바꿔준다.
if (natIdEnd.indexOf(",") >= 0)
natIdEnd = "etc";
// 국가 tab이 바뀐 경우에는 현재 국가 Tab 및 알파벳 검색의 href 값 변경
if (("#nat_tab_" + natIdEnd) != $("#nat_tab > li.on").attr("id"))
{
$("#nat_tab > li.on").removeClass("on");
var srcTarget = $("#nat_tab_" + natIdEnd);
srcTarget.addClass("on");
}
}
}
function unisch_prog_view() {
var frm = document.seaach_sch_opttest_frm;
var param = 'cmd_typ=req_list&sel_course='+ $("#constSelCourse").val() +'&natCd='+ $("#natCd").val();
$.ajax({
url: '/service/study_info/svc_youngsch_best_view.asp',
type: 'POST',
data: param,
dataType: 'json',
async: false,
error: function() {
alert("Error loading Search info");
},
success: function(p_data) {
if(p_data.sch_unisch_prog_List != undefined && p_data.sch_unisch_prog_List.length > 0)
{
$("#unisch_prog").show();
dvf_simpleinnerHtml(p_data.sch_unisch_prog_List, "#uni_prog_list_frm", true);
var chk_val = chk_val_first();
if ($("#chkInitInfoSq").val() != "") {
chk_init_info_Seq($("#chkInitInfoSq").val());
}else {
chk_init_info_Seq(chk_val);
}
if (($("#cat_li1").val() != "") && ($("#cat_li1").val() != "")) {
view_contents_cat_list($("#cat_li1").val(), $("#cat_li1").val());
}
}
else
{
$("#unisch_prog").hide();
alert("해당 조건의 학교정보가 없습니다.");
}
}
});
}
function chk_init_info_Seq(arg){
if (arg > 0 )
{
param = 'cmd_typ=req_info_seq&best_cd=' + arg;
$.ajax({
url: '/service/study_info/svc_youngsch_best_view.asp',
type: 'POST',
data: param,
dataType: 'json',
async: false,
error: function() {
alert("Error loading Search info");
},
success: function(p_data) {
if(p_data.sch_unisch_prog_List != undefined && p_data.sch_unisch_prog_List.length > 0)
{
$("#best_contents_area").show();
dvf_simpleinnerHtml(p_data.sch_unisch_prog_List, "#uni_info_list_frm", true);
var chk_val2=chk_val_first2();
Change_cur_list(arg,chk_val2);
}
else
{
$("#best_contents_area").hide();
alert("해당 조건의 학교정보가 없습니다.");
}
}
});
}
}
function Change_cur_list(arg1,arg2){
view_program_list(arg1);
view_program_title(arg1);
view_contents_cat_list(arg1,arg2);
$("#unisch_prog_loading").hide();
}
function Change_category_tab(arg1,arg2){
view_contents_cat_list(arg1,arg2);
}
function dvf_simpleinnerHtml(p_dataset, p_grid, p_clear)
{
var dataBody = jQuery(p_grid).find(".data_body");
if (p_clear)
{
dataBody.children(":not(.row_struct)").remove();
}
jQuery(p_dataset).each(function() {
var datarec = this;
var row = jQuery(p_grid).find(".row_struct").clone();
row.find("datafield").each(function() {
if (jQuery(this).attr("bef_callback"))
{
eval(jQuery(this).attr("bef_callback") + "()");
}
var val = eval("datarec." + jQuery(this).attr("id"));
if (jQuery(this).attr("aft_callback"))
{
val = eval(jQuery(this).attr("aft_callback") + "('" + val + "')");
}
jQuery(this).after(val);
jQuery(this).remove();
});
row.removeClass("row_struct");
row.appendTo(dataBody);
});
}
function make_val(arg){
var ret_val= "";
return ret_val;
}
function make_val2(arg){
var ret_val= "";
return ret_val;
}
function chk_val_first(){
var frm = document.seaach_sch_opttest_frm;
var init_code;
if (frm.school_best_code.length > 1)
{
init_code = frm.school_best_code[0].value ;
}else
{
init_code = frm.school_best_code.value;
}
return init_code;
}
function chk_val_first2(){
var frm = document.seaach_sch_opttest_frm;
var init_code;
if (frm.school_best_info_code.length > 1)
{
init_code = frm.school_best_info_code[0].value ;
}else
{
init_code = frm.school_best_info_code.value;
}
return init_code;
}
function view_program_list(b_cd){
var frm = document.seaach_sch_opttest_frm;
var load_page = '/service/study_info/sch_bestform_view.asp?cmd_typ=prg_list&sel_course='+ $("#constSelCourse").val() +'&natCd='+ $("#natCd").val() +'&best_code='+b_cd;
$("#uni_prog_list").load(load_page);
}
function view_program_title(b_cd){
var load_page = "/service/study_info/sch_bestform_view.asp?cmd_typ=prg_title&best_code="+b_cd;
$("#uni_prog_title").load(load_page);
}
function view_contents_cat_list(b_cd,c_cd){
var load_page = "/service/study_info/sch_bestform_view.asp?cmd_typ=cat_list&best_code="+b_cd+"&cont_code="+c_cd;
$("#uni_contents_list").load(load_page);
view_contents_sub_cat_list(b_cd,c_cd);
view_contents_list(b_cd,c_cd);
}
function view_contents_sub_cat_list(b_cd,c_cd){
var load_page = "/service/study_info/sch_bestform_view.asp?cmd_typ=sub_cat_list&best_code="+b_cd+"&cont_code="+c_cd;
$("#uni_contents_sub_category").load(load_page);
}
function view_contents_list(b_cd,c_cd){
var load_page = "/service/study_info/sch_bestform_view.asp?cmd_typ=contents_view&best_code="+b_cd+"&cont_code="+c_cd;
$("#uni_contents_view").load(load_page);
}