// JavaScript-Library
// Projekt: touropa.com
// (c)2004 Denkwerk GmbH

//--------------------------------------------------------------------------------
// Umgebungsvariablen definieren
//--------------------------------------------------------------------------------

var ns = (document.layers)? true : false;
var ie = (document.all)? true : false;
var w3c = ((document.getElementById) && (!document.all))? true : false; // ie5 kennt getElementById auch

//Variablen je nach Browser und Version mit Werten belegen
var version = parseInt(navigator.appVersion);
var agent = navigator.userAgent.toLowerCase();

if ((agent.indexOf("compatible") == -1) && (version >= 5)) {
	//alert("Netscape 6");
	var obj = document.getElementById;
   	var styleObj = ".style";
   	var sichtbar = 'visible';
    var unsichtbar = 'hidden';

	}
if (agent.indexOf("msie") != -1) {
	//alert("IE");
	var obj = document.all;
   	var styleObj = ".style";
    var sichtbar ="visible";
    var unsichtbar = "hidden";

	}
if ((agent.indexOf("compatible") == -1) && (version < 5)) {
	//alert("Netscape 4");
	var obj = document.layers;
    var styleObj = "";
   	var sichtbar = "show";
    var unsichtbar = "hide";

}

var picPath = "/tp/rtk/images/ibe/";
var picName = "teaser";
var fileEx = ".jpg";
var teaser = new Array(7);

    /**
    *  tauscsht den Teaser im Reiseberater aus
    * @param int die Nummer des Teasers (Default: 0 => Anzahl der Kategorien)
    */
    function swapReiseberaterTS(inTeaserNumber){

        document.getElementById("Reiseberater").src = teaser[inTeaserNumber].src;
    }

    /**
    * laedt die Grafiken für den Reiseberater vor
    * @param int die Nummer des Teasers (Default: 0 => Anzahl der Kategorien)
    */
   function preload(){
     for (i = 0; i < teaser.length; i++){
        teaser[i] = new Image();
        teaser[i].src = picPath + picName + i  + fileEx;
    }

   }
   //window.onload =  preload();

//--------------------------------------------------------------------------------
// Öffnet Fenster (popup) mit freien Parametern
//--------------------------------------------------------------------------------

function openPopup(theURL,winName,features) {
  a=window.open(theURL,winName,features);
  a.focus();
  return false;
}



//--------------------------------------------------------------------------------
// Druckt aktuelle Seite
//--------------------------------------------------------------------------------

function printText()
{
 if ((!ns) && (!w3c))
 {
  // Focus auf den Frame lenken welcher gedruckt werden soll
  window.focus();
  // BrowserObject ,,Print Box,, anlegen
  var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
        document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
        WebBrowser1.ExecWB(6, 2); //Use a 1 vs. a 2 for a prompting dialog box
  WebBrowser1.outerHTML = "";
 }
 else
 {
  window.print();
 }
}

//--------------------------------------------------------------------------------
// Öffnet Fenster (popup) und plaziert dieses in der Bildschirmmitte
//--------------------------------------------------------------------------------

function openSendPasswordPopup(url){
winName = 'info';
w = 426;
h = 285;
var parameter = 'width='+w+',height='+h+',left='+eval((screen.width-w)/2)+',top=50,scrollbars=no,resizable=no,location=no,menubar=no,toolbar=no';

	a = window.open(url,winName,parameter);
	a.focus();
	return false;
}

function openTouropaPreisPopup(url){
winName = 'info';
w = 436;
h = 270;
var parameter = 'width='+w+',height='+h+',left='+eval((screen.width-w)/2)+',top=50,scrollbars=no,resizable=no,location=no,menubar=no,toolbar=no';

	a = window.open(url,winName,parameter);
	a.focus();
	return false;
}

function openKreditkartenPopup(url){
winName = 'info';
w = 426;
h = 630;
var parameter = 'width='+w+',height='+h+',left='+eval((screen.width-w)/2)+',top=50,scrollbars=no,resizable=no,location=no,menubar=no,toolbar=no';

	a = window.open(url,winName,parameter);
	a.focus();
	return false;
}

function openAGBPopUp(url){
winName = 'info';
w = 660;
h = 530;
var parameter = 'width='+w+',height='+h+',left='+eval((screen.width-w)/2)+',top=50,scrollbars=yes,resizable=no,location=no,menubar=no,toolbar=no';

	a = window.open(url,winName,parameter);
	a.focus();
	return false;
}

function openFlugInfoPopUp(url){
winName = 'info';
w = 660;
h = 530;
var parameter = 'width='+w+',height='+h+',left='+eval((screen.width-w)/2)+',top=50,scrollbars=1,resizable=no,location=no,menubar=no,toolbar=no';

	a = window.open(url,winName,parameter);
	a.focus();
	return false;
}

function openMietwagenInfoPopUp(url){
winName = 'info';
w = 640;
h = 700;
var parameter = 'width='+w+',height='+h+',left='+eval((screen.width-w)/2)+',top=50,scrollbars=no,resizable=no,location=no,menubar=no,toolbar=no';

	a = window.open(url,winName,parameter);
	a.focus();
	return false;
}

function openExtraInfoPopUp(url){
winName = 'info';
w = 660;
h = 530;
var parameter = 'width='+w+',height='+h+',left='+eval((screen.width-w)/2)+',top=50,scrollbars=1,resizable=no,location=no,menubar=no,toolbar=no';

	a = window.open(url,winName,parameter);
	a.focus();
	return false;
}

function openFlughafenPopUp(url){
winName = 'info';
w = 660;
h = 530;
var parameter = 'width='+w+',height='+h+',left='+eval((screen.width-w)/2)+',top=50,scrollbars=yes,resizable=no,location=no,menubar=no,toolbar=no';

	a = window.open(url,winName,parameter);
	a.focus();
	return false;
}

function openRenameShoppingCartPopUp(url) {
winName = 'renameCart';
w = 426;
h = 285;
var parameter = 'width='+w+',height='+h+',left='+eval((screen.width-w)/2)+',top=50,scrollbars=no,resizable=no,location=no,menubar=no,toolbar=no';

	a = window.open(url,winName,parameter);
	a.focus();
	return false;
}

function openRecommendShoppingCartPopUp(url){
winName = 'info';
w = 660;
h = 655;
var parameter = 'width='+w+',height='+h+',left='+eval((screen.width-w)/2)+',top=50,scrollbars=yes,resizable=no,location=no,menubar=no,toolbar=no';

	a = window.open(url,winName,parameter);
	a.focus();
//	return false;
}

//--------------------------------------------------------------------------------
// Öffnet Fenster (popup) und plaziert dieses in der Bildschirmmitte
//--------------------------------------------------------------------------------

function openInfoPopup(url){
winName = 'info'
w = 446;
h = 460;
var parameter = 'width='+w+',height='+h+',left='+eval((screen.width-w)/2)+',top=50,status=no,scrollbars=yes,resizable=yes,location=no,menubar=no,toolbar=no';

	a = window.open(url,winName,parameter);
	a.focus();
	return false;

}

//--------------------------------------------------------------------------------
// Öffnet neues Content-Fenster (popup) und plaziert dieses in der Bildschirmmitte
// inserted by Oliver Klein
//--------------------------------------------------------------------------------

function openTPPopup(url, w, h){

var parameter = 'width='+w+',height='+h+',left='+eval((screen.width-w)/2)+',top=50,scrollbars=auto,resizable=no,location=no,menubar=no,toolbar=no';


if (self.window.name != "popupOK" ) {
	self.window.name == "popupOK"
	touropawin = window.open(url,'touropa',parameter);
	window.touropawin.focus();
	}
else {
	if (window.touropawin.closed == true) {
		touropawin = window.open(url,'touropa',parameter);
		window.touropawin.focus();
		}
	else {
		window.touropawin.location.href=url;
		window.touropawin.resizeTo(w,h);
		window.touropawin.focus();
		}
	}
}


//--------------------------------------------------------------------------------
// Öffnet Fenster (popup) und plaziert dieses in der Bildschirmmitte
//--------------------------------------------------------------------------------

function openContentPopup(url, winName, w, h){

var parameter = 'width='+w+',height='+h+',left='+eval((screen.width-w)/2)+',top=50,scrollbars=yes,resizable=yes,location=no,menubar=no,toolbar=no';

	a = window.open(url,winName,parameter);
	a.focus();
	return false;

}

// vor Deployment auf Integration/Stage bitte ausführbar machen:
//history.forward();

var nextUrl = "";

/**
* funktion für Klick auf Home Button:
* ruft Layer auf mit Texthinweis
*/
function confirmNavigation(inUrl){
     nextUrl = inUrl;
     document.getElementById("confirmLayer").style.visibility = "visible";
}



/**
* Funktion für Button-Home Layer
* @param boolean
* @param die Url die geladen werden soll
*/
function confirmDeleteBasket(confirmDelete){
	document.getElementById("confirmLayer").style.visibility = "hidden";
    if (confirmDelete && nextUrl != ""){
        document.location.href = nextUrl;
	} else  {
      nextUrl = "";
    }

}

/**
* Funktion zum &Ouml;ffnen der Agentur-Popups
* @param String die URL
*/
function openAgenturPopup(inURL){
	var theFeatures = "width=820,height=390,toolbar=0,scrollbars=1,menubar=0,resizable=1,status=0";
	var theName = "_agentur";
	var theWindow = window.open(inURL,theName,theFeatures);
	theWindow.focus();


}

 /**
 * Öffnet ein Fenster mit <code>inUrl</code>
 * @param String die Url
 * @param String der Fenstername
 * @param String die Breite
 * @param String die Höhe   
 */  
function openWindow(inUrl, 
                     inName,
                     inWidth,
                     inHeight){
            var theFeatures = "width="+inWidth+",height="+inHeight+"toolbar=0,scrollbars=1,menubar=0,resizable=1,status=0";
            var theWindow = window.open(inUrl,inName,theFeatures);
            theWindow.focus();
}

/* #################################   flash-Detection  ################################################### */
       var opSystem = navigator.platform;
       var isIE = false;

       function checkFlash(inRequiredVersion) {
           theVersionFlag = false;

           if (navigator.plugins != null && navigator.plugins.length > 0) {
               var thePlugin = navigator.plugins['Shockwave Flash'];

               if (typeof thePlugin == 'object') {
                   var theVersion = thePlugin.description.split(' ')[2];

                   theVersionFlag = theVersion >= inRequiredVersion;
               }
           }
           else if (navigator.userAgent
                   && navigator.userAgent.indexOf("MSIE") > -1
                   && navigator.userAgent.indexOf("Windows") > -1
                   && navigator.userAgent.indexOf("Windows 3") < 0
                   && document.all
                   && !window.opera) {
               isIE = true;
               document.write('<scr' + 'ipt language=VBScript>\n ');
               document.write('intCurVersion = 10\nwhichVersion = ' + inRequiredVersion + '\n');
               document.write('Do\nOn Error Resume Next\n');
               document.write('theVersionFlag = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & intCurVersion)))\n');
               document.write('If theVersionFlag = true Then Exit Do\n');
               document.write('intCurVersion = intCurVersion - 1\n');
               document.write('Loop While intCurVersion >= whichVersion\n');
               document.write('</scr' + 'ipt>');
           }
           return theVersionFlag;
       }
