function PrintPreview()
{
	var win = window.open();
	win.document.write("<html>");
	win.document.write("<head>");
	win.document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"/performinggroups/style/print.css\" />");
	win.document.write("</head>");
	win.document.write("<body>");
	win.document.write("<img src=\"/performinggroups/images/logo_printable_performinggroups.gif\">\n");
	win.document.write("<hr>");
	win.document.write(document.getElementById("contentcolumn").innerHTML);
	win.document.write("<p><strong>Story from RT&Eacute; Performing Groups:<br />"+document.location+"</strong></p>");
	win.document.write("</body>");
	win.document.write("</html>");
	win.document.close();
}

function gotoDate(dt)
{
	var new_date = new Date(dt);
	
	if(new_date > today)
		return;
	
	var month = new_date.getMonth()+1;
	if(month < 10) month = "0" + month;

	var date = new_date.getDate();
	if(date < 10) date = "0" + date;

	var new_loc = String(window.location);
	if(re_url.exec(String(window.location)))
	{
		new_loc = new_loc.replace(re_url, "/" + new_date.getFullYear() + "/" +  month + date + "/");
		var pos = new_loc.lastIndexOf("/");
		new_loc = new_loc.substr(0, pos + 1) + "index.html";
	}
	else
	{
		var pos = new_loc.lastIndexOf("/");
		new_loc = new_loc.substr(0, pos + 1) + "/" + new_date.getFullYear() + "/" +  month + date + "/" + "index.html";
	}
	
	window.location = new_loc;
}

function gotoDateProg(dt)
{
	var new_date = new Date(dt);
	
	if(new_date > today)
		return;
	
	var month = new_date.getMonth()+1;
	if(month < 10) month = "0" + month;
	var date = new_date.getDate();
	if(date < 10) date = "0" + date;

	var new_loc = String(window.location);
	new_loc = "/news/" + new_date.getFullYear() + "/" +  month + date + "/" + PROG_FILENAME + ".html";
	
	window.location = new_loc;
}

function gotoDatePerformingGroups(dt)
{
	var new_date = new Date(dt);
	
	var year = new_date.getFullYear();
	var to_year = year;

	var month = new_date.getMonth()+1;
	var to_month = month+1;
	if(to_month == 13){ to_month = 1; to_year = to_year+1;}

	if(month < 10) month = "0" + month;
	if(to_month < 10) to_month = "0" + to_month;

	var date = new_date.getDate();
	if(date < 10) date = "0" + date;

	var new_loc = String(window.location);
	new_loc = "/performinggroups/eventsearch.html?xsl=event_listing&date=" + year + month + date + "000000&todate=" + to_year + to_month + date + "000000";
	
	window.location = new_loc;
}


var CALENDAR_DATE = new Date();
var PROG_FILENAME="index";
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, "gotoDatePerformingGroups", xmlhttp.responseText)
		    }
		}
		xmlhttp.send(null);
	}
}

function changeMonth(dt)
{
	dt = new Date(dt);
	var strmonth = dt.getMonth()+1;
	if (10 > strmonth)
			strmonth="0" + strmonth;
	var stryear = dt.getFullYear();
	
	var str = "?fromdate=01/"+strmonth+"/"+stryear;

	getCalendarDatesAsync("http://www.rte.ie/GigListingFeed/GetGigListingCalendar.aspx"+str, dt.valueOf());
}


function monthsearch() {

	monthNames=['January','February','March','April','May','June','July','August','September','October','November','December'];
	monthNum=['01','02','03','04','05','06','07','08','09','10','11','12'];
	monthDays=['31','29','31','30','31','30','31','31','30','31','30','31'];

	year=today.getFullYear();
	for (i=0;i<12;i++)
	{
		if (i >= today.getMonth() )
		{
			document.write("<option value=\"date=" + year + monthNum[i] + "01000000&todate=" + year + monthNum[i] + monthDays[i] + "000000\">"+ monthNames[i] + " " + year + "</option>");
		}
	}

	year=today.getFullYear()+1;
	for (i=0;i<12;i++)
	{
		if (i <= today.getMonth() )
		{
			document.write("<option value=\"date=" + year + monthNum[i] + "01000000&todate=" + year + monthNum[i] + monthDays[i] + "000000\">"+ monthNames[i] + " " + year + "</option>");
		}
	}
}

function showPlayer(url)
{
	var win = window.open(url, "rteplayer", "height=560,width=860,status=yes,toolbar=no,menubar=no,location=no");
	win.focus();
}

function showplayer(url)
{
	var win = window.open(url, "rteplayer", "height=560,width=860,status=yes,toolbar=no,menubar=no,location=no");
	win.focus();
}



