function st_time(f) {
	var summer_time = new Date(f.nl_year.value, eval(f.s_mth.value)-1, eval(f.s_date.value), 9, 0, 0);
	var winter_time = new Date(f.nl_year.value, eval(f.w_mth.value)-1, eval(f.w_date.value), 10, 0, 0);
	var sm_time = Date.parse(summer_time);
	var wt_time = Date.parse(winter_time);
	document.nanum_clock.unixtime_s.value = sm_time;
	document.nanum_clock.unixtime_w.value = wt_time;
}
function n_clock(f) {
	var tmpl_mth;
	var tmpl_date;
	var tmpl_hour;
	var tmpl_min;
	var tmpl_sec;
	var tmpc_mth;
	var tmpc_date;
	var tmpc_hour;
	var tmpc_min;
	var tmpc_sec;
	var time_gap;
	var t_gap;
	var is_gap;
	var kr_str;
	var cz_str;
	var ihtml;

var clockobj=document.getElementById? document.getElementById("n_clock") : document.all.n_clock;

	var nl_time = new Date(f.nl_year.value, eval(f.nl_mth.value)-1, eval(f.nl_date.value), eval(f.nl_hour.value), eval(f.nl_min.value), eval(f.nl_sec.value)+1);
	var nx_time = Date.parse(nl_time);

	tmpl_year = eval(f.nl_year.value);
	tmpl_mth = eval(f.nl_mth.value);
	tmpl_date = eval(f.nl_date.value);
	tmpl_hour = eval(f.nl_hour.value);
	tmpl_min = eval(f.nl_min.value);
	tmpl_sec = eval(f.nl_sec.value)+1;

	tmpc_year = eval(f.nc_year.value);
	tmpc_mth = eval(f.nc_mth.value);
	tmpc_date = eval(f.nc_date.value);
	tmpc_hour = eval(f.nc_hour.value);
	tmpc_min = eval(f.nc_min.value);
	tmpc_sec = eval(f.nc_sec.value)+1; 

	if (nx_time < f.unixtime_s.value) {
		t_gap = 8;
	} else if (nx_time > f.unixtime_w.value) {
		t_gap = 8;
	} else {
		t_gap = 7;
	}

	is_gap = eval(f.time_gap.value) - t_gap;
	f.time_gap.value = t_gap;

	var next_kr = new calc_cal(tmpl_year, tmpl_mth, tmpl_date, tmpl_hour, tmpl_min, tmpl_sec, 0);

	f.nl_year.value = next_kr.y;
	if (next_kr.m < 10) {
		f.nl_mth.value = "0" + next_kr.m;
	} else {
		f.nl_mth.value = "" + next_kr.m;
	}

	if (next_kr.d < 10) {
		f.nl_date.value = "0" + next_kr.d;
	} else {
		f.nl_date.value = "" + next_kr.d;
	}

	if (next_kr.h < 10) {
		f.nl_hour.value = "0" + next_kr.h;
	} else {
		f.nl_hour.value = "" + next_kr.h;
	}

	if (next_kr.i < 10) {
		f.nl_min.value = "0" + next_kr.i;
	} else {
		f.nl_min.value = "" + next_kr.i;
	}

	if (next_kr.s < 10) {
		f.nl_sec.value = "0" + next_kr.s;
	} else {
		f.nl_sec.value = "" + next_kr.s;
	}
	kr_str = "Korea: " + f.nl_year.value + "-" + f.nl_mth.value + "-" + f.nl_date.value + " " + f.nl_hour.value + ":" + f.nl_min.value + ":" + f.nl_sec.value + " / ";

	var next_cz = new calc_cal(tmpc_year, tmpc_mth, tmpc_date, tmpc_hour, tmpc_min, tmpc_sec, is_gap);

	f.nc_year.value = next_cz.y;

	if (next_cz.m < 10) {
		f.nc_mth.value = "0" + next_cz.m;
	} else {
		f.nc_mth.value = "" + next_cz.m;
	}

	if (next_cz.d < 10) {
		f.nc_date.value = "0" + next_cz.d;
	} else {
		f.nc_date.value = "" + next_cz.d;
	}

	if (next_cz.h < 10) {
		f.nc_hour.value = "0" + next_cz.h;
	} else {
		f.nc_hour.value = "" + next_cz.h;
	}

	if (next_cz.i < 10) {
		f.nc_min.value = "0" + next_cz.i;
	} else {
		f.nc_min.value = "" + next_cz.i;
	}

	if (next_cz.s < 10) {
		f.nc_sec.value = "0" + next_cz.s;
	} else {
		f.nc_sec.value = "" + next_cz.s;
	}
	cz_str = "Czech: " + f.nc_year.value + "-" + f.nc_mth.value + "-" + f.nc_date.value + " " + f.nc_hour.value + ":" + f.nc_min.value + ":" + f.nc_sec.value + " / ";

	ihtml = kr_str+cz_str+" (시차: "+f.time_gap.value+" 시간)";
	clockobj.innerHTML = ihtml;
	setTimeout("n_clock(document.nanum_clock)", 1000);
}

function calc_cal(y, m, d, h, i, s, w) {
	var leapyear;
	var size_mth;
	this.y = y;
	this.m = m;
	this.d = d;
	this.h = h;
	this.i = i;
	this.s = s;
	this.w = w;

	if (((this.y % 4 == 0) && (this.y % 100 != 0)) || ((this.y % 400 == 0) && (this.y % 4000 != 0))) {
		var leapyear = 1;
	}
	switch (this.m) {
		case 4 :
		case 6 :
		case 9 :
		case 11 :
			size_mth = 30;
			break;
		case 2 :
			if (leapyear) {
				size_mth = 29;
			} else {
				size_mth = 28;
			}
			break;
		default :
			size_mth = 31;
			break;
	}
	if (this.s == "60") {
		this.s = 0;
		this.i += 1;
		if (this.i == 60) {
			this.i = 0;
			this.h += 1;
			if (this.h == 24) {
				this.h = 0;
				this.d += 1;
				if (this.d > size_mth) {
					this.d = 1;
					this.m += 1;
					if(this.m == 13) {
						this.m = 1;
						this.y += 1;
					}
				}
			}
		}
	}

	this.h += this.w;

}


