var selectedContent = null;
var iVideo = {
	selectedContent:null,
	cb: function(){},
	getInsertDialog:function(cb, options){
		window.open('/ivideo/record.php?step=filelist&type='+options.content+'&appid='+options.appid, 'ivideo', 'width=625,height=400,menubar=yes,resizable=yes');
		this.cb = cb;
		return false;
	},
	complete:function(ivideoobj){
		this.cb(ivideoobj);
		InfoBox.close();
	},
	preview:function(ivo){
		console.info(ivo,ivo.contentid);
		selectedContent = ivo.contentid;
		$('#insertbtn li').removeClass('inactive');
		if (ivo.type=='video'){
			ratio = ivo.width / 270;
			width = 270;
			height = Math.ceil(ivo.height/ratio);
			$('#previewbox').html('<embed width="'+width+'" height="' + height + '" flashvars="file='+ivo.contenturl+'&amp;showdigits=true&amp;image=' + ivo.contenturl.replace('.flv', '.jpg') + '&amp;logo=/img/ivideo.png" allowfullscreen="true" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" bgcolor="#FFFFFF" src="/video/mediaplayer.swf"/>');
		}else{
			// audioplayerz?
			$('#previewbox').html('<embed width="270" height="20" flashvars="file='+ivo.contenturl+'&amp;showdigits=true&amp;image=' + ivo.contenturl.replace('.flv', '.jpg') + '&amp;logo=/img/ivideo.png" allowfullscreen="true" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" bgcolor="#FFFFFF" src="/video/mediaplayer.swf"/>');
		}

	}
};

function displayHelp(){
	$("#ivideohelp").show();
	$("#ivideofilelist").hide();
}
function closeHelp(){
	$("#ivideohelp").hide();
	$("#ivideofilelist").show();
}
