var tMajorVersion = 10;
var tMinorVersion = 0;
var tShockwaveFound = 0;

if (navigator.mimeTypes && navigator.mimeTypes["application/x-director"] && navigator.mimeTypes["application/x-director"].enabledPlugin) {
	
	if (navigator.plugins && navigator.plugins["Shockwave for Director"] && (tVersionIndex = navigator.plugins["Shockwave for Director"].description.indexOf(".")) != - 1) {
		var tMajorVersionString = navigator.plugins["Shockwave for Director"].description.substring(tVersionIndex-2, tVersionIndex);
		var tMinorVersionString = navigator.plugins["Shockwave for Director"].description.substring(tVersionIndex+1, tVersionIndex+2);
		if (parseInt(tMajorVersionString) >= tMajorVersion) {
			if (tMinorVersion > 0) {
				if (parseInt(tMinorVersionString) >= tMinorVersion) {
					tShockwaveFound = 1;
				}
			} else {
				tShockwaveFound = 1;
			}
		}
	}
	
} else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.userAgent.indexOf("Windows 95")>=0 || navigator.userAgent.indexOf("Windows 98")>=0 || navigator.userAgent.indexOf("Windows NT")>=0 )) {

	var tVersionString = "";
	document.write('<SCRIPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('set tSWControl = CreateObject("SWCtl.SWCtl") \n');
	document.write('if IsObject(tSWControl) then \n');
	document.write('tVersionString = tSWControl.ShockwaveVersion("") \n');
	document.write('end if');
	document.write('</SCRIPT\> \n');
	if (tVersionString != "") { 
		tVersionIndex = tVersionString.indexOf(".")
		var tMajorVersionString = tVersionString.substring(tVersionIndex-2, tVersionIndex);
		var tMinorVersionString = tVersionString.substring(tVersionIndex+1, tVersionIndex+2);
		if (parseInt(tMajorVersionString) >= tMajorVersion) {
			if (tMinorVersion > 0) {
				if (parseInt(tMinorVersionString) >= tMinorVersion) {
					tShockwaveFound = 1;
				}
			} else {
				tShockwaveFound = 1;
			}
		}
	}
	
}


function ShowDCR (src, w, h, sw1) {
	if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
		// include Embed for Navigator and Safari
		ShowDCREmbed (src, w, h, sw1);
	} else {
		// XHTML valid Object tag only
		ShowDCRObject (src, w, h, sw1);
	}
}

function ShowDCRObject (src, w, h, sw1) {
	var html = '';
	html += '<object type="application/x-director" data="'+src+'" width="'+w+'" height="'+h+'">';
	html += '<param name="src" value="'+src+'" />';
	html += '<param name="sw1" value="'+sw1+'" />';
	html += '<param name="swRemote" value="swSaveEnabled=\'true\' swVolume=\'true\' swRestart=\'true\' swPausePlay=\'true\' swFastForward=\'true\' swContextMenu=\'true\' "/>';
	html += '<param name="swStretchStyle" value="fill" />';
	html += "</object>";
	document.write(html);
}

function ShowDCREmbed (src, w, h, sw1) {
	var html = '';
	html += '<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=10,0,0,0" ';
	html += 'id="'+src+'" width="'+w+'" height="'+h+'">';
	html += '<param name="src" value="'+src+'" />';
	html += '<param name="sw1" value="'+sw1+'" />';
	html += '<param name="swRemote" value="swSaveEnabled=\'true\' swVolume=\'true\' swRestart=\'true\' swPausePlay=\'true\' swFastForward=\'true\' swContextMenu=\'true\' "/>';
	html += '<param name="swStretchStyle" value="fill" />';
	html += '<embed src="'+src+'" width='+w+" height="+h;
	html += ' swRemote="swSaveEnabled=\'false\' swVolume=\'true\' swRestart=\'false\' swPausePlay=\'false\' swFastForward=\'false\' swContextMenu=\'true\'" '; 
	html += ' swStretchStyle="fill" type="application/x-director" pluginspage="http://www.adobe.com/shockwave/download/" sw1="'+sw1+'" ></embed>';
	html += '</object>';
	document.write(html);
}

function openNewWindowTitle(link,title) {
	popuptest=window.open(link,title,'toolbar=yes, location=yes, directories=yes, status=yes, menubar=yes, scrollbars=yes, copyhistory=yes, resizable=yes');
}

function openNewWindow(link) {
	//if(isIE7) {
	//	document.getElementById("no-new-window").style.display = "block";
	//}
	popuptest=window.open(link,'','toolbar=yes, location=yes, directories=yes, status=yes, menubar=yes, scrollbars=yes, copyhistory=yes, resizable=yes');
	if(popuptest==null)
		document.getElementById("no-new-window").style.display = "block";
}
