﻿<!--
var _dayOfMonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);


// 로그인
function goLogin(){
  document.studylogin.action="http://www.24study.co.kr/members/login/login_form.asp";
  document.studylogin.submit();
}

// 로그아웃
function goLogout(){
  document.studylogin.action="http://www.24study.co.kr/members/login/login_out.asp";
  document.studylogin.submit();
}

// 개체 보기/닫지
function OnDisplayMore(oView){
  var obj = document.getElementById(oView);
  if (obj.style.display == "none"){
    obj.style.display = "block";
  }else{
    obj.style.display = "none";
  }
}

//문자열내의 모든 공백제거
function SpaceRemoveAll(str) {
  var indexNo, ilen;
  
  while(true) {
    indexNo = str.indexOf(" ");
    if(indexNo == -1) break; //공백이 없으면 종료 합니다.
    ilen = str.length;       //문자열 길이를 구합니다.
    str = str.substring(0,indexNo) + str.substring((indexNo+1),ilen); //공백을 잘라 냅니다.
  }
  return str;
}
//날짜 SelectBox 변경
function SetDaySelectBox(yearObj, monthObj, dayObj) {
  var    i, year, month ;
  
  year = parseInt(yearObj.options[yearObj.selectedIndex].text,10);
  month = parseInt(monthObj.options[monthObj.selectedIndex].text,10);
  
  if (IsLeapYear(year) == true)
    _dayOfMonth[1] = 29;
  else
    _dayOfMonth[1] = 28;
  
  dayObj.length = _dayOfMonth[month - 1];
  
  for (i = 1; i <= dayObj.length; i++) {
    dayObj.options[i - 1].value  = (i < 10) ? ('0' + i) : i;
    dayObj.options[i - 1].text  = (i < 10) ? ('0' + i) : i;
  }
}
  
function IsLeapYear(iYear) {
  if(iYear % 4 == 0) {
    if(iYear % 100 == 0) {
      if(iYear % 400 == 0) return true;
      return false;
    }
    else return true;
  }
  return false;
}

//주민번호 체크 (정상 : 1, 앞번호 오류 2, 뒷번호 오류 3, 나이제한 오류 4)
function checkJumin(preNo,postNo,limitAge){
  var  chk=0
  var  yy=preNo.substring(0,2);
  var  mm=parseInt(preNo.substring(2,4));
  var  dd=parseInt(preNo.substring(4,6));
  var  sex=parseInt(postNo.substring(0,1));
  if((preNo.length!=6)) {
    return 2;
  }
  if((sex!=1 & sex!=2 & sex!=3 & sex!=4)||(postNo.length!=7)){
    return 3;
  }
  if(sex <= 2) yy = "19"+yy;
  else yy = "20"+yy;
  
  var d=new Date(); 
  var cy=d.getYear(); //올해
  var cm=d.getMonth()+1;//이번달
  var cd=d.getDate();//오늘날짜
  var iage = 0;
  if (parseInt(mm) < parseInt(cm)) iage=cy-yy;
  else {
    if (dd < parseInt(cd)) iage=cy-yy;
    else iage=cy-yy-1;
  }
  if(iage < 14) return 4;
  for(var  i=0;i<=5;i++){
    chk=chk+((i%8+2)*parseInt(preNo.substring(i,i+1)))
  }
  for(var  i=6;i<=11;i++){
    chk=chk+((i%8+2)*parseInt(postNo.substring(i-6,i-5)))
  }
  chk=11-(chk  %11)
  chk=chk%10
  if(chk!=postNo.substring(6,7)){
    return 3;
  }
  return 1;
}

//숫자만 눌리게  하기 , 방향키  +  Delele + BackSpace
function onlynum() {
  var  iCode  =  event.keyCode;
  if(!(  ((iCode  >= 48) &&  (iCode <=  57)) ||  ((iCode  >= 37) &&  (iCode <=  40)) ||  ((iCode  >= 96) &&  (iCode <=  105))  || (iCode  == 8 ) ||  (iCode ==  46 )|| (iCode  == 9 ))  )  event.returnValue  =  false;
}

// Trim 함수
String.prototype.trim = function() {
  return this.replace(/(^ *)|( *$)/g, "");
}
String.prototype.ltrim = function() {
  return this.replace(/(^ *)/g, "");
}
String.prototype.rtrim = function() {
  return this.replace(/( *$)/g, "");
}

// 부동산용어검색
function open_realtyword() {
  openwindow('http://www.24study.co.kr/common/realty_word.asp','',660,660,'scrollbars=yes','','');
}

// 회원정보수정
function open_mem_modify() {
  openwindow('http://www.24study.co.kr/members/mem_pre_modify.asp','mem_modify',845,600,'scrollbars=yes','','');
}

// 팝업창을 원하는 위치에 생성합니다.
function openwindow(url, name, width, height, option, align, valign) 
{
  var x,y;
  var window_option = "width="+width+",height="+height;
  if(!isalivewindow(name)) name.closed = true;
  if (option!=null) window_option+=","+option;
  if (align==null) align="center";
  if (valign==null) valign="center";

  if (align=="left") x=0;
  else if (align=="right") x=(screen.width-width);
  else if (align=="center") x=(screen.width-width)/2

  if (valign=="top") y=0;
  else if (valign=="bottom") y=(screen.height-height);
  else if (valign=="center") y=(screen.height-height)/2

  window_option+=",left="+x+",top="+y;

  window.open(url,name,window_option);
  //winPop.focus();
}

// 윈도우가 열려있는지 체크합니다.
function isalivewindow(win)
{
  if (!win.closed) return true;
  else return false;
}

// 페이지 이동을 합니다.
// @param    delay    페이지 이동 지연 시간 (milliseconds)
function movepage(str,delay)
{
  if (delay==null) 
    window.location.href=str;
  else 
    window.setinterval("window.location.href='"+str+"'",delay);
}

// 현재 히스토리 엔트리에 페이지를 읽어들입니다. (뒤로가기 버튼 비활성화)
function replacepage(str,delay)
{
  if (delay==null) 
    window.location.replace(str);
  else 
    window.setinterval("window.location.replace('"+str+"')",delay);
}

// 현재 페이지 새로 고침
function reloadpage(delay)
{
if (delay==null) 
    window.location.reload();
  else 
    window.setinterval("window.location.reload()",delay);
}

// 문자열을 클립보드에 복사합니다. (ie전용)
function copytoclip(str) 
{
  if (window.document.all) // ie일때
    window.clipboarddata.setdata('text',str);
}

// 브라우저의 시작페이지 변경창을 띄웁니다. (ie전용)
function sethomepage(url) 
{
  window.document.write("<span id='objhomepage' style='behavior:url(#default#homepage); display:none;' >s</span>");
  window.document.all.objhomepage.sethomepage(url);
}

// 브라우저의 즐겨찾기 추가창을 띄웁니다. (ie전용)
function addfavorite(url, homename) 
{
  window.external.addfavorite(url, homename);
}

// 모니터 해상도를 구합니다.
function getwindowresolution() 
{
  if (window.screen)
  {
    var returnarray = new array(2);
    returnarray[0] = window.screen.width;
    returnarray[1] = window.screen.height;
    return returnarray;
  }
  else return false;
}

// 사용자의 색상 설정을 구합니다.
// @return    색상비트수를 반환합니다. ( 8비트 : 256색, 16비트 : 하이컬러 , 24비트 : 트루컬러 )
function getwindowcolor() 
{
  if (window.screen)
  {
    return screen.colordepth;
  }
}

// 브라우저의 제목표시줄을 설정합니다.
function setwindowtitle(str) 
{
  document.title = str;
}

// 브라우저의 제목표시줄의 문자열을 반환합니다.
function getwindowtitle() 
{
  return document.title;
}

// 브라우저의 상태표시줄을 설정합니다.
function setstatustitle(str) 
{
  window.status = str;
}

// 브라우저의 상태표시줄의 문자열을 반환합니다.
function getstatustitle() 
{
  return window.status;
}

// 한글 마지막 글자의 중성 유무를 체크합니다.
/*
 * ex ) var str = "사탕";
 *    if (checkfinalconsonant(str)) {
 *       window.alert(str+"을 먹었습니다.");
 *    }
 *    else {
 *       window.alert(str+"를 먹었습니다.");
 *    }
*/
function checkfinalconsonant(str) 
{
  var strtemp = str.substr(str.length-1);
  if ((strtemp.charCodeAt(0)-16)%28!=0) return true;
  else return false;
}

// 문자열에 사용해서는 안되는 html태그가 있는지 체크합니다.
function isvalidhtml(str) 
{
  var re = new RegExp("<[\/]{0,1}[^\f\n\r\t\v]*(html|table|tr|td|script|form|xmp|!|iframe|textarea|input|meta)[^\f\n\r\t\v]*","gi");
  var matcharray = str.match(re);
  if (matcharray) return false;
  else return true;
}

//  올바른 메일형식인지 체크합니다.
function isvalidemail(str) 
{
  var re=new RegExp("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$","gi");
  var matcharray=str.match(re);
  if (matcharray) return true;
  else return false;
}

// 올바른 홈페이지형식인지 체크합니다.
function isvalidhomepage(str) 
{
  var re=new RegExp("^((ht|f)tp:\/\/)((([a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3}))|(([0-9]{1,3}\.){3}([0-9]{1,3})))((\/|\\?)[a-z0-9~#%&'_\+=:\?\.-]*)*)$","gi");
  var matcharray=str.match(re);
  if (matcharray) return true;
  else return false;
}

// 올바른 전화번호 형식(숫자-숫자-숫자)인지 체크합니다.
function isvalidphone(str) 
{
  if (str.search(/^(\d+)-(\d+)-(\d+)$/g)!=-1) return true;
  else return false;
}

// 알파벳  숫자만으로 구성된 문자열인지 체크합니다.
function isalphadigit(str) {
  if (str.search(/[^a-zA-Z0-9]/g)==-1) return true;
  else return false;
}

// 알파벳만으로 구성된 문자열인지 체크합니다.
function isalphabet(str) 
{
  if (str.search(/[^a-zA-Z]/g)==-1) return true;
  else return false;
}

// 대문자로만 구성된 문자열인지 체크합니다.
function isuppercase(str) 
{
  if (str.search(/[^A-Z]/g)==-1) return true;
  else return false;
}

// 소문자로만 구성된 문자열인지 체크합니다.
function islowercase(str) 
{
  if (str.search(/[^a-z]/g)==-1) return true;
  else return false;
}

// 한글로만 구성된 문자열인지 체크합니다.
function iskorean(str) 
{
  var strlength = str.length;
  var i;
  var unicode;

  for (i=0;i<strlength;i++) 
  {
    unicode = str.charcodeat(i);
    if ( !(44032 <= unicode && unicode <= 55203) ) return false;  
  }
  return true;
} 

// 숫자만으로 구성된 문자열인지 체크합니다.
function isdigit(str) 
{
  if (str.search(/[^0-9]/g)==-1) return true;
  else return false;
}

// 문자열이 null인지 체크합니다.
function isnull(str) 
{
  if (str == null || str == "") return true;
  else return false;
}

// 문자열에 한칸이상의 스페이스 입력이 있는지를 체크합니다.
function isValidSpace(str) 
{
  if (isnull(str)) return false;
  else {
    if (str.search(/[\s]{2,}/g)!=-1) return false;
    else return true;
  }
}

//키입력이 숫자(NumLock(144), Tab(9), BackSpcace(8), Arrow(← 37,→ 39), Enter(13), Del(46), .(110,190), - (109,189))인지 체크
function isKeyDownNumeric( value, useDot, useMinus )
{
  var bDot = false, bMinus = false;
  if(useDot!="" && useDot != null) bDot = useDot;
  if(useMinus!="" && useMinus != null) bMinus = useMinus;
  if((value < 48 || value > 57) && (value < 96 || value > 105) && value != 35 && value != 36 && value != 37 && value != 39 && value != 8 && value != 9 && value != 46 && value != 13) {
    if(!bDot || value != 190) 
      if(!bMinus || value != 189) { event.returnValue=false; }
  }
}

//영문 및 숫자 키입력이 숫자(NumLock(144), Tab(9), BackSpcace(8), Home(36), End(35) Arrow(← 37,→ 39), Enter(13), Del(46), .(110,190), - (109,189))인지 체크
function isKeyDownAlphaNumeric( value, useDot, useMinus )
{
  var bDot = false, bMinus = false;
  if(useDot!="" && useDot != null) bDot = useDot;
  if(useMinus!="" && useMinus != null) bMinus = useMinus;
  if((value < 48 || value > 57) && (value < 65 || value > 90) && (value < 96 || value > 105) && value != 35 && value != 36 && value != 37 && value != 39 && value != 8 && value != 9 && value != 46 && value != 13) {
    if(!bDot || value != 190) 
      if(!bMinus || value != 189) { event.returnValue=false; }
  }
}
      

//인수로 받은 년월일과 생성한 Date객체의 년월일이 일치하면 true
function isVaildDate(yy,mm,dd){
    --mm;
    var dateVar = new Date(yy, mm, dd);
    return (dateVar.getFullYear()==yy && dateVar.getMonth()==mm && dateVar.getDate()==dd) ? true : false;
}
//인수로 받은 년월일과 생성한 Date객체의 년월일이 일치하면 요일반환
function getWeekName(yy,mm,dd) {
  var dateVar = new Date(yy, mm-1, dd);
  if(isVaildDate(yy,mm,dd)) return ['일','월','화','수','목','금','토'][dateVar.getDay()];
  else return;
}

// 마지막날짜
function isEndDate(val) { 
  var today = new Date(); 
  var meetday = new Date(val); // 월-일-년 d-day날자를 넣습니다. 
  var day = Math.ceil((today-meetday)/24/60/60/1000)-1; 
  return day;
}

//플레쉬 임베드
function  loadFlash(url, width, height, wmode) {
  if(isnull(wmode)) wmode = "window"; //"transparent"
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"' +
                 ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"' +
                 '  width="' + width + '" height="' + height + '">');
  document.write('<param  name = "wmode"  value = "'+wmode+'"  />');
  document.write('<param  name = "movie"  value = "' + url + '"  />');
  document.write('<param name="quality"  value = "best"  />');
  document.write('<param name="allowScriptAccess" value="always" />');
  document.write('<embed src = "' + url + '"' +
                 '  quality = "best"' +
                 '  pluginspage = "http://www.macromedia.com/go/getflashplayer"' +
                 '  type = "application/x-shockwave-flash"' +
                 '  width = "' + width + '" height="' + height +'" allowScriptAccess="always" wmode="' + wmode +'"></embed>');
  document.write('</object>');
}

// 천단위 "," 찍기
function comma(str) {
  str = new String(str);
  this.str = str;
  len = str.length;
  str1 = "";

  for(i=1; i<=len; i++) {
   str1 = str.charAt(len-i)+str1;
   if((i%3 == 0)&&(len-i != 0)) str1 = ","+str1;
  }
  return str1;
}

function check_loginform(oForm) {
  if(SpaceRemoveAll(oForm.studyid.value) == "" || SpaceRemoveAll(oForm.studyid.value) == "아이디" ) { alert("아이디를 입력해 주세요."); return false; }
  oForm.studyid.value = SpaceRemoveAll(oForm.studyid.value);
  if(SpaceRemoveAll(oForm.studypw.value) == "") { alert("비밀번호를 입력해 주세요."); return false; }
  oForm.studypw.value = SpaceRemoveAll(oForm.studypw.value);
  //oForm.action = "https://www.joinsland.com/edubook/login_proc.asp";
  oForm.action = "/members/login/login_proc.asp";
  //document.getElementById("btnLogin").style.display = 'none';
  return true;
}

function goLogin(){
	document.studylogin.action="http://www.24study.co.kr/members/login/login.asp";
  document.studylogin.submit();
}

function goLogout(){
  document.studylogin.action="http://www.24study.co.kr/members/logout/logout.asp";
	document.studylogin.submit();
}

function doBlink() {
  if(!document.all) return;
  else {  
    var blink = document.getElementsByTagName("blink"); 
    for (var i=0; i < blink.length; i++){
      blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "";
    }
  }
} 

function startBlink(){
  setInterval("doBlink()",600);
} 

//====popup
function openStudyWin(theURL,winName,features) { //v2.0
	var eduWin = window.open(theURL,winName,features);
	eduWin.focus();
}

function CheckStrLen(inputText, MaxLen)
{
	var i, len=0;

	for(i=0 ; i < inputText.length ; i++) (inputText.charCodeAt(i) > 255)? len+=2:len++;

	if (MaxLen < len)
		return false;
	else
		return true;
}
//-->

