
var disBg='#DBDBDB';

var NUM = "0123456789";	
var SALPHA = "abcdefghijklmnopqrstuvwxyz";
var ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"+SALPHA;
var EMAIL = "!#$%&*+-./=?@^_`{|}"+NUM+ALPHA;
var PASSWORD = "!@.#,$%^*&_-"+ALPHA+NUM;

function CheckType(s,spc) {
	var i;
	for(i=0; i<s.length; i++) {
		if (spc.indexOf( s.substring(i, i+1)) < 0) {
			return false;
		}
	}
		
	return true;
}

function CheckSpaceAll(str){
	var index;
	var len;

	while(true){
		index=str.value.indexOf(" ");
		if(index==-1) break;
		len=str.value.length;
		str.value=str.value.substring(0,index) + str.value.substring((index+1), len);
	}
return str.value;
}

function CheckSpace(str){
	var len;

	while(true){
		if (str.value.charAt(0) != " ") break;
		len=str.value.length;
		str.value=str.value.substring(1,len);
	}

	while(true){
		len=str.value.length;
		if (str.value.charAt(len-1) != " ") break;
		str.value=str.value.substring(0,len-1);
	}

return str.value;
}

function nextTab(obj,nxt,len){
	if (obj.value.length>=len) nxt.focus();
}

function setConfig(name,value){
	setCookie( name, value, 365 );
	alert('¼³Á¤ÀÌ ÀúÀåµÇ¾ú½À´Ï´Ù');
}

function setCookie( name, value, expiredays ){
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

function 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 layTgl(obj) {
	if(!obj) return;
	if (obj.style.display=='none') obj.style.display = 'block';
	else obj.style.display = 'none';
}

function layTgl2(obj_name) {
	obj=document.getElementById(obj_name);
	layTgl(obj);
}

function textDisable(o,d){
	if (d)
	{
		o.style.backgroundColor='#EFEFEF';
		o.disabled=true;
	}
	else 
	{
		o.style.backgroundColor='';
		o.disabled=false;
	}
}

function checkBlank(o,m){
	if (typeof o=='undefined')
	{
		return true;
	}
	if (!o.value)
	{
		alert(m+' ÀÔ·ÂÇÏ¼¼¿ä');
		o.focus();
		return false;
	}
	return true;
}

function checkSel(o,m){
	if (o.selectedIndex==0)
	{
		alert(m+' ¼±ÅÃÇÏ¼¼¿ä');
		o.focus();
		return false;
	}
	return true;
}

function checkCB(obj,msg){
	icbk=0;
	if (obj.length)
	{
		//fobj=obj[0];
		for (dh=0; dh<obj.length; dh++)
		{
			if (obj[dh].checked==true)
			{
				icbk++;
				break;
			}
		}
	}
	else if (obj && obj.checked==true)
	{
		//fobj=obj;
		icbk++;
	}

	if (icbk<1)
	{
		alert(msg+' ¼±ÅÃÇÏ¼¼¿ä');
		//if (fobj) fobj.focus();
		return false;
	}
	return true;
}

function checkAll(obj,ck){
	if (obj.length)
	{
		for (i=0; i<obj.length; i++)
		{
			obj[i].checked=ck;
		}
	}
	else if (obj)
	{
		obj.checked=ck;
	}	
}

function checkOne(obj,i,ck){
	if (obj.length)
	{
		obj[i].checked=ck;
	}
	else if (obj)
	{
		obj.checked=ck;
	}	
}

function checkNum(o,m){
	if (!CheckType(o.value, NUM)) {
		alert(m+' ¼ýÀÚ¸¸ ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù');
		o.focus();
		return false;
	}
	return true;
}


function wisaOpen(url,name,scroll){
	//window.open(url,name,'top=10,left=10,height=100,width=100,status=no,scrollbars=no,toolbar=no,menubar=no');
	if (!scroll) scroll='no';
	window.open(url,name,'top=10,left=10,height=100,width=100,status=yes,resizable=yes,scrollbars='+scroll+',toolbar=no,menubar=no');
}


function selfResize(){
	self.resizeTo(document.body.scrollWidth , document.body.scrollHeight);
}

function selfResize2(a){
	self.resizeTo(document.body.scrollWidth , document.body.scrollHeight+a);
}

function Resize(w, h) {
	sh=screen.Height-150;
	if (h>sh)
	{
		h=sh;
	}

	if(Math.abs(document.body.offsetWidth - document.body.clientWidth) > 5) {
		window.resizeTo(w + 26, h + 55);
	}
	else {
		window.resizeTo(w + 10, h + 59);
	}


}

function CheckMail(email){
	aindex=email.indexOf("@");
	dotindex=email.indexOf(".");

	if (aindex==-1 || dotindex==-1 || aindex >= (dotindex-1)) return false;
	return true;
}

function isEmpty(data){
	for (ii=0; ii<data.length; ii++) {
		if(data.substring(ii, ii+1) != " ") return false;
	}
	return true;
}

//IE PNG use
function setPng24(obj) { 
      var browser = navigator.appName;
      var version = parseFloat(navigator.appVersion.replace (/^.*MSIE ([.0-9]+).*$/,"$1"));

      if(browser.indexOf("Internet Explorer") && version < 7.0 ) { // IE6 ÀÌÇÏ¿¡¼­¸¸ µ¿ÀÛ 2008-03-14 by zardsama
            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 ''; 
      }
}
