document.writeln ("<iframe name='ckFrame' ID='ckFrame' width=500 frameborder=0 height=0 hspace=0 vspace=0 marginwidth=0 marginheight=0 src='' scrolling='0'></iframe>");
document.writeln ("<iframe name='ckAuth' ID='ckAuth' width=0 height=0 frameborder=0 hspace=0 vspace=0 marginwidth=0 marginheight=0 src='' scrolling='no'></iframe>");
init();



/*-----------------------------------------------*/
// °ËÁõÇÒ iFrame ÃÊ±âÈ­
/*-----------------------------------------------*/
function init(){
	ckFrame.document.location.href = "about:blank";
	ckAuth.document.location.href = "about:blank";
}



/*-----------------------------------------------*/
// IDÁßº¹È®ÀÎ
/*-----------------------------------------------*/
function check_DuplicatID(ckSubmit,itemFil,objID,objSiteKey){
	if (check_ID_Pwd("ID(¾ÆÀÌµð)",objID)){
		ckFrame.document.location.href="/common/fnc_srv/check_ID_RegNo.asp?ckSubmit="+ckSubmit+"&ckFil="+itemFil+"&ckID="+objID.value+"&ckSiteKey="+objSiteKey.value;
		return;
	}
}
/*-----------------------------------------------*/
// È¸¿ø°¡ÀÔÈ®ÀÎ
/*-----------------------------------------------*/
function check_DuplicatRegNo(ckSubmit,itemFil,objName,objRegNo,objMemberTarget){
	if (check_TextBlank("¼º¸í",objName,"") && check_TextBlank("ÁÖ¹Îµî·Ï¹øÈ£",objRegNo,"")){
		ckFrame.document.location.href="/common/fnc_srv/check_ID_RegNo.asp?ckSubmit="+ckSubmit+"&ckFil="+itemFil+"&ckName="+objName.value+"&ckID="+objRegNo.value+"&ckMemberTarget="+objMemberTarget.value;
		return;
	}
}
/*-----------------------------------------------*/
// ½Ç¸íÈ®ÀÎ
/*-----------------------------------------------*/
function check_RegNo2(ckSubmit,itemFil,objName,objRegNo,objMemberTarget){
	if (check_TextBlank("¼º¸í",objName,"") && check_TextBlank("ÁÖ¹Îµî·Ï¹øÈ£",objRegNo,"")){
		ckFrame.document.location.href="/common/fnc_srv/check_ID_RegNo.asp?ckOnly=&ckSubmit="+ckSubmit+"&ckFil="+itemFil+"&ckName="+objName.value+"&ckID="+objRegNo.value+"&ckMemberTarget="+objMemberTarget.value;
		return;
	}
}

/*-----------------------------------------------*/
// ½Ç¸íÈ®ÀÎ-±¤°íÁÖ
/*-----------------------------------------------*/
function check_RegNo3(ckSubmit,itemFil,objName,objRegNo){
	if (check_TextBlank("¼º¸í",objName,"") && check_TextBlank("ÁÖ¹Îµî·Ï¹øÈ£",objRegNo,"")){
		ckFrame.document.location.href="/common/fnc_srv/check_ID_RegNo.asp?ckOnly=&ckSubmit="+ckSubmit+"&ckFil="+itemFil+"&ckName="+objName.value+"&ckID="+objRegNo.value;
		return;
	}
}
/*-----------------------------------------------*/
// ¼¼¹«»ç/È¸°è»ç µî·Ï¹øÈ£ È®ÀÎ(±¸ºÐ,¼º¸í,µî·Ï¹øÈ£)
/*-----------------------------------------------*/
function check_Pro_RegNo(ckSubmit,itemFil,strTable,objName,objProRegNo){
	if (check_TextBlank("¼º¸í",objName,"") && check_TextBlank("µî·Ï¹øÈ£",objProRegNo,"")){
		ckFrame.document.location.href="/common/fnc_srv/check_ID_RegNo.asp?ckSubmit="+ckSubmit+"&ckFil="+itemFil+"&ckTable="+strTable+"&ckName="+objName.value+"&ckID="+objProRegNo.value;
		return;
	}
}
/*-----------------------------------------------*/
// Login
/*-----------------------------------------------*/
// Login("LoginEnd()","PWD",document.frmLogin.v_SiteKey, document.frmLogin.v_ID, document.frmLogin.v_PWD, document.frmLogin.v_Save);

//function LoginSSL(){
//	frmLogin.method="POST";
//	frmLogin.action="/common/fnc_srv/LoginSSL.asp";		//½Ç¼­¹ö https://www.stscenter.co.kr/common/fnc_srv/LoginSSL.asp
//	frmLogin.submit();
//	return true;
//}

//#####################################
// ## À¥È¸¿ø ·Î±×ÀÎ Ã³¸® ½ºÅ©¸³Æ®
function EnterKeySubmitSSL()
{
	if(event.keyCode == 13)
		checkLoginFormSSL()
}

// SSL º¸¾ÈÁ¢¼Ó Function
function checkLoginFormSSL(){
	var expdate = new Date();
	var vAction;
	var vDomain = document.domain;
	//alert("SSL2");
	if (check_Login_item()==false) return;
	
	if (frmLogin.v_idSave.checked){
		expdate.setTime(expdate.getTime() + 1000 * 3600 * 24 * 30); // 30ÀÏ
	}else{
		expdate.setTime(expdate.getTime() - 1); // ÄíÅ° »èÁ¦Á¶°Ç
	}

	setCookie("membersaveid", frmLogin.v_ID.value, expdate);
	
	if(vDomain.indexOf("dev-") == -1){
		//LoginSSL();
		//return;
		vAction = "https://www.stscenter.co.kr/common/fnc_srv/Login.asp"
	}else{
		//Login("LoginEnd()","PWD",document.frmLogin.v_SiteKey,document.frmLogin.v_ID,document.frmLogin.v_PWD,document.frmLogin.chkSave);
		//return;
		vAction = "/common/fnc_srv/Login.asp"
	}

	// SSL¿¡ ÀÇÇÑ µµ¸ÞÀÎÀ» ´Ù¸£°Ô ÀÎ½ÄÇÏ¿© ¼­ºñ½º¼­¹ö ¹Ý¿µ½Ã Å×½ºÆ®°¡ ¸Å¿ì ¾î·Á¿òÀÌ ÀÖÀ½
	// °³¹ß½Ã¿¡´Â ÀÓ½Ã·Î »ç¿ëÇÏ°í ¼­ºñ½º ¿ÀÇÂ½Ã¿¡ Å×½ºÆ®ÈÄ SSL ¹Ý¿µÇØ¾ßÇÔ.
	//vAction = "/common/fnc_srv/Login.asp"
	frmLogin.method="POST";
	frmLogin.action= vAction;
	frmLogin.submit();
	return true;
}


function check_Login_item(){

	if (check_TextBlank("¾ÆÀÌµð",document.frmLogin.v_ID,"")==false) return false;
	if (check_TextBlank("ºñ¹Ð¹øÈ£",document.frmLogin.v_PWD,"")==false) return false;

	return true;
}
function Logout(){
	document.location.href="/common/fnc_srv/LogOut.asp";
	return;
}


//#####################################
// ## ±¤°íÁÖÈ¸¿ø ·Î±×ÀÎ Ã³¸® ½ºÅ©¸³Æ®
function AdvertEnterKeySubmitSSL()
{
	if(event.keyCode == 13)
		AdvertcheckLoginFormSSL()
}

// SSL º¸¾ÈÁ¢¼Ó Function
function AdvertcheckLoginFormSSL(){
	var expdate = new Date();
	var vAction;
	var vDomain = document.domain;
	//alert("SSL2");
	if (check_Login_item()==false) return;
	
	if (frmLogin.v_advertidSave.checked){
		expdate.setTime(expdate.getTime() + 1000 * 3600 * 24 * 30); // 30ÀÏ
	}else{
		expdate.setTime(expdate.getTime() - 1); // ÄíÅ° »èÁ¦Á¶°Ç
	}

	setCookie("advertsaveid", frmLogin.v_ID.value, expdate);
	
	if(vDomain.indexOf("dev-") == -1){
		//LoginSSL();
		//return;
		vAction = "https://www.stscenter.co.kr/common/fnc_srv/AdvertLogin.asp"
	}else{
		//Login("LoginEnd()","PWD",document.frmLogin.v_SiteKey,document.frmLogin.v_ID,document.frmLogin.v_PWD,document.frmLogin.chkSave);
		//return;
		vAction = "/common/fnc_srv/AdvertLogin.asp"
	}

	// SSL¿¡ ÀÇÇÑ µµ¸ÞÀÎÀ» ´Ù¸£°Ô ÀÎ½ÄÇÏ¿© ¼­ºñ½º¼­¹ö ¹Ý¿µ½Ã Å×½ºÆ®°¡ ¸Å¿ì ¾î·Á¿òÀÌ ÀÖÀ½
	// °³¹ß½Ã¿¡´Â ÀÓ½Ã·Î »ç¿ëÇÏ°í ¼­ºñ½º ¿ÀÇÂ½Ã¿¡ Å×½ºÆ®ÈÄ SSL ¹Ý¿µÇØ¾ßÇÔ.
	//vAction = "/common/fnc_srv/AdvertLogin.asp"
	frmLogin.method="POST";
	frmLogin.action= vAction;
	frmLogin.submit();
	return true;
}


function Advertcheck_Login_item(){

	if (check_TextBlank("¾ÆÀÌµð",document.frmLogin.v_ID,"")==false) return false;
	if (check_TextBlank("ºñ¹Ð¹øÈ£",document.frmLogin.v_PWD,"")==false) return false;

	return true;
}
function AdvertLogout(){
	document.location.href="/common/fnc_srv/advertLogOut.asp";
	return;
}
//########################################

function getCookie(Name) {
  var search = Name + "="
  if (document.cookie.length > 0) { // ÄíÅ°°¡ ¼³Á¤µÇ¾î ÀÖ´Ù¸é
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // ÄíÅ°°¡ Á¸ÀçÇÏ¸é
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset)
      // ÄíÅ° °ªÀÇ ¸¶Áö¸· À§Ä¡ ÀÎµ¦½º ¹øÈ£ ¼³Á¤
      if (end == -1)
        end = document.cookie.length
      return unescape(document.cookie.substring(offset, end))
    }
  }
  return "";
}

function setCookie (name, value, expires) {
  document.cookie = name + "=" + escape (value) +
    "; path=/; expires=" + expires.toGMTString() + ";"; 
}
//########################################

function LoginSSL(){
	//var vAction = "https://"+document.domain+"/common/fnc_srv/LoginSSL.asp";
	//alert(vAction);
	frmLogin.method="POST";
	frmLogin.action= "https://www.stscenter.co.kr/common/fnc_srv/LoginSSL.asp";
	frmLogin.submit();
	return true;
}


function Login(ckSubmit,ckFil,objSiteKey,objID,objPWD,objSave){
	var todayDate = new Date();
	var isSave;
	var isSSL;
	var baseUrl;
	todayDate.setDate(todayDate.getDate() + 365);
	
	if(objSave.checked){
		isSave = "Y";
	}else{
		isSave = "N";
	}

	if (check_TextBlank("±×·ìÄÚµå",objSiteKey,"") && check_TextBlank("¾Æ¾Æµð",objID,"") && check_TextBlank("ºñ¹Ð¹øÈ£",objPWD,"")){
		//ckFrame.document.location.href="/common/fnc_srv/Login.asp?ckSubmit="+ckSubmit+"&ckFil="+ckFil+"&ckSiteKey="+objSiteKey.value+"&ckID="+objID.value+"&ckPWD="+objPWD.value;
		ckFrame.document.location.href="/common/fnc_srv/Login.asp?ckSubmit="+ckSubmit+"&ckFil="+ckFil+"&ckSiteKey="+objSiteKey.value+"&ckID="+objID.value+"&ckPWD="+objPWD.value+"&ckSave="+isSave;
		return;
	}
}
/*-----------------------------------------------*/
// LogOut
/*-----------------------------------------------*/
//function Logout(ckSubmit){
//	//document.location.href="/common/fnc_srv/LogOut.asp?ckSubmit="+ckSubmit;
//	ckFrame.document.location.href="/common/fnc_srv/LogOut.asp?ckSubmit="+ckSubmit;
//	return;
//}

/*-----------------------------------------------*/
// useContentCoupon
/*-----------------------------------------------*/
function useContentCoupon(ckSubmit){
	ckFrame.document.location.href="/common/fnc_srv/useContentCoupon.asp?ckSubmit="+ckSubmit;
	return;
}

/*-----------------------------------------------*/
// useContentCoupon
/*-----------------------------------------------*/
function buyContentCoupon(ckSubmit){
	ckFrame.document.location.href="/common/fnc_srv/buyContentCoupon.asp?ckSubmit="+ckSubmit;
	return;
}

/*-----------------------------------------------*/
// Check RegNo len(ÁÖ¹Îµî·Ï¹øÈ£ ÀüÃ¼ : 13, µÚºÎºÐ : 7)
/*-----------------------------------------------*/
function checkRegNo(ckSubmit,ckFil,objRegNo,len){
	ckFrame.document.location.href="/common/fnc_srv/checkRegNo.asp?ckSubmit="+ckSubmit+"&ckFil="+ckFil+"&ckRegNo="+objRegNo.value+"&ckLen="+len;
	return;
}

/*-----------------------------------------------*/
// Check ID (°ø°³ÀÚ·á/ºñ°ø°³ ÀÚ·á)
/*-----------------------------------------------*/
function check_ViewID(ckSubmit,ckSubmitFalse,ckID,ckSiteKey){
	ckFrame.document.location.href="/common/fnc_srv/checkID.asp?ckSubmit="+ckSubmit+"&ckSubmitFalse="+ckSubmitFalse+"&ckID="+ckID+"&ckSiteKey="+ckSiteKey;
	return;
}

/*-----------------------------------------------*/
// Check Refund (¿¹Ä¡±Ý È¯ºÒ½ÅÃ»¿©ºÎ)
/*-----------------------------------------------*/
function check_Refund(ckSubmit,ckMemberNo){
	ckFrame.document.location.href="/common/fnc_srv/checkRefund.asp?ckSubmit="+ckSubmit+"&ckMemberNo="+ckMemberNo;
	return;
}
