// title
//document.title="yong-online";

// 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 loginform_clearbg(type) {
	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 f = document.login_form;
	
	if (type == "id") {
		f.id.style.backgroundImage = 'url(/kri/images/main/login_input1.gif)';
		f.id.style.backgroundRepeat = 'no-repeat';
	} 
	
	else if (type == "pass") {
		f.passwd.style.backgroundImage = 'url(/kri/images/main/login_input2.gif)';
		f.passwd.style.backgroundRepeat = 'no-repeat';
	}
}


window.onload = __init;
function __init() {
	getform();
}

function idSetCookie (name, value, expires) {
	//alert("xxx");
  document.cookie = name + "=" + escape (value) + 
    "; 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);
			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 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 back_top() 
{ 
    x = document.body.scrollLeft; 
    y = document.body.scrollTop; 
    step = 2; 

    while ((x != 0) || (y != 0)) { 
        scroll (x, y); 
        step += (step * step / 100); 
        x -= step; 
        y -= step; 
        if (x < 0) x = 0; 
        if (y < 0) y = 0; 
    } 
    scroll (0, 0); 
}



