//############### Menu Script Start ####################
function menu(gval) 
{
	var menu = '/index.php?WS=';
	window.location = menu+gval;
}
//############### Menu Script End ####################

//############### Form Script Start ####################
function Form_chkVal(Fid,msg)
{
	var frm=document.getElementById(Fid);
	if(!frm.value) {alert(msg);frm.focus();return false;}
	else {return true;}
}

function Form_chkVal2(Fid,msg)
{
	var frm=document.getElementById(Fid);
	if(!frm.value) {alert(msg);return false;}
	else {return true;}
}

function Form_chkCheckbox(form,name,msg)
{
	var chk;
	var gid;

	for(i=0;i<form.elements.length;i++)
	{
		if(form.elements[i].name==name)
		{
			if(!gid) gid=i;
			if(form.elements[i].checked) chk=true;
		}
	}

	if(chk==true)
	{
		return true;
	}
	else
	{
		if(msg) alert(msg);
		form.elements[gid].focus();
		return false;
	}
}

function Form_checkAll(form,name)
{
	if(document.getElementById(name).checked==true) var a=false;
	else var a=true;

	for(i=0;i<form.elements.length;i++)
	{
		if(form.elements[i].name==name)
		{
			form.elements[i].checked=a;
		}
	}
}

//영문 숫자만 허용
function Lib_isCode(val) 
{ 
	for(var i=0;i<val.length;i++) 
	{ 
		var chr=val.substr(i,1); 
		if((chr<'0' || chr>'9') && (chr<'a' || chr>'z') && (chr<'A' || chr>'Z') && chr!='-' && chr!='_' && chr!='.') 
		{ 
			return false; 
		} 
	} 
	return true; 
}

function Lib_isKorean(val) 
{ 
	var code=0; 
	for(var i=0;i<val.length;i++) 
	{ 
		var code=val.charCodeAt(i); 
		var chr=val.substr(i,1).toUpperCase(); 
		code=parseInt(code); 
		if((chr<'0' || chr>'9') && (chr<'A' || chr>'Z') && (code>255 || code<0)) 
		{ 
			return false; 
		} 
	} 
	return true; 
}
//############### Form Script End ####################

//############### Window Script Start ####################
function ScrollMenu(layerID){ 
	var bNetscape4plus = (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) >= "4"); 
	var bExplorer4plus = (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.substring(0,1) >= "4"); 
	var menuFrom, menuTo, timerCheck, offset; 
	var iMenu; 
	
	if ( bNetscape4plus ) { 
		iMenu = document.getElementById(layerID); 
	} else if ( bExplorer4plus ) { 
		iMenu = document.getElementById(layerID); 
	} 
	menuFrom = parseInt (iMenu.style.top, 10); 
	menuTo = document.body.scrollTop + 166; 
	timerCheck = 500; 
	
	if ( menuFrom != menuTo ) { 
		offset = Math.ceil( Math.abs( menuTo - menuFrom ) / 10 ); 
		if ( menuTo < menuFrom ) offset = -offset; 
		iMenu.style.top = parseInt (iMenu.style.top, 10) + offset; 
		timerCheck = 10; 
	} 
	setTimeout ("ScrollMenu()", timerCheck); 
} 

// 스크롤 싸이즈 변경 가능 / 화면 중앙에... 
function Lib_newWin(url,name,wid,hei,option) 
{ 
	var x=screen.width/2-wid/2; 
	var y=screen.height/2-hei/2; 
	
	var option_='left='+x+',top='+y+',width='+wid+',height='+hei+',scrollbars=1,resizable=1'; 
	if(option) option_+=','+option; 
	
	newwindow=window.open(url,name,option_); 
	newwindow.focus(); 
} 

// 싸이즈 스크롤 안됨 // 띄워보면 암 
function Lib_newModal(url,name,wid,hei,option) 
{ 
	var x, y; 
	x=(document.layers) ? loc.pageX : event.clientX; 
	y=(document.layers) ? loc.pageY : event.clientY; 
	
	var rand=Math.random()*4; 
	
	option_='dialogLeft='+x+'px;dialogTop='+y+'px;dialogWidth='+wid+'px;dialogHeight='+hei+'px;scrollbars=0;resizable=0;'; 
	if(option) option_+=option; 
	
	window.showModalDialog(url+'?rand='+rand,name,option_); 
}
//############### Window Script End ####################

