
var tMajorVersion = 8;// 8.5 needed > 8.5 = 8,5,0,0
var tMinorVersion = 1;
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;
			}
		}
	}
	
}

/*
 DirTag Class v0.3
 Created by: Valentin Schmidt
	
 Clone of FlashTag Class by Mike Chambers and Christian Cantrell
	
 Generates a browser-specific Director Shockwave tag. Create a new instance, set whatever
 properties you need, then call either toString() to get the tag as a string, or call write() 
 to write the tag out.
 
*/


/**
 * Creates a new instance of the DirTag.
 * src: The path to the DCR file.
 * width: The width of your movie.
 * height: the height of your Fmovie.
 * Example:

 */
function DirTag(id, src, width, height, forceReloadFlag, bgc)
{
    this.src       = src;
    if (forceReloadFlag) this.src += '?'+Math.random();
    this.width     = width;
    this.height    = height;
    this.version   = null;
    this.id        = id;
    this.bgcolor   = bgc;
    this.dirVars = null;
}

/**
 * Sets the Director Shockwave version used in the Director Shockwave tag.
 */
DirTag.prototype.setVersion = function(v)
{
    this.version = v;
}

/**
 * Sets the ID used in the Director Shockwave tag.
 */
DirTag.prototype.setId = function(id)
{
    this.id = id;
}

/**
 * Sets the background color used in the Director Shockwave tag.
 */
DirTag.prototype.setBgcolor = function(bgc)
{
    this.bgcolor = bgc;
}

/**
 * Sets any variables to be passed into the Director Shockwave content, as externalParamValue("sw1")..("sw9").
   maximum 9 args supported
 */
DirTag.prototype.setDirvars = _setDirvars;
function _setDirvars(){
    this.dirVars = _setDirvars.arguments;
}
	
/**
 * Get the Director Shockwave tag as a string. 
 */
DirTag.prototype.toString = function()
{
    var ieWin = (/Win/.test(navigator.userAgent) && navigator.appName.indexOf ("Microsoft") != -1) ? 1 : 0;
    var DirTag = new String();
    
    if (ieWin && tShockwaveFound)
    
    {
        DirTag += '<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" ';
        if (this.id != null)
        {
            DirTag += 'id="'+this.id+'" ';
        }
        DirTag += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version='+this.version+'" ';
        DirTag += 'width="'+this.width+'" ';
        DirTag += 'height="'+this.height+'">';
        DirTag += '<param name="src" value="'+this.src+'"/>';
        DirTag += '<param name="bgcolor" value="#'+this.bgcolor+'"/>';
        if (this.dirVars != null){
        	var len = Math.min(this.dirVars.length, 8);
        	for (i=0;i<len;i++)
        		DirTag += '<param name="sw'+(i+1)+'" value="'+this.dirVars[i]+'"/>';
        }
        DirTag += '</object>';
    }
  
    else
    
    {
        DirTag += '<embed src="'+this.src+'" ';
        DirTag += 'bgcolor="#'+this.bgcolor+'" ';
        //DirTag += 'swStretchVAlign="Bottom"';
        DirTag += 'width="'+this.width+'" ';
        DirTag += 'height="'+this.height+'" ';
        DirTag += 'type="application/x-director" ';
        if (this.dirVars != null){
        	var len = Math.min(this.dirVars.length, 8);
        	for (i=0;i<len;i++)
            DirTag += 'sw'+(i+1)+'="'+this.dirVars[i]+'" ';
        }
        if (this.id != null)
        {
            DirTag += 'name="'+this.id+'" ';
            DirTag += 'id="'+this.id+'" ';
        }
        DirTag += 'playerVersion="10" ';
        DirTag += 'pluginspage="http://www.macromedia.com/shockwave/download/">';
        DirTag += '</embed>';
    }

	
    return DirTag;
}

/**
 * Write the Director Shockwave tag out. Pass in a reference to the document to write to. 
 */
DirTag.prototype.write = function(doc)
{
  doc.write(this.toString());
}



function nsw() {

if (document.getElementById('mediaBox')){

    var nsw = document.getElementById('mediaHolder');
    
    var nsw1 = document.createElement("div");

	nsw1.setAttribute('id','nsw');
	
	nsw1.innerHTML = '<p> A newer version of Shockwave must be installed to display this content. To update your Shockwave installation click <a href="http://www.google.com/search?hl=en&q=shockwave+player+download&btnG=Google+Search" target="_blank" id="swLink">here</a>.</p>';
	
	nsw.appendChild(nsw1);
	

	
 }

}
