$ = function(ID)
	{
		return document.getElementById(ID);
	}

$cE = function(Tag, Attr)
	{
		Attr = (typeof(Attr) == 'object') ? Attr : {};
		var Ce = document.createElement(Tag);
		
		for(var $i in Attr)
			{
				if($i == 'style' && typeof(Attr[$i]) == 'object')
					{
						for(var $a in Attr[$i])
							Ce.style[$a] = Attr[$i][$a];
					}
				else
					{
						Ce[$i] = Attr[$i];
					}
			}
		
		return Ce;
	}

$tN = function(Text)
	{
		return document.createTextNode(Text);
	}

window.onload = function()
	{
		if(typeof(MouseMove) != 'boolean' || MouseMove != false)
			{
				document.onmousemove = function(e)
					{
						e = (window.event) ? window.event : e;
						
						$('InfoID').style.left		= e.clientX + 20 + 'px';
						$('InfoID').style.top		= e.clientY + 20 + 'px';
					}
			}
	}

doSearch = function(Form, Go)
	{
		var Loc = '/search/';
		var Q = Form.elements['query'].value;
		Q = Q.replace(/\s/ig, '_')
		Q = Q.replace(/[^A-Z0-9&_.-]/ig, '');

		if(typeof(Form.elements['media']) == 'object')
			{
				var T = 0;
				if(Form.elements['media'][0].checked)
					T += parseInt(Form.elements['media'][0].value);
				if(Form.elements['media'][1].checked)
					T += parseInt(Form.elements['media'][1].value);

				if(T == 2)
					Loc += 'video/';
				else if(T == 1)
					Loc += 'music/';
				else
					Loc += 'all/';
			}
		else
			{
				Loc += 'all/';
			}
		Loc += ((Q != '') ? Q : '*') + '/';
		Loc += ((typeof(Form.elements['search']) != 'undefined') ? Form.elements['search'].value : 'all') + '/';
		
		Form.action = Loc;
		if(typeof(Go) == 'undefined' || Go != false)
			document.location = Form.action;
		
		return false;
	}

doMedia = function(URL)
	{
		var Window = window.open(URL, 'media', 'width=600,height=450');
		Window.focus();
		return false;
	}

FixIEStyle = function()
	{
		if(navigator.userAgent.indexOf('MSIE') < 0)
			return;

		var Kleur	=
			{
				body			:	'#4AA5D7',
				'div#content'	:	'#002A50'
			}

		var Sheets = document.styleSheets;
		for(var $s = 0; $s < Sheets.length; $s++)
			{
				if(Sheets[$s].rules)
					{
						var Rules = Sheets[$s].rules;
						for(var $i = 0; $i < Rules.length; $i++)
							{
								var Text	= Rules[$i].selectorText.toLowerCase();
								if(typeof(Kleur[Text]) != 'undefined' && typeof(Rules[$i].style.backgroundColor) == 'string')
									Rules[$i].style.backgroundColor = Kleur[Text];
								
								if(!isNaN(parseInt(Rules[$i].style.opacity)))
									Rules[$i].style.filter = 'alpha(opacity = ' + (Rules[$i].style.opacity*100) + ')';
							}
					}
			}
	}

Redir = function()
	{
		document.location.replace(URL);
	}

doRedir = function(URi, Sec)
	{
		URL = URi;
		Sec = (typeof(Sec) != 'number') ? 3 : Sec;
		setTimeout(Redir, Sec*1000);
	}

$HTML = function(HTML)
	{
		var Div				= document.createElement('div');
		Div.innerHTML		= '<textarea>'+HTML+'</textarea>';
		var Waarde			= Div.childNodes[0].value;
		var Div				= '';

		return Waarde;
	}

getPos = function(welke, soort, CheckScroll)
	{
		var Totaal		= (soort == "left") ? welke.offsetLeft : welke.offsetTop;
		var parentobj	= welke.offsetParent;
		var Scroll		= 0;
		while(parentobj != null)
			{			
				Totaal		+= (soort == "left") ? parentobj.offsetLeft : parentobj.offsetTop;

				Totaal		-= Scroll;
				parentobj	= parentobj.offsetParent;
			}

		if(typeof(CheckScroll) == 'undefined' || CheckScroll != false)
			{
				var parentObj =	 welke.parentNode;
		
				while(parentObj != null)
					{
						if(typeof(parentObj.scrollTop) == "number" && parentObj.tagName.toUpperCase() == 'DIV')				
							Scroll += (soort != "left") ? parentObj.scrollTop : parentObj.scrollLeft;
						
						parentObj = parentObj.parentNode;
					}
		
				return (Totaal - Scroll);
			}
		return Totaal;
	}


Info = function(x, y)
	{
		this.x = x;
		this.y = y;
		
		this.Show = function(Obj, ImgSrc)
			{
				if(typeof(Obj.onmouseout) != 'function')
					Obj.onmouseout = function() { $Info.Hide(); };
				
				if(typeof(ImgSrc) == 'string')
					{
						var Img		= $('InfoID').getElementsByTagName('img')[0];
						Img.style.visibility = 'hidden';
						Img.src		= ImgSrc;
						$('InfoID').style.display = '';						
					}
			}
		
		this.Hide = function()
			{
				$('InfoID').style.display = 'none';
			}
		
		this.Fix = function(Img)
			{
				Img.style.visibility = 'visible';
				if(Img.offsetWidth > this.x)
					Img.width = this.x;
				
				if(Img.offsetHeight > this.y)
					Img.height = this.y;
			}
	}

getInfo = function(Type, Form, Element, ID)
	{
		var aID = document.forms[Form].elements[Element];
		aID.options.length = 0;
		aID[0]					= new Option($HTML('Loading&hellip;'), 0, false, false);
		aID[0].style.fontStyle	= 'italic';
		aID[0].style.color		= '#C0C0C0';
		aID.disabled			= true;

		AJAX				= new AjaxLite();
		AJAX.URL			= 'data.php/' + Type + '/';
		AJAX.Post['id']		= (!isNaN(parseInt(ID))) ? ID : 0;
		AJAX.aID			= aID;
		AJAX.Type			= Type;
		AJAX.ORSC			= function() { AJAX.doCheck(); };
		AJAX.doOnChange		= function()
			{
				if(this.Re.length > 1)
					{
						this.aID.options.length = 0;

						if(this.Type == 'artists')
							{
								aID[0]					= new Option('All albums', 0, true, true);
								aID[0].style.color		= '#C0C0C0';
								aID[0].style.fontStyle	= 'italic';
							}

						for(var $i = 1; $i < this.Re.length; $i++)
							{
								var Data		= this.Re[$i].split('<><>');
								var Select		= (Data[0] == parseInt(this.aID.id.split('_')[1])) ? true : false;
								this.aID[this.aID.options.length] = new Option($HTML(Data[1]), Data[0], Select, Select);
							}
						this.aID.disabled			= false;
						if(typeof(this.aID.onchange) == 'function')
							this.aID.onchange();
					}
				else
					{
						this.aID[0]					= new Option('No ' + Type.toLowerCase() + ' found!', 0, false, false);
						this.aID[0].style.fontStyle	= 'italic';
						this.aID[0].style.color		= '#CC0000';
						this.aID.disabled			= true;
					}
			};
		AJAX.doRequest();
	}
