function Is () {

   // convert all characters to lowercase to simplify testing

    var agt=navigator.userAgent.toLowerCase()



    // *** BROWSER VERSION ***

    this.major = parseInt(navigator.appVersion)

    this.minor = parseFloat(navigator.appVersion)



    //test for Netscape browser

	this.nav  = ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1)

                && (agt.indexOf('compatible') == -1)))

    this.nav2 = (this.nav && (this.major == 2))

    this.nav3 = (this.nav && (this.major == 3))

    this.nav4 = (this.nav && (this.major == 4))

    this.nav4up = this.nav && (this.major >= 4)

    this.nav5up = this.nav && (this.major >= 5)

    

    //test for IE browser

    this.ie   = (agt.indexOf("msie") != -1)

    this.ie3  = (this.ie && (this.major == 2))

    this.ie4  = (this.ie && (this.major == 4))

    this.ie4up  = (this.ie  && (this.major >= 4))    

	

	//test for OS

    this.win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) )

    // NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all

    //        Win32, so you can't distinguish between Win95 and WinNT.

    this.win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1))



    // NOTE: Reliable detection of Win98 may not be possible. It appears that:

    //       - On Nav 4.x and before you'll get plain "Windows" in userAgent.

    //       - On Mercury client, the 32-bit version will return "Win98", but

    //         the 16-bit version running on Win98 will still return "Win95".

    this.win98 = ((agt.indexOf("win98")!=-1)||(agt.indexOf("windows 98")!=-1))

    this.winnt = ((agt.indexOf("winnt")!=-1)||(agt.indexOf("windows nt")!=-1))	

    this.win32 = this.win95 || this.winnt || this.win98 || 

                 ((this.major >= 4) && (navigator.platform == "Win32")) ||

                 (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1)

                 

    this.mac    = (agt.indexOf("mac")!=-1)

}





function QuickTimeTag(inMovieName, inMovieWidth, inMovieHeight) {

	document.writeln("<embed src=\"" + inMovieName + ".mov\" width=\"" + inMovieWidth + "\" height=\"" + inMovieHeight + "\" scale=\"tofit\" autoplay=\"true\" controller=\"false\" loop=\"false\" pluginspage=\"http://quicktime.apple.com/\" name=\"QuickTime\" align=\"middle\" border=\"1\">");

}



function WindowsMediaObjectTag(inMovieName, inMovieWidth, inMovieHeight) {

	document.writeln("<object id=\"MediaPlayer\" width=\"" + inMovieWidth + "\" height=\"" + inMovieHeight + "\"");

	document.writeln("classid=\"CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95\"");

	document.writeln("codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715\"");

	document.writeln("standby=\"Loading Microsoft Windows Media Player components...\"");

	document.writeln("type=\"application/x-oleobject\">");

	document.writeln("<param name=\"FileName\" value=\"" + inMovieName + ".wmv\">");

	document.writeln("<param name=\"ShowControls\" value=\"False\">");

	document.writeln("<param name=\"ShowStatusBar\" value=\"False\">");

	document.writeln("<param name=\"AutoStart\" value=\"True\">");

	document.writeln("</object>");

}



function WindowsMediaEmbedTag(inMovieName, inMovieWidth, inMovieHeight) {

	document.writeln("<embed type=\"application/x-mplayer2\"");

	document.writeln("pluginspage=\"http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&\"");

	document.writeln("src=\"" + inMovieName + ".wmv\"");

	document.writeln("showcontrols=0");

	document.writeln("autostart=1");

	document.writeln("name=\"MediaPlayer\" width=\"" + inMovieWidth + "\" height=\"" + inMovieHeight + "\">");

	document.writeln("</embed>");

}





// Creates the appropriate <embed> or <object> tag for the given platform and browser.

function MovieTag(inMovieName, inMovieWidth, inMovieHeight) {

	var is = new Is();

	if (is.win) {

		if (is.ie) {

			// With IE for Windows we always use Windows Media

			WindowsMediaObjectTag(inMovieName, inMovieWidth, inMovieHeight);

			return;

		} else {

			// With Netscape for Windows we give them Windows Media only it's all they have.

			if ((navigator.mimeTypes["video/x-ms-wmv"] != null && navigator.mimeTypes["video/x-ms-wmv"].enabledPlugin) && (navigator.mimeTypes["video/quicktime"] == null || !navigator.mimeTypes["video/quicktime"].enabledPlugin)) {

				WindowsMediaEmbedTag(inMovieName, inMovieWidth, inMovieHeight);

				return;

			}

		}

	}

	// If we have no reason to use Windows media, give them a QuickTime embed tag.

	QuickTimeTag(inMovieName, inMovieWidth, inMovieHeight);

}

