
var channel4 = "MyChubu-Channel";
var api = "http://api.ustream.tv/json/channel/";
var ustobjId;

$(function()
{
	var url4 = api 
		+ channel4
		+ "/getInfo?key=433A0E4A0ACBBCEB9F065DA8E95592F2"
		+ '&callback={callback}';

	checkOnAir4();
	setInterval(checkOnAir4, 30000);	

}
);

function checkOnAir4()
{
	// ステータスを取得する
	var url4 = api 
		+ channel4
		+ "/getValueOf/status?key=433A0E4A0ACBBCEB9F065DA8E95592F2"
		+ '&callback={callback}';
		
	$.getJSONP(url4, function(res) {
		if(res == "live") { // On Air中
		//	$('#checkair_mini').text("On Air");
			$('#uc4').css({"background": "url(http://mychubu.chu.jp/images/ustch_mc.gif) left bottom no-repeat"});
			$('#uc4-1').css({"background": "url(http://mychubu.chu.jp/images/ustch_mc.gif) left bottom no-repeat"});
		}
		else { // Off Air
		//	$('#checkair_mini').text("Off Air");
			$('#uc4').css({"background": "url(http://mychubu.chu.jp/images/ustch_mc.gif) left top no-repeat"});
			$('#uc4-1').css({"background": "url(http://mychubu.chu.jp/images/ustch_mc.gif) left top no-repeat"});
		}
	});

}
