//=====================================================================================
// Start flash support

// Detect compatible flash player
var minFlashVersion = 4;	// Macromedia v4 appears to play our v5 files
var canPlayFlash = false;	// Assume we can't play flash

if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {
	// Netscape and other modern browsers, find the installed plugin and
	// compare the version
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	for (var i = 0; i < words.length; ++i)
	{
		if (isNaN(parseInt(words[i]))) continue;
		var playerVersion = words[i]; 
	}
	canPlayFlash = playerVersion >= minFlashVersion;
} else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE") >= 0) {
	var canDetectPlugin = false;
	if (navigator.appVersion.indexOf("Win") != -1) {
		// All IE Windows versions support plugin detection (before IE4, client-side scripting was
		// not supported, so it will fall through to the noscript tag)
		canDetectPlugin = true;
	} else if (navigator.appVersion.indexOf("Mac") != -1) {
		// MacIntosh version 4.5 is a special problem in that it does not support browser
		// detection, but version 5 and later does
		if (parseInt(navigator.appVersion) > 4) {
			canDetectPlugin = true;
		}
	}
	if (canDetectPlugin) {
		// We test version by instanciating ActiveX object
		// Hide this from IE4.5 Mac by splitting the tag
		document.write('<scr' + 'ipt language=vbscript\> \n');
		document.write('on error resume next \n');
		document.write('canPlayFlash = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & minFlashVersion)))\n');
		document.write('</scr' + 'ipt\> \n');
	}
}

function playFlash5(sFlashFile, sNoFlashFile, w, h)
{
	// Show flash presentation if we have a compatible flash player installed
	if (canPlayFlash) {
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" width="' + w + '" height="' + h + '"><param name="movie" value="Media/' + sFlashFile + '"><param name="quality" value="high"><param name="Loop" value="true"><param name="play" value="true"><param name="menu" value="false">');
		document.write('<embed src="Media/' + sFlashFile + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + w + '" height="' + h + '"></embed>');
		document.write('<noembed><img border="0" width="' + w + 'px" height="' + h + 'px" src="Media/' + sNoFlashFile + '"></noembed>');
		document.write('</object>');
	} else{
		document.write('<img border="0" width="' + w + 'px" height="' + h + 'px" src="Media/' + sNoFlashFile + '">')
	}
}

// End flash support
//=====================================================================================

//=====================================================================================
// Start floatover button support

function MM_swapImgRestore()
{
	var i, x, a = document.MM_sr;
	for(i=0; a && i < a.length && (x = a[i]) && x.oSrc; i++)
	{
		x.src = x.oSrc;
	}
}

function MM_preloadImages()
{
	var d = document;
	if(d.images)
	{
		if(!d.MM_p) d.MM_p = new Array();
		var i, j = d.MM_p.length, a = MM_preloadImages.arguments;
		for(i=0; i < a.length; i++)
		{
			if(a[i].indexOf("#") != 0)
			{
				d.MM_p[j] = new Image;
				d.MM_p[j++].src = a[i];
			}
		}
	}
}

function MM_findObj(n, d)
{
	var p, i, x;
	if(!d) d = document;
	if((p = n.indexOf("?")) > 0 && parent.frames.length)
	{
		d = parent.frames[n.substring(p+1)].document;
		n = n.substring(0, p);
	}
	if(!(x = d[n]) && d.all) x = d.all[n];
	for(i=0; !x&&i < d.forms.length; i++)
	{
		x = d.forms[i][n];
	}
	for(i=0; !x && d.layers && i < d.layers.length; i++)
	{
		x = MM_findObj(n, d.layers[i].document);
	}
	if(!x && d.getElementById) x = d.getElementById(n); return x;
}

function MM_swapImage() {
	var i, j = 0, x, a = MM_swapImage.arguments;
	document.MM_sr = new Array;
	for(i = 0; i < (a.length-2); i += 3)
	{
		if((x = MM_findObj(a[i])) != null)
		{
			document.MM_sr[j++] = x;
			if(!x.oSrc) x.oSrc = x.src;
			x.src = a[i+2];
		}
	}
}

// End floatover graphic support
//====================================================================================

//====================================================================================
// Start validation support

var daysOfMonth = new Array( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 );
var daysOfMonthLY = new Array( 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 );

function isLeapYear(year)
{
	year = year - 0;
	if((year/4) != Math.floor(year/4)) return false;
	if((year/100) != Math.floor(year/100)) return true;
	if((year/400) != Math.floor(year/400)) return false;
	return true;
}

function isValidDate(day, month, year)
{
	day = day - 0;
	month = month - 0;
	year = year - 0;
	if ((month < 1) || (month > 12)) return false;
	if (isLeapYear(year) && (day > daysOfMonthLY[month-1])) return false;
	if (!isLeapYear(year) && (day > daysOfMonth[month-1])) return false;
	return true;
}
			
// End validation support
//====================================================================================

//====================================================================================
// Start delete support

function deleteit(itemName, itemID, workerUrl, doneUrl)
{
	if(confirm("Do you really want to delete the " + itemName + "?"))
	{
		window.location = workerUrl + "?mode=D&id=" + itemID + "&from=" + doneUrl;
	}
}

// End delete support
//====================================================================================