/////////////////////////////////////////////////////
//	NReflectionStaticClass constants
//
var Type_String = "string";
var Type_Int = "number";
var Type_Object = "object";
var Type_Bool = "boolean";

/////////////////////////////////////////////////////
//	NReflectionStaticClass object
//
function NReflectionStaticClass()
{
	//	Operations
	NReflectionStaticClass.prototype.HasProperties = function(obj)
	{
		var prop;
		for(prop in obj)
			return true;
		return false;
	}

	NReflectionStaticClass.prototype.HasProperty = function(obj, propertyName)
	{
		var prop;
		for(prop in obj)
			if(String(prop) == String(propertyName))
				return true;
		return false;
	}

	NReflectionStaticClass.prototype.IsInstance = function(obj)
	{
	    return String(typeof(obj)) != "undefined" && String(typeof(obj)) != "unknown" && String(obj) != "null";
	}

	NReflectionStaticClass.prototype.HasBaseClassOfType = function(obj, typeName)
	{
	    if(!this.IsInstance(obj))
	    	return false;

		if(!this.HasProperties(obj))
			return false;

		if(!this.IsInstance(obj.GetBaseTypeName))
			return false;

		return obj.GetBaseTypeName() == typeName || this.HasBaseClassOfType(obj.GetBaseType(), typeName);
	}

	NReflectionStaticClass.prototype.IsOfType = function(obj, typeName)
	{
	    if(!this.IsInstance(obj))
	    	return false;
		
		if(String(typeof(obj)).toLowerCase() != Type_Object)
			return String(typeof(obj)).toLowerCase() == typeName.toLowerCase();
		
		if(typeName == Type_Object)
			return true;
			
		if(!this.HasProperties(obj))
			return false;

		if(!this.IsInstance(obj.GetTypeName))
			return false;
	    
		return obj.GetTypeName() == typeName;
	}

	NReflectionStaticClass.prototype.IsOfTag = function(obj, tagName)
	{
	    if(!this.IsOfType(obj, Type_Object))
	    	return false;
			
		if(!this.HasProperties(obj))
			return false;

		if(!this.IsInstance(obj.tagName))
			return false;
	    
		return obj.tagName.toLowerCase() == tagName.toLowerCase();
	}
}
//	Static Instance
var NReflection = new NReflectionStaticClass();
