
$(function () {
	$(".videoTypeControls .flashLow").click(function(event) {
		event.preventDefault();
		$("#player").get(0).setQuality("med");
	});
	$(".videoTypeControls .flashHigh").click(function(event) {
		event.preventDefault();
		$("#player").get(0).setQuality("high");
	});
});

function newsVideo(vidPlayer, dcUrl, contentGroup, referringPage, title, dataUrl, isWatchTab) {
	
	window.newsFlashPlayerPlayList = function () {
		var davBase = "http://secure-nz.imrworldwide.com/cgi-bin/m?ci=nz-nzoom-dav&cc=1";
		var davCommon = davBase + "&cg=" + encodeURIComponent(contentGroup);
		return {
			ad: dcUrl,
			low: dataUrl.low,
			med: dataUrl.med,
			high: dataUrl.high,
			dav0: davCommon + "&tl=dav0-" + encodeURIComponent(title) + "&rp=" + encodeURIComponent(referringPage) + "&si=" + encodeURIComponent(referringPage),
			dav1: davCommon + "&tl=dav1-" + encodeURIComponent(title),
			dav2: davCommon + "&tl=dav2-" + encodeURIComponent(title),
			freq: 30,
			timeout: 10											
		};
	};

	window.isWatchTab = function () {
		// if set to true, the banner will be in 468x60 , and false will be
		// 760x120
		return isWatchTab;
	}; 

	var so = new SWFObject('/stylesheets/tvnz/news/flash/player.swf', "player", 640, 420, "10.0.0.0", "#FFFFFF");
	so.addParam("allowScriptAccess", "always");
	so.addParam("wmode", "transparent");
	so.addParam("allowFullScreen", "true");
	so.addParam("swLiveConnect", "true");
	so.useExpressInstall("/stylesheets/tvnz/news/flash/playerProductInstall.swf");
	so.write(vidPlayer.attr('id'));
	
}


