var Teletext = new Object();
Teletext = function(){
	this.url = "../../resources/ver1-0/mediathek/teletext/teletext.swf";
	this.width = 680;
	this.height = 430;
	this.id = "teletextflash";
	this.bgcolor = "#000000";
};
Teletext.prototype = {
	Source: function(){
		var out = "";
		out += '<object\n';
		out += '	classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"\n';
		out += '	codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"\n';
		out += '	width="' + this.width + '"\n';
		out += '	height="' + this.height + '"\n';
		out += '	id="' + this.id + '"\n';
		out += '	align="middle"\n';
		out += '>\n';
		out += '<param name="allowScriptAccess" value="always"/>\n';
		out += '<param name="allowFullScreen" value="false"/>\n';
		out += '<param name="movie" value="' + this.url + '"/>\n';
		out += '<param name="quality" value="high"\n';
		out += '<param name="bgcolor" value="' + this.bgcolor + '"\n';
		out += '<embed\n';
		out += '	src="' + this.url + '"\n';
		out += '	quality="high"\n';
		out += '	allowScriptAccess="always"\n';
		out += '	bgcolor="' + this.bgcolor + '"\n';
		out += '	width="' + this.width + '"\n';
		out += '	height="' + this.height + '"\n';
		out += '	name="' + this.id + '"\n';
		out += '	align="middle"\n';
		out += '	allowFullScreen="false"\n';
		out += '	swliveconnect="true"\n';
		out += '	type="application/x-shockwave-flash"\n';
		out += '	pluginspage="http://www.macromedia.com/go/getflashplayer"\n';
		out += '/>\n';
		out += '</object>\n';
		return out;
	},
	SendToFlash: function( page, subpage ){
		page = Math.abs( page );
		subpage = Math.abs( subpage );
		if( !isNaN( page ) && !isNaN( subpage ) && page >= 100 && page <= 899 && subpage >= 0 && subpage <= 256 ){
			var movie = ( navigator.appName.indexOf("Microsoft") != -1 ) ? window[ this.id ] : document[ this.id ];
			movie.SendToFlashHandler( page, subpage );
		}
	}
}
var teletext = new Teletext();
document.write( teletext.Source() );

$( "li.active ul li a" ).css( "cursor", "pointer" );

function GetMessageFromTeletextFlash( page, subpage, pagecount ) {
	$( "li.active ul li a" ).css( "color", "#959595" );
	if( $( "#ttx_page_" + page ).length > 0 ) $( "#ttx_page_" + page ).css( "color", "#FFFFFF" );
	var ivwImage = $( "<img />" );
	var src = "http://ntv.ivwbox.de/cgi-bin/ivw/CP/"+ivw_code+";"+ntv_location+"/"+ntv_navipath+"?r="+escape(document.referrer)+"&d="+(Math.random()*100000);
	ivwImage.attr({ src: src });
}

function SendMessageToTeletextFlash( page, subpage ){
	teletext.SendToFlash( page, subpage );
	$( "li.active ul li a" ).css( "color", "#959595" );
	return false;
}



