var widget_clipid = typeof clipid == 'string' ? clipid : 20511;

var syndicatePlayerWrite = '<div id="flashContent" class="flashContent" style="float:' + playerFloat + '; width:'+playerWidth+'px; height:'+playerHeight+'px;">This movie clip brought to you by Reelz Channel</div>';
syndicatePlayerWrite += '<script type="text/javascript">var so = new SWFObject("http://cache.reelzchannel.com/assets/flash/syndicatedPlayer.swf", "syndicatedSWF", "100%", "100%", "9", "#ffffff");';
syndicatePlayerWrite += 'so.addParam( "allowScriptAccess", "always" ); so.addParam( "allowFullScreen", "true" );';
syndicatePlayerWrite += 'so.addVariable("clipid", "' + widget_clipid + '"); so.addVariable("listid", "' + listID + '"); so.write("flashContent");</script>';
document.write(syndicatePlayerWrite);

function setMovieId( sender, id ) {
	var flashMovie = document.getElementById('syndicatedSWF');
	litags = document.getElementsByTagName("LI");
	clipListindex = 0;
	clipListLen = litags.length;
	for (clipListindex =  0; clipListindex < clipListLen; clipListindex++)
	{
	    li = litags[clipListindex];
	    if (li.className == "clipRow_active") li.className = "clipRow";
	}
	if(sender.parentNode && sender.parentNode.parentNode.parentNode.className == "clipRow")
    sender.parentNode.parentNode.parentNode.className = "clipRow_active";

    if(sender.parentNode && sender.parentNode.parentNode.className == "clipRow")
	sender.parentNode.parentNode.className = "clipRow_active";
	
	//if (sender.parentNode && sender.parentNode.tagName.toLowerCase() == "li") sender.parentNode.className = "clipRow_active";
	if (flashMovie) flashMovie.setMovie( id );
	return false;
}

// sets the state of list itemn to selected
function setItemSelected( id ) 
{
    var litags = document.getElementsByTagName("LI");
    var clipListindex = 0;
    var clipListLen = litags.length;
	
    for (clipListindex =  0; clipListindex < clipListLen; clipListindex++)
    {
        var li = litags[clipListindex];
	    
	    if (li.className == "clipRow" || li.className == "clipRow_active")
	    {
            if (li.getAttribute("id") != id)
            {
                if (li.className == "clipRow_active") li.className = "clipRow";
            }
            else 
            {
                li.className = "clipRow_active";
            }
        }
    }
	return false;
}
