
// Montag, 7. Februar 2011 12:13
function onFocusClearDefault( thisValue, defaultValue )
{
 if ( thisValue == defaultValue )
 {
  return '';
 }
 return thisValue;
}
// Identification
IE = document.all&&!window.opera;
DOM = document.getElementById&&!IE;
function showContainer(strID, isFocus){
    // Get object
    var myObj = (IE)?document.all[strID]:document.getElementById(strID);
    // Display
    if(isFocus == 1){
        myObj.style.display = 'block';    // Display Container
    }else{
  if( navigator.appVersion.indexOf("MSIE 5") == -1 ){
      myObj.style.display = 'none';    // Hide Container
  }
    }
}
// Toolbox-Text austauschen 
function change(id,newtext) {
  document.getElementById(id).innerHTML=newtext;
}
// Seiten-Infos fuer Ausdruck
function getURL(){ // URL abbilden
  var url = location.href;
 document.write(url);
}
function Datum(n) { // Datum abbilden
    this.length = n 
    return this
}
monthNames = new Datum(12)
monthNames[1] = "Januar"
monthNames[2] = "Februar"
monthNames[3] = "M&auml;rz"
monthNames[4] = "April"
monthNames[5] = "Mai"
monthNames[6] = "Juni"
monthNames[7] = "July"
monthNames[8] = "August"
monthNames[9] = "September"
monthNames[10] = "Oktober"
monthNames[11] = "November"
monthNames[12] = "Dezember"
dayNames = new Datum(7)
dayNames[1] = "Sonntag"
dayNames[2] = "Montag"
dayNames[3] = "Dienstag"
dayNames[4] = "Mittwoch"
dayNames[5] = "Donnerstag"
dayNames[6] = "Freitag"
dayNames[7] = "Samstag"
function customDateString(oneDate) {
    var theDay = dayNames[oneDate.getDay() + 1]
    var theMonth = monthNames[oneDate.getMonth() + 1]
    var theYear = oneDate.getYear()
    if(theYear<1000) theYear+=1900;
        var theMinutes = oneDate.getMinutes();
    if (theMinutes < 10) theMinutes = "0" + theMinutes;
        return theDay + " " + oneDate.getDate() + "." + theMonth + " " + oneDate.getHours() + ":" + theMinutes + " Uhr";
}
function pageInfo() {
 document.write("<strong>URL: </strong>");
   getURL();
   document.write("<br /><strong>Datum:</strong>&nbsp;");
   document.write(customDateString(new Date()));
   document.write("<br /><br />Weitere Informationen &uuml;ber das Reiseland Deutschland finden Sie unter: www.deutschland-tourismus.de");
}
// Fenster &ouml;ffnen
function launch_window(page,size_x,size_y)
  {
  OpenWin = window.open(page, "Popup", "toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,copyhistory=no,width="+size_x+",height="+size_y);
  }
function launch_window_noscroll(page,size_x,size_y)
  {
  OpenWin = window.open(page, "Popup", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,copyhistory=no,width="+size_x+",height="+size_y);
  }
// Fenster schlie&szlig;en und zu URL gehen 
function goclose(andgo) 
  {  
  opener.location.href=andgo;
  self.close(); 
  }

// open PopUp and self go to URL
function popAndSelfGo (popUrl, popUrlWidth, popUrlHeight, selfGoUrl) {
    window.location.href=selfGoUrl;
    launch_window(popUrl, popUrlWidth, popUrlHeight);
}
 
// Expand List
function expandList(idDiv) {
    document.getElementById(idDiv).style.height = 'auto';
    document.getElementById(idDiv).className = '';
}
function collapseList(idDiv) {
    document.getElementById(idDiv).style.height = '17.9em';
    document.getElementById(idDiv).className = 'nobullets';
}
function hideLink(idDiv) {
    document.getElementById(idDiv).style.display = 'none';
}
function showLink(idDiv) {
    document.getElementById(idDiv).style.display = 'inline';
}
// Merkzettel bzw Reiseplaner
function ShowDocument(URL)
{
opener.location.href=URL;
return;
}
// konfiguriert die Seite für den Skyscraper
function showSkyscraper(){
  document.getElementById('skyscraper').style.display = 'inline';
  document.getElementById('wrapper').style.width = '895px';
  document.getElementById('main').style.cssFloat = 'left';
  document.getElementById('main').style.styleFloat = 'left';
}
// Laenderauswahl Layer ein- und ausblenden, Klassen setzen, Extended Language
function gotopanel(panelId){ // alle schliessen
  document.getElementById('consumer').style.display = 'none';
  document.getElementById('trade').style.display = 'none';
  document.getElementById('press').style.display = 'none';
  document.getElementById('eBrochure').style.display = 'none';
  document.getElementById('nav'+'consumer').className = 'default';
  document.getElementById('nav'+'trade').className = 'default';
  document.getElementById('nav'+'press').className = 'default';
  document.getElementById('nav'+'eBrochure').className = 'default';     
  document.getElementById(panelId).style.display = 'block';
  document.getElementById('nav'+panelId).className = 'selected';
}
function showCC() { // ruft das Panel Consumer auf
    gotopanel('consumer');
    openCC();
}
function showTrade() { // ruft das Panel Trade auf
    gotopanel('trade');
   openCC();
}
function showPress() { // ruft das Panel Press auf
    gotopanel('press');
   openCC();
}
function showPress() { // ruft das Panel E-Book auf
    gotopanel('eBrochure');
   openCC();
}
function openCC(){ // blendet den Choose Entry Layer ein
   document.getElementById('chooseCountry').style.display = 'block';
   document.getElementById('wrapper').style.filter = 'alpha(opacity=20)';
   document.getElementById('wrapper').style.opacity = '0.2';
   document.getElementById('toolBoxInfoText').style.color = '#eee';
   document.getElementById('picBar').style.display = 'none';
   document.getElementById('rightHtmlButton2').style.display = 'none';
}    
function closeCC(url){ // blendet den Choose Entry Layer aus
   document.getElementById('chooseCountry').style.display = 'none';
   document.getElementById('wrapper').style.filter = 'alpha(opacity=100)';
   document.getElementById('wrapper').style.opacity = '1.0';
   document.getElementById('toolBoxInfoText').style.color = '#333';
   document.getElementById('picBar').style.display = 'block';
   document.getElementById('rightHtmlButton2').style.display = 'block';
   var cc_lang = document.getElementById('cc_lang').value;
//# 091022 MH   document.location.href = url + "?cc_lang=" + cc_lang;
}
function setLangCC(cc_lang) { // setzt die gewaehlte Sprache fest
    document.getElementById('cc_lang').value = cc_lang;
}
function showExtended(id) { // blendet den Extended Language Layer ein
    document.getElementById(id).style.visibility = 'visible';
}
function hideExtended(id) { // blendet den Extended Language Layer aus        
    document.getElementById(id).style.visibility = 'hidden';
}
// Reiseland Deutschland Karte - Ruecklink
openUrl = function(groupName, itemPrefix, itemId) {
itemId=itemId.replace("__","-f");
if (groupName=='orte') $newu='/DEU/reiseland_deutschland/master_tlstadt-id'+itemId+'.html'
else if (groupName=='bundeslaender') $newu='/DEU/reiseland_deutschland/master_tlbundesland-id'+itemId+'.html'
else if (groupName=='ferienstrassen') $newu='/DEU/reiseland_deutschland/master_tlfstrasse-id'+itemId+'.html'
else if (groupName=='tourist_region') $newu='/DEU/reiseland_deutschland/master_tlregion-id'+itemId+'.html'
else if (groupName=='messe') $newu='/DEU/reiseland_deutschland/master_tlmesse-id'+itemId+'.html'
else if (groupName=='shopping') $newu='/DEU/reiseland_deutschland/master_tlshopping-id'+itemId+'.html'
else if (groupName=='events') $newu='/DEU/reiseland_deutschland/master_tlevents-id'+itemId+'.html'
else if (groupName=='event') $newu='/DEU/reiseland_deutschland/master_tlevents-id'+itemId+'.html'
else if (groupName=='sightseeing') $newu='/DEU/reiseland_deutschland/master_tlsight-id'+itemId+'.html'
else if (groupName=='kur') $newu='/DEU/reiseland_deutschland/master_tlkur-id'+itemId+'.html'
else if (groupName=='museen') $newu='/DEU/reiseland_deutschland/master_tlmuseum-id'+itemId+'.html'
//alert(groupName+", "+itemPrefix+", "+itemId);
this.location.href=$newu;
this.focus();
}
 
// ehem. divFunctions
function openAuthorThread( tag_id ){
    elem = document.getElementById(tag_id);
    elem.style.display = 'inline';
}
function closeAuthorThread( tag_id ){
    elem = document.getElementById(tag_id);
    elem.style.display = 'none';
}

//InternetExplorer Security-Flash
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){    
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":    
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

function bookmark(url,title){
  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
  window.external.AddFavorite(url,title);
  } else if (navigator.appName == "Netscape") {
    window.sidebar.addPanel(title,url,"");
  } else {
    alert("Press CTRL-D (Netscape), CTRL-T (Opera) or CTRL-D (Safari) to bookmark this page.");
  }
}
 
//Tauscht Elemente auf Click hin mit einander aus
function switchElement(obj) {
var el = document.getElementById(obj);
if ( el.style.display != "none" ) {
el.style.display = 'none';
}
else {
el.style.display = '';
}
}



//Blendet Suchbalken Panel ein
function showQuery () {
    var switchOn = document.getElementById('navSearchExtQuery');
    switchOn.style.display = 'block';
    
    var switchOff = document.getElementById('navSearchExt');
    switchOff.style.display = 'none';
}



//Funktionen der Bildergalerien fuer Salesportal Belgien
    var galleryOpen;
    
    function openGal(id) { //blendet Bildergalerie ein
        var ws = getWindowScroll();
        var div = document.getElementById(id);
        document.getElementById(id).style.display = 'block';
        var width = div.offsetWidth;
        var height = div.offsetHeight;
        var bodyWidth = document.body.offsetWidth;
        galleryOpen = id;
        div.style.left = ( bodyWidth / 2 - width / 2 ) + "px";
        div.style.top = (ws.height / 2 - height / 2) + ws.top + "px";
        document.body.appendChild(div);
        document.getElementById('wrapper').style.filter = 'alpha(opacity=20)';
           document.getElementById('wrapper').style.opacity = '0.2';
    }
    
    function closeGal(id) { //blendet Bildergalerie aus
        document.getElementById(id).style.display = 'none';
           document.getElementById('wrapper').style.filter = 'alpha(opacity=100)';
           document.getElementById('wrapper').style.opacity = '1.0';
        galleryOpen = null;
    }
    
    function doResize() { //richtet die Galerie zentriert aus
        if (galleryOpen) {
            var div = document.getElementById(galleryOpen);
            var width = div.offsetWidth;
            var height = div.offsetHeight;
            var bodyWidth = document.body.offsetWidth;
            var ws = getWindowScroll();
            div.style.left = ( bodyWidth / 2 - width / 2 ) + "px";
            div.style.top = (ws.height / 2 - height / 2) + ws.top + "px";
        }    
    }
    
    getWindowScroll =  function() {
        var w = window;
          var T, L, W, H;
          with (w.document) {
            if (w.document.documentElement && documentElement.scrollTop) {
                  T = documentElement.scrollTop;
                  L = documentElement.scrollLeft;
            } else if (w.document.body) {
                  T = body.scrollTop;
                  L = body.scrollLeft;
            }
            if (w.innerWidth) {
                  W = w.innerWidth;
                  H = w.innerHeight;
            } else if (w.document.documentElement && documentElement.clientWidth) {
                  W = documentElement.clientWidth;
                  H = documentElement.clientHeight;
            } else {
                  W = body.offsetWidth;
                  H = body.offsetHeight
            }
          }
          return { top: T, left: L, width: W, height: H };
    }   

    unescoPopup = function(id,lang)  {
      w1 = window.open("http://www.dzt.de/applications/unesco/htdocs/gallery360.php?id="+id+"&lang="+lang, "gallery360", "width=760,height=540,scrollbars=no,status=no");
      w1.focus()
    }
    
    window.onresize = doResize;
 

// Blendet IFrame Fenster ein und aus

function openPop(mywidth){ // blendet den Choose Entry Layer ein
   document.getElementById('popIframe').style.display = 'block';

   document.getElementById('toolBoxInfoText').style.color = '#eee';


   if (mywidth=='') {
       mywidth='700';
   } else if (mywidth=='0') {
       mywidth='700';
   } 
   document.getElementById('popIframe').style.width = mywidth + 'px';
   document.getElementById('popIframe').style.margin = '0 0 0 -' + mywidth / 2 + 'px';
   document.getElementById('rightHtmlButton2').style.display = 'none';
}    
function closePop(url){ // blendet den Choose Entry Layer aus
   document.getElementById('popIframe').style.display = 'none';
   document.getElementById('wrapper').style.filter = 'alpha(opacity=100)';
   document.getElementById('wrapper').style.opacity = '1.0';
   document.getElementById('toolBoxInfoText').style.color = '#333';
   document.getElementById('rightHtmlButton2').style.display = 'block';
}

// DW-TV Deutsche Welle Videos bzw. allgemein als SWF-Videolayer
function openDwTvVideo(SwfSrc, SwfHeadline){
   $('DwTvVideo').setStyle('display', 'block').fade('show');
   $('wrapper').fade(0.2);   
   $('DwTvHeadline').set('text', SwfHeadline);
    
   var newY = $(window).getScroll();                               
   $('DwTvVideo').setPosition({y: newY.y + 50}); 
   
    if (Browser.Engine.trident == true) {  
        $('picBar').setStyle('display', 'none');
    }                                      
   
var DwTvVideoSwf = new Swiff(SwfSrc, {
    id: 'DwTvVideoExternal',   
    width: 681,                
    height: 420,               
    params: {                  
        wmode: 'window',       
        bgcolor: '#ffffff',    
        allowFullScreen: 'true'
    },                         
    vars: {                    
    },                         
    callBacks: {               
    }                          
});                              
DwTvVideoSwf.inject("DwTvVideoSwfDiv");  
// urchinTracker('/video/ruhr2010' + SwfHeadline);
   
}    
function closeDwTvVideo(){ 
   $('DwTvVideo').fade('hide').setStyle('display', 'none')
   $('wrapper').fade('in');
   
    if (Browser.Engine.trident == true) { 
        $('picBar').setStyle('display', 'block');
    }                                     
                                               
   $('DwTvHeadline').innerHTML = '';
   $('DwTvVideoSwfDiv').empty();     
}

function switchDwTvVideoList() {
    var divDwTvVideoListStatus = $('moreDwTvVideos').getStyle('display');
    
    if (divDwTvVideoListStatus == 'block') {
        $('moreDwTvVideos').setStyle('display','none');
        $('switchDwTvVideoList').set('text',DwTvMoreVideosShow);        
        } else {
            $('moreDwTvVideos').setStyle('display','block');
            $('switchDwTvVideoList').set('text',DwTvMoreVideosHide);
            document.location.href = '#switchDwTvVideoList';
    }
}
 
/* --- Videoframe --- */
// Positionierung bei Start, Scrolling und Resizing
var resizing = function () {
    if ($('VideoBox')) {
        var size = $(window).getSize();
        var elementsize = $('VideoBox').getSize();
        var scroll = $(window).getScroll();
        var myEffect = new Fx.Morph($('VideoBox'), {duration: 1000, transition: Fx.Transitions.Sine.easeOut});
        myEffect.start({
            'margin-top': -((size.y - elementsize.y) / 2) + scroll.y -200
        });
    }
}

function openVideo(options){
//Aufraeumen
    if ($('VideoBox')) {
        $('VideoBox').destroy();
    }
//Werte vordefinieren
    if (options.width) {
        var boxwidth = parseInt(options.width) + 50;
    } else {
        var boxwidth = 650;
    }
//Elemente definieren
    var VideoBox = new Element('div', {
        'id' : 'VideoBox',
        'styles': {
            'width': boxwidth  + 'px',
            'margin-left': -(boxwidth + 30) / 2 + 'px'
        }
    })
    var VideoHeadline = new Element('h1', {
        'id': 'VideoHeadline',
        'html': options.headline
    });

    if (options.CloseAnchor) {
        var CloseAnchorLink = new Element('a', {    
        'id': 'CloseAnchor',                    
        'href': 'javascript:(closeVideo());',   
        'html': options.CloseAnchor             
        });                                         
        } else {                                
            var CloseAnchorLink = new Element('a', {
            'id': 'CloseAnchor',                    
            'href': 'javascript:(closeVideo());',   
            'html': 'Close window'                  
    });                                         
    }
    
    var Clearance = new Element('br', {
        'class': 'clear'
    });
    var VideoDiv = new Element('div', {
        'id': 'VideoDiv'
    });
    // SWF
    var VideoSwf = new Swiff(options.swf, {
        id: 'VideoSwf',
        width: options.width,
        height: options.height,
        params: {
            wmode: 'window',
            bgcolor: '#ffffff',
            allowFullScreen: 'true'
        },
        vars: $merge(options.vars || {},{
            thisLocation: options.flv
        })
    });
    // TEXT
    if (options.text) {
        var VideoPara = new Element('p', {
            id: 'VideoPara',
            html: options.text
        });
    }
    // LINKLISTE
    if (options.links) {
        var VideoList = new Element('ul', {
            id: 'VideoList'
        });
        for (i in options.links) {
            var ListItem = new Element('li');
            var Anc = new Element('a', {
                'href': options.links[i],
                'html': i
            });
            ListItem.adopt(Anc);
            VideoList.adopt(ListItem);
        }
    }
    //HTML Bottom
    if (options.htmlbottom) {
        var VideoHtml = new Element('div', {
            'id': 'VideoHtml',
            'html': options.htmlbottom
        });
    }
// Verschachteln
    VideoDiv.adopt(VideoSwf);
    VideoBox.adopt(CloseAnchorLink, VideoHeadline, Clearance, VideoDiv);
    if (VideoPara) {
        VideoPara.inject(VideoBox, 'bottom');
    }
    if (VideoList) {
        VideoList.inject(VideoBox, 'bottom');
    }
    if (VideoHtml) {
        VideoHtml.inject(VideoBox, 'bottom');
    }
    VideoBox.inject($(document.body), 'top');
// Picbar ausblenden
//    if (Browser.Engine.trident == true) {  
        $('picBar').setStyle('display', 'none');
//    }
// Repositionierung
    window.addEvent('resize', resizing);
// Einblenden
    $('wrapper').fade(0.2);
    $('rightHtmlButton2').setStyle('display', 'none');
    VideoBox.setStyle('display', 'block').fade(1);
    var size = $(window).getSize();
    var elementsize = VideoBox.getSize();
    var scroll = $(window).getScroll();
    VideoBox.set('styles', {
        'margin-top': -((size.y - elementsize.y) / 2) + scroll.y
    });

// Tracking
    if (options.tracker) {
        urchinTracker('/flash/video/' + options.tracker);
    }
}

function closeVideo(){ 
   $('VideoBox').fade('hide').setStyle('display', 'none');
   $('wrapper').fade('in');
   $('rightHtmlButton2').setStyle('display', 'block');
//    if (Browser.Engine.trident == true) { 
        $('picBar').setStyle('display', 'block');
//    }
    window.removeEvent('resize', resizing);
    $('VideoBox').destroy();
}
