﻿function getPlayerMovieURL(cntID) {
	var result = "";
	if(cntID != undefined && cntID != null) {
		contentID = cntID;
	}
	if(contentID == undefined || contentID == null) {
		contentID = "000108C2";
	}
	result += "http://content.sweetim.com/sim/sweetim_wink.swf?";
	result += "ContentURL=" + g_playerConfig.RootURL + contentID + ".swf";
	result += "&StageW=" + getPlayerW();
	result += "&StageH=" + getPlayerH();
	result += "&XScale=" + g_playerConfig.XScale;
	result += "&YScale=" + g_playerConfig.YScale;
	result += "&LPURL=" + g_playerConfig.LandingURL;
	result += "&LPVER=" + g_playerConfig.LandingVer;
	result += "&LPREF=" + g_playerConfig.LandingRef;
	result += "&StopFRM=" + g_playerConfig.StopFRM;
	result += "&Mode=" + 1;
	return result;
}

function getPlayerH() {
	return g_playerConfig.StageH;
}

function getPlayerW() {
	return g_playerConfig.StageW;
}

function writePlayer(cntID) {
	var lfStr = "";
	var playerObj = document.getElementById("twPlayer");
	if(playerObj) {
		lfStr += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"';
		lfStr += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"';
		lfStr += ' width="' + getPlayerW() + '"';
		lfStr += ' height="' + getPlayerH() + '"';
		lfStr += ' id="sim_wink_player"';
		lfStr += ' valign="top">';
		lfStr += '<param name="allowScriptAccess" value="sameDomain" />';
		lfStr += '<param name="movie" value="' + getPlayerMovieURL(cntID) + '" />';
		lfStr += '<param name="quality" value="high" />';
		lfStr += '<param name="scale" value="exactfit" />';
		lfStr += '<param name="wmode" value="transparent" />';
		lfStr += '<embed src="' + getPlayerMovieURL(cntID) + '"';
		lfStr += ' quality="high"';
		lfStr += ' width="' + getPlayerW() + '"';
		lfStr += ' height="' + getPlayerH() + '"';
		lfStr += ' name="sim_wink_player"';
		lfStr += ' valign="top"';
		lfStr += ' allowscriptaccess="sameDomain"';
		lfStr += ' type="application/x-shockwave-flash"';
		lfStr += ' wmode="transparent"';
		lfStr += ' pluginspage="http://www.macromedia.com/go/getflashplayer" />';
		lfStr += '</object>';
		playerObj.innerHTML = lfStr;
	}
}

function getPlayerInsertCode() {
	var result = "";
	var config = { RootURL: "http://content.sweetim.com/sim/cp/icons/",
		StageW: 220, StageH: 225, XScale: 35, YScale: 35,
		LandingURL: "http://www.sweetim.com/s.asp",
		LandingVer: 3,
		LandingRef: 13,
		StopFRM: 20
	};
	var movieURL = getPlayerInsertMovieURL(config);
	var landingURL = config.LandingURL + "?lpver=" + config.LandingVer + "&ref=" + config.LandingRef;
	result += '<div style="width:' + config.StageW + '; height:' + (config.StageH + 30) + '">';
	result += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"';
	result += 'id="wp" width="' + config.StageW + '" height="' + config.StageH + '" align="top">';
	result += '<param name="allowScriptAccess" value="sameDomain" />';
	result += '<param name="movie" value="' + movieURL + '" />';
	result += '<param name="loop" value="false" />';
	result += '<param name="menu" value="false" />';
	result += '<param name="quality" value="high" />';
	result += '<param name="scale" value="exactfit" />';
	result += '<param name="bgcolor" value="#ffffff" />';
	result += '<embed src="' + movieURL + '"';
	result += ' loop="false" menu="false" quality="high" scale="exactfit" bgcolor="#ffffff"';
	result += ' width="' + config.StageW + '" height="' + config.StageH + '"';
	result += ' swLiveConnect=true id="wp" name="wp1" align="top" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	result += '</object>';
	result += '<br/><a href="' + landingURL + '" target="_blank">Get yours at SweetIM.com</a>';
	result += '</div>';
	return result;
}

function getPlayerInsertMovieURL(config) {
	var result = "http://content.sweetim.com/sim/sweetim_wink.swf?";
	result += "ContentURL=" + config.RootURL + contentID + ".swf";
	result += "&StageW=" + config.StageW;
	result += "&StageH=" + config.StageH;
	result += "&XScale=" + config.XScale;
	result += "&YScale=" + config.YScale;
	result += "&LPURL=" + config.LandingURL;
	result += "&LPVER=" + config.LandingVer;
	result += "&LPREF=" + config.LandingRef;
	result += "&StopFRM=" + config.StopFRM;
	result += "&Mode=" + 2;
	return result;
}

