//<script language='JavaScript'>

	$(function()
	{
		$('#articles').css({
			fontSize: '15px'
		});

		$('#articles div.attrib').css({
			fontSize: '75%'
		});

		$('#articles .body p').css({
			margin: '10px 0 0 0'
		});

		$('#articles h2').css({
			fontSize: '110%'
		});

		$('#articles h2#lead').css({
			fontSize: '130%'
		});

		$('#articles .more').css({
			clear: 'both',
			fontSize: '80%',
			fontWeight: 'bold',
			borderBottom: '1px solid #ccc',
			marginBottom: '10px'
		});

		$('#articles div#new').css({
			marginBottom: '10px',
			textAlign: 'center'
		});

		$('#articles div.tagline').css({
			clear: 'both',
			height: '10px'
		});

		$('#articles div#tags').css({
			fontSize: '75%'
		});

		$('#articles div#tags a.tag').css({
			paddingLeft: '1em'
		});

		$('#articles span.stream').css({
			color: '#003366'
		});

		$('#articles span.#datesel').css({
		});

		// An article 'delete' button.
		$('#articles h2 a.delete').click(function(event){
			var h2 = $(this).parent();
			var id = $(h2).find('input[name=id]').val();
			if (confirm("Do you want to delete this article?"))
			{
				window.location = 'index.php?content=articles&action=delete&id='+id;
				return false;
			}
		});

		///////////////////////////////////////////////////////////////////////
		// The editor
		$('#articles #edit .message').css({
			paddingLeft: '5px',
			color: '#0c0'
		});

		$('#articles #edit .error').css({
			paddingLeft: '5px',
			color: '#c00'
		});

		$('#articles #edit table').css({
			width: '100%'
		});

		$('#articles #edit table tr th').css({
			width: '1px',
			whiteSpace: 'nowrap'
		});

		$('#articles #edit table .text').css({
			width: '100%'
		});

		$('#articles #edit table .tag').css({
			width: '50%'
		});

		$('#articles #edit table .submit').css({
			width: '25%'
		});

		$('month').change(function()
		{
			populate2();
		});

		populate(0, 0, 0);
	});

	function populate(dd, mm, yy)
	{
		date = document.getElementById('edit');
		if (date == null) return;
		if (date.day == null) return;
		var d=parseInt(dd);
		var m=parseInt(mm);
		var y=parseInt(yy);
		var today= new Date();
		if (dd==0) d= today.getDate();
		if (mm==0) m= today.getMonth()+1;
		if (yy==0) y= today.getFullYear();
		for (var i=0; i <31 ; i++)
		{
			date.day.options[i] = new Option(String(i+1));
		}
		date.day.options[d-1].selected=true;
		date.month.options[m-1].selected=true;
		offset=4;
		ty=today.getFullYear();
		if (y+offset>ty) offset=ty-y;
		for (var i=0, j=y+offset; i <10 ; i++, j--)
		{
			date.year.options[i] = new Option(String(j));
		}
		date.year.options[offset].selected=true;
	}

	function populate2()
	{
		var date = document.edit;
		var days=0;
		if (date.month.options[1].selected)
			days=28;
		else if (date.month.options[8].selected
			|| date.month.options[3].selected
			|| date.month.options[5].selected
			|| date.month.options[10].selected)
			days=30;
		else
			days=31;
		for (i=0; i<31; i++)
		{
			date.day.options[i]=null;
		}
		for (var i=0; i <days ; i++)
		{
			var x= String(i+1);
			date.day.options[i] = new Option(x);
		}
	}

//</script>

