function WriteSWF(url, id, color, width, height, var1, var2, var3) {
	var s = "";
	s += "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" + width + "\" height=\"" + height + "\" id=\"" + id + "\">";
	s += "        <param name=\"allowScriptAccess\" value=\"always\" />";
	s += "        <param name=\"movie\" value=\"" + url + "\" />";
	s += "        <param name=\"quality\" value=\"high\" />";
	s += "        <param name=\"bgcolor\" value=\"" + color + "\" />";
	s += "        <param name=\"wmode\" value=\"transparent\" />";
	s += "        <param name=\"FlashVars\" value=\"HtmlSet1=" + var1 + "&HtmlSet2=" + var2 + "&HtmlSet3=" + var3 + "&ScreenHeight=" + screen.height + "\" />";
	s += "        <EMBED src=\"" + url + "\" FlashVars=\"HtmlSet1=" + var1 + "&HtmlSet2=" + var2 + "&HtmlSet3=" + var3 + "&ScreenHeight=" + screen.height + "\" quality=\"high\" bgcolor=\"" + color + "\" width=\"" + width + "\" height=\"" + height + "\" name=\"" + id + "\" wmode=\"transparent\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\">";
	s += "</object>";
	document.write(s);
}

var arrayList = new Array();
var playerWMP;
var intNext = 0;

function WriteWMP(url, width, height, display, controls, status, auto, tracker, position_controls, count, frame) {
	var s = "";
	s += "<OBJECT id=\"csjs_mc_player\" classid=\"CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95\"";
	s += " CODEBASE=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701\"";
	s += " standby=\"Now loading...\"";
	s += " TYPE=\"application/x-oleobject\"";
	if (width > 0) { s += " width=" + width; }
	if (height > 0) { s += " height=" + height; }
	s += ">";

	s += "<PARAM NAME=\"FileName\" VALUE=\"" + url + "\">";
	s += "<PARAM NAME=\"ShowDisplay\" VALUE=\"" + display + "\">";
	s += "<PARAM NAME=\"ShowControls\" VALUE=\"" + controls + "\">";
	s += "<PARAM NAME=\"ShowStatusBar\" VALUE=\"" + status + "\">";
	s += "<PARAM NAME=\"AutoStart\" VALUE=\"" + auto + "\">";
	s += "<PARAM NAME=\"PlayCount\" VALUE=\"" + count + "\">";
	s += "<PARAM NAME=\"ShowTracker\" value=\"" + tracker + "\" />";
	s += "<param name=\"ShowPositionControls\" value=\"" + position_controls + "\" />";

	s += "<Embed TYPE=\"application/x-mplayer2\"";
	s += " pluginspage=\"http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/\"";
	s += " SRC=\"" + url + "\"";
	s += " name=csjs_mc_player";
	s += " ShowDisplay=" + display;
	s += " ShowControls=" + controls;
	s += " ShowStatusBar=" + status;
	s += " AutoStart=" + auto;
	s += " ShowTracker=" + tracker;
	s += " ShowPositionControls=" + position_controls;
	s += " Roop=" + count;
	if (width > 0) { s += " width=" + width; }
	if (height > 0) { s += " height=" + height; }
	s += "></Embed>";

	s += "</OBJECT>";

	document.write(s);
	
	playerWMP = document.getElementById("csjs_mc_player");

	if (frame == 1) {
		if(playerWMP) {
			addEventListener(playerWMP, "PlayStateChange", CheckBanner);
		}
	}
}

var contentsUrl = "";
function CheckBanner() {
    var id = playerWMP.GetCurrentEntry();
    if (id != 0) {
        contentsUrl = playerWMP.GetMediaParameter(id, 'ContentsURL');
    }
}

function addEventListener(target, type, func) {
  if(target.attachEvent) {
    target.attachEvent(type, func);
  } else if(target.addEventListener) {
    target.addEventListener(type, func, true);
  }
}

function GotoContentsPage() {
    if (contentsUrl != "") {
        document.URL = contentsUrl;
    }
}

function GotoPage(str_url) {
	document.URL = str_url;
}
