

// ----------------- render player in edit clip page ----------------------- 
jsPlayer ={
	current_thumb_id:null,
	current_thumb_html :null
}
jsPlayer.render = function(index,url)
	{
		if(this.current_thumb_id)
			$(this.current_thumb_id).innerHTML = this.current_thumb_html; 
		this.current_thumb_id = "thumb_"+index;
		this.current_thumb_html = $(this.current_thumb_id).innerHTML;

		var pars="thumb_id=thumb_"+index+"&url="+url;
		new Ajax.Request("/mystuff/render_thumb_player/",{parameters:pars})	
	}
	


// --------------------- track selected clip in channel landing page
jsClipList={
	current_clip_row_id:null,
	clip_ids:[]
}
jsClipList.init_page = function(options)
{
	this.current_page = options.current_page;
	this.items_per_page = options.items_per_page;
	this.offset = this.current_page * this.items_per_page;
}
jsClipList.set_clip_ids = function(clip_ids,channel_id){
	if(clip_ids)
		this.clip_ids = clip_ids.split(",");
	else
		this.clip_ids = [];
		
	if(channel_id)
		this.channel_id = channel_id;
}	

jsClipList.to_select = function(vidNum)	
{
	this.clip_number = vidNum;
	var elm_id = "thumb_"+vidNum;
	if( $(this.current_clip_row_id) )
		$(this.current_clip_row_id).className = "";
	if($(elm_id))
	{
		this.current_clip_row_id = elm_id;
		$(this.current_clip_row_id).className = "selected"; 		
	}
	//debugger;
	if ($('clip_title'))
	{
		if(this.clip_ids.length > 0)
			var pars = "clip_id="+this.clip_ids[vidNum-this.offset];
		else
			var pars = ""
		new Ajax.Request("/mystuff/display_clip_info/"+this.channel_id,{parameters:pars});
		
	}
}
jsClipList.get_selected_clip_id = function()	
{
	if(this.clip_ids)
		return this.clip_ids[this.clip_number];
	else	
		return ;
}
jsClipList.get_selected_clip_sequence_number = function()	
{
	return this.clip_number;
}

jsClipList.get_clip_ids = function()	
{
	if(this.clip_ids)
		return this.clip_ids;
	else	
		return [];
}
//-----------flash player call back----------------------------
function clipPosition_callback(vidNum) 
{
		setTimeout("jsClipList.to_select("+vidNum+")",20);	
}
