<!--
/*--------------------------------------------------------------------------------
  ÆäÀÌÁöÀÌ¸§         :
  ÆäÀÌÁö¼³¸í         : 
  ³¯Â¥               : 20/10/2006
  Author             : ¼Õ½Â¿ë
  Recent modified by :
  Modified by          Date         	Reason to
  -----------       ----------        ----------------
 ---------------------------------------------------------------------------------*/
 

 
 function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
 
 
 // ÀÌ¹ÌÁö »çÀÌÁî Á¶Àý

 function imgcheck(imgObj, bool)
{
	var imgWidth  = 560; //** ¼³Á¤ ÀÌ¹ÌÁö Æø°ª
	var imgHeight = 3000; //** ¼³Á¤ ÀÌ¹ÌÁö ³ôÀÌ°ª
	
	if(bool) //** ÀÌ¹ÌÁö°¡ ·ÎµùÀÌ ´Ù µÇ¾úÀ»°æ¿ì
	{
		var O_Width = imgObj.width; //** ÀÌ¹ÌÁöÀÇ ½ÇÁ¦ Æø
		var O_Height = imgObj.height; //** ÀÌ¹ÌÁöÀÇ ½ÇÁ¦ ³ôÀÌ
		var ReWidth = O_Width; //** º¯È­µÈ Æø ÀúÀå º¯¼ö
		var ReHeight = O_Height; //** º¯È­µÈ ³ôÀÌ ÀúÀå º¯¼ö
	
	if(ReWidth > imgWidth)
	{
		ReWidth = imgWidth;
		ReHeight = (O_Height * ReWidth) / O_Width;
	}
	
	if(ReHeight > imgHeight)
	{
		ReWidth = (ReWidth * imgHeight) / ReHeight;
		ReHeight = imgHeight;
	}
	//** Ã³¸®
		imgObj.width = ReWidth;
		imgObj.height = ReHeight;
		//imgObj.alt = ReWidth +','+ ReHeight;
	}
	else //** ÀÌ¹ÌÁö°¡ ÇØ´ç °æ·Î¿¡ ¾ø¾î ·Îµù ¿¡·¯°¡ »ý°åÀ»°æ¿ì
	{
			//** ¾Èº¸ÀÌ°Ô ½ºÅ¸ÀÏ ½ÃÆ®·Î Ã³¸®
			imgObj.style.display = 'none';
	}
}

 

//////////// Æ®¸²
String.prototype.trim = function(){	
	return this.replace(/(^\s*)|(\s*$)/g, "");
}

//////////// ÇÑ±¹¾î ÇÊÅÍ
function chkKoreanStr(strEmailId) {
	var validChar = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
	for (var i = 0; i < strEmailId.length; i++) {
		if (validChar.indexOf(strEmailId.charAt(i)) == -1) {
			return false;
		}
	}
	return true;
}

//////////// ¼ýÀÚ¸¸ ÀÔ·Â ¹Þ±â
function numOnly() {
	if ((event.keyCode<48) || (event.keyCode>57)) {
	event.returnValue=false;
	}
}

//////////// Æ¯¼ö¹®ÀÚ ÇÊÅÍ
function chkOtherStr(strEmailId) {
	var strUnValidChar = " `~!@#$%^&*()+=|\\{}[]:;\"'?/<>,";
	for (var i=0; i < strEmailId.length; i++) {
		if (strUnValidChar.indexOf(strEmailId.charAt(i)) != -1)
		{
			return false;
		}
	}
	return true;
}

//////////// ÀÌ¸áÃ¼Å©
function validate(emailad) { 

var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/; 
var check=/@[\w\-]+\./; 
var checkend=/\.[a-zA-Z]{2,3}$/; 

        if(((emailad.search(exclude) != -1)||(emailad.search(check)) == -1)||(emailad.search(checkend) == -1)){ 
                alert("¿Ã¹Ù¸¥ ÀÌ¸ÞÀÏ Çü½ÄÀÌ ¾Æ´Õ´Ï´Ù");
		return false;
        }
        return true;
}














 function dateSrh_submit(){
		if (this.form_dateSrh.date1.value == ""){
				window.alert ("°Ë»ö ½ÃÀÛ ¹üÀ§¸¦ ÀÔ·ÂÇÏ¼¼¿ä!");
				setSDate_list('1');
				return false;
		}
		
		if (this.form_dateSrh.date2.value == ""){
				window.alert ("°Ë»ö ³¡¹üÀ§¸¦ ÀÔ·ÂÇÏ¼¼¿ä!");
				setSDate_list('2');
				return false;
		}
}
function student_del(){
  	if (confirm("Á¤¸» Áö¿ì½Ã°Ú½À´Ï±î? È®ÀÎÀ» ´©¸£½Ã¸é »èÁ¦ µË´Ï´Ù") == false){
  			return;
  	}
  
		this.list_form.action="student_delete_process.asp";
		this.form_Pinfo.submit();
  	this.list_form.submit();
}

 function search_submit(){
				this.form_search.action= "<%=linkURL%>.asp";
				this.form_search.submit();		
}


// form1 ³¯Â¥ ÀÔ·ÂÇÏ±â
// obj = form name, case1 = input box ¹øÈ£

function setSDate(case1)
{
	var obj;
	var info = window.showModalDialog("../inc/calendar.asp", null, "dialogHeight: 200px; dialogWidth: 200px; center: Yes; help: No; resizable: No; status: No;");
	if (info)
	{
		document.form1.all['date'+case1].value = info.yyyy + '-' + info.mm + '-' + info.dd;
	//	document.form1.all['date'+case1].value = info.dd + '/' + info.mm + '/' + info.yyyy;
	}
}

// form2 ³¯Â¥ ÀÔ·ÂÇÏ±â
function setSDate2(case1)
{
	var info = window.showModalDialog("../inc/calendar.asp", null, "dialogHeight: 200px; dialogWidth: 200px; center: Yes; help: No; resizable: No; status: No;");
	if (info)
	{
		document.form2.all['date'+case1].value = info.yyyy + '-' + info.mm + '-' + info.dd;
	}
}

// form1 ¸®¼Â
function form_reset()
{
		this.form1.reset();
}

// form2 ¸®¼Â
function form2_reset()
{
		this.form2.reset();
}

// ¸®½ºÆ® ¹Ú½º ¹Ù·Î °¡±â
function warp(){
		var location = "<%=linkUrl%>"+".asp?student_seq=";
		window.location=location+this.list_type_form.course_type.options[this.list_type_form.course_type.selectedIndex].value;
}

// -----------------------
function none(){}

function window_open(id, url, width, height, scrollbars) {
	if (url) {
		var wnd = window.open( url, id, 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars='+scrollbars+',width='+width+',height='+height,true);
        wnd.focus();
	}
window.open( url, id, 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars='+scrollbars+',width='+width+',height='+height,true);
}

function make_id(obj){
	var obj;
	parent.hidden_frm.location.href = "make_id.asp?student_seq="+obj;
}


function sumInvoice(obj){
		var obj;
		var T = Number('1e' + 3);
		weekly_tuition 		= eval(this.form2.weekly_tuition.value);
		weeks 				    = eval(this.form2.weeks.value);
		free_weeks 		    = eval(this.form2.free_weeks.value);
		total_weeks				= weeks + free_weeks;
		admin_fee					= eval(this.form2.admin_fee.value);
	  oshc							= eval(this.form2.oshc_fee.value);
	  homestay					= eval(this.form2.homestay_fee.value);
	  pickup						= eval(this.form2.pickup_fee.value);
	  material					= eval(this.form2.material_fee.value);
	  etc								= eval(this.form2.etc_fee.value);
	  DC_percent				= eval(this.form2.DC_percent.value);
	  DC_amount					= eval(this.form2.DC_amount.value);
	  agent_cashback    = eval(this.form2.agent_cashback.value);
	  cm_rate       		= eval(this.form2.cm_rate.value);
	  
	  if (obj=='l'){
	 				 this.form2.total_tuition.value = weekly_tuition * weeks;   // ÀüÃ¼ ÇÐºñ °è»ê
	 				 total_tuition	                = eval(this.form2.total_tuition.value);
	 				 
	 				 this.form2.dc_total.value = total_tuition * DC_percent/100 + DC_amount;
	 				 dc_total			                = eval(this.form2.dc_total.value);
	 				 
	 				 total_tuition_dc               = total_tuition - dc_total
	 				 
	 				 this.form2.total_amount.value  = total_tuition + admin_fee + oshc + homestay + pickup + material + etc - dc_total;
	 				 total_amount                   = eval(this.form2.total_amount.value);
	 				 
	 				 profit_nodc 										= total_tuition * cm_rate/100;
	 				 this.form2.profit_amount.value = Math.round((profit_nodc - dc_total)*T)/T + agent_cashback;
	 				 profit_amount                  = eval(this.form2.profit_amount.value);
	 				 
	 				 this.form2.DC_weekly_tuition.value = 	Math.round((total_tuition_dc/total_weeks)*T)/T;
	 	}
	  if (obj=='s'){
	 				 total_tuition	    						= eval(this.form2.total_tuition.value);
	 				 
	 				 this.form2.dc_total.value = total_tuition * DC_percent/100 + DC_amount;
	 				 dc_total			    						= eval(this.form2.dc_total.value);
	 				 
	 				 this.form2.total_amount.value  = total_tuition + admin_fee + oshc + homestay + pickup + material + etc - dc_total;
	 				 total_amount 									= eval(this.form2.total_amount.value);
	 				 
	 				 profit_nodc 										= total_tuition * cm_rate/100;
	 				 this.form2.profit_amount.value = Math.round((profit_nodc - dc_total)*T)/T + agent_cashback;
	 				 profit_amount 									= eval(this.form2.profit_amount.value);
	 	}	 	
	 		 				 this.form2.rem_student_amount.value = total_amount;
	 		 				 this.form2.rem_student_balance.value = eval(total_amount) - eval(this.form2.rem_student_amount.value)
}
/*
function balance_check(){
				 		 		total_amount = this.form2.total_amount.value;
								this.form2.rem_student_balance.value = eval(total_amount) - eval(this.form2.rem_student_amount.value);
								this.form2.profit_amount.value = eval(this.form2.profit_amount.value) - eval(this.form2.rem_student_balance.value);
}
*/
function balance_check(){
						var T = Number('1e' + 3);
				 		 	//	total_amount = this.form2.total_amount.value;
				 		var cm_rate         = eval(this.form2.cm_rate.value);
				 	  var total_tuition	  = eval(this.form2.total_tuition.value);
	 				  var profit_nodc 		= total_tuition * cm_rate/100;
	 				  var dc_total			  = eval(this.form2.dc_total.value);
	 				  var agent_cashback  = eval(this.form2.agent_cashback.value);
				 		this.form2.rem_student_amount.value = eval(this.form2.total_amount.value) - eval(this.form2.rem_student_balance.value);
				 		this.form2.profit_amount.value = (Math.round((profit_nodc - dc_total)*T)/T + agent_cashback) - eval(this.form2.rem_student_balance.value);
}


function layerSel(obj){
		var obj;
		if (obj == 'language'){
		   		eval("Layer_" + "language1" + ".style.display = 'inline'");
		   		eval("Layer_" + "language2" + ".style.display = 'inline'");
		   		eval("Layer_" + "language3" + ".style.display = 'inline'");
		   		eval("Layer_" + "school" + ".style.display = 'none'");
		}
		if (obj == 'school'){
		   		eval("Layer_" + "school" + ".style.display = 'inline'");
		   		eval("Layer_" + "language1" + ".style.display = 'none'");
		   		eval("Layer_" + "language2" + ".style.display = 'none'");
		   		eval("Layer_" + "language3" + ".style.display = 'none'");
		}		
}

//===============================ÇÐºñ °ü·Ã(tuition_fee, invoice)
function clearInvoice(obj){
			this.form2.weekly_tuition.value	 = 0;
	    this.form2.weeks.value           = 0;
	    this.form2.free_weeks.value      = 0;
			this.form2.total_tuition.value   = 0;
	    this.form2.admin_fee.value       = 0;
	    this.form2.oshc_fee.value        = 0;
	    this.form2.homestay_fee.value    = 0;
	    this.form2.pickup_fee.value      = 0;
	    this.form2.material_fee.value    = 0;
	    this.form2.etc_fee.value         = 0;
	    this.form2.DC_percent.value      = 0;
	    this.form2.DC_amount.value       = 0;
	    this.form2.dc_total.value   = 0;
	    this.form2.agent_cashback.value  = 0;
	    this.form2.cm_rate.value         = 0;
	    this.form2.total_amount.value    = 0;
	    this.form2.profit_amount.value   = 0;
}

function tuition_view()
{
	this.div.style.position == "absolute";
	this.div.style.display == 'inline';
}

// obj1 = tuition_seq, obj2 = office, obj3 = cm_rate, obj4 = total_tution, obj5=staff_id, obj6=etc
function invoice_insert(obj1,obj2,obj3,obj4,obj5,obj6,obj7)
{
	var location = "../invoice/invoice_insert.asp?tuition_seq="+obj1+"&office_cd="+obj2+"&cm_rate="+obj3+"&total_tuition="+obj4+"&staff_id="+obj5+"&others="+obj6+"&agent_cashback="+obj7;
	window.open(location,'Tuition','width=740, height=260, top=0, left=0, scrollbars=yes');
}

// tuition fee ÀÔ·Â
function tuition_insert(obj1,obj2)
{
	var location = "../tuition/tuition_fee_insert.asp?enroll_seq="+obj1+"&c_rate="+obj2;
	window.open(location,'Tuition','width=740, height=420, top=0, left=0, scrollbars=yes');
}

// tuition fee ¼öÁ¤
function tuition_modify(obj1,obj2){
	var obj1;
	var obj2;
	var location = "../tuition/tuition_fee_modify.asp?tuition_seq="+obj1+"&v_type="+obj2;
	window.open(location,'tuition_fee_modify','width=740, height=420, top=0, left=0, resizable=no, scrollbars=yes');
}

function tuition_delete(tuition_seq){
	  var tuition_seq;
	  
  	if (confirm("»èÁ¦µË´Ï´Ù. Á¤¸» Áö¿ì½Ã°Ú½À´Ï±î? È®ÀÎÀ» ´©¸£½Ã¸é »èÁ¦ µË´Ï´Ù") == false){
  			return;
  	}	  
	  parent.hidden_frm.location.href = "../tuition/tuition_delete_process.asp?tuition_seq="+tuition_seq;
}

function invoice_modify(obj1){
	var obj1;
	var location = "../invoice/invoice_modify.asp?invoice_no="+obj1;
	window.open(location,'tuition_fee_modify','width=740, height=260, top=0, left=0, resizable=no, scrollbars=yes');
}

function invoice_cancel(invoice_no, cancel_yn){
	  var invoice_no;
	  var cancel_yn;
	  parent.hidden_frm.location.href = "../invoice/invoice_cancel_process.asp?invoice_no="+invoice_no+"&cancel_yn="+cancel_yn;
}

function invoice_delete(invoice_no){
	  var invoice_no;
	  
  	if (confirm("»èÁ¦µË´Ï´Ù. Á¤¸» Áö¿ì½Ã°Ú½À´Ï±î? È®ÀÎÀ» ´©¸£½Ã¸é »èÁ¦ µË´Ï´Ù") == false){
  			return;
  	}	  
	  parent.hidden_frm.location.href = "../invoice/invoice_delete_process.asp?invoice_no="+invoice_no;
}

//----------¾îÄ«¿îÆÃ °ü·Ã
// ÀÔ·Â
function acc_insert(){
	var location = "acc_insert.asp";
	window.open(location,'popup','width=500, height=300');
}

// ¼öÁ¤
function tuition_modify(obj1,obj2){
	var obj1;
	var obj2;
	var location = "../tuition/tuition_fee_modify.asp?tuition_seq="+obj1+"&v_type="+obj2;
	window.open(location,'tuition_fee_modify','width=740, height=420, top=0, left=0, resizable=no, scrollbars=yes');
}

// Äµ½½
function acc_cancel(acc_no, cancel_yn){
	  var acc_no;
	  var cancel_yn;
	  parent.hidden_frm.location.href = "../accounting/acc_cancel_process.asp?acc_no="+acc_no+"&cancel_yn="+cancel_yn;
}

// IFRAME Å©±âÀÚµ¿Á¶Àý
function resizeFrame(iframeObj){
        var innerBody = iframeObj.contentWindow.document.body;
        oldEvent = innerBody.onclick;
        innerBody.onclick = function(){ resizeFrame(iframeObj, 1);oldEvent; };
        var innerHeight = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight);
        iframeObj.style.height = innerHeight;
        var innerWidth = innerBody.scrollWidth + (innerBody.offsetWidth - innerBody.clientWidth);
        iframeObj.style.width = innerWidth;     
        if( !arguments[1] )        /* Æ¯Á¤ ÀÌº¥Æ®·Î ÀÎÇÑ È£Ãâ½Ã ½ºÅ©·ÑÀ» ±×³É µÐ´Ù. */
                this.scrollTo(1,1);
}

function s_viw(str){
	var location = "/school/school_view.asp?school_seq="+str;
	window.open(location,'ÇÐ±³Á¤º¸','width=750, height=1000, top=0, left=0, resizable=no, scrollbars=yes');
}


function move_page(obj){
	location.href(obj);
}

function move_prev(){
	history.back();
}

function move_page_onPop(_url, _name, _width, _height){
	window.open(_url, _name, 'scrollbars=yes,width='+_width+', height='+_height);
}

function embedswf(aaa,bbb,ccc){
 document.write("<embed src='"+aaa+"' width='"+bbb+"' height='"+ccc+"'>")
}
-->