// MC Media Player: JavaScript file v 0.8
// More information: www.mcmediaplayer.com

// SWFObject Integration 2008-11-12 Gary Rowswell
function f_swfobject_mcmp(fv_mcmp_id,fv_mcmp_w,fv_mcmp_h,fv_mcmp_var) {

	if (fv_mcmp_var != false) {
		// Pass Defined Vars or Default Values
		var flashvars = {
			streamingServerURL: ((typeof fv_mcmp_var.streamingServerURL == 'undefined') ? '' : fv_mcmp_var.streamingServerURL),
			fpFileURL: ((typeof fv_mcmp_var.fpFileURL == 'undefined') ? '' : fv_mcmp_var.fpFileURL),
			fpPreviewImageURL: ((typeof fv_mcmp_var.fpPreviewImageURL == 'undefined') ? '' : fv_mcmp_var.fpPreviewImageURL),
			fpPreviewImageSize: ((typeof fv_mcmp_var.fpPreviewImageSize == 'undefined') ? '' : fv_mcmp_var.fpPreviewImageSize),
			fpAction: ((typeof fv_mcmp_var.fpAction == 'undefined') ? '' : fv_mcmp_var.fpAction),
			defaultBufferLength: ((typeof fv_mcmp_var.defaultBufferLength == 'undefined') ? '1' : fv_mcmp_var.defaultBufferLength),
			defaultEndAction: ((typeof fv_mcmp_var.defaultEndAction == 'undefined') ? 'previewImage' : fv_mcmp_var.defaultEndAction),
			defaultStopAction: ((typeof fv_mcmp_var.defaultStopAction == 'undefined') ? 'previewImage' : fv_mcmp_var.defaultStopAction),
			// Player Settings
			colorScheme: ((typeof fv_mcmp_var.colorScheme == 'undefined') ? '' : fv_mcmp_var.colorScheme),
			playerBackgroundColor: ((typeof fv_mcmp_var.playerBackgroundColor == 'undefined') ? 'FFF5EB' : fv_mcmp_var.playerBackgroundColor),
			playerSize: ((typeof fv_mcmp_var.playerSize == 'undefined') ? '' : fv_mcmp_var.playerSize),
			playerAutoResize: ((typeof fv_mcmp_var.playerAutoResize == 'undefined') ? 'on' : fv_mcmp_var.playerAutoResize),
			videoScreenPosition: ((typeof fv_mcmp_var.videoScreenPosition == 'undefined') ? '0x0' : fv_mcmp_var.videoScreenPosition),
			videoScreenSize: ((typeof fv_mcmp_var.videoScreenSize == 'undefined') ? fv_mcmp_w + 'x' + fv_mcmp_h : fv_mcmp_var.videoScreenSize),
			// Messages Settings
			msgBackgroundColor: ((typeof fv_mcmp_var.msgBackgroundColor == 'undefined') ? '000000' : fv_mcmp_var.msgBackgroundColor),
			msgBackgroundOpacity: ((typeof fv_mcmp_var.msgBackgroundOpacity == 'undefined') ? '90' : fv_mcmp_var.msgBackgroundOpacity),
			// Button Settings
			fpButtonOpacity: ((typeof fv_mcmp_var.fpButtonOpacity == 'undefined') ? '60' : fv_mcmp_var.fpButtonOpacity),
			fpButtonPosition: ((typeof fv_mcmp_var.fpButtonPosition == 'undefined') ? '116x40' : fv_mcmp_var.fpButtonPosition),
			fpButtonSize: ((typeof fv_mcmp_var.fpButtonSize == 'undefined') ? '126x126' : fv_mcmp_var.fpButtonSize),
			fpButtonColor: ((typeof fv_mcmp_var.fpButtonColor == 'undefined') ? '' : fv_mcmp_var.fpButtonColor),
			// Control Panel
			cpBackgroundColor: ((typeof fv_mcmp_var.cpBackgroundColor == 'undefined') ? '000000' : fv_mcmp_var.cpBackgroundColor),
			cpBackgroundOpacity: ((typeof fv_mcmp_var.cpBackgroundOpacity == 'undefined') ? '60' : fv_mcmp_var.cpBackgroundOpacity),
			cpButtonsOpacity: ((typeof fv_mcmp_var.cpButtonsOpacity == 'undefined') ? '100' : fv_mcmp_var.cpButtonsOpacity),
			cpCounterPosition: ((typeof fv_mcmp_var.cpCounterPosition == 'undefined') ? '' : fv_mcmp_var.cpCounterPosition),
			cpFullscreenBtnPosition: ((typeof fv_mcmp_var.cpFullscreenBtnPosition == 'undefined') ? '' : fv_mcmp_var.cpFullscreenBtnPosition),
			cpHidePanel: ((typeof fv_mcmp_var.cpHidePanel == 'undefined') ? 'button' : fv_mcmp_var.cpHidePanel),
			cpHideDelay: ((typeof fv_mcmp_var.cpHideDelay == 'undefined') ? '0' : fv_mcmp_var.cpHideDelay),
			cpInfoBtnPosition: ((typeof fv_mcmp_var.cpInfoBtnPosition == 'undefined') ? '' : fv_mcmp_var.cpInfoBtnPosition),
			cpPlayBtnPosition: ((typeof fv_mcmp_var.cpPlayBtnPosition == 'undefined') ? '' : fv_mcmp_var.cpPlayBtnPosition),
			cpPlayBtnColor: ((typeof fv_mcmp_var.cpPlayBtnColor == 'undefined') ? '' : fv_mcmp_var.cpPlayBtnColor),
			cpPosition: ((typeof fv_mcmp_var.cpPosition == 'undefined') ? '' : fv_mcmp_var.cpPosition),
			cpRepeatBtnPosition: ((typeof fv_mcmp_var.cpRepeatBtnPosition == 'undefined') ? '' : fv_mcmp_var.cpRepeatBtnPosition),
			cpScrubberPosition: ((typeof fv_mcmp_var.cpScrubberPosition == 'undefined') ? '' : fv_mcmp_var.cpScrubberPosition),
			cpScrubberColor: ((typeof fv_mcmp_var.cpScrubberColor == 'undefined') ? '' : fv_mcmp_var.cpScrubberColor),
			cpScrubberLoadedColor: ((typeof fv_mcmp_var.cpScrubberLoadedColor == 'undefined') ? '' : fv_mcmp_var.cpScrubberLoadedColor),
			cpScrubberElapsedColor: ((typeof fv_mcmp_var.cpScrubberElapsedColor == 'undefined') ? '' : fv_mcmp_var.cpScrubberElapsedColor),
			cpVolumeStart: ((typeof fv_mcmp_var.cpVolumeStart == 'undefined') ? '75' : fv_mcmp_var.cpVolumeStart),
			cpStopBtnPosition: ((typeof fv_mcmp_var.cpStopBtnPosition == 'undefined') ? '' : fv_mcmp_var.cpStopBtnPosition),
			cpStopBtnColor: ((typeof fv_mcmp_var.cpStopBtnColor == 'undefined') ? '' : fv_mcmp_var.cpStopBtnColor),
			cpVolumeBtnPosition: ((typeof fv_mcmp_var.cpVolumeBtnPosition == 'undefined') ? '' : fv_mcmp_var.cpVolumeBtnPosition),
			cpVolumeCtrlColor: ((typeof fv_mcmp_var.cpVolumeCtrlColor == 'undefined') ? '' : fv_mcmp_var.cpVolumeCtrlColor),
			cpSize: ((typeof fv_mcmp_var.cpSize == 'undefined') ? '' : fv_mcmp_var.cpSize),
			// Tooltip Settings
			tooltipTextColor: ((typeof fv_mcmp_var.tooltipTextColor == 'undefined') ? '000000' : fv_mcmp_var.tooltipTextColor),
			tooltipBGColor: ((typeof fv_mcmp_var.tooltipBGColor == 'undefined') ? 'CCCCCC' : fv_mcmp_var.tooltipBGColor)
		};
	}
	var params = {
		allowfullscreen: "true",
		menu: "false",
		wmode: "opaque"
	};
	var attributes = {
		id: fv_mcmp_id,
		name: fv_mcmp_id
	};
	if (swfobject.hasFlashPlayerVersion("7.0.19.0")) {
		swfobject.embedSWF(v_url_root + "media/swf/mcmp.swf",fv_mcmp_id,fv_mcmp_w,fv_mcmp_h,"7.0.19.0",v_url_root + "media/swf/expressInstall.swf",flashvars,params,attributes);
	} else {
		$("<object/>")
			.attr("codebase","http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0")
			.attr("classid","clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B")
			.attr("width",fv_mcmp_w)
			.attr("height",fv_mcmp_h)
			.append(
				$("<param/>")
					.attr("name","controller")
					.attr("value","false")
			)
			.append(
				$("<param/>")
					.attr("name","src")
					.attr("value",fv_mcmp_var.fpPreviewImageURL)
			)
			.append(
				$("<param/>")
					.attr("name","href")
					.attr("value",fv_mcmp_var.fpFileURL.replace("flv","mp4"))
			)
			.append(
				$("<param/>")
					.attr("name","target")
					.attr("value","myself")
			)
			.appendTo("#" + fv_mcmp_id);
	}
	
}
