var Framework =
{
	Cookie:
	{
		SetCookie: function(Name, Value, Days)
		{
			if (Days)
			{
				var date = new Date();
				date.setTime(date.getTime() + (Days * 24 * 60 * 60 * 1000));
				var Expires = '; expires=' + date.toGMTString();
			}
			else
			{
				var Expires = '';
			}
			document.cookie = Name + '=' + Value + Expires + '; path=/';
		},
		GetCookie: function(Name)
		{
			var NameEQ = Name + '=';
			var Ca = document.cookie.split(';');
			for (var i = 0; i < Ca.length; i++)
			{
				var C = Ca[i];
				while (C.charAt(0) == ' ') C = C.substring(1, C.length);
				if (C.indexOf(NameEQ) == 0) return C.substring(NameEQ.length, C.length);
			}
			return null;
		},
		DeleteCookie: function(Name)
		{
			this.SetCookie(Name, '', -1);
		}
	},
	Filter:
	{
		Email: function(Email)
		{
			var Pattern = /^[a-z0-9-_]+(?:\.[a-z0-9-_]+)*@(?:[a-z0-9-]+(?:\.[a-z0-9-]+)*(?:\.(?:aero|arpa|asia|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel|[a-z]{2})))$/i
			if (Email.length > 0)
			{
				return (Pattern.test(Email)) ?  true : false;
			}
			else
			{
				return false;
			}
		}
	},
	Flash:
	{
		PercentLoaded: function(Movie)
		{
			return Movie.PercentLoaded();
		},
		IsLoaded: function(Movie)
		{
			return (this.PercentLoaded(Movie) == 100);
		},
		IsPlaying: function(Movie)
		{
			return Movie.IsPlaying();
		},
		Start: function(Movie)
		{
			Movie.Play();
		},
		Stop: function(Movie)
		{
			Movie.StopPlay();
		},
		Rewind: function(Movie)
		{
			return Movie.Rewind();
		},
		Pan: function(Movie, X, Y, Mode)
		{
			Movie.Pan(X, Y, Mode);
		},
		SetZoomRect: function(Movie, Top, Right, Bottom, Left)
		{
			var Ratio = 20;
			Movie.SetZoomRect(parseInt(Left * Ratio), parseInt(Top * Ratio), parseInt(Right * Ratio), parseInt(Bottom * Ratio));
		},
		Zoom: function(Movie, PercentZoom)
		{
			Movie.Zoom(parseInt(PercentZoom));
		},
		Send: function(Movie, Name, Value)
		{
			Movie.Send(Name);
		},
		Receive: function(Message)
		{
			var Variable = Message[0];
			var Value = Message[1];
			alert(Variable + ' = ' + Value);
		}
	},
	Misc:
	{
		ID: function(ID)
		{
			return document.getElementById(ID);
		},
		Tag: function(Tag)
		{
			return document.getElementsByTagName(Tag);
		},
		Name: function(Name)
		{
			return document.getElementsByName(Name);
		},
		ClassName : function(ClassName)
		{
			var TagIndex = 0;
			var TagMatched = 0;
			var Elements = new Array();

			var Tags = this.Tag('*');
			var Condition = ' ' + ClassName + ' ';
			for (TagIndex = 0; TagIndex < Tags.length; TagIndex++)
			{
				var Pattern = ' ' + Tags[TagIndex].className + ' ';
				if (Pattern.indexOf(Condition) != -1)
				{
					Elements[TagMatched] = Tags[TagIndex];
					TagMatched++;
				}
			}
			return Elements;
		},
		Alert: function(Message)
		{
			alert(Message);
		},
		Confirm: function(Text, Url)
		{
			if (confirm(Text)) this.Redirect(Url);
		},
		Redirect: function(Url)
		{
			top.location.href = Url;
		},
		AddOnLoad: function(OnLoad)
		{
			var OldOnLoad = window.onload;
			if (typeof OldOnLoad != 'function')
			{
				window.onload = OnLoad;
			}
			else
			{
				window.onload = function()
				{
					OldOnLoad();
					OnLoad();
				}
			}
		},
		Preload: function(Images)
		{
			var Container = Array();
			for (var i = 0; i < Images.length; i++)
			{
				Container[i] = new Image();
				Container[i].src = Images[i];
			}
		}
	}
}
