function writeMediaFile(movieWidth, movieHeight, movieSrc, loop, controller) {
  loop = loop ? loop : 'false';
  controller = controller ? controller : 'true';
	document.write('<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="' + movieWidth + '" HEIGHT="' + movieHeight + '" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">' +
	'<PARAM NAME="src" VALUE="' + movieSrc + '">' +
	'<PARAM NAME="autoplay" VALUE="true">' +
	'<PARAM NAME="controller" VALUE="' + controller + '">' +
	'<PARAM NAME="loop" VALUE="' + loop + '">' +
	'<EMBED SRC="' + movieSrc + '" WIDTH="' + movieWidth + '" HEIGHT="' + movieHeight + '" AUTOPLAY="true" CONTROLLER="true" LOOP="false" PLUGINSPAGE="http://www.apple.com/quicktime/">' +
	'</EMBED></OBJECT>');
}

// Declare all variables, arrays etc..
var FLASH = 1;

function flash_menu(installed) {
	if (installed == 1) {
		FLASH = 1;
	} else if (installed == 0) {
		FLASH = 0;
	}
}

function delayFlash(flash_file, img_file, img_alt, flash_width, flash_height, flashDiv, flashTime) {
	setTimeout('writeFlashBanner(\''+flash_file+'\', \''+img_file+'\', \''+img_alt+'\', \''+flash_width+'\', \''+flash_height+'\', \''+flashDiv+'\')', flashTime);
}

function writeFlashBanner(flash_file, img_file, img_alt, flash_width, flash_height, flashDiv) {
	if ((IE && FLASH) || ((NS || NS6) && FLASH && MAC) || ((NS || NS6) && FLASH)) {
		if (IE && !MAC) {
			getElementById(flashDiv).innerHTML = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0" ID="" WIDTH="'+flash_width+'" HEIGHT="'+flash_height+'"><PARAM NAME="movie" VALUE="'+flash_file+'"><PARAM NAME="quality" VALUE="high"></OBJECT>';
		} else if (NS || NS6 || (IE && MAC)) {
			getElementById(flashDiv).innerHTML = '<EMBED SRC="'+flash_file+'" swLiveConnect="TRUE" WIDTH="'+flash_width+'" HEIGHT="'+flash_height+'" QUALITY="high" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>';
		}
	} else {
		getElementById(flashDiv).innerHTML = '<img src="'+img_file+'" width="'+flash_width+'" height="'+flash_height+'" alt="'+img_alt+'">';
	}
}

function checkLicenceChecked(frm) {
	var licenceChecked = false;
	var Msg = '';
	for (var i = 0; i < frm.licence.length; i++) {
		if (frm.licence[i].checked == true) {
			licenceChecked = true;
		}
	}

	if (licenceChecked == false) {
		alert('Please select a licence level');
		return false;
	}

}


function checkFormatTypeLengthChecked(frm) {
	var Msg = '';
	var formatChecked = false;
	var typeChecked = false;
	var lengthChecked = false;
	for (var i = 0; i < frm.format.length; i++) {
		if (frm.format[i].checked == true) {
			formatChecked = true;
		}
	}
	if (formatChecked == false) {
		Msg += 'Please select a video format\n';
	}

	if (frm.platform) {
		if (frm.platform.length == null) {
			if (frm.platform.checked == true) {
				typeChecked = true;
			}
		} else {
    			for (var i = 0; i < frm.platform.length; i++) {
    				if (frm.platform[i].checked == true) {
    					typeChecked = true;
    				}
    			}
		}
		if (typeChecked == false) {
			Msg += 'Please select a type of licence\n';
		}
	}

	if (frm.licence_duration) {
		if (frm.licence_duration.length == null) {
			if (frm.licence_duration.checked == true) {
				lengthChecked = true;
			}
		} else {
			for (var i = 0; i < frm.licence_duration.length; i++) {
				if (frm.licence_duration[i].checked == true) {
					lengthChecked = true;
				}
			}
		}
		if (lengthChecked == false) {
			Msg += 'Please select a licence duration\n';
		}
	}

	if (formatChecked == false || typeChecked == false || lengthChecked == false) {
		alert(Msg);
		return false;
	}
}