function gotoDate(dt)
{
	var new_date = new Date(dt);
	
	if(new_date > today)
		return;
	
	var month = new_date.getMonth()+1;

	var date = new_date.getDate();

	var new_loc = String(window.location);
	var pos = new_loc.lastIndexOf("/");
	new_loc = new_loc.substr(0, pos + 1) + (date < 10 ? "0": "") + date + (month < 10 ? "0": "") + month + new_date.getFullYear() + ".html";
	window.location = new_loc;
}

var CALENDAR_DATE = new Date();
var PROG_FILENAME="blog";
function getCalendarDatesAsync(url, dt)
{
	if(Sarissa)
	{
		CALENDAR_DATE = dt;
		var xmlhttp = new XMLHttpRequest();
		xmlhttp.open("GET", url, true);
		
		xmlhttp.onreadystatechange = function() {
		    if (xmlhttp.readyState == 4) {
		        renderCalendar(CALENDAR_DATE, "gotoDate", xmlhttp.responseText)
		    }
		}
		xmlhttp.send(null);
	}
}

function changeMonth(dt)
{
	dt = new Date(dt);
	getCalendarDatesAsync("/arts/inc/blog_archive.inc", dt.valueOf());
}


function writeDate()
{
	document.write((new Date()).toString().substr(0,20));
}


function showPlayer(url)
{
	var win = window.open(url, "rteplayer", "height=560,width=860,status=yes,toolbar=no,menubar=no,location=no");
	win.focus();
}


function changeStoryImage (img)
{
	var el = document.getElementById("storyImage" + img);

	for (i=1; document.getElementById("storyImage" + i) != null; i++)
	{
		document.getElementById("storyImageListItem" + i).className = "unselected";
		document.getElementById("storyImage" + i).style.display = "none";
	}
	if(el != null)
	{
		document.getElementById("storyImageListItem" + img).className = "selected";
		el.style.display = "block";
	}

}

function PrintPreview()
{
	var win = window.open();
	win.document.write("<html>");
	win.document.write("<head>");	
	win.document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"/arts/style/print.css\" />");
	win.document.write("</head>");
	win.document.write("<body>");	
	win.document.write("<img src=\"/news/images/logo_printable_entertainment.gif\">\n");	
	win.document.write("<hr>");		
	win.document.write(document.getElementById("primaryContent").innerHTML);
	win.document.write("<p><strong>Story from RT&Eacute; Entertainment:<br />"+document.location+"</strong></p>");
	win.document.write("</body>");
	win.document.write("</html>");	
	win.document.close();
}
