performgo = 0;
rtv_id = $j(".playercontainer").attr("rel");
var flashvars =
{
'file':'/includes/list.php?rtv='+rtv_id,
'id':'playerID',
'autostart':'true',
'mute':'true',
'repeat':'list',
'displayclick':'none',
'controlbar':'none',
'repeat':'always',
'skin':'/sc/modieus.swf'
};
var params =
{
'allowfullscreen':'true',
'allowscriptaccess':'always',
'bgcolor':'#000000'
};
var attributes =
{
'align':'top',
'name':'playerID',
'id':'playerID'
};
swfobject.embedSWF('/sc/player.swf', 'player', '620', '470', '8', '/player/expressInstall.swf', flashvars, params, attributes);
function gid(name){
return document.getElementById(name);
};
function playerReady(obj){
player = gid(obj.id);
displayFirstItem();
player.addModelListener('LOADED', 'loadedMonitor');
};
function displayFirstItem(){
//alert("starter");
playlist = player.getPlaylist();
if(playlist !=""){
itemMonitor({index:0});
player.addControllerListener('ITEM', 'itemMonitor');
//alert(playlist);
}else{
setTimeout("displayFirstItem()", 200);
}
};
function itemMonitor(obj){
video_id = player.getPlaylist()[obj.index].title;
//alert(naslov);
//setTimeout("player.sendEvent('SEEK', 40);", 2000);
if(performgo!=0){
$j(".tvplay").html('getting details . . . please wait<br/><br/><img src="/im/tvload.gif" />');
new Ajax.Request("/proces.php",{method:'post',postBody:'tvinfo='+video_id,onComplete:tvinfo_end});	
}
};
function loadedMonitor(obj){
hload = obj.loaded;
if(hload>0 && performgo==0){
performgo = 1;
rndsek = $j(".tvplay").attr("id");
player.sendEvent('SEEK', rndsek);
player.sendEvent('MUTE','false');
$j(".tvplay").html('getting details . . . please wait<br/><br/><img src="/im/tvload.gif" />');

new Ajax.Request("/proces.php",{method:'post',postBody:'tvinfo='+video_id,onComplete:tvinfo_end});
}
};
function tvinfo_end(req){
$j(".tvplay").html(req.responseText);
$j('.tvabout').jScrollPane({showArrows:true,scrollbarWidth:8});
$j('.ccc').jScrollPane({showArrows:true,scrollbarWidth:8});
}
//*********************************************publish comment
$j("input[name='comment_submit']").live("click", function(){
video_id = $j("textarea").attr("rel");
comment_user = $j("input[name='comment_name']").val();
frtekst = $j("textarea").val();
if(comment_user=="" || frtekst==""){
alert('please enter your comment and name');	
}else{
$j("input[name='comment_name']").val("");
$j("textarea").val("");
$j(".video_comments_cont").html('<div class="gettingcomms"><img src="/im/load_s.gif"/></div>');
new Ajax.Request("/proces.php",{method:'post',postBody:'comment_publish='+video_id+'&comment_user='+comment_user+'&comment_cc='+frtekst,onComplete:publish_end});	
}
});
function publish_end(req){
$j(".video_comments_cont").html(req.responseText);
$j('.ccc').css({height:"130px"});
$j('.outercommentlimit').css({height:"130px"});
$j('.jScrollPaneContainer:last').css({height:"130px",backgroundColor:"#000"});
$j('.ccc').jScrollPane({showArrows:true,scrollbarWidth:8});
}