if(typeof window.oushe == "undefined"){
	window.oushe = {};
}
if(typeof window.oushe.movie == "undefined"){
	window.oushe.movie = {};
}

(function(package){
	jQuery.extend(package, {
		//图片
		imageBrower : function(id,beltclass,panelclass,autoplay){
			stepcarousel.setup({
				galleryid: id, //id of carousel DIV
				beltclass: beltclass, //class of inner "belt" DIV containing all the panel DIVs
				panelclass: panelclass, //class of panel DIVs each holding content
				autostep: {enable:autoplay, moveby:1, pause:3000},
				panelbehavior: {speed:300, wraparound:false, persist:true},
				defaultbuttons: {enable: false, moveby: 1, leftnav: ['arrowl.gif', -10, 100], rightnav: ['arrowr.gif', -10, 100]},
				statusvars: ['statusAlong', 'statusBlong', 'statusClong'], //register 3 variables that contain current panel (start), current panel (last), and total panels
				contenttype: ['inline'] //content setting ['inline'] or ['external', 'path_to_external_file']
			});
		},
		//添加播放链接
		addPlaylinks : function(args){
			var checked = false;
			var callback = args.callback || function(){};
			var message = "";
			if(!args.movieid || args.movieid <= 0){
				message = "缺少电影信息，保存失败！";
			}else if(!args.links || args.links.length <= 0){
				message = "请正确填写电影链接 !";
			}else{
				checked = true;
			}
			
			if(checked){
				new AjaxRequest(args.movieid + "/json/playlinks/add/" + (args.playid || 0) + "/", {link:args.links,playName:args.name||"",order:args.order||0}, function(data){
					callback(data.isAdd, data.message, data);
				}).begin();
			}else{
				callback(false, message);
			}
		}
	});
	
})(window.oushe.movie);
