
/*************************************************************************
* Thanks to Caio Chassot for original popup & isUndefined code           *
*************************************************************************/
 
// Show date function
function showDate(dateToShow)
{
 	alert("Will eventually show the date '" + dateToShow + "'");
}

// Show event function
function showEvent(eventId)
{
 	alert("Will eventually show the event with id '" + eventId + "'");
}
 
function raw_popup(url, target, width, height, features)
{
	if (isUndefined(width))
		width = 460;
	if (isUndefined(height))
		height = 400;
	if (isUndefined(features))
		features = 'alwaysRaised=yes, dependent=yes, directories=no, location=no,  menubar=no, resizable=yes, statusbar=no, scrollbars=yes, toolbar=no';
	if (isUndefined(target))
		target   = '_blank';
	var x = (screen.availWidth - 12 - width) / 2;
	var y = (screen.availHeight - 48 - height) / 2;
	var theWindow = window.open(url, target, features + ', width=' + width + ', height=' + height + ', left=' + x + ', top=' + y);
	theWindow.focus();
	return theWindow;
}

function link_popup(src, width, height, features)
{
    return raw_popup(src.getAttribute('href'), src.getAttribute('target') || '_blank', width, height, features);
}

function isUndefined(v) {
    var undef;
    return v===undef;
}