var VD = {};

var nextFunctionValue = null;

VD.utils = {
	
	chkSel : function(sel,msg)
	{		
	    if(sel.length == null || sel.length == "undefined")
	    {
	        if(sel.checked)
	        	return true;
	        
	        myAlert(msg);	        
	        return false;
	    }
	    else
	    {        
	        var i=0;
	        for(i=0;i<sel.length;i++)
	        {
	            if(sel[i].checked)
	                return true;
	        }
	        
	        myAlert(msg);
	        return false;
	    }
	},
		
	nextFunc : function()
	{
		if(!nextFunctionValue)
			return;
			
		try
		{
		nextFunctionValue();
		nextFunctionValue = null;
		}
		catch(ex)
		{
			// none;
		}
	},	
	
	chkBlank : function(obj,msg)
	{
		if(obj.value == "")
		{
			nextFunctionValue = obj.focus;			
			myAlert(msg,VD.utils.nextFunc);
			return false;
		}
		
		return true;
	},
	
	chkBlankNoFocus : function(obj,msg)
	{
		if(obj.value == "")
		{
			myAlert(msg,VD.utils.nextFunc);
			return false;
		}
		
		return true;
	},
	
	chkSel2 : function(sel,msg)
	{		
	    if(sel.length == null || sel.length == "undefined")
	    {
	        if(sel.checked)
	        	return true;
	        
	        alert(msg);	        
	        return false;
	    }
	    else
	    {        
	        var i=0;
	        for(i=0;i<sel.length;i++)
	        {
	            if(sel[i].checked)
	                return true;
	        }
	        
	        alert(msg);
	        return false;
	    }
	},

	chkBlank2 : function(obj,msg)
	{
		if(obj.value == "")
		{
			alert(msg);
			obj.focus();
			return false;
		}
		
		return true;
	},
	
	chkSame: function(obj1,obj2)
	{
		if(obj1.value != obj2.value)
		{
			nextFunctionValue = obj1.focus;
			var msg = "항목이 일치하지 않습니다.";
			myAlert(msg,VD.utils.nextFunc);
			return false;
		}
		
		return true;
	}
}
