// cThema Klasse

	function cThemenListe() {
		
		this.themen = new Array;
		
		this.addThema = function(t) {
			this.themen.push(t);
			return this.themen.length-1;
		}

		this.getThema = function(kuerzel) {
			for(var i=0;i<this.themen.length;i++) {
				if(this.themen[i].kuerzel == kuerzel) {
					return this.themen[i];
					break;
				}
			}
			return false;	
		}


	}

	function cThemenButton(div, titel, idx, obj) {
		// alles auf Kleinbuchstaben setzen & Leerzeichen entfernen (z.B. wegen "Mein Video")
			//var titel_parsed = titel.toLowerCase();
			//var titel_parsed = titel_parsed.replace(/ /g, "");
		
		// Themen-Button anlegen und gleich anzeigen (Top-Navigation)
			var elem = '<div id="'+ obj +'" class="'+ obj +'">';
				elem += '<div id="aktiv" name="aktiv" class="top_navi_red">';
					//elem += '<a href="javascript:changeNavigation(\''+ obj +'\');"><img src="'+global_image_path+'gfx/buttonact_'+ obj +'.png" border="0"></a>';
					elem += '<a href="/krone/S'+sendung_id+'/category__'+obj+'/kmwebtv/index.html"><img src="'+global_image_path+'gfx/buttonact_'+ obj +'.png" border="0"></a>';
				elem += '</div>';
				
				
				elem += '<div id="passiv" name="passiv" class="top_navi_grey">';
					//elem += '<a href="javascript:changeNavigation(\''+ obj +'\');"><img src="'+global_image_path+'gfx/button_'+ obj +'.png" border="0"></a>';
					elem += '<a href="/krone/S'+sendung_id+'/category__'+obj+'/kmwebtv/index.html"><img src="'+global_image_path+'gfx/button_'+ obj +'.png" border="0"></a>';
				elem += '</div>';
			elem += '</div>';
			
			var l = $(elem);
			$(l).hide();
			//$(l).click( function() { loadThema(idx, "last"); } );
			$(l).fadeIn(1000);
			$(l).appendTo(div);
	}
	
	function cThema(titel, anmut, kuerzel, hidden) {
		
		// Sammlung aller Videos zu einem Thema
		this.titel		= titel;          	// Titel der Playlist
		this.anmut		= anmut;           	// Style des Themas
		this.kuerzel		= kuerzel		// Kürzel der Playlist/Kategorie
		this.hidden		= hidden		// gibt an, ob die Kat. eine versteckte ist
		this.videos		= new Array();		// beinhaltet alle Videos
		
		// PUBLIC
		
		// ein Video hinzufügen
		this.addVideo = function(video, sort) {
			// Video wird oben eingefügt, wenn der Param. first ist 
			if(sort == "first") {
				this.videos.unshift(video);
			}
			else {
				this.videos.push(video);
			}
		}
		
		// prüft, ob ein per Link-ID übergebenes Video in diesem Thema enthalten ist, und gibt ggf. den index des gefundenen videos zurück
		this.containsVideo = function(wantedId, id_type) {
			for ( var i=0; i<this.videos.length; i++ ) {
				if(id_type == 'hxcms_id') var l = this.videos[i].storyId;
				else var l = this.videos[i].mediaId;
				if ( l == wantedId ) {
					return i;
					break;
				}
			}
			return -1;
		}

	}
	
	function cKategorieDropDown(div, titel, idx, obj) {
		
		//var elem = '<div class="kat_elem" onClick="changeNavigation(\''+ obj +'\'); loadThema('+idx+', \'last\');"><a href="#">'+ titel +'</a></div>';
		var _href = '/krone/S'+sendung_id+'/category__'+obj+'/kmwebtv/index.html';
		var elem = '<div class="kat_elem" onClick="document.location.href=\''+_href+'\'"><a href="'+_href+'">'+ titel +'</a></div>';
		//$(elem).click( function() { loadThema(idx, "last"); } );
		$(elem).appendTo(div);
	}
	
	function cSpecialButton(div, titel, idx, obj) {				
		if(obj =='stimmen'){
			var elem = '<div id="'+ obj +'" class="'+ obj +'">';
					elem += '<div id="aktiv" name="aktiv" class="special_active">';
						elem += '<a href="javascript:changeNavigation(\''+ obj +'\');"><img src="'+global_image_path+'gfx/buttonact_'+ obj +'.gif" border="0"></a>';
					elem += '</div>';
					
					
					elem += '<div id="passiv" name="passiv" class="special_inactive">';
						elem += '<a href="javascript:changeNavigation(\''+ obj +'\');"><img src="'+global_image_path+'gfx/button_'+ obj +'.gif" border="0"></a>';
					elem += '</div>';
				elem += '</div>';			
			
		} else {
			
			var elem = '<div id="'+ obj +'" class="'+ obj +'">';
					elem += '<div id="aktiv" name="aktiv" class="special_active">';
						elem += '<a href="/krone/S'+sendung_id+'/category__'+obj+'/kmwebtv/index.html"><img src="'+global_image_path+'gfx/buttonact_'+ obj +'.gif" border="0"></a>';
					elem += '</div>';
					
					
					elem += '<div id="passiv" name="passiv" class="special_inactive">';
						elem += '<a href="/krone/S'+sendung_id+'/category__'+obj+'/kmwebtv/index.html"><img src="'+global_image_path+'gfx/button_'+ obj +'.gif" border="0"></a>';
					elem += '</div>';
				elem += '</div>';
		}



				
			var l = $(elem);
			$(l).hide();
			if(obj =='stimmen'){
				$(l).click( function() { loadThema(themenListe.themen[idx].kuerzel, "last"); changeNavigation(obj); } );
			}
			//$(l).addClass(titel);
			$(l).fadeIn(1000);
			$(l).appendTo(div);
	
	}
	