/* Fensterausstattung */ 
var frn_wdl_r = ',resizable=yes';
var frn_wdl_s = ',scrollbars=yes';
var frn_wdl_rs = frn_wdl_r+frn_wdl_s;
var frn_wdl_tsr = ',toolbar=yes'+frn_wdl_s+frn_wdl_r;
var frn_wdl_full = ',left=0,top=0,status=yes,menubar=yes,location=yes'+frn_wdl_tsr;
/* definierte Fenster */
var frn_wd_max = 'width='+screen.availWidth+',height='+screen.availHeight+frn_wdl_full;

var frn_software = 'width=815,height=597';
var frn_iphone_leistungen = 'width=800,height=597';
var frn_iphone_uebersicht = 'width=800,height=597';
var frn_iphone_auslandstarife = 'width=600,height=700';
var frn_iphone_sondertarife = 'width=600,height=700'+frn_wdl_r;
var frn_audioplayer = 'width=600,height=250';
var frn_audioplayer_big = 'width=650,height=500';
var frn_hilfe = 'width=880,height=600'+frn_wdl_tsr;
var frn_popupklein = 'width=490,height=530'+frn_wdl_rs;
var frn_popupgross = 'width=800,height=700'+frn_wdl_rs;
var frn_realplayer = 'width=650,height=500'+frn_wdl_rs;
var frn_chart_win = 'width=780,height=570'+frn_wdl_rs;
var frn_depotnews = 'width=500,height=400'+frn_wdl_rs;
var frn_depotinfo = 'width=660,height=500'+frn_wdl_rs;
var frn_flashplayer = 'width=720,height=440,resizable=no';
var freespeedplayer = 'width=600,height=460,resizable=no';
var frn_grusskarte = 'width=450,height=350'+frn_wdl_rs;
var frn_tarifinfo = 'width=415,height=280'+frn_wdl_rs;
var frn_sms = 'width=340,height=200';
var frn_discout_detail ='width=480,height=320'+frn_wdl_s;
var frn_discout_vergleich ='width=480,height=680'+frn_wdl_s;
var frn_mcenter_aktion ='width=500,height=500';
var frn_tvidetail ='width=500,height=580'+frn_wdl_rs;
var frn_newsticker = 'width=632,height=440,resizable=yes';
var frn_buliticker = 'width=767,height=630,resizable=no';
var frn_pcCheck = 'width=790,height=556'+frn_wdl_s;
var frn_best_help = 'width=430,height=200,resizable=yes,left='+(screen.width-430)/2+',top='+(screen.height-200)/2+'';
var frn_best_help_with_scrollbar = 'width=430,height=200,status=0,scrollbars=yes,resizable=1,left='+(screen.width-430)/2+',top='+(screen.height-200)/2+'';

var frn_best_info = 'width=430,height=200,status=0,scrollbars=0,resizable=1,left='+(screen.width-430)/2+',top='+50+'';

var locHref = window.location.href;
var PROTOCOL = locHref.substring(0,locHref.indexOf(':'));

var frn_JS_PROT = window.location.protocol;
var frn_JS_HOST = window.location.hostname;
var frn_JS_HASH = window.location.hash;

function frn_openWin(theURL,winName,features,w,h) {
  if ( w != "" && w != undefined ) {
    breite = RegExp("(width=[0-9]+)");
    if (  features.search("width=") >= 0 ) { 
      features = features.replace(breite,"width="+w);
    } else {
      features = features + ",width=" + w + "";
    }
  }
  if ( h != "" && h != undefined ) {
    hoehe = RegExp("(height=[0-9]+)");
    if ( features.search("height=") >= 0 ) {
      features = features.replace(hoehe, "height=" + h);
    } else {
      features = features + ",height=" + h + "";
    }
  }
  Fenster = window.open(theURL,winName,features);
  // Fenster.focus();
}

function openWin(theURL,winName,features) {
    Fenster = window.open(theURL,winName,features);
    Fenster.focus();
 }
function frn_hilfe() {
    frn_openWin('http://www.freenet.de/hilfe/','_hilfe',frn_hilfe);
 }
 function hilfe() {
    frn_openWin('http://www.freenet.de/hilfe/','_hilfe',frn_hilfe);
 }

function frn_bulitick() {
    frn_openWin('http://nn2.freenet.de/inf/sportslive/my_fb_mbl/html_php/index.php','_hilfe',frn_buliticker);
 }


function frn_best_helpPopUp(webapp,src,w,h)
{ 
if(webapp && webapp.length > 0)
  { helpUrl = "/"+webapp+"/pos2/popups/hilfe/"+src+"/index.html"; }
else
  { helpUrl = "/pos2/popups/hilfe/"+src+"/index.html"; }
frn_openWin(helpUrl,'pos_hilfe',frn_best_help_with_scrollbar,w,h);
}

 
function frn_infoPopUp(url, width, height)
{ 
    frn_openWin(url,'_info',frn_best_info, width, height);
}

function frn_tuevPopUp()
{ 
    tuev = window.open('https://pos.freenet.de/src/tuev-zertifikat.gif', 'tuev', 
    	'width=510,height=770,status=0,scrollbars=0,resizable=1,left='+50+',top='+50+'');
}

function frnWeitersagen() {
  frn_openWin('','popwsagen',frn_bildershow,632,660);
  document.weitersagen.submit();
}


//flyout
frn_flyActiv = 500;

function frn_showThemen(){

 if (document.getElementById('frnThemenFlyout').style.display != 'inline'){
  document.getElementById('frnKopfMehr').className='aktivClick';
  document.getElementById('frnThemenFlyout').style.display = "inline";
  //hide selects - IE6
  for(i=0; i<document.getElementsByTagName('select').length; i++){
	hiddenElem = document.getElementsByTagName('select')[i];
	hiddenElem.style.visibility="hidden";
	}
   /* if (document.getElementById("frnMoviePlayer")) {
           document.getElementById("frnMoviePlayer").style.visibility = "hidden";
      } */
 } else {
  frn_hideThemen();
 }

}

function frn_hideThemen(){
  document.getElementById('frnKopfMehr').className='';
  document.getElementById('frnThemenFlyout').style.display = "none";
  for(i=0; i<document.getElementsByTagName('select').length; i++){
	hiddenElem = document.getElementsByTagName('select')[i];
	hiddenElem.style.visibility="visible";
  }
 /* if (document.getElementById("frnMoviePlayer")) {
  document.getElementById("frnMoviePlayer").style.visibility = "visible";
  } */
}

var firstKeyDown = false;
var firstKeyDownFeet = false;
var firstKeyDownTwo = false;
var firstKeyDownFeetTwo = false;

function focusQuick(){
 $('#suchfeld').keydown(function() {
     if(firstKeyDown != true){
      $('#suchfeld').addClass('searchBg');
       firstKeyDown = true;
     }
     if( ($(this).hasClass('expanded')) && firstKeyDownTwo != true){
      $('#suchfeld').removeClass('searchBg');
      $('#suchfeld').css('background-position','0 -90px');
      firstKeyDownTwo = true;

     }
  });
  $('#suchfeld2').keydown(function() {
      $(this).removeClass('searchBg');
      $('#suchfeld2').css('background-position','0 -90px');

      firstKeyDownTwo = true;
  });

document.getElementById('web').childNodes[0].style.backgroundColor = '#C2E392';
}


// bo 03-10
// focus Suchschlitz

try {
 if ( (e = document.getElementById("suchfeld")) != null  )e.focus();
}
catch(err) { }

/*
$(document).ready( function() {

 $(".frn_searchFootNavi a").click(function(){
    $(".frn_searchFootNavi a").removeClass("frn_active");
    $(this).addClass("frn_active");

    var searchAct = $(this).attr('id');

    if (searchAct == 'foot_web') {
     $("#frnGoogleFoot").show();
     $('#frn_searchTypeFoot').val('art');
     $('#frn_searchTargetFoot').attr('action','http://tools.freenet.de/mod_perl/linker/freenet_footer_suche_web/suche.freenet.de/suche');
     $('#frn_searchTargetFoot').attr('method','get');
     $('#frnSearchFootNorm').show();
     $('#foot_suchfeld').attr('name','query');
     $('#frnCountryFoot').val('');
     $('#frnFrefFoot').val('');
    }

    if (searchAct == 'foot_fn') {
     $('#frn_searchTypeFoot').val('art');
     $('#frn_searchTargetFoot').attr('action','http://suche.freenet.de/suche/index.html');
     $('#frn_searchTargetFoot').attr('method','post');
     $('#frnSearchFootNorm').show();
     $('#foot_suchfeld').attr('name','query');
     $('#frnCountryFoot').val('FN');
     $('#frnFrefFoot').val('http://suche.freenet.de/suche');
     $("#frnGoogleFoot").show();
    }

    if (searchAct == 'foot_shopping') {
     $('#frn_searchTypeFoot').val('art');
     $('#frn_searchTargetFoot').attr('action','http://tools.freenet.de/mod_perl/linker/freenet_footer_suche_shopping/shopping.freenet.de/search.do');
     $('#frn_searchTargetFoot').attr('method','get');
     $('#frnSearchFootNorm').show();
     $('#foot_suchfeld').attr('name','searchText');
     $("#frnGoogleFoot").hide();
    }

  });
});

*/

var newLook = 'new';
var highlightChoiseHead = '#C2E392';
var highlightChoiseFoot = '#FFFFFF';



function SearchChange(art){

  if (newLook == 'old'){
    if (typeof(document.getElementById("foot_web") ) != undefined) {
    }else{
         document.getElementById('frnGoogleFoot').style.display = 'block';
    }
  } else{

    document.getElementById('frnGoogleHead2').style.display = 'none';
    if (typeof(document.getElementById("foot_web") ) != undefined) {
    }else {
         document.getElementById('frnGoogleFoot').style.display = 'none';
    }
  }

  if (art == 'web'){
       if (newLook == 'old'){

       } else{
          document.getElementById('frnGoogleHead2').style.display = 'none';
       }

    document.getElementById('web').childNodes[0].style.backgroundColor = highlightChoiseHead;
    document.getElementById('searchButton').className = 'websuche';
    document.getElementById('frn_searchType').value = art;
    document.getElementById('frn_searchTarget').action =
'http://tools.freenet.de/mod_perl/linker/freenet_startseite_suche_b_web/suche.freenet.de/suche';
    document.getElementById('frn_searchTarget').method = 'get';
    document.getElementById('suchfeld').name = 'query';
    document.getElementById('frnCountry').value = '';
    document.getElementById('frnFref').value = '';
  }

  if (art == 'bilder'){
     document.getElementById('bilder').childNodes[0].style.backgroundColor = highlightChoiseHead;
     document.getElementById('searchButton').className = 'bilder';
     document.getElementById('frn_searchType').value = art;
     document.getElementById('suchfeld').name = 'query';
     document.getElementById('frn_searchTarget').method = 'post';
     document.getElementById('frn_searchTarget').action = 'http://suche.freenet.de/bilder/';
  }

  if (art == 'freenet'){
        if (newLook == 'old'){
       } else{
       }

    document.getElementById('fn').childNodes[0].style.backgroundColor = highlightChoiseHead;
    document.getElementById('searchButton').className = 'freenetsuche';
    document.getElementById('frn_searchType').value = art;
    document.getElementById('frn_searchTarget').action = 'http://suche.freenet.de/suche/';
    document.getElementById('frn_searchTarget').method = 'post';
    document.getElementById('frn_searchTarget').name = 'search';
    document.getElementById('frnCountry').value = 'FN';
    document.getElementById('frnFref').value = 'http://suche.freenet.de/suche';
    document.getElementById('suchfeld').name = 'query';
    document.getElementById('frnGoogleHead2').style.display = 'none';
  }

  if (art == 'lokales'){
  }

  if (art == 'shopping'){
         if (newLook == 'old'){
         } else{
         }

    document.getElementById('shopping').childNodes[0].style.backgroundColor = highlightChoiseHead;
    document.getElementById('searchButton').className = 'shoppingsuche';
    document.getElementById('frn_searchType').value = art;
    document.getElementById('suchfeld').name = 'searchText';
    document.getElementById('frn_searchTarget').action =
'http://tools.freenet.de/mod_perl/linker/freenet_startseite_suche_b_shopping/shopping.freenet.de/search.do';
    document.getElementById('frnGoogleHead2').style.display = 'none';

  }

  if (art == 'wikipedia'){
           if (newLook == 'old'){
           } else{
           }
     document.getElementById('wikipedia').childNodes[0].style.backgroundColor = highlightChoiseHead;
     document.getElementById('searchButton').className = 'wikisuche';
     document.getElementById('frn_searchType').value = art;
     document.getElementById('suchfeld').name = 'search';
     document.getElementById('frn_searchTarget').action ='http://lexikon.freenet.de/Wikipedia:Hauptseite?';
     document.getElementById('frnGoogleHead2').style.display = 'none';
  }

  if (art == 'maps'){
     document.getElementById('maps').childNodes[0].style.backgroundColor = highlightChoiseHead;
     document.getElementById('searchButton').className = 'maps';
     document.getElementById('frn_searchType').value = art;
     document.getElementById('suchfeld').name = 'whatVis';
     document.getElementById('suchfeld2').name = 'whereVis';
     document.getElementById('frn_searchTarget').action ='http://suche.freenet.de/maps/';
     document.getElementById('frnGoogleHead2').style.display = 'none';
  }

}

//suche fuss
function SearchFootChange(art){

   if (typeof(document.getElementById("foot_web") ) != undefined) {  }
   document.getElementById('frnGoogleFoot').style.display = 'none';
   if (newLook == 'old'){
   } else{
   }

 if (art == 'web'){
     if (newLook == 'old'){
            document.getElementById('frnGoogleFoot').style.display = 'block'
     } else{
            document.getElementById('frnGoogleFoot').style.display = 'none';
     }

    document.getElementById('foot_web').childNodes[0].style.backgroundColor =highlightChoiseFoot;
    document.getElementById('searchButtonFoot').className = 'websuche';
    document.getElementById('frn_searchTypeFoot').value = art;
    document.getElementById('frn_searchTargetFoot').action =
'http://tools.freenet.de/mod_perl/linker/freenet_footer_suche_web/suche.freenet.de/suche';
    document.getElementById('foot_suchfeld').name = 'query';
    document.getElementById('frnCountryFoot').value = '';
    document.getElementById('frnFrefFoot').value = '';

  }

  if (art == 'bilder'){
     document.getElementById('foot_bilder').childNodes[0].style.backgroundColor = highlightChoiseFoot;
     document.getElementById('searchButtonFoot').className = 'bilder';
     document.getElementById('frn_searchTypeFoot').value = art;
     document.getElementById('foot_suchfeld').name = 'query';
     document.getElementById('frn_searchTargetFoot').method = 'post';
     document.getElementById('frn_searchTargetFoot').action = 'http://suche.freenet.de/bilder/';
  }

  if (art == 'freenet'){
      if (newLook == 'old'){
      } else{
      }

      document.getElementById('foot_freenet').childNodes[0].style.backgroundColor = highlightChoiseFoot;
      document.getElementById('frn_searchTypeFoot').value = art;
      document.getElementById('frn_searchTargetFoot').action = 'http://suche.freenet.de/suche/';
      document.getElementById('frn_searchTargetFoot').method = 'post';
      document.getElementById('frn_searchTargetFoot').name = 'search';
      document.getElementById('frnCountryFoot').value = 'FN';
      document.getElementById('frnFrefFoot').value = 'http://suche.freenet.de/suche';
      document.getElementById('foot_suchfeld').name = 'query';
      document.getElementById('frnGoogleFoot').style.display = 'none';
      document.getElementById('searchButtonFoot').className = 'freenet';
  }

  if (art == 'lokales'){
       document.getElementById('foot_lokales').childNodes[0].style.backgroundColor = highlightChoiseFoot;
  }

 if (art == 'shopping'){
    if (newLook == 'old'){
    } else{
    }

    document.getElementById('foot_shopping').childNodes[0].style.backgroundColor = highlightChoiseFoot;
    document.getElementById('frn_searchTypeFoot').value = art;
    document.getElementById('foot_suchfeld').name = 'searchText';
    document.getElementById('frn_searchTargetFoot').action =
'http://tools.freenet.de/mod_perl/linker/freenet_footer_suche_shopping/shopping.freenet.de/search.do';
    document.getElementById('searchButtonFoot').className = 'shopping';
  }

  if (art == 'wikipedia'){
      if (newLook == 'old'){
      } else{
      }
      document.getElementById('foot_wikipedia').childNodes[0].style.backgroundColor = highlightChoiseFoot;
      document.getElementById('searchButtonFoot').className = 'wikipedia';
      document.getElementById('frn_searchType').value = art;
      document.getElementById('suchfeld').name = 'search';
      document.getElementById('frn_searchTargetFoot').action ='http://lexikon.freenet.de/Wikipedia:Hauptseite?';
  }

  if (art == 'maps'){
     document.getElementById('foot_maps').childNodes[0].style.backgroundColor = highlightChoiseFoot;
     document.getElementById('searchButtonFoot').className = 'maps';
     document.getElementById('frn_searchType').value = art;
     document.getElementById('foot_suchfeld').name = 'whatFootVis';
     document.getElementById('foot_suchfeld2').name = 'whereFootVis';
     document.getElementById('frn_searchTargetFoot').action ='http://suche.freenet.de/maps/';
  }


}


// eo 03-10



function utf8_encode ( string ) {
    string = (string+'').replace(/\r\n/g, "\n").replace(/\r/g, "\n");
 
    var utftext = "";
    var start, end;
    var stringl = 0;
 
    start = end = 0;
    stringl = string.length;
    for (var n = 0; n < stringl; n++) {
        var c1 = string.charCodeAt(n);
        var enc = null;
 
        if (c1 < 128) {
            end++;
        } else if((c1 > 127) && (c1 < 2048)) {
            enc = String.fromCharCode((c1 >> 6) | 192) + String.fromCharCode((c1 & 63) | 128);
        } else {
            enc = String.fromCharCode((c1 >> 12) | 224) + String.fromCharCode(((c1 >> 6) & 63) | 128) + String.fromCharCode((c1 & 63) | 128);
        }
        if (enc != null) {
            if (end > start) {
                utftext += string.substring(start, end);
            }
            utftext += enc;
            start = end = n+1;
        }
    }
 
    if (end > start) {
        utftext += string.substring(start, string.length);
    }
 
    return utftext;
}

function searchChar () {

if( (document.getElementById("suchfeld").name == 'whatVis') || (document.getElementById("suchfeld2").name == 'whereVis') ){

  inhaltWhat = document.getElementById("suchfeld").value; 
  var newInputWhat = document.createElement("input");
  newInputWhat.type = "hidden";
  newInputWhat.name = "what";
  newInputWhat.value = utf8_encode(inhaltWhat);
  document.getElementById('frn_searchTarget').appendChild(newInputWhat);
  document.getElementById("suchfeld").value = '';

  inhaltWhere = document.getElementById("suchfeld2").value; 
  var newInputWhere = document.createElement("input");
  newInputWhere.type = "hidden";
  newInputWhere.name = "where";
  newInputWhere.value = utf8_encode(inhaltWhere);
  document.getElementById('frn_searchTarget').appendChild(newInputWhere);
  document.getElementById("suchfeld2").value = '';

} else if ( (typeof(document.getElementById("frnFootSuch") ) == undefined) ){

  if ( (document.getElementById("foot_suchfeld").name == 'whatFootVis') || ( document.getElementById("foot_suchfeld2").name == 'whereFootVis') ){

   inhaltWhatFoot = document.getElementById("foot_suchfeld").value; 
   var newInputWhatFoot = document.createElement("input");
   newInputWhatFoot.type = "hidden";
   newInputWhatFoot.name = "what";
   newInputWhatFoot.value = utf8_encode(inhaltWhatFoot);
   document.getElementById('frn_searchTargetFoot').appendChild(newInputWhatFoot);
   document.getElementById("foot_suchfeld").value = '';

   inhaltWhereFoot = document.getElementById("foot_suchfeld2").value; 
   var newInputWhereFoot = document.createElement("input");
   newInputWhereFoot.type = "hidden";
   newInputWhereFoot.name = "where";
   newInputWhereFoot.value = utf8_encode(inhaltWhereFoot);
   document.getElementById('frn_searchTargetFoot').appendChild(newInputWhereFoot);
   document.getElementById("foot_suchfeld2").value = '';
  }
} else{}

/*

  inhalt = document.getElementById("suchfeld").value;
  inhalt = utf8_encode(inhalt);
  document.getElementById("frn_searchQuery").value=inhalt;
*/


}
