/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	var done = false;
	var httpObject = null;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	// Get the HTTP Object
	function getHTTPObject()
	{
		if(window.ActiveXObject)
			return new ActiveXObject("Microsoft.XMLHTTP");
		else if(window.XMLHttpRequest)
			return new XMLHttpRequest();
		else
		{
			alert("Your browser does not support AJAX.");
			return null;
		}
	}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	// Change the value of the outputText field
	function setOutput()
	{
		if(httpObject.readyState == 4)
		{
			//alert(httpObject.responseText);
			cStatus = document.getElementById('archive');
			if(cStatus)
			{
				cStatus.innerHTML = httpObject.responseText;
				done = true;
			}
		}
		if(done == true)
		{
			done = false;
			// setTimeout('LoadStatus()', 60000);
		}
	}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	// Implement business logic
	function Load(c)
	{
		var szDate = '';
		// alert(get('archive_year'));
		// alert(get('archive_month'));
		// alert(get('archive_day'));
		if(c !== false)
		{
			szDate = ab.year.value + '-' + (ab.month.value < 10 ? '0' + ab.month.value : ab.month.value) + '-' + (ab.day.value < 10 ? '0' + ab.day.value : ab.day.value);
			/*set('archive_year', ab.year.value, 0);
			set('archive_month', ab.month.value, 0);
			set('archive_day', ab.day.value, 0); */
		}
		// cStatus = document.getElementById('archive');
		// if(cStatus)
		// {
			// cStatus.innerHTML = '<img src="images/loader_refresh_blue.gif" border="0" title="Please wait..">';
		// }
		httpObject = getHTTPObject();
		if(httpObject != null)
		{
			httpObject.open("POST", "scripts/list.php?date=" + szDate, true);
			httpObject.send(null);
			httpObject.onreadystatechange = setOutput;
		}
	}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	// Implement business logic
	function LoadByYear()
	{
		cStatus = document.getElementById('archive');
		// if(cStatus)
		// {
			// cStatus.innerHTML = '<img src="images/loader_refresh_blue.gif" border="0" title="Please wait..">';
		// }
		httpObject = getHTTPObject();
		if(httpObject != null)
		{
			httpObject.open("POST", "scripts/list.php", true);
			httpObject.send(null);
			httpObject.onreadystatechange = setOutput;
		}
	}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	function set(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=/";
	}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	function get(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;
	}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	function del(name) {
		createCookie(name,"",-1);
	}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	function setCBItemByValue(id, val)
	{
		if((list = document.getElementById(id)))
		{
			for(x=0; x<list.options.length; x++)
			{
				if(list.options[x].value == val)
				{
					list.selectedIndex = x;
					return;
				}
			}
		}
	}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	function initialise()
	{
		/* var d = new Date();
		var year = d.getFullYear();
		var month = (d.getMonth() + 1);
		var day = (d.getDate() - 1);
		//setCBItemByValue('year', (get('archive_year') ? get('archive_year') : year));
		//setCBItemByValue('month', (get('archive_month') ? get('archive_month') : month));
		//setCBItemByValue('day', (get('archive_day') ? get('archive_day') : day));
		//alert(year + '=' + month + '=' + day);
		
		setCBItemByValue('year', year);
		
		setCBItemByValue('month', month);
		
		setCBItemByValu e('day', day);*/
		Load(false);
	}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////