function bronsonVideo (obj, wid, loc) {

	var width = width;
	var info;
	var bronsonUrl;	
	var div;
	var url;

	this.div = document.getElementById(loc);
	if (!this.div) {
		debug("There is no div named: " + loc + " on the page, you can't put a player nowhere!");
		return;
	}
	try { 
		this.url = obj.url;
	} catch (err) {
		// probably passed in a string instead
	}

	if (typeof(obj) == 'undefined') {
		debug("You must provide either a json-encoded video object OR a bronson video URL to play a video");
		return;
	}

	if (typeof(wid) == 'undefined') {
		debug("You must provide a target WIDTH currently either 480 or 568");
		return;
	} else {
		this.width = wid;
		debug("this.width: " + this.width );
	}
	debug("typeof Obj: " + typeof(obj));
	if (typeof(obj) == 'string') {
		debug("STRING " + obj);
		this.url = getInfo(obj);
		trace("this.url: " + this.url);
	}

	if (typeof(obj) == 'object') {
		try {
			this.url = obj.url;
			debug("current url: " + this.url);
		} catch (err) {
			// invalid object!?
			debug("invalid object! no url: " + obj.url);	
		}
	}

	if (this.url && this.width && this.div) {
		trace(this.url + " " + this.width + " " + this.div.id);
		trace("this.width before doplayer: " + this.width);
		doPlayer(this.url, this.width, this.div.id);
	} else {
		if (!this.url) {
			trace("I was unable to get the url: " + this.url + " not doing player");
		}
		if (!this.width) {
			trace("no width, not doing player: " + this.width);
		}

		if (!this.div) {
			trace("could not find target div : " + loc + " not doing player");
		}
		
		trace("something is missing!");
	}

	function getInfo(url) {
		//  means I don't know if it's streaming or not, etc., I just have an url or guid
		debug("getinfo for url: " + url);
		var src = srcGet('/service?service=getasset&type=video&output_format=json&url=' + url);
		this.info = JSON.parse(src);
		debug(src);
		try {
			this.url = this.info.url;
			debug("getInfo: got url: " + this.url);
		} catch (err) {
			trace("could not get the url from the returned object either!!");
			return;
		}
		return this.url;
		
	}

	function doPlayer(url, width, divid) {
		if (typeof(this.url) == 'undefined' || !this.url) {
			trace("sorry no url, please set this.url first");
			return;
		}
		if (width) {
			this.width = width;
		}
		trace("doPlayer: this.width: " + this.width);
		trace("doPlayer width: " + width);
		if (! this.width ) {
			trace("sorry, no width, please set this.width first");
			return;
		}
		if (divid) {
			
		} else {
			divid = this.div.id;
		}
		document.write("<scri" + "pt src='http://www.filminfocus.com/video/" + this.url + "/player?width=" + this.width + "&div=" + divid + "' type='text/javascript' language='JavaScript'></scr" + "ipt>");
	}

}

// sample usage:  bronsonVideo(bronson_url_identifier, desiredWidth, desiredTargetDiv);
// EG
// var bv = new bronsonVideo('limits_premierefootage2', 568, 'mainVideoPlayer');



