/* ·¹ÀÌ¾î °ü·Ã ½ºÅ©¸³Æ® */
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

/* ÇÃ·¡½Ã ½ºÅ©¸³Æ® */
function __tx__(id){
document.write(document.getElementById(id).value);
}

/* ÇÃ·¡½Ã ½ºÅ©¸³Æ® */
function __ws__(id){
document.write(id.text);id.id='';
}

/* ºê¶ó¿ìÁ® Å¸ÀÌÆ² */
document.title="°³³ä¿ø¸® ÃÊµîÇÐ±³";

/* ÀÚµ¿ ÀÌ¹ÌÁö Æ÷Ä¿½º ¾Æ¿ô */
function autoblur(){ 
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") 
	document.body.focus(); 
} 
	document.onfocusin=autoblur;


//iframe auto resize
function iframe_autoresize(arg) {
    arg.height = eval(arg.name+".document.body.scrollHeight");
}

//Email Çü½Ä check
function Email_chk(Form_Name, Field_Name) {
	var t = eval("document." + Form_Name + "." + Field_Name + ".value");
	var ValidFlag = false;
	var atCount = 0;
	var SpecialFlag;
	var atLoop;
	var atChr;
	var BadFlag;
	var tAry1;
	var UserName;
	var DomainName;
	
	if(t.length > 0 && t.indexOf("@") > 0 && t.indexOf(".") > 0) {
		atCount = 0;
		SpecialFlag = false;
		
		for(atLoop=1; atLoop<=t.length; atLoop++) {
			atChr = t.substring(atLoop, atLoop+1);
			
			if(atChr == "@") atCount = atCount + 1;
			if((atChr >= 32) && (atChr <= 44)) SpecialFlag = true;
			if((atChr == 47) || (atChr == 96) || (atChr >= 123)) SpecialFlag = true;
			if((atChr >= 58) && (atChr <= 63)) SpecialFlag = true;
			if((atChr >= 91) && (atChr <= 94)) SpecialFlag = true;
		}
		
		if((atCount == 1) && (SpecialFlag == false)) {
			BadFlag = false;
			tAry1 = t.split("@");
			UserName = tAry1[0];
			DomainName = tAry1[1];
			
			if((UserName.length <= 0) || (DomainName.length <= 0 )) BadFlag = true;
			if(DomainName.substring(1, 2 ) == ".") BadFlag = true;
			if(DomainName.substring(DomainName.length-1, DomainName.length) == ".") BadFlag = true;
			
			ValidFlag = true;
		}
	}
	
	if(BadFlag == true) ValidFlag = false;
	
	return ValidFlag;
}

//ID Çü½Ä Check
function CheckChar(name) {
	strarr = new Array(name.value.length);
	
	if((name.value.charAt(0) < "a" || name.value.charAt(0) > "z") && (name.value.charAt(0) < "A" || name.value.charAt(0) > "Z")) {
		return true;
	}
	
	for(i = 0; i < name.value.length; i++) {
		strarr[i] = name.value.charAt(i)
		if((strarr[i] >= 0) && (strarr[i] <= 9))
			continue;
		else if((strarr[i] >= "a") && (strarr[i] <= "z"))
			continue;
		else if((strarr[i] >= "A") && (strarr[i] <= "Z"))
			continue;
		else {
			return true;
		}
	}  
	return false;
}

//±ÛÀÚ¼ö Á¦ÇÑ.
function in_ti(word, length) {
	if(word.length > length) {
		word = word.substring(0, length) + "..";
	}
	
	document.write(word);
}

/*
launchCenter(str1, str2, int1, int2, str3)
 - str1 : ÆË¾÷µÉ url 
 - str2 : ÆË¾÷Ã¢ ¸í
 - int1 : ÆË¾÷Ã¢ÀÇ °¡·Î±æÀÌ
 - int2 : ÆË¾÷Ã¢ÀÇ ¼¼·Î±æÀÌ
 - str3 : ±âÅ¸ ÆË¾÷Ã¢ÀÇ Attribute
 - ¼³¸í : ÆË¾÷Ã¢À» ¸ð´ÏÅÍÀÇ ÇÑ°¡¿îµ¥¿¡ À§Ä¡½ÃÅ´
 - ¹ÝÈ¯°ª : ¾øÀ½
*/

// launchCenter(url, name, width, height, att)
function launchCenter(url, name, width, height, att) 
{
  var str = "height=" + height + ",innerHeight=" + height;
  str += ",width=" + width + ",innerWidth=" + width;
  if (window.screen) {
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;

    var xc = (aw - width) / 2;
    var yc = (ah - height) / 2;

    str += ",left=" + xc + ",screenX=" + xc;
    str += ",top=" + yc + ",screenY=" + yc;
    str += "," + att
  }
  return window.open(url, name, str);
}
//----------------------------------------------------------------------------//

/* ÁØºñÁß */
function ready(){
	window.alert("ÇØ´ç¸Þ´º´Â ¼­ºñ½º ÁØºñÁßÀÔ´Ï´Ù.");
}


/* Main */
function main(){
	window.location.href = "../main/main.asp";
}

/* ±³Àç¼Ò°³ */
function book_main(num) { //±³Àç¼Ò°³ ¸ÞÀÎ

	if (num =='1'){ //½ºÅ¸Æ®°úÁ¤
	window.location.href = "../book/book_03.aspx?ItemType=1";
	}
	
	else if (num =='2'){ //±âº»¿ø¸®°úÁ¤
	window.location.href = "../book/book_03.aspx?ItemType=2";
	}
	
	else if (num == '3'){ //¹ßÀüÀÀ¿ë°úÁ¤
	window.location.href = "../book/book_03.aspx?ItemType=3";
	}
	
	else if (num == "4"){ //¹®Á¦À¯Çü°úÁ¤
	window.location.href = "../book/book_03.aspx?ItemType=6";
	}

	else if (num == "5"){ //½ÉÈ­°æ½Ã°úÁ¤
	window.location.href = "../book/book_03.aspx?ItemType=4";
	}

	else if (num == "6"){ //ÃÖ»óÀ§°úÁ¤
	window.location.href = "../book/book_03.aspx?ItemType=5";
	}
	
	else { //
	window.location.href = "../book/book_03.aspx";
	}

}

/* °­ÀÇ ¼Ò°³ */
function intro_01(){	//
	window.location.href = "../intro/intro_01.asp";
}
function intro_02(){	//
	window.location.href = "../intro/intro_02.asp";
}
function intro_03(){	//
	window.location.href = "../intro/intro_03.asp";
}

/* Ä¿¹Â´ÏÆ¼ */
function comm_01(){	//
	window.location.href = "#";
}
function comm_02(){	//
	window.location.href = "#";
}


/* ÇÃ·¹ÀÌ¾î */
function player_win(ld_code, path, lm_code) {
	if(lm_code == null) {
		if(path.toLowerCase() == "high_path") {
			//window.open("../player/player.aspx?LD_Code=" + ld_code + "&path=" + path, "player", "width=949,height=592,left=0,top=0,scrollbarsy=yes");
			window.open("../player/player.aspx?LD_Code=" + ld_code + "&path=" + path, "player", "width=671,height=430,left=0,top=0,scrollbarsy=yes");
		} else {
			window.open("../player/player.aspx?LD_Code=" + ld_code + "&path=" + path, "player", "width=671,height=430,left=0,top=0,scrollbarsy=yes");
		}
	} else {
		if(path.toLowerCase() == "high_path") {
			//window.open("../player/player.aspx?LM_Code=" + lm_code + "&path=" + path, "player", "width=949,height=592,left=0,top=0,scrollbarsy=yes");
			window.open("../player/player.aspx?LM_Code=" + lm_code + "&path=" + path, "player", "width=671,height=430,left=0,top=0,scrollbarsy=yes");
		} else {
			window.open("../player/player.aspx?LM_Code=" + lm_code + "&path=" + path, "player", "width=671,height=430,left=0,top=0,scrollbarsy=yes");
		}
	}
}

//³¯Â¥Ã¼Å©
function isJDate(ymd) {
	if(ymd.split("-").length != 3) {
		return true;
	}
	
	yy = ymd.split("-")[0];
	mm = ymd.split("-")[1];
	dd = ymd.split("-")[2];
	
	if(isNaN(yy)) {
		return true;
	}
	
	if((yy < 1901) || (yy > 2078)) {
		return true;
	}
	
	if(isNaN(mm)) {
		return true;
	}
	
	if((mm < 1) || (mm > 12)) {
		return true;
	}
	
	if(isNaN(dd)) {
		return true;
	}
	
	if(mm == 1 || mm == 3 || mm == 5 || mm == 7 || mm == 8 || mm == 10 || mm == 12) {
		kk = 31;
	} else if(mm == 4 || mm == 6 || mm == 9 || mm == 11) {
		kk = 30;
	} else if((yy % 4 == 0 && yy % 100 != 0) || (yy % 400 == 0)) {
		kk = 29;
	} else {
		kk = 28;
	}
	
	if((dd < 1) || (dd > kk)) {
		return true;
	}
	
	return false;
}

/* È¸»ç¼Ò°³ */
function company(){ //È¸»ç¼Ò°³
    window.open("http://home.imath.tv/", "_blank");
}

/* ÇÐ³âº° ÁýÁß ÇÐ½À¹ý ÆË¾÷ */
function oncl(url) {
    window.open("../stu_system/" + url + ".htm", "study_system", "status=no,resizable=no,width=700,height=550,scrollbars=yes,top=0,left=50");
}
