// a script based detector for flash files

function traceObj(obj){
	var i;
	for(i in obj){
		document.write(i + ":" + obj[i] + "<br>\n");
	}
}

// broswer detect

var ie = (navigator.appVersion.indexOf("MSIE") != -1) ? 1 : 0;
var win = (navigator.appVersion.indexOf("Windows") != -1) ? 1 : 0;
var mac = (navigator.appVersion.indexOf("Macintosh") != -1) ? 1 : 0;


function getFlashVersion(){
	// this object will contain relevant info and be returned
	// at the end of the function
	var player = {
		'description':null,
		'version':null,
		'majVersion':null,
		'minVersion':null
	}
	
	// if this works we're laughing
	if(navigator.plugins['Shockwave Flash']){
		// d will equal something like: Shockwave Flash 6.0 r29
		var d = player.description = navigator.plugins['Shockwave Flash'].description;

		// get a major and minor from that...  '[ r]+' is for mozilla, ' r' doesn't work (?)
		var rexp = /([\d\.]+)[ r]+([\d\.]+)/;
		var result = rexp.exec(d);
		if(result){
			player.version = result[0];
			player.majVersion = result[1];
			player.minVersion = result[2];
		}
	}
	
	else if(navigator.userAgent.indexOf("WebTV") != -1){
	// don't like this because it's static, hopefully the plugins array will work in future versions
		player.majVersion = 3;
		player.description = "WebTV";
	}

	else if(ie && win){
	// why doesn't win/ie support plugin detection?  sigh.  use vbscript
		// put the maxVersion here
		var maxVersion = 8;
		//
		
		
		
		
/*Function VBGetSwfVer(i)
  on error resume next
  Dim swControl, swVersion
  swVersion = 0
  
  set swControl = CreateObject("ShockwaveFlash.ShockwaveFlash." + CStr(i))
  if (IsObject(swControl)) then
    swVersion = swControl.GetVariable("$version")
  end if
  VBGetSwfVer = swVersion
End Function
*/
			
		var a = '';
		a+='<SCR' + 'IPT type="text/vbscript"> \n';
		a+='on error resume next \n'
		a+='i=4 \n';
		a+='VB_version=4 \n';
		a+='Do While (i < '+ maxVersion + ') \n';
		a+='  If(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & i))) Then \n';
		a+='    VB_version = i \n';
		a+='    i=i+1 \n';
		a+='  End If \n';
		a+='Loop \n';
		a+='</SCR' + 'IPT> \n';
		document.write(a);
		player.description = "win/ie";
		player.majVersion = player.version = VB_version;
	}
	return (player.description) ? player : false;
}

function makeMovie(url,name,w,h){
	movie = '<object name="'+name+'" type="application/x-shockwave-flash" ';
	movie += 'data="' + url + '" width="'+w+'" height="'+h+'">';
	movie += '<param name="movie" value="' + url + '" /></object>';
	return movie;
}

// this one's handy...
function openWin(url,name,attr){
	window.open(url,name,attr);
}
