
function showMiniPlayer(tabs, info, promoImage, hasWMP) 
{
	// PATH TO PLAYER GOES HERE
	var movie = 'http://www.ncwanted.com/presentation/v1/flash/video/video_mini.swf?v=20081024';
	var o;
	
	var parameters = '';
	if (tabs) parameters += 'videoTabs=' + tabs + '&';
	if (info) parameters += 'videoInfo=' + info + '&';
	if (promoImage) parameters += 'promoImage=' + escape(promoImage) + '&';
	if (!hasWMP) parameters += 'nowmp=true&';
	
	parameters = parameters.substring(0, parameters.length - 1);

	// -- (1) width and height in the next line, AND below
	o = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="video_mini" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="330" height="280">';

	o += '<param name="movie" value="' + movie + '" />';
	o += '<param name="FlashVars" value="' + parameters + '" />';

    o += '<param name="quality" value="high" />';

    // these are critical for site catalyst clickmap
    o += '<param name="wmode" value="transparent" />';
    o += '<param name="allowScriptAccess" value="always" />';
    o += '<param name="swLiveConnect" value="true" />';

    o += '<embed name="video_mini" src="' + movie + '" wmode="transparent"';
	o += 'FlashVars="' + parameters + '" ';

	// -- (2) width and height in the next line, AND above
    o += 'allowScriptAccess="always" swLiveConnect="true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="330" height="280"></embed>'
	o += '</object>';
	
	document.write(o);

}



// setFlashvar_WMP_status -- not currently used
function setFlashvar_WMP_status(){
	document.getElementById("video_player").SetVariable("/:WMP_status", WMP.playState);
}


function emailThis(assetID) {
	window.open('/apps/email_to_friend/email_to_friend/?id_asset=' + assetID, 'popupwin1', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=625,height=400,left=100,top=100');	
}


function rateThis(assetID) {
	window.open('/apps/rate_asset/rate_asset/?id_asset=' + assetID, 'popupwin2', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=625,height=400,left=100,top=100');	
}


// setWMVURL(url) -- called when it is time to start the WMP
function setWMVURL(u) {

	gimmeWMP(u);
	l = document.getElementById('LayerWMP');
	l.style.visibility = "visible";
	return;

}


// ShutDownWMV() -- called when it is time to shut down the WMP
function ShutDownWMV () {
	l = document.getElementById('LayerWMP');
	l.innerHTML = '<br />';
	return;
}


	
// startRegularPlayer(vidInfo) -- called from mini player when trying to play
// a video that is only allowed to be played in the regular player 
function startRegularPlayer(vidInfo) {
	popUp(vidInfo, 'video');
}
	
	

// moreVideos() -- called from mini player
function moreVideos(url) {
	popUp(url,'video');
	
}

// changeAd(ad_url) -- called from big VP to change ad
function changeAd(adurl) {
	load_new_ad(adurl);
	//alert('changeAd Called ' + adurl);

}




// video_player_DoFSCommand -- gets called from the mini player's
// fscommand; note that the function name prefix *must* match the
// swf's movie id
function video_mini_DoFSCommand(command, args) {
    doFSCommand (command, args);
}

// video_player_DoFSCommand -- gets called from the full player's
// fscommand; note that the function name prefix *must* match the
// swf's movie id
function video_player_DoFSCommand(command, args) {
    doFSCommand (command, args);
}

function doFSCommand(command, args) {

	//command might begin with FSCommand:, strangely.  maybe for local 
	// stuff?  maybe for safari?
	if (command.substring(0, 10) == 'FSCommand:') {
		command = command.substring(10);
	}
	
	if (command == "setWMVURL") { 
		setWMVURL(args);
	
	} else if (command == 'ShutDownWMV') {
		ShutDownWMV();

	} else if (command == 'rateThis') {
		rateThis(args);

	} else if (command == 'emailThis') {
		emailThis(args);

	} else if (command == 'showWarning') {
		// for error messages from the client
		alert(args);

	} else if (command == 'setTitle') { 
		// change the page title
		// should not apply in mini player.
		document.title = args;

	} else if (command == 'moreVideos') {
		moreVideos(args);
		//alert('more vidoes' + args);

	} else if (command == 'kickoffRegular') {
		startRegularPlayer(args);

	} else if (command == 'showAdFor') {
		changeAd(args);

	}

		/*
		// WMV things are currently disabled
	else if (command == 'toggleWMVfullScreen') {
		//WMP=document.getElementById('Player');
		//WMP.fullScreen = !WMP.fullScreen;

	} else if (command == 'stopWMV') {
		alert('in stop');
		WMP=document.getElementById('Player');
		alert(WMP);
		WMP.detachEvent('playStateChange', setFlashvar_WMP_status);
		WMP.controls.stop();

	} else if (command == 'toggleWMVMute') {
		var WiMP=document.getElementById('LayerWMP').childNodes[0];
		WiMP.settings.mute = !WiMP.settings.mute;
		delete WiMP;
    }
		*/
	
}



function gimmeWMP(url) {

	var blank = false;

	if (blank)		o = '<object id="Player" height=240 width=320 ';
	else		o = '<object id="Player" height=280 width=310 ';
		

	if (navigator.userAgent.toLowerCase().indexOf('safari') != -1 
			|| navigator.userAgent.toLowerCase().indexOf('msie') != -1) 
			o += 'classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" '; 
	else 
			o += 'classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" '; 

		
	o += 'standby="Loading Windows Media Player components..." ';
	o += 'type="application/x-oleobject" ';
	o += 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112">';

	o += '<param name="URL" value="' + url + '">';

	if (blank)		o += '<param name="ShowStatusBar" value="0">';
	else		o += '<param name="ShowStatusBar" value="1">';
	
	if (blank)		o += '<param name="uiMode" value="none">';
	else		o += '<param name="uiMode" value="mini">';
	
	o += '<param name="autoStart" value="True">';

	if (blank)		
		o += '<embed height=240 width=320 type="application/x-mplayer2" src="' + url + '" name="Player" ';
	else
		o += '<embed height=280 width=310 type="application/x-mplayer2" src="' + url + '" name="Player" ';



	if (blank)		
		o += 'showstatusbar="0" showdisplay="0" uiMode="none" showcontrols="0" showtracker="0">';
	else
		o += 'showstatusbar="1" showdisplay="0" uiMode="mini" showcontrols="1" showtracker="0">';
		
		
	o += '</embed>';
	o += '</object>';



	document.getElementById('LayerWMP').innerHTML = o;


	//WMP = Player;
	//alert(WMP);
		
	// from b5b
	//		var WiMP = document.getElementById("Player");
	//		alert(WiMP);
			//WMP.attachEvent("playStateChange",setFlashvar_WMP_status); 
	// end from b5b
	//		WiMP=document.getElementById("Player");
	//		WiMP.attachEvent("playStateChange",setFlashvar_WMP_status); 


}

