// title
//document.title="깨물고 싶은 대전액션, 케로로 파이터";



// openwindow
function openwindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}

// location
function locationUrl(url){
	window.location = url;
}

// swapImg
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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 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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function pop(url,intWidth,intHeight) { 
	window.open(url, "_blank", "width="+intWidth+",height="+intHeight+",resizable=0,scrollbars=0") ;
}
function pop_scroll(url,intWidth,intHeight) { 
	window.open(url, "_blank", "width="+intWidth+",height="+intHeight+",resizable=0,scrollbars=1") ;
}
//검은투명레이어열기
function black(idname) { 
	//layer_black.style.display = "block";
	document.getElementById(idname).style.display="block";
}
function layer_close(idname) { 
	document.getElementById(idname).style.display="none";
}

function flash(url,id,width,height){
document.write('<object width="'+width+'" height="'+height+'" id="'+id+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" type="application/x-shockwave-flash">'
+'<param name="movie" value="'+url+'">'
+'<param name="quality" value="high">'
+'<param name="wmode" value="transparent">'
+'<param name="allowScriptAccess" value="always">'
+'<param name="FlashVars" value="playMode=embeded">'
+'<param name="swliveconnect" value="true" />'
+'<embed src="'+url+'" quality="high" allowscriptaccess="always" pluginspage="http://www.macromedia.com/go/getflashplayer" width="'+width+'" height="'+height+'" type="application/x-shockwave-flash" ></embed>'
+'</object>');
}

function movie(url,id,width,height){
	document.write('<object type="video/x-ms-wmv" data="http://www.sarahsnotecards.com/catalunyalive/fishstore.wmv" width="'+width+'" height="'+height+'">'
	+'<param name="AutoSize" value="0">'
	+'<param name="AutoStart" value="1">'
	+'<param name="AutoRewind" value="1">'
	+'<param name="ClickToPlay" value="1">'
	+'<param name="Enabled" value="1">'
	+'<param name="ShowTracker" value="1">'
	+'<param name="EnableTracker" value="0">'
	+'<param name="EnableContextMenu" value="0">'
	+'<param name="ShowStatusBar" value="0">'
	+'<param name="ShowControls" value="0">'
	+'<param name="ShowAudioControls" value="0">'
	+'<param name="ShowCaptioning" value="0">'
	+'<param name="Mute" value="0">'
	+'<param name="ShowDisplay" value="0">'
	+'<param name="BufferingTime" value="3">'
	+'<param name="PlayCount" value="1">'
	+'<param name="FileName" value='+url+'>'
	+'</object>');
}

function resizeIframe(fr) { 
                fr.setExpression('height',resize_frame.document.body.scrollHeight); 
                fr.setExpression('width',resize_frame.document.body.scrollWidth); 
} 
function goURLbySelect(url,target) {
	if (url) {
		target.document.location.href = url ;
	}
}

/********************************************************************
*  Function Name		: resizeFrame
*  Description			: 아이프레임 자동 사이
*  Input Data			: tagURL
*  Output Data			: None
*  사용되는 Function 		: None
/********************************************************************/
function resizeFrame(){
		var oBody = iframe_event.document.body;
		var oFrame = document.all("iframe_event");
		oFrame.style.height = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight);
		oFrame.style.width = oBody.scrollWidth + (oBody.offsetWidth - oBody.clientWidth);
}

//PNG

function setPNG24(obj) {
    obj.width=obj.height=1;
    obj.className=obj.className.replace(/\bPNG24\b/i,'');
    obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
    obj.src='';
    return '';
}


// Form 문에서 값을 체크하기 위한 함수 모음
	/*--------------------------------------------------------------------------
	* 사용 예 :
	* <FORM name="form1" onSubmit="return chkForm(this)">
	* input tag에 대한 설명
	* <input
	*	type="text" 	//형식
	*	name="id" 		//이름
	*	hname="아이디" 	//한글 이름
	*	pattern="regId" //어떤 정규식으로 처리할지 선언 (pattern="/^[a-zA-Z]+$/")
	*	required 		//필수 항목에 설정
	*   maxlength=10 	//길이 제한(byte)
	* >
	*-------------------------------------------------------------------------*/
	
	// 폼객체의 이름을 가져오기. 나중에 에러메세지 등에 사용할 객체 이름을 적을것.
	function FormGetElementName(obj)
	{
		if (obj.getAttribute("hname") != null) {
			return obj.hname;
		} else {
			return obj.name;
		}
	}
	// 패턴하고 비교하여 패턴에 맞지 않는 값일 경우 alert 메세지 띄움.
	function FormCheckPattern(obj,pattern,hname)
	{
		var regNum = /^[0-9]+$/;
		var regPhone =/^[0-9]{2,3}-[0-9]{3,4}-[0-9]{4}$/;
		var regMail =/^[_a-zA-Z0-9-]+@[._a-zA-Z0-9-]+\.[a-zA-Z]+$/;
		var regDomain =/^[.a-zA-Z0-9-]+.[a-zA-Z]+$/;
		var regAlpha =/^[a-zA-Z]+$/;
		var regHost =/^[a-zA-Z-]+$/;
		var regHangul =/[가-힣]/;	
		var regHangulEng =/[가-힣a-zA-Z]/;
		var regHangulEngNum =/[가-힣a-zA-Z0-9]/;
		var regHangulOnly =/^[가-힣]*$/;	
		var regPasswd = /^[a-zA-Z0-9_-]+$/;
		var regPlainPhone = /^[0-9_-]+$/;
		var regDate =/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/;
		var regEngNum =/[a-zA-Z0-9]/;
	
		pattern = eval(pattern);
	
		if(!pattern.test(obj.value)){
			alert("" + hname + " 항목의 형식이 올바르지 않습니다.");
			obj.focus();
			return false;
		}
		return true;
	}
	
	// 문자열의 길이를 계산.
	function StringLength(str)
	{
	//	return (str.length + (escape(str) + "/%u").match(/%u/g).length-1);
	    var l = 0;
	    for (var i=0; i<str.length; i++)
	    	l += (str.charCodeAt(i) > 128) ? 2 : 1;
	    return l;
	}
	
	// form 객체의 maxlength를 가져와 길이 비교를 하고 넘어갈 경우 alert 메세지를 띄움.
	function FormGetElementLength(obj,len,hname)
	{
		if(StringLength(obj.value) > len){
			alert("" + hname + " 항목은 " + "최대 " + len + "byte로 입력이 제한되어 있습니다.\n\n(영문숫자1byte,한글2byte로 계산)");
			obj.focus();
			return false;
		}
	
		return true;
	}
	
	function FormMinElementLength(obj,len,hname)
	{
		if(StringLength(obj.value) < len){
			alert("" + hname + " 항목은 " + "최소 " + len + "byte 이상입니다.\n\n(영문숫자1byte,한글2byte로 계산)");
			obj.focus();
			return false;
		}
	
		return true;
	}
	
	// value가 없을 경우 select, text에 따라 적절한 alert 메세지 띄움
	function FormCheckText(obj, hname)
	{
		if(obj.value.length < 1){
			if (obj.tagName.toUpperCase() == "SELECT")
				alert("" + hname + " 항목을 선택하여 주십시요.");
			else
				alert("" + hname + "를 입력해 주세요.");
	
			obj.focus();
			return false;
		}
		return true;
	}
	
	function FormCheckSelect(obj, hname)
	{
		if(obj.value.length < 1){
			alert("" + hname + " 항목을 선택하여 주십시요.");
			obj.focus();
			return false;
		}
		return true;
	}
	
	function FormCheckCheckbox(form, ele, hname)
	{
	
		//obj = eval(form.name+'.'+ele.name);
		obj = document.getElementsByName(ele.name);
		
		//2006-05-02 체크박스가 여러개일경우 추가
		if(obj.length > 1){
			var count = 0;
			for (i = 0; i < obj.length; i++) {
	       		if (obj[i].checked == true ) {
	    			count++;
				}
			}
			
			if (count == 0 ) { 
				alert("" + hname + " 항목을 선택하여 주십시요.");
				return false;
			}
		}
		else{
			
			alert("" + hname + " 항목을 선택하여 주십시요.");
			obj.focus();
			return false;
		}
	
		return true;
		
		/*
		if (!obj.checked){
			alert("" + hname + " 항목을 선택하여 주십시요.");
			obj.focus();
			return false;
		}
		return true;
		*/
	
	}
	
	function FormCheckRadio(form, ele, hname)
	{
		obj = eval(form.name+'.'+ele.name);
		for (i=0;i<obj.length;i++) {
			if (obj[i].checked)
				return true;
		}
		alert("" + hname + " 항목을 선택하여 주십시요.");
		obj.focus();
		return false;
	}
	
	// 실제 Form 객체들의 값들을 체크하는 함수
	function FormValidate(f)
	{
		var i,currEl;
	
		for(i = 0; i < f.elements.length; i++){
			currEl = f.elements[i];
	
			//필수 항목을 체크한다.
			if (currEl.getAttribute("required") != null){
				if(currEl.type.toUpperCase() == "TEXT" || currEl.tagName.toUpperCase() == "SELECT" || currEl.tagName.toUpperCase() == "TEXTAREA" ||currEl.type.toUpperCase() == "PASSWORD" || currEl.type.toUpperCase() == "FILE" || currEl.type.toUpperCase() == "HIDDEN"){
					if(!FormCheckText(currEl,FormGetElementName(currEl)))
						return false;
				}
				else if(currEl.type.toUpperCase() == "CHECKBOX"){
					if(!FormCheckCheckbox(f, currEl,FormGetElementName(currEl)))
						return false;
				}
				else if(currEl.type.toUpperCase() == "RADIO"){
					if(!FormCheckRadio(f, currEl,currEl.hname))
						return false;
				}
			}
	
			// 길이 제한을 체크한다.
			if(currEl.type.toUpperCase() == "TEXT" || currEl.tagName.toUpperCase() == "TEXTAREA" ||currEl.type.toUpperCase() == "PASSWORD") {
				if(currEl.getAttribute("maxlength") != null && currEl.value.length > 0){
					if(!FormGetElementLength(currEl,currEl.getAttribute("maxlength"),FormGetElementName(currEl))) {
						return false;
					}
				}
				
				if(currEl.getAttribute("minlength") != null && currEl.value.length > 0){
					if(!FormMinElementLength(currEl,currEl.getAttribute("minlength"),FormGetElementName(currEl))) {
						return false;
					}
				}
			}
	
			// 입력 패턴을 체크한다.
			if(currEl.getAttribute("pattern") != null && currEl.value.length > 0){
				if(!FormCheckPattern(currEl,currEl.pattern,FormGetElementName(currEl)))
					return false;
			}
		}
	
		return true;
	}

	/**
	*	파일 사이즈를 용량 표시와 함께 리턴 한다.
	*/
	function getFileSize(nSize) {
		if (nSize <= 1024)
			return parseInt(nSize) + " byte";
		else if (nSize <= 1024 * 1024)
			return parseInt(nSize / 1024 * 100) / 100 + " Kbyte";
		else if (nSize <= 1024 * 1024 * 1024)
			return parseInt(nSize / (1024 * 1024) * 100) / 100 + " Mbyte";

		return parseInt(nSize / (1024 * 1024 * 1024) * 100) / 100 + " Gbyte";
	}
// 쿠키관련 모음
	function popup_setcookie( name, value, expiredays )
	{
		var todayDate = new Date(); 
		todayDate.setDate( todayDate.getDate() + expiredays ); 
		document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" 
	}
	
	
	function popup_getCookie(name)
	{
	        var nameOfCookie = name + "=";
	        var x = 0;
	        while ( x <= document.cookie.length )
	        {
	                var y = (x+nameOfCookie.length);
	                if ( document.cookie.substring( x, y ) == nameOfCookie ) {
	                        if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
	                                endOfCookie = document.cookie.length;
	                       return unescape( document.cookie.substring( y, endOfCookie ) );
	                }
	                x = document.cookie.indexOf( " ", x ) + 1;
	                if ( x == 0 )
	                        break;
	        }
	        return "";
	}



// 로그인 관련 함수 모음
	function  login_check()
	{

		var secuKey = document.getElementById("secuKey");
		if(secuKey != undefined) {
			if(secuKey.checked) {
				document.getElementById("temp").style="";
				alert(1);
			}
		}

		var f = document.login_form;
		
		if(checkFormValue(f) ) {
			
			saveform();
						
			f.id.value = f.id.value.toLowerCase();
			document.getElementById("custInfoExtDto.custId").value=f.id.value;
			document.getElementById("custInfoExtDto.pwd").value=f.passwd.value;
			//f.action = CERT_HOME_URL + "/sso/loginRedirect.do?backURL=" + BACK_URL;
			f.submit();
		}
		
	}

	function checkFormValue(form)
	{
		if(FormValidate(form))
		{
			return true;
		}
		else
		{
			return false;
		}
	
	}

//로그인 폼 아이디/비밀번호 표시 사라지기
function loginform_clearbg(type) {
	var HOST_URL = self.location.host;
	var string_value=/tooniland./;
	if (string_value.test(HOST_URL))
	{		
		var f = document.gc_login;
		
		if (type == "id") {
			f.gc_gid.style.backgroundImage = '';
		} 
		else if (type == "pass") {
			f.gc_pwd.style.backgroundImage = '';
		}

	} else {
	
		var f = document.login_form;
		
		if (type == "id") {
			f.id.style.backgroundImage = '';
		} 
		else if (type == "pass") {
			f.passwd.style.backgroundImage = '';
		}
	}
}

//로그인 폼 아이디/비밀번호 표시 나타내기
function loginform_addbg(type) {
	
	var HOST_URL = self.location.host;
	var string_value=/tooniland./;
	if (string_value.test(HOST_URL))
	{		
		var f = document.gc_login;
		if (type == "id") {
			f.gc_gid.style.backgroundImage = 'url(http://cache.goorm.com/krf/renew/common/LoginIdBg.gif)';
			f.gc_gid.style.backgroundPosition = '10px center';
			f.gc_gid.style.backgroundRepeat = 'no-repeat';
		} 	
		else if (type == "pass") {
			f.gc_pwd.style.backgroundImage = 'url(http://cache.goorm.com/krf/renew/common/LoginPwBg.gif)';
			f.gc_pwd.style.backgroundPosition = '10px center';
			f.gc_pwd.style.backgroundRepeat = 'no-repeat';
		}
	} else {
		var f = document.login_form;
		if (type == "id") {
			f.id.style.backgroundImage = 'url(http://cache.goorm.com/krf/renew/common/LoginIdBg.gif)';
			f.id.style.backgroundPosition = '10px center';
			f.id.style.backgroundRepeat = 'no-repeat';
		} 	
		else if (type == "pass") {
			f.passwd.style.backgroundImage = 'url(http://cache.goorm.com/krf/renew/common/LoginPwBg.gif)';
			f.passwd.style.backgroundPosition = '10px center';
			f.passwd.style.backgroundRepeat = 'no-repeat';
		}
	}
		
	
}


window.onload = __init;
function __init() {	
//	updatePopup();
	var HOST_URL = self.location.host;
	var string_value=/tooniland./;
	if (string_value.test(HOST_URL))
	{
		getform_tooni();
	} else {
		getform();
	}
}

function idSetCookie (name, value, expires) {
	document.cookie = name + "=" + escape (value) + "; domain=.goorm.com; path=/; expires=" + expires.toGMTString();
} 

function idSetCookieTooni (name, value, expires) {
	document.cookie = name + "=" + escape (value) + "; domain=.tooniland.com; path=/; expires=" + expires.toGMTString();
} 

function saveform() {
	var expdate = new Date();
	//var f = document.login_form;
	var id = document.getElementById("id").value;
	
	try {
		//if (f.save_cnk.checked) {
		if (document.getElementById("save_cnk").checked) {
			//alert(document.getElementById("id").value);
			//alert('아이디 정보를 저장할 경우 다음접속시\n\n'+
			//'아이디를 입력하지 않으셔도 됩니다.\n\n')
			expdate.setTime(expdate.getTime() + 1000 * 3600 * 24 * 7); // 7일 ==> 7일동안 보전
		} else {
			expdate.setTime(expdate.getTime() - 1);
		}
		idSetCookie("saveid", id, expdate);
		//alert(document.cookie);
		//setCookie("savepass", f.cnj_pass.value, expdate);
	} catch (e) {
		
	}	
}
function getform() {
	//var f = document.login_form;	
	try {
		//alert(document.cookie);
		//f.save_cnk.checked = ((f.id.value = getCookie("saveid")) != "");
		document.getElementById("save_cnk").checked = ((document.getElementById("id").value = getCookie("saveid")) != "");
		
		//f.save_cnk.checked = ((f.passwd.value = getCookie("savepass")) != "");
	
		loginform_addbg('pass');

		if (document.getElementById("save_cnk").checked) {
			document.getElementById("id").value = getCookie("saveid");
			loginform_clearbg('id');
		}
		else {
			document.getElementById("id").value = '';
			loginform_addbg('id');
		}
	} catch (e) {
		
	}
}

//채널링 투니용~
function saveform_tooni() {
	var expdate = new Date();
	//var f = document.login_form;
	var gc_id = document.getElementById("gc_id").value;
	
	try {
		//if (f.save_cnk.checked) {
		if (document.getElementById("save_cnk").checked) {
			//alert(document.getElementById("id").value);
			//alert('아이디 정보를 저장할 경우 다음접속시\n\n'+
			//'아이디를 입력하지 않으셔도 됩니다.\n\n')
			expdate.setTime(expdate.getTime() + 1000 * 3600 * 24 * 7); // 7일 ==> 7일동안 보전
		} else {
			expdate.setTime(expdate.getTime() - 1);
		}
		idSetCookieTooni("saveid", gc_id, expdate);
		//alert(document.cookie);
		//setCookie("savepass", f.cnj_pass.value, expdate);
	} catch (e) {
		
	}	
}
function getform_tooni() {

	//var f = document.login_form;	
	try {
		//alert(document.cookie);
		//f.save_cnk.checked = ((f.id.value = getCookie("saveid")) != "");
		document.getElementById("save_cnk").checked = ((document.getElementById("gc_id").value = getCookie("saveid")) != "");
		
		//f.save_cnk.checked = ((f.passwd.value = getCookie("savepass")) != "");
	
		loginform_addbg('pass');		

		if (document.getElementById("save_cnk").checked) {
			
			if (getCookie("saveid") != null)
			{
				document.getElementById("gc_id").value = getCookie("saveid");
				loginform_clearbg('id');
			} else {
				document.getElementById("gc_id").value = "";
			}
			
		}
		else {
			
			document.getElementById("gc_id").value = '';
			loginform_addbg('id');
			//투니용에서 자동 저장된 쿠키
			if (getCookie("idSave") != '')
			{
						document.getElementById("save_cnk").checked = ((document.getElementById("gc_id").value = getCookie("idSave")) != "");
						document.getElementById("gc_id").value = getCookie("idSave");
			}
		}
		
	} catch (e) {
		
	}
}



// 뷰 플래시
function flashWrite(url,w,h,id,bg,vars,win){

	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
	"<param name='allowScriptAccess' value='always' />"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='FlashVars' value='"+vars+"' />"+
	"<param name='wmode' value='"+win+"' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<param name='bgcolor' value='"+bg+"' />"+
	"<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";

	document.write(flashStr);
}
function Createflash(w,h,movie,ids){
	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+ids+"' align='middle'>"+
	"<param name='allowScriptAccess' value='always' />"+
	"<param name='movie' value='"+movie+"' />"+
	"<param name='wmode' value='transparent' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<embed src='"+movie+"' wmode='transparent' menu='false' quality='high' width='"+w+"' height='"+h+"' name='"+ids+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";
	
	 document.write(flashStr);

}

//	링크 클릭시 테두리없애기
function autoblur() {
 if(!document.body){
  return;
 }else if(event.srcElement.tagName == "A" && document.body){
  document.body.focus();
 }
}
document.onfocusin = autoblur;

	function getCookie(Name) {
		var search = Name + "="
		if (document.cookie.length > 0) { // 쿠키가 설정되어 있다면
		offset = document.cookie.indexOf(search)
		if (offset != -1) {
			offset += search.length
			end = document.cookie.indexOf(";", offset)
		
			if (end == -1)
				end = document.cookie.length
				return unescape(document.cookie.substring(offset, end))
			}
		}
		return "";
	}

 function getNickNameCookie(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 decodeURI((document.cookie.substring(offset, end)))
    } 
  } 
  return ""; 
} 

function GNB_CheckLogin() {
	var search = 'AUTH_TICKET_KEY=';
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(search)
		if (offset != -1) {
			return true
		}
	}
	return false;
}

//투니 채널링용 로그인 체크
function GNB_CheckLoginTooni() {
	var search = 'cAI=';
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(search)
		if (offset != -1) {
			return true
		}
	}
	return false;
}


//-- 게시판 제목 가로크기 재정의를 위한 배열 선언
var _titleWidthArray = new Array();

//-- 키보드 보안 체크여부
function secuKeyCheckCookie() {
	if (popup_getCookie("SECU_KEY").length == 0) {
		return "checked"
	} else {
		return "";
	}
}

//-- 키보드 보안 체크 클릭
function keyboardSecurityCheck() {
	var secuKey = "SECU_KEY";
	var secuKeyCheck = document.getElementById("secuKeyCheck");
	if(secuKeyCheck != undefined) {
		if(secuKeyCheck.checked) {
			popup_setcookie( secuKey, "none", -1 )
		} else {
			popup_setcookie( secuKey, "none", 1 )
		}
	}
	document.location.reload();
}



/* 200911 renew */
/* 로그인 인풋 배경 처리 */
function setFieldBackground(obj){
	var imgName = 'loginPassword.gif';

	if( obj.name == 'id' ) imgName = 'LoginIdBg.gif';
	else imgName = 'LoginPwBg.gif';

	if(obj.value.trim()==''){
		obj.style.background = 'url(http://cache.goorm.com/krf/renew/common/'+imgName+') no-repeat 10px center';
	}else{
		obj.style.background = 'url(http://cache.goorm.com/krf/renew/common/blank.gif)';
	}
}

function setClearBackground(obj){
	obj.style.background  = 'url(http://cache.goorm.com/krf/renew/common/blank.gif)';
}

String.prototype.trim=function(){
	 var str=this.replace(/(\s+$)/g,"");
	 return str;
}

//슬라이드 겔러리


	var itemflag=false, itembzAw=0, itemtemp=0, itemamount=0, itembzHchk=0, _targetItem=null, slideSize=0;
	//itemflag:롤링 여부, itembzAw:현재위치
	//itemtemp:롤링 속도,배너 사이즈 체크, itemamount:배너하나당 width값, itembzHchk:화면에 보여지는 width
	//itembzAw:현재위치 , _targetItem:objectID

	function slideLR(obj,chk,atom,list) { //obj:objectID, chk:Left Right, atom:배너하나당 width값, list:화면에 보여지는 갯수

		if (!itemflag){

			_targetItem	= document.getElementById(obj);

			var objs = _targetItem.getElementsByTagName("td");
			var i = objs.length;
			var itemTotalWidth = i * atom;
			var itemChkAllow = (itembzAw + itemTotalWidth) - (atom * list);
			itemamount = atom * list;

			itembzHchk = (atom * i) - (atom * list);
			itemflag=true;

			if ((itemChkAllow < (atom * list)) && (chk == "R")) {
				itemamount = (atom * itemChkAllow) / atom;
			}

			for (var intI = 0; intI <= 10; intI++) { //한번에 이동할 슬라이딩 크기 지정
				if (atom % intI == 0) {
					slideSize = intI;
				}
			}

			//itemamount = atom; //한칸씩 이동할 크기 지정


			if (!isNaN(_targetItem.style.left)){
				itembzAw = 0;
				return scroll(chk);
			}
			else {
				itembzAw = parseInt(_targetItem.style.left);
				return scroll(chk);
			}
		}
	}

	function scroll(chkPos) {
		if (itemflag) {
			if((itembzAw == 0 && chkPos == "L") || ((itembzAw <= (-itembzHchk)) && chkPos == "R")){
				itemtemp = 0;
				itemflag = false;
			} else{
				itemtemp += slideSize;
				if(chkPos=='L') {
					_targetItem.style.left = (itembzAw + itemtemp) +"px";
					if ((itembzAw + itemtemp) == 0) {
						itembzAw = 0;
					}
				} else if(chkPos=='R') {
					_targetItem.style.left = (itembzAw - itemtemp) +"px";
			   }
				if(itemamount<=itemtemp) {
					itemflag = false;
					itemtemp = 0;
					itembzAw = parseInt(_targetItem.style.left);

				}
				window.setTimeout("scroll('"+chkPos+"')", 15);			
			}
		}
		
	}


