if('undefined' == typeof Emv.Videode)
{
	Emv.Videode = {};
}
if('undefined' == typeof Emv.Videode.Coverflow)
{
	Emv.Videode.Coverflow = {};
}

/**
 * sample object for handling image subtitle and credits in Video.de Coverflow views
 */
Emv.Videode.Coverflow.Legend = function(subtitleId, creditsId)
{
	this.id = subtitleId + '_' + creditsId;
	this.subtitleId = subtitleId;
	this.creditsId  = creditsId;
	this.creditsFormat = '%c';
	
	this.getId = function()
    {
    	return this.id;
    }
    
    this.handleEvent = function(event)
    {
    	if(event.name == Emv.Coverflow.Event._IMAGE_LOADED)
    	{
    		document.getElementById(this.subtitleId).innerHTML = unescape(event.params.text);
    		var copy = this.creditsFormat;
    		if(event.params.copyright != '')
    		{
    			copy = copy.replace(new RegExp("\%c",  "gi"), unescape(event.params.copyright));
    		}
    		else
    		{
    			copy = '';
    		}
    		document.getElementById(this.creditsId).innerHTML  = copy;
    	}
    }
    
    this.setCreditsFormat = function(format)
    {
    	this.creditsFormat = format;
    }
};