
var bgdark = "#F2F4F7";
var bglight = "#FFFFFF";
var bgmouseover = "#CCD0DD";

var resized_images_width = new Array();
var resized_images_height = new Array();

	function fullscreen()
	{
		scrollbars = 0;
		var oSource = window.event.srcElement.src;
		width = resized_images_width[oSource];
		height = resized_images_height[oSource] + 50;

		if(width > screen.availWidth)
		{
			width = screen.availWidth;
			scrollbars = 1;
		}

		if(height > screen.availHeight)
		{
			height = screen.availHeight;
			scrollbars = 1;
		}

		fullscr = window.open(oSource, "_blank","toolbar=no,location=no,menubar=no,fullscreen="+scrollbars+",channelmode="+scrollbars+",scrollbars="+scrollbars+",status=no,left=0,top=0,width="+width+",height="+height);
	}

	function resize(image)
	{
		if(!image)
		{
			var image = window.event.srcElement;
		}

		width = image.width;
		height = image.height;
		var url = image.src;

		if(width > 650)
		{
			resized_images_width[url] = width;
			resized_images_height[url] = height;
			image.width = 650;
			image.alt = 'Originele grootte: '+width+'x'+height;
			image.style.border = "dashed 1px black";
			image.style.cursor = "hand";
			image.onclick = fullscreen;
			image.height = Math.floor(height/(width/650));
		}
	}

	function check_images()
	{
		count = document.images.length;
		i = 0;
		j = 0;

		while(count>i)
		{
			url = document.images[i].src;
			if(!url.match("ebeatz.nl/img") && !url.match("trashbin.tk/img/") )
			{
				j++;
				if(document.images[i].complete)
				{
					resize(document.images[i]);
				}
				else
				{
					document.images[i].onload = resize;
				}
			}

			i++;
		}

	}

	function openUrl(sUrl, openWindow)
	{
		if (openWindow == 1)
		{
			newwindows = window.open(sUrl);
		}
		else
		{
			window.location=sUrl;
		}
	}

	function openpopup(popurl, w, h)
	{
		winpops=window.open(popurl,'','width='+w+',height='+h+',resizable');
	}

	function insertsmilie(smilie)
	{
		document.input.topicpost.value += ' ' + smilie + ' ';
	}

	function changebg(o, mode, color)
	{
		if(mode=='Over')
		{
			o.style.backgroundColor=bgmouseover;
		}
		else
		{
			if(color=='1') o.style.backgroundColor=bglight;
			if(color=='2') o.style.backgroundColor=bgdark;
		}
	}

	function pasteclipboard()
	{
		document.input.topicpost.value += document.input.clipboard.value;
		document.input.topicpost.focus();
	}

	function quote_msg(msg)
	{
		document.input.topicpost.value += msg;
		document.input.topicpost.focus();
	}

	function copy_url(surl)
	{
		document.input.copyurl.value = surl;
		document.input.copyurl.focus();
	}

	function AddToList()
	{
		var from = document.input.elements['usergroupid[]'];
		var to = document.input.elements['forumusergrouplist[]'];
		var i;
		var txt = '';

		to.options[to.options.length] = new Option(from.options[from.selectedIndex].text, from.options[from.selectedIndex].value);
		from.options[from.selectedIndex] = null;

		for (i=0; i < to.options.length; i++)
		{
			if (typeof(to.options[i].value) != 'undefined')
			{
				if (txt != '')
				{
					txt = txt + ',' + to.options[i].value;
				}
				else
				{
					txt = to.options[i].value;
				}
			}
		}

		document.input.allforumusergroups.value = txt;
	}

	function RemoveFromList()
	{
		var from = document.input.elements['forumusergrouplist[]'];
		var to = document.input.elements['usergroupid[]'];
		var i;
		var txt = '';

		to.options[to.options.length] = new Option(from.options[from.selectedIndex].text, from.options[from.selectedIndex].value);
		from.options[from.selectedIndex] = null;

		for (i=0; i < from.options.length; i++)
		{
			if (typeof(from.options[i].value) != 'undefined')
			{
				if (txt != '')
				{
					txt = txt + ',' + from.options[i].value;
				}
				else
				{
					txt = from.options[i].value;
				}
			}
		}

		document.input.allforumusergroups.value = txt;
	}

	function random_banner()
	{
		var i=0;
		banners = new Array();

		banners[i++] = '<a target=_blank href="http://www.radio54.nl"><img class="advert" src="http://www.ebeatz.nl/banners/bannerr54_dance.gif" width="264" height="80" border=0 align="absmiddle"></a>';
		banners[i++] = '<a target=_blank href="http://www.ebeatz.nl/hosting"><img class="advert" src="http://www.ebeatz.nl/banners/hosting-bannerNW.gif" width="264" height="80" border=0 align="absmiddle"></a>';
		//banners[i++] = '<a target=_blank href="http://www.extrema.nl/clicks.php?clicksid=59"><img class="advert" src="http://www.ebeatz.nl/banners/solar468_60_ani.gif" border=0 align="absmiddle"></a>';
		//banners[i++] = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash4/cabs/swflash.cab#version=4,0,0,0" width="600" height="120"><param name="movie" value="http://www.ebeatz.nl/banners/banner_solar_120_600.swf"><param name="menu" value="false"><param name="quality" value="high"><param name="bgcolor" value="#FFFFFF"><embed src="http://www.ebeatz.nl/banners/banner_solar_120_600.swf" quality="high" bgcolor="#FFFFFF" width="480" height="80" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed> </object>';

		n=banners.length;
		d = randInt(0, n - 1);
		document.write(banners[d]);
	}

	function random_banner_right()
	{
		var i=0;
		banners = new Array();

		//banners[i++] = '<a href="http://www.ebeatz.nl/topicdisplay.php?8649"><img src="banners/vlfbanner.jpg" border="0" alt="" /></a>';
		banners[i++] = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="120" height="600"><param name="movie" value="/banners/banner120x600_500kb.swf"><param name="quality" value="high"><embed src="/banners/banner120x600_500kb.swf" quality=high TYPE="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="120" height="600"></embed></object>';
		//banners[i++] = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="120" height="600"><param name="movie" value="/banners/banner_sneakerz_120x600_2008.swf"><param name="quality" value="high"><embed src="/banners/banner_sneakerz_120x600_2008.swf" quality=high TYPE="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" width="120" height="600"></embed></object>';

		n=banners.length;
		d = randInt(0, n - 1);
		//document.write(banners[d]);
	}

	function randInt(min,max)
	{
	     var div = (max - min) + 1
	     var randNum = Math.random()
	     for (var i = 0; i <= div - 1; i++)
	     {
	          if (randNum >= i / div && randNum < (i+1) / div)
	          {return i + min}
	     }
	}