function resizeplayer(w,h) {
	var divname = "mediaspot";
	if(isNaN(w)) { w = 320; }
	if(isNaN(h)) { h = 300; }
	if(document.getElementById) {
		document.getElementById(divname).style.width = w + "px";
		document.getElementById(divname).style.height = h + "px";
	} else if (document.all) {
		document.all[divname].style.pixelWidth = w;
		document.all[divname].style.pixelHeight = h;
	}
}

// ----- FLASH DETECTION BEGIN
// Major version of Flash required
var requiredMajorVersion = 8;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 0;
// Version check based upon the values entered above in "Globals"
var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
// ----- FLASH DETECTION END

var randnum = Math.random();
var vidnum;
var xmlfile;
var lang;
var cmsvid;
var duration;
if(vidnum=="undefined") { vidnum=""; }
if(xmlfile=="undefined") { xmlfile=""; }
if(lang=="undefined") { lang="en"; }
if(cmsvid=="undefined") { cmsvid=""; }
if(duration=="undefined") { duration=""; }

// Check to see if the version meets the requirements for playback
if (hasReqestedVersion) {
	// ATLAS CODE
	if ((typeof adServer!="undefined") && (typeof enableAds!="undefined") && (enableAds == "true")) {
		// ----- PRE-POST ROLL BEGIN
		showAds(AAMB4); // PRE-ROLL AD CALL
		if (typeof flashSWFURL == "undefined") { flashSWFURL = ""; }
		if (typeof flashCLICKURL == "undefined") { flashCLICKURL = ""; }
		var flashSWFURL_pre = flashSWFURL;
		showAds(AAMB7); // POST-ROLL AD CALL
		var flashSWFURL_post = flashSWFURL;

		//document.write(flashSWFURL_pre);
		//document.write(flashSWFURL_post);
		// ----- PRE-POST ROLL END
			
		var so = new SWFObject("/common/flash/twnvideoplayer_generic_v3_autoplay.swf?randnum="+randnum+"&clickTag="+flashCLICKURL, "twnflv", "100%", "100%", "8", "#000000");
		so.addVariable("flashSWFURL_pre", flashSWFURL_pre);
		so.addVariable("flashSWFURL_post", flashSWFURL_post);
		so.addVariable("flashCLICKURL", flashCLICKURL);
	} else { 
		// ADTECH CODE

		if (typeof flashSWFURL_preroll == "undefined") { flashSWFURL_preroll = ""; }
		if (typeof flashCLICKURL_preroll == "undefined") { flashCLICKURL_preroll = ""; }
		if (typeof flashDURATION_preroll == "undefined") { flashDURATION_preroll = ""; }
		if (typeof flashSWFURL_postroll == "undefined") { flashSWFURL_postroll = ""; }
		if (typeof flashCLICKURL_postroll == "undefined") { flashCLICKURL_postroll = ""; }
		if (typeof flashDURATION_postroll == "undefined") { flashDURATION_postroll = ""; }

		var so = new SWFObject("/common/flash/twnvideoplayer_generic_v3b_autoplay.swf?randnum="+randnum+"&clickTAG="+flashCLICKURL_preroll+"&clickTAG2="+flashCLICKURL_postroll, "twnflv", "100%", "100%", "8", "#000000");
		so.addVariable("flashSWFURL_pre", flashSWFURL_preroll);
		so.addVariable("flashCLICKURL_pre", flashCLICKURL_preroll);
		so.addVariable("flashDURATION_pre", flashDURATION_preroll);
		so.addVariable("flashSWFURL_post", flashSWFURL_postroll);
		so.addVariable("flashCLICKURL_post", flashCLICKURL_postroll);
		so.addVariable("flashDURATION_post", flashDURATION_postroll);
	}
	so.addParam("loop","false");
	so.addParam("menu","false");
	so.addParam("wmode","opaque");
	so.addVariable("fv_vidnum", vidnum);
	so.addVariable("fv_xmlfile", xmlfile);
	so.addVariable("fv_lang", lang);
	so.addVariable("fv_cmsvid", cmsvid);
	so.write("mediaspot");
} else {
	document.write("<br />This Flash movie requires Flash player version 8 or greater.");
	document.write("<br />Either an older Flash player or no Flash player was detected on your browser.");
	document.write("<br /><a href=http://www.adobe.com/go/getflash/ target=_blank><img src=http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif border=0></a>");
}
