var streamdata = {"id":"1420","client_id":"3045","file":"0504Alone","title":"Alone But Not Lonely","description":"Whatever the case, loneliness is a major problem in our age. Some feel when they're alone, and others feel it in a crowd. Singles bars are filled with lonely people, but did you know a person can be alone but not lonely. You see, the root of all loneliness is alienation from God. You can try to fill the void with crowds and noise, but there will always be that nagging loneliness until you fill it with a personal relationship of Jesus Christ. And then you'll learn how to be alone but not lonely. This is Bryant Wright, speaking right from my heart.","created":"2007-04-27 13:37:54.531319","updated":"2007-04-27 13:37:54.531319","file_ts":null,"size":"2651297","hash":null,"author":"Bryant Wright","fps":"15","res":"640x480","audio_bps":null,"audio_sample":"22050","duration":"31","youversion_status":null,"format_iphone":null,"video_codec":"vp6f","audio_codec":"mp3","format_mp4":null,"hascaptions":null,"desc":"Whatever the case, loneliness is a major problem in our age. Some feel when they're alone, and others feel it in a crowd. Singles bars are filled with lonely people, but did you know a person can be alone but not lonely. You see, the root of all loneliness is alienation from God. You can try to fill the void with crowds and noise, but there will always be that nagging loneliness until you fill it with a personal relationship of Jesus Christ. And then you'll learn how to be alone but not lonely. This is Bryant Wright, speaking right from my heart.","time":1327736697,"ip":"38.107.179.236","iserver":"rightfromtheheart.lightcastmedia.com","ipath":"\/console_js2.php","console_id":"967920189","flashvars":"","ctype":"S","pheight":20,"width":640,"height":480,"url":"http:\/\/rightfromtheheart.lightcastmedia.com\/lcmplayer.swf?autoStart=1&&noresize=1&file=http%3A%2F%2Fca03.us.lightcastmedia.com%2Fedge2%2F3045%2F0504Alone","media_url":"http:\/\/ca03.us.lightcastmedia.com\/edge2\/3045\/0504Alone","other_img":" ","rtmppath":false,"smilpath":false}
function lcm_setinner(name,val) { if(document.getElementById(name)) document.getElementById(name).innerHTML = val; }
function lcm_simlive_audio() {
	if(streamdata.height == 1) return false;
	if(!streamdata.failcount) streamdata.failcount = 1;
	else streamdata.failcount++;
	if(streamdata.failcount < 4) return false;
	streamdata.url = streamdata.audio_url;
	streamdata.height = 1;
	streamdata.width = 1;
	streamdata.other_img = '<' + 'img src="http://lcint.lightcastmedia.com/images/audioOnly.jpg" alt="Audio Only" /' + '>';
	lcm_console_init();
}
function lcm_console_init() {

	lcm_setinner('lcm_stream_author', streamdata.author); lcm_setinner('lcm_stream_title', streamdata.title); lcm_setinner('lcm_stream_desc', streamdata.desc);
	var obe_top = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http:\/\/fpdownload.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=7,0,0,0\" width=\"" + streamdata.width + "\" height=\"" + (streamdata.height+streamdata.pheight) + "\" id=\"player\" align=\"middle\" VIEWASTEXT>\n\t\t<param name=\"allowScriptAccess\" value=\"sameDomain\" \/>\n\t\t<param name=\"movie\" value=\"";
	var obe_middle = "\" \/>\n\t\t<param name=\"quality\" value=\"best\" \/>\n\t\t<param name=\"bgcolor\" value=\"#ffffff\" \/>\n\t\t<param name=\"allowFullScreen\" value=\"true\"></param>\n\t\t<param name=\"FlashVars\" value=\"" + streamdata.flashvars + "\"></param>\n\t\t<embed src=\"";
	var obe_bottom = "\" quality=\"best\" FlashVars=\"" + streamdata.flashvars + "\" bgcolor=\"#ffffff\" width=\"" + streamdata.width + "\" height=\"" + (streamdata.height+streamdata.pheight) + "\" name=\"player\" align=\"middle\" allowScriptAccess=\"sameDomain\"  allowFullScreen=\"true\" type=\"application\/x-shockwave-flash\" pluginspage=\"http:\/\/www.macromedia.com\/go\/getflashplayer\" \/>\n\t<\/object>";
	
	if(streamdata.rtmppath) {
		streamdata.url += '&rtmppath=' + escape(streamdata.rtmppath) + '&rtmpfile=' + escape(streamdata.rtmpfile);
	}
	if(streamdata.smilpath) {
		streamdata.url += '&smilpath=' + escape(streamdata.smilpath);
	}

	if(streamdata.ctype && (streamdata.ctype == 'L' || streamdata.ctype == 'F' || streamdata.ctype == 'f')) {
		var curtime = new Date(); var secs = (streamdata.simlive_start + lcm_timeoffset) - Math.round(curtime.getTime()/1000);
		if(secs < 1 && streamdata.duration && streamdata.duration > 0 && Math.abs(secs) > (streamdata.duration - 30)) {
			if(window.lcm_finished) lcm_finished();
			else lcm_setinner('lcm_simlive_countdown', 'This event has finished');
			return false;
		}
		else if(secs > 1) return lcm_countdown();
		else {
			if(streamdata.ctype != 'F' && streamdata.ctype != 'f') {
			  if(streamdata.rtmppath || streamdata.smilpath) streamdata.url += '&sec='+Math.abs(secs)
			  else streamdata.url += '%26sec%3D' + Math.abs(secs);
			}
			//streamdata.url += '%26sec%3D' + Math.abs(secs);
		}
	}

	if(window.lcm_started) lcm_started();
	if((document.getElementById('lcm_video') || streamdata.client_id == "3117" || streamdata.client_id == "3157") && (navigator.userAgent.indexOf('iPhone') > 0 || navigator.userAgent.indexOf('iPad') > 0)) {
		if(streamdata.ctype == 'L' || streamdata.ctype == 'l')	document.location.replace("http://customers.lightcastmedia.com/cupertinoconsole/" + streamdata.client_id + "/" + streamdata.console_id + ".m3u8");
		else if(streamdata.ctype == 'F')	document.location.replace("http://mobilestream.lightcastmedia.com:1935/live/" + streamdata.client_id + "/" + streamdata.console_id + "/playlist.m3u8");
		else document.location.replace("http://customers.lightcastmedia.com/cupertino/" + streamdata.client_id + "/" + streamdata.id + ".m3u8");
		return true;
	}
	lcm_setinner('lcm_video', (obe_top + streamdata.url + obe_middle + streamdata.url + obe_bottom + (streamdata.other_img ? streamdata.other_img : '')));
}

if(typeof window.addEventListener != 'undefined') { window.addEventListener('load', lcm_console_init, false); } //.. gecko, safari, konqueror and standard
else if(typeof document.addEventListener != 'undefined') { document.addEventListener('load', lcm_console_init, false); } //.. opera 7
else if(typeof window.attachEvent != 'undefined') { window.attachEvent('onload', lcm_console_init); } //.. win/ie


var lcm_loadtime = new Date();
lcm_timeoffset = Math.round(lcm_loadtime/1000) - streamdata.time;
//alert(lcm_timeoffset);
var lcm_httprequest;

function lcm_reloaddata() {
    var url = 'http://' + streamdata.iserver + streamdata.ipath + '?dataformat=js&u='+streamdata.client_id+'&c='+streamdata.console_id+'&ip='+streamdata.ip;
    var script = document.createElement('script');
    script.src = url;
    document.body.appendChild(script);
}

function lcm_countdown() {
  //alert(lcm_timeoffset);
  var curtime = new Date();
  var secs = (streamdata.simlive_start + lcm_timeoffset) - Math.round(curtime.getTime()/1000);
  //alert('offset:'+lcm_timeoffset+':nocorrection:'+ (streamdata.simlive_start - Math.round(curtime.getTime()/1000)) + ':corrected:'+secs);

  if(secs % 30 == 0 && secs > 10) lcm_reloaddata();

  if(document.lcm_simlive_format) var DisplayFormat = document.lcm_simlive_format; else var DisplayFormat = "%%dd%% Days, %%hh%% Hours, %%mm%% Minutes, %%ss%% Seconds";

  if (secs < 0) return lcm_console_init();

  var calctime = [((Math.floor(secs/86400))%100000).toString(),	((Math.floor(secs/3600))%24).toString(), ((Math.floor(secs/60))%60).toString(),	(secs % 60).toString()  ]
  var prefixes = ['d','h','m','s']
  for(var i = 0; i < prefixes.length; i++) { 
	lcm_setinner('lcm_simlive_'+prefixes[i], calctime[i]); lcm_setinner('lcm_simlive_'+prefixes[i]+prefixes[i],(calctime[i].length < 2 ? '0' : '') + calctime[i]);
  }
  
  if(document.getElementById('lcm_simlive_countdown')) {
	var DisplayStr = DisplayFormat;
	for(var i = 0; i < prefixes.length; i++) {
		DisplayStr = DisplayStr.replace(RegExp('%%' + prefixes[i] + '%%','gi'), calctime[i]);
		DisplayStr = DisplayStr.replace(RegExp('%%' + prefixes[i] + prefixes[i] + '%%','gi'),(calctime[i].length < 2 ? '0' : '') + calctime[i]);
	}
	document.getElementById('lcm_simlive_countdown').innerHTML = DisplayStr;
  }

  setTimeout("lcm_countdown()", 1000);
}

