function generateRelationImageLink(flashExists, imageExists, urlExists, height, width, URL, URLTarget, title, flashFile, imageFile) {

	if (flashExists) {
		var hasRightFlashVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
		if (hasRightFlashVersion) {
			generateFlashLink(urlExists, height, width, URL, URLTarget, title, flashFile);
		} else if (imageExists) {
			generateImageLink(urlExists, URL, URLTarget, title, imageFile, width, height)
		}
	} else if (imageExists) {
		generateImageLink(urlExists, URL, URLTarget, title, imageFile, width, height)
	}
}


function generateFlashLink(urlExists, height, width, URL, URLTarget, title, flashFile) {
	if (urlExists) {
		document.write("<div id='ClickMeDiv' style='Height:"+ height +"; width: " + width + "'><a href='"+ URL + "' " + URLTarget + " title='" + title + "'><img src='/SysImages/s.gif' height='" + height + "' width='100%' border='0' alt='" + title + "'></a></div>")
	}

	var oeTags = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
	+ 'width="' + width + '" height="' + height + '"'
	+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
	+ '<param name="movie" value="' + flashFile +'" /><param name="quality" value="high" /><param name="bgcolor" value="#FFFFFF" />'
	+ '<param name="wmode" value="transparent">'
	+ '<embed src="' + flashFile + '" quality="high" bgcolor="#FFFFFF" '
	+ 'width="' + width + '" height="' + height + '" name="detectiontest" aligh="middle"'
	+ 'play="true"'
	+ 'loop="false"'
	+ 'quality="high"'
	+ 'allowScriptAccess="sameDomain"'
	+ 'type="application/x-shockwave-flash"'
	+ 'wmode="transparent"'
	+ 'pluginspage="http://www.macromedia.com/go/getflashplayer">'
	+ '<\/embed>'
	+ '<\/object>';

	document.write(oeTags);   // embed the Flash Content SWF when all tests are passed
	if (urlExists) {
		document.write("</div>")
	}
}


function generateImageLink(urlExists, URL, URLTarget, title, imageFile, width, height) {
	if (urlExists) { 
		document.write("<a href='" + URL + "'" + URLTarget + " title='" + title + "'>")
	}

	document.write("<img src='" + imageFile + "' border='0' alt='" + title + "'");

	if (height != '') {
		document.write(" height='" + height + "'")
	}
	if (width != '') {
		document.write(" width='" + width  + "'")
	}
	document.write(">")
	
	if (urlExists) {
		document.write("</a>")
	} 
}


