function encode_utf8(rohtext) {
     // dient der Normalisierung des Zeilenumbruchs
     rohtext = rohtext.replace(/\r\n/g,"\n");
     var utftext = "";
    for(var n=0; n<rohtext.length; n++)
         {
         // ermitteln des Unicodes des  aktuellen Zeichens
         var c=rohtext.charCodeAt(n);
         // alle Zeichen von 0-127 => 1byte
         if (c<128)
             utftext += String.fromCharCode(c);
         // alle Zeichen von 127 bis 2047 => 2byte
        else if((c>127) && (c<2048)) {
             utftext += String.fromCharCode((c>>6)|192);
             utftext += String.fromCharCode((c&63)|128);}
         // alle Zeichen von 2048 bis 66536 => 3byte
         else {
            utftext += String.fromCharCode((c>>12)|224);
             utftext += String.fromCharCode(((c>>6)&63)|128);
             utftext += String.fromCharCode((c&63)|128);}
         }
     return utftext;
 }
// Menu Times
$(document).ready(function(){
	$('.timesSwf span').css("visibility","visible");
	$('.timesSwf span a').css("visibility","visible");
	$('.timesSwf span').flash(
        { 
            src: '../swf/timesSemiBold.swf', 
            flashvars: { 
                css: [
                    '* { color: #'+timesColor+'; }',
                    'a { color: #'+timesColorA+'; text-decoration: none; }'
                ].join(' ')
            },
			wmode: "transparent"
        },
        { version: 7 },
        function(htmlOptions) {
            htmlOptions.flashvars.txt = encode_utf8(this.innerHTML);
            this.innerHTML = '<span>'+this.innerHTML+'</span>';
            var $alt = $(this.firstChild);
            htmlOptions.height = $alt.height();
            htmlOptions.width = $alt.width();
            $alt.addClass('alt');
            $(this)
                .addClass('flash-replaced')
                .prepend($.fn.flash.transform(htmlOptions));			
        }
    );
});

// Menu Interstate
$(document).ready(function(){
	$('.interstateSwf span').css("visibility","visible");
	$('.interstateSwf span a').css("visibility","visible");
	$('.interstateSwf span').flash(
        { 
            src: '../swf/interstate.swf', 
            flashvars: { 
                css: [
                    '* { color: #'+interstateColor+'; }',
                    'a { color: #'+interstateColorA+'; text-decoration: none; }'
                ].join(' ')
            },
			wmode: "transparent"
        },
        { version: 7 },
        function(htmlOptions) {
            htmlOptions.flashvars.txt = encode_utf8(this.innerHTML);
            this.innerHTML = '<span>'+this.innerHTML+'</span>';
            var $alt = $(this.firstChild);
            htmlOptions.height = $alt.height();
            htmlOptions.width = $alt.width();
            $alt.addClass('alt');
            $(this)
                .addClass('flash-replaced')
                .prepend($.fn.flash.transform(htmlOptions));			
        }
    );
});


//Menu Interstate spécial
$(document).ready(function(){
	$('.interstateSwf2 span').css("visibility","visible");
	$('.interstateSwf2 span a').css("visibility","visible");
	$('.interstateSwf2 span').flash(
		{ 
			src: '../swf/interstate.swf', 
			flashvars: { 
				css: [
					'* { color: #'+interstateColor+'; }',
					'a { color: #'+interstateColorA+'; text-decoration: none; }'
				].join(' ')
			},
			wmode: "transparent"
		},
		{ version: 7 },
		function(htmlOptions) {
			htmlOptions.flashvars.txt = encode_utf8(this.innerHTML);
			this.innerHTML = '<span>'+this.innerHTML+'</span>';
			var $alt = $(this.firstChild);
			htmlOptions.height = $alt.height();
			htmlOptions.width = $alt.width();
			$alt.addClass('alt');
			$(this)
				.addClass('flash-replaced')
				.prepend($.fn.flash.transform(htmlOptions));			
		}
	);
});


//Menu Interstate boutique
$(document).ready( function(){
	if( typeof interstateShopColor != "undefined" ) {	
		$('.interstateSwfShop span').css("visibility","visible");
		$('.interstateSwfShop span a').css("visibility","visible");
		$('.interstateSwfShop span').flash(
			{ 
				src: '../swf/interstate.swf', 
				flashvars: { 
					css: [
						'* { color: #'+interstateShopColor+'; }',
						'a { color: #'+interstateShopColorA+'; text-decoration: none; }'
					].join(' ')
				},
				wmode: "transparent"
			},
			{ version: 7 },
			function(htmlOptions) {
				htmlOptions.flashvars.txt = encode_utf8(this.innerHTML);
				this.innerHTML = '<span>'+this.innerHTML+'</span>';
				var $alt = $(this.firstChild);
				htmlOptions.height = $alt.height();
				htmlOptions.width = $alt.width();
				$alt.addClass('alt');
				$(this)
					.addClass('flash-replaced')
					.prepend($.fn.flash.transform(htmlOptions));			
			}
		);
	}
});