//
// $Id: bringupPlayer.js,v 1.19 2008/05/19 15:05:34 daver Exp $
// $Source: /bbsrc/web/docs/en/jscommon/bringupPlayer.js,v $
//

function convertAllFields(){
	document.searchbox.query.value = document.searchbox.query.value.toLowerCase()
}

function bringupPlayer(clip,vCat,Title){
	var width = "853";
	var height = "470";
	var url_media = "http://www.bloomberg.com/avp/avp.htm?";

	if(vCat){
		url_media += "N=" + vCat + "&";
	}
	if(Title){
		url_media += "T=" + Title + "&";
	}
	url_media += "clipSRC=";

	var url;
	var windowid = "videoplayer";
	if( clip.match(/vid=/) == null ) {
		url = url_media + clip;
	}else{
		var clipID = clip.split("=");
		url = url_media + "mms://media2.bloomberg.com/cache/" + clipID[1] + ".asf";
	}
	var pwin = window.open( url, windowid, 
			"directories=no,location=no,menubar=no,resizable=no," +
			"scrollbars=no,status=no,toolbar=no,width=" + width + 
			",height=" + height ); 
	if(pwin){if(window.focus)pwin.focus();}
}

function audioPlayer(args){
	var url="http://www.bloomberg.com/audioplayers/playr_go.html?" + args;
	window.open(url, "","fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,directories=no,location=no,width=306,height=394")
}

/*
Play the 1st audio/video via sid2vid given a story ID.
*/
function bringupPlayerBySID(sid){
	var url = "http://www.bloomberg.com/apps/news?pid=sid2vid&sid=" + sid;
	var windowid = "videoplayer";
	var width = "853";
	var height = "470";

	var pwin = window.open( url, windowid, 
			"directories=no,location=no,menubar=no,resizable=no," +
			"scrollbars=no,status=no,toolbar=no,width=" + width + 
			",height=" + height ); 
	if(pwin){if(window.focus)pwin.focus();}
}

/**
Pop Quote/Chart/News tooltip for a ticker symbol.
Note: wz_tooltip.js has to be included AFTER the call, in the end of HTML BODY.
*/
function popwQuoteFull(obj,tkr){
	obj.T_ABOVE = true
	obj.T_STATIC = true
	obj.T_FONTCOLOR = '#000000'
	obj.T_FONTFACE = 'Verdana,sans-serif'
	obj.T_BGCOLOR = '#ddedd9'
	obj.T_WIDTH = 290
	obj.T_DELAY = 250

	return "<span class='pop_tkr'>" + tkr + "</span><br>" +
		"<img style='margin-bottom:5px' height='80' width='280' " +
		"src='/apps/chart?h=80&w=280&range=3m&type=gp_line&cfg=BQuote.xml&ticks=" +
		tkr + "'>" +
		"<span class='t_blue'><center>" +
		"<a href=/apps/quote?ticker=" +
		tkr + ">Quote</a> | " +
		"<a href=/apps/cbuilder?ticker1=" +
		tkr + ">Chart</a> | " +
		"<a href=/apps/news?pid=conews&tkr=" +
		tkr + ">News</a>" +
		"</center></span>" 
}

/**
Pop a text tooltip of the given pixel width.
*/
function popwtext(obj,textstr,iwidth){
	obj.T_ABOVE = true
	obj.T_STATIC = true
	obj.T_FONTCOLOR = '#000000'
	obj.T_FONTFACE = 'Verdana,sans-serif'
	obj.T_BGCOLOR = '#ddedd9'
	obj.T_WIDTH = iwidth
	obj.T_DELAY = 50
	return "<div class='poptext'>" + textstr + "</div>"
}

function popwQuoteShort(obj,tkr){
	return popwtext(obj,"Get Quote<br>" + tkr,110)
}

function popwSearchNews(obj){
	return popwtext(obj,'Search News',110)
}

function popwSendEmail(obj){
	return popwtext(obj,'Send E-mail',110)
}

function popwOpenWebSite(obj){
	return popwtext(obj,'Open Web Site',120)
}

function popwEnterSymbolHelp(obj){
	return popwtext(obj,'Click here for help with entering symbols or searching news.',220)
}

if(self.QString) if(QString("PLAYTV") == "1") bringupPlayer('LiveBTV');

