//Script zum Bestimmen des richtigen Stylesheets
//Copyright ars navigandi GmbH - Johannes Hauf
//Anzulegen sind in /css : 
// win_ns.css, win_ie.css, win_mo.css (Die drei wichtigen Windows Browser)
// mac_ns.css, mac_ie.css, mac_mo.css (Die drei wichtigen MAC-Browser)
// std_ns.css, std_mo.css, std_std.css (NN4.x z.b. Linux, Mozilla z.b. Linux, alles andere)
var bp;
var msg;
/* this class is used to detect os, browser and browser version.
Get the information like this:
bp.platform -> OS
bp.browser -> Browser
bp.version -> Browser version
if the detection fails, the retun will be some standard values (fallback - std, std, '')
You can set Your own strings for the detection so You may use less then 21 stylesheets ;-)
*/

function BP() {
	//Set here the strings for the os identification
	var win = 'win'; //Microsoft Windows; default: win
	var mac = 'mac'; //Macintosh; default: mac
	var lin = 'std'; //Linux; default: lin
	
	//Set the information for the browser identification strings
	var ie = 'ie'; //Internet Explorer; default: ie
	var mo = 'mo'; //Mozilla; default: mo
	var ns = 'ns'; //Netscape Navigator <= 4.x; default: ns
	var nn6 = 'mo'; //Netscape 6+; default: nn6
	var opera = 'ie'; //Opera; default: opera
	var konq = 'std'; //KDE Konqueror; default: konq
	var safari = 'safari'; //Apple Safari; default: safari
	
	//set some default variables
	this.browser = 'std';
	this.platform = 'std';
	this.version = '';
	
	//Check for the os used
	if (navigator.platform.indexOf('Mac') > -1) {
		this.platform = mac;
	} else if (navigator.platform.indexOf('Win') > -1) {
		this.platform = win;
	} else if (navigator.platform.indexOf('Linux') > -1) {
		this.platform = lin;
	}
	
	if (navigator.appName.indexOf('Microsoft') > -1) {
		if(navigator.userAgent.indexOf('Opera') > -1) {
			this.browser = opera;
			this.version = getVersion("Opera ");
		} else {
			this.browser = ie;
			this.version = getVersion("MSIE ");
		}
	} else if (navigator.appName.indexOf('Konqueror') > -1) {
		this.browser = konq;
		this.version = '';
	}else {
		if (navigator.appVersion.charAt(0) <= 4) {
			this.browser = ns;
			this.version = getVersion("Mozilla/");			
		} else if (this.platform == mac && navigator.userAgent.indexOf('Safari') > -1) {
			this.browser = safari;
		} else {
			/*var ausgabe = '';
			for(var i in navigator) {
				ausgabe += i+": "+navigator[i]+"\n";
			}
			alert(ausgabe);*/
			if(navigator.vendor.indexOf('Netscape') > -1) {
				this.browser = nn6;
				this.version = navigator.vendorSub;
			} else {
				this.browser = mo;
				this.version = getVersion("rv:");
			}
		}
	}
	
	return this;
	
}

//Function to get the exact version of the browser
function getVersion(pattern) {
	var ua = window.navigator.userAgent
	var patternIndex = ua.indexOf (pattern);
	var version = ua.substring (patternIndex+pattern.length, (ua.indexOf (".", patternIndex+pattern.length ))+3);
	while(isNaN(version) && version.length > 0) {
		version = version.substring(0,version.length-1);
	} 
	return version;
}

bp = new BP();

//alert("Platform: "+bp.platform+"\nBrowser: "+bp.browser+"\nVersion: "+bp.version);
	
//alert ('<LINK HREF="/de/de/css/' + bp.platform + '_' + bp.browser + '.css" REL="styleSheet" TYPE="text/css">');
//Normale Auswahl css mit 4 Files
document.write('<LINK HREF="/css/' + bp.platform + '_' + bp.browser + '.css" REL="styleSheet" TYPE="text/css">');

//Auswahl nur zwischem MAC und PC
//document.write('<LINK HREF="/de/css_achensee/' + bp.platform + '.css" REL="styleSheet" TYPE="text/css">');

//-----------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------

//Einblendung des Textes in der Browser-Linkleiste



//Bildwechselfunktion
if (document.images) {
	//Hauptmenue
	informationsanfrage1=new Image();	informationsanfrage1.src="/images/informationsanfrage.gif";
	informationsanfrage2=new Image();	informationsanfrage2.src="/images/informationsanfrage_over.gif";
	reiseziele3=new Image();				reiseziele3.src="/images/reiseziele.gif";
	reiseziele4=new Image();				reiseziele4.src="/images/reiseziele_over.gif";
	interconnect5=new Image();				interconnect5.src="/images/interconnect.gif";
	interconnect6=new Image();				interconnect6.src="/images/interconnect_over.gif";
	tourismusprodukte7=new Image();		tourismusprodukte7.src="/images/tourismusprodukte.gif";
	tourismusprodukte8=new Image();		tourismusprodukte8.src="/images/tourismusprodukte_over.gif";
	direktbuchen9=new Image();				direktbuchen9.src="/images/direktbuchen.gif";
	direktbuchen10=new Image();			direktbuchen10.src="/images/direktbuchen_over.gif";

}

var msg=new Array 
(
	'', 
	'Informationsanfrage', 
	'Reiseziele', 
	'Inter-Connect Marketing', 
	'Tourismusprodukte', 
	'Direkt Buchen'
);

function mark(imgName, num, status) {
if (document.images) {
imgMark = eval(imgName + num + ".src");
document [imgName].src = imgMark;
}
window.status = msg[status];
}

function mailto(x) {
if(x == "leer") {
	document.forms[0].reset();
	document.forms[0].elements[0].blur();
	return;
} else {
	window.location.href = x;
	document.forms[0].reset();
	document.forms[0].elements[0].blur();
}
}


/*Written 2003 Georg Kemser (kemser@arsnavigandi.de)
Version 1.0 - Last modified 6.1.2003 
Method:
Erzeugt ein neues Fenster mit bestimmbarer Zieldatei, Internem Titel (müssen verschiedene Namen für verschiedene Pop-ups haben), Breite, Hoehe, relative X-Position und Y-Position
und passt das Fenster für Ausnahme Netscape an*/

var isNav4, isNav6, isIE4;

function NeuFenster(Datei,InternTitel,Breite,Hoehe,XPos,YPos,auto) {
	if (isNav6) {
		fbreite = Breite +  8; fhoehe = Hoehe + 27;
	} else if (isNav4) {
		fbreite = Breite + 15; fhoehe = Hoehe + 15;
	} else {
		fbreite = Breite + 12; fhoehe = Hoehe + 31;
	}
	Fenster = window.open(Datei,'InternTitel','width='+fbreite+',height='+fhoehe+',screenX='+XPos+',screenY='+YPos+',scrollbars='+auto+',dependent=yes,resizable=yes');
	Fenster.moveTo(XPos,YPos);
	Fenster.resizeTo(fbreite,fhoehe);
}



/*Written 2003 Johannes Hauf (hauf@arsnavigandi.de)
Version 1.1 - Last modified 6.1.2003
These are JS-methods to connect Javascript and Flash
When You embed your movie be sure you have the following in the "object" tag:
id="myMovie" (DO NOT SET the name-attribute in the "object"-tag (Mozilla)
In the "embed"-tag you need both: id and name.
If you want use a other name than "myMovie" You have to replace all items.

Version history:
1.0 initial release
1.1 added support for multiple Arguments from AS to JS, removed some bugs*/

/*This method waits for a call from myMovie
and calls a javascript method, given in argument "method"*/

var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
function myMovie_DoFSCommand(method, args) {
	var myMovieObj = InternetExplorer ? myMovie : document.myMovie;
	var args = args.split('###');
	eval(method)(args[0],args[1],args[2],args[3],args[4]);
}

if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<SCRIPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('Sub myMovie_FSCommand(ByVal command, ByVal args)\n');
	document.write(' call myMovie_DoFSCommand(command, args)\n');
	document.write('end sub\n');
	document.write('</SCRIPT\> \n');
}

/*Method Caller
This javascript function calls any actionscript-method/-function
whithin "myMovie"
Arguments: 
method -> This is the full name of the function within the movie
argument0-argument5 -> up to 5 arguments which are passed to the function
(if you need more arguments just copy and paste ;-))*/

function methodCaller(method, argument0, argument1, argument2, argument3, argument4){
	window.document.myMovie.SetVariable("_root.JS.method", method);
	window.document.myMovie.SetVariable("_root.JS.argument0", trimLineEnding(argument0));
	window.document.myMovie.SetVariable("_root.JS.argument1", trimLineEnding(argument1));
	window.document.myMovie.SetVariable("_root.JS.argument2", trimLineEnding(argument2));
	window.document.myMovie.SetVariable("_root.JS.argument3", trimLineEnding(argument3));
	window.document.myMovie.SetVariable("_root.JS.argument4", trimLineEnding(argument4));
	window.document.myMovie.TCallFrame("_root.JS", 0);
}

//This sets some information about the browser in flash movie
function setBrowserInFlash(){
	var browser = 'std';
	if (navigator.appName.indexOf('Microsoft') > -1) {
		browser = 'ie';
	} else {
		if (navigator.appVersion.charAt(0) <= 4) {
			browser = 'ns';
		} else {
			browser = 'mo';
		}
	}
	window.document.myMovie.SetVariable("_root.JS.browser", browser);
	window.document.myMovie.SetVariable("_root.JS.browserMainVer", navigator.appVersion.charAt(0));
}

//Sets all properties in movie/object
function setProperty(method, property){
	window.document.myMovie.SetVariable(method, property);
}

//This method replaces the windows line-ending "\r\n" by "\n" (UNIX)
function trimLineEnding(text){
	var mytext = ""+text;
	var mytext = mytext.replace(/\r\n/g,"\n");
	return (mytext);
}

/*It is important to "escape" text or other variables in Flash.
Only when the Argument is "escaped", ist is possibe to transmit special characters
like "'" or linefeeds*/

function copyTextToHTML(text){
	window.document.myForm.user_input.value = decode_utf8(unescape(text));
}

//Text encoding in UTF-8
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;
}

//Text decoding in UTF-8
function decode_utf8(utftext) {
	var plaintext = ""; var i=0; var c=c1=c2=0;
	// while-Schleife, weil einige Zeichen uebersprungen werden
	while(i<utftext.length)
		{
		c = utftext.charCodeAt(i);
		if (c<128) {
			plaintext += String.fromCharCode(c);
			i++;}
		else if((c>191) && (c<224)) {
			c2 = utftext.charCodeAt(i+1);
			plaintext += String.fromCharCode(((c&31)<<6) | (c2&63));
			i+=2;}
		else {
			c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2);
			plaintext += String.fromCharCode(((c&15)<<12) | ((c2&63)<<6) | (c3&63));
			i+=3;}
		}
	return plaintext;
}

/* This calls the JS-method */

function setNavigation(status, status2) {
	methodCaller('_root.setNavigation',status, status2)
}

//Close Popup-Layer
function hidePopupLayer(layerid) {
	if (document.getElementById)
	{
	// this is the way the standards work
	var style2 = document.getElementById(layerid).style;
	style2.display = style2.display? "none":"none";	
	}
	else if (document.all)
	{
	// this is the way old msie versions work
	var style2 = document.all[layerid].style;
	style2.display = style2.display? "none":"none";
	}
	else if (document.layers)
	{
	// this is the way nn4 works
	var style2 = document.layers[layerid].style;
	style2.display = style2.display? "none":"none";
	}
}