/* ------------------------------------------------------------------------------------------- */
/* vodafone.global.js - VERSION 0.3.0 - DATE 2009/10/02 */
/* ------------------------------------------------------------------------------------------- */
/* PUBLISHING DATE 2009-11-05 04:28:58 */
/* ------------------------------------------------------------------------------------------- */

// GLOBAL VARS - BEGIN
if(!window.VF) {
  VF = new Object();
}
VF.randomNumber = Math.floor(Math.random()*1000000000000000000);
VF.includeLoginLoaded = false;
// GLOBAL VARS - END 



// OMNITURE MICROPAGE SETTING SCRIPT - BEGIN
function omnitureSetContentToMicropage() {
    if(s.prop23 && s.prop22 && s.prop21) {
        s.prop23 = s.prop22;
        s.prop22 = s.prop21;
        s.prop21 = s.channel;
    }
    if(!s.prop23 && s.prop22 && s.prop21) {
        s.prop23 = s.prop22;
        s.prop22 = s.prop21;
        s.prop21 = s.channel;
    }
    if(!s.prop23 && !s.prop22 && s.prop21) {
        s.prop22 = s.prop21;
        s.prop21 = s.channel;
    }
    if(!s.prop23 && !s.prop22 && !s.prop21) {
        s.prop21 = s.channel;
    }
    if(s.channel) {
        s.channel = "Mircopages";
    }
    if(s.hier1) {
        s.hier1 = "Micropages/" + s.hier1;
    }
    if(s.pageName) {
        s.pageName = "Micropages:" + s.pageName;
    }
}
// OMNITURE MICROPAGE SETTING SCRIPT - END

// OMNITURE TEASER TRACKING SCRIPT - BEGIN
$(window).load(function() {
    $("a[class*='trackingTeaser']").click(function(){
        if (window.s) {
            varClassNames = $(this).attr("class");
            varHref = $(this).attr("href");
            varTeaserID = varClassNames.substring(varClassNames.indexOf("trackingTeaser") + 14, varClassNames.indexOf("Click"));
            varClickType = varClassNames.substr(varClassNames.indexOf("Click") + 5, 1);
            if (varHref.indexOf("?") != -1) {
                varHref = varHref + "&";
            }
            else {
                varHref = varHref + "?";
            }
            varHref = varHref + "icmp=" + s.pageName + ":" + varTeaserID + "::" + varClickType;
            $(this).attr("href", varHref);
        }
    });
    $("div[class*='trackingTeaser']").each(function(){
        if (window.s) {
            varClassNames = $(this).attr("class");
            varTeaserID = varClassNames.substr(varClassNames.indexOf("trackingTeaser") + 14, 6);
            if (s.prop30) {
                s.prop30 += "," + s.pageName + ":" + varTeaserID;
            }
            else {
                s.prop30 = s.pageName + ":" + varTeaserID;
            }
        }
    });
});
// OMNITURE TEASER TRACKING SCRIPT - END

// FLASH LOADER - BEGIN
function flash_detect() {
  var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
  var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;
  var flashVer = 0;
  flash2Installed = false;
  flash3Installed = false;
  flash4Installed = false;
  flash5Installed = false;
  flash6Installed = false;
  flash7Installed = false;
  flash8Installed = false;
  flash9Installed = false;
  flash10Installed = false;
  flash11Installed = false;
  flash12Installed = false;
  if(isIE && isWin) {
    document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
    document.write('on error resume next \n');
    document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
    document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
    document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
    document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');
    document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
    document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
    document.write('flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');
    document.write('flash9Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');
    document.write('flash10Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.10"))) \n');
    document.write('flash11Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.11"))) \n');
    document.write('flash12Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.12"))) \n');
    document.write('</SCR' + 'IPT\> \n');
  }
  if(navigator.plugins) {
    if(navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
      var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
      var flashVersion = parseInt(flashDescription.substr(flashDescription.indexOf(".")-1, 1 ));
      if (flashVersion == 0) {
        var flashVersion = parseInt(flashDescription.substr(flashDescription.indexOf(".")-2, 2 ));
      }
      flash2Installed = flashVersion == 2;
      flash3Installed = flashVersion == 3;
      flash4Installed = flashVersion == 4;
      flash5Installed = flashVersion == 5;
      flash6Installed = flashVersion == 6;
      flash7Installed = flashVersion == 7;
      flash8Installed = flashVersion == 8;
      flash9Installed = flashVersion == 9;
      flash10Installed = flashVersion == 10;
      flash11Installed = flashVersion == 11;
      flash12Installed = flashVersion == 12;
    }
  }
  for(var i = 2; i < 13; i++) {
    if (eval("flash" + i + "Installed") == true) flashVer = i;
  }
  return flashVer;
}
function flash_show(requiredFlashVer, film_name, film_breite, film_hoehe, ersatz_grafik, alt_tag, fallback_link, fallback_link_target) {
  flashVer = flash_detect();
  if(flashVer < requiredFlashVer || !film_name) {
    if(fallback_link != "") {
      document.write('<a href="'+fallback_link+'" target="'+fallback_link_target+'"><img src="'+ersatz_grafik+'" alt="'+alt_tag+'" width="'+film_breite+'" height="'+film_hoehe+'"></a>');
    } else {
      document.write('<img src="'+ersatz_grafik+'" alt="'+alt_tag+'" width="'+film_breite+'" height="'+film_hoehe+'">');
    }
  } else {
    if(flash_show.arguments && flash_show.arguments.length >= 7 && (typeof(flash_show.arguments[6])!='undefined')) {
      var param = '?'+flash_show.arguments[6];
    } else {
      var param = '';
    }
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"         codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,0,0" width="'+film_breite+'" height="'+film_hoehe+'">');
    document.write('<param name=movie value="'+film_name+param+'">');
    document.write('<param name=quality value=high>');
    document.write('<param name=wmode value=opaque>');
    document.write('<embed src="'+film_name+param+'" quality=high pluginspage="https://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="opaque" width="'+film_breite+'" height="'+film_hoehe+'"></embed>');
    document.write('</object>');
  }
}
// FLASH LOADER - END


// INFODOK SEARCH - BEGIN
function createXHR() {
  var request = false;
  try {
    request = new ActiveXObject('Msxml2.XMLHTTP');
  }
  catch (err2) {
    try {
      request = new ActiveXObject('Microsoft.XMLHTTP');
    }
    catch (err3) {
      try {
        request = new XMLHttpRequest();
      }
      catch (err1) {
        request = false;
      }
    }
  }
  return request;
}
function searchInfoDok(numberInfoDok, pageId) { 
  xhr=createXHR();
  url = "/infofaxe/" + numberInfoDok + ".pdf";
  xhr.open("HEAD", url, true);
  xhr.onreadystatechange=function() {
    document.getElementById("messageInfoDok" + pageId).style.display = "";
    document.getElementById("loadInfoDok" + pageId).style.display = "none";
    document.getElementById("messageInfoDok" + pageId).innerHTML = "<strong>Suche nach InfoDok " + numberInfoDok + "...</strong>";
    if(xhr.readyState == 4) {
      var value;
      if(xhr.status == 200) { 
        value = " InfoDok " + numberInfoDok + " vorhanden.";
        document.getElementById("messageInfoDok" + pageId).style.display = "none";
        document.getElementById("loadInfoDok" + pageId).style.display = "";
        document.getElementById("linkInfoDok" + pageId).href = url;
        document.getElementById("linkInfoDok" + pageId).innerHTML = "InfoDok " + numberInfoDok + " jetzt downloaden";
      } else {
        if(xhr.status==404) {
          document.getElementById("messageInfoDok" + pageId).style.display = "";
          value = "<strong>InfoDok " + numberInfoDok + " nicht vorhanden!</strong>";
          document.getElementById("loadInfoDok" + pageId).style.display = "none";
        }
      }
    document.getElementById("messageInfoDok" + pageId).innerHTML=value;
    }
  }
  xhr.send(null); 
}
function resetSearchInfoDok(pageId) {
  document.getElementById("messageInfoDok" + pageId).style.display = "none";
  document.getElementById("loadInfoDok" + pageId).style.display = "none";
  document.getElementById("inputInfoDok" + pageId).value = "";
} 
// INFODOK SEARCH - END


// URL-PARAMETERS - BEGIN
function getUrlParameters() {
  var stringElements = "";
  var varValue = "";
  //schaue ob ein query string vorhanden ist
  if(window.location.search != "") {
    QUERYSTRING = window.location.search
    QUERYSTRING = QUERYSTRING.replace(/\?/,"");
    QUERYSTRING = QUERYSTRING.replace(/\?/,"&");
    //trenne den querystring nach jedem & in stringElements auf
    stringElements = QUERYSTRING.split("&");
    //durchlaufe jeden dieser stringElements
    for (i=0;i<stringElements.length;i++) {
      //trenne den teilstring in weiteren teilstring auf,
      //trenne also variablennamen vom inhalt
      varValue = stringElements[i].split("=");
      arrayUrlParameter[varValue[0]] = varValue[1];
    }
  }
}
function changePreSelect() {
  if(arrayUrlParameter["TarifID"]) {
    document.getElementById(arrayUrlParameter["TarifID"]).click();
  }
}
// URL-PARAMETERS - END

// URL-PARAMETERS DECODE-URI - BEGIN
function getUrlParametersDecodeURI() {
  var stringElements = "";
  var varValue = "";
  //schaue ob ein query string vorhanden ist
  if(window.location.search != "") {
    QUERYSTRING = window.location.search;
    QUERYSTRING = decodeURI(QUERYSTRING);
    QUERYSTRING = QUERYSTRING.replace(/\?/,"");
    QUERYSTRING = QUERYSTRING.replace(/\?/,"&");
    //trenne den querystring nach jedem & in stringElements auf
    stringElements = QUERYSTRING.split("&");
    //durchlaufe jeden dieser stringElements
    for (i=0;i<stringElements.length;i++) {
      //trenne den teilstring in weiteren teilstring auf,
      //trenne also variablennamen vom inhalt
      varValue = stringElements[i].split("=");
      arrayUrlParameter[varValue[0]] = varValue[1];
    }
  }
}
// URL-PARAMETERS DECODE-URI - END

// URL-PARAMETERS UNESCAPE - BEGIN
function getUrlParametersUnescape() {
  var stringElements = "";
  var varValue = "";
  //schaue ob ein query string vorhanden ist
  if(window.location.search != "") {
    QUERYSTRING = window.location.search;
    QUERYSTRING = unescape(QUERYSTRING);
    QUERYSTRING = QUERYSTRING.replace(/[+]/g,"-");
    QUERYSTRING = QUERYSTRING.replace(/\?/,"");
    QUERYSTRING = QUERYSTRING.replace(/\?/,"&");
    //trenne den querystring nach jedem & in stringElements auf
    stringElements = QUERYSTRING.split("&");
    //durchlaufe jeden dieser stringElements
    for (i=0;i<stringElements.length;i++) {
      //trenne den teilstring in weiteren teilstring auf,
      //trenne also variablennamen vom inhalt
      varValue = stringElements[i].split("=");
      arrayUrlParameter[varValue[0]] = varValue[1];
    }
  }
}
// URL-PARAMETERS UNESCAPE - END


// WEB2.0 - BEGIN
function jah(url,target) {
  // native XMLHttpRequest object
  window.status = "loading ...";
  if(window.XMLHttpRequest) {
    req = new XMLHttpRequest();
    req.onreadystatechange = function() {jahDone(target);};
    req.open("GET", url, true);
    req.send(null);
  // IE/Windows ActiveX version
  } else if(window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    if(req) {
      req.onreadystatechange = function() {jahDone(target);};
      req.open("GET", url, true);
      req.send();
    }
  }
}
function jahDone(target) {
  // only if req is "loaded"
  if(req.readyState == 4) {
    // only if "OK"
    if(req.status == 200) {
      results = req.responseText;
      document.getElementById(target).innerHTML = results;
      launchJavascript(results);
      window.status = "";
    } else {
      window.status = "error: " + req.statusText
    }
  }
}
function launchJavascript(responseText) {
  // RegExp from prototype.sonio.net
  var ScriptFragment = '(?:<scr'+'ipt.*?>)((\n|.)*?)(?:</scr'+'ipt>)';
  var match = new RegExp(ScriptFragment, 'img');
  var scripts = responseText.match(match);
  if(scripts) {
    var js = '';
    for(var s = 0; s < scripts.length; s++) {
      var match = new RegExp(ScriptFragment, 'im');
      js += scripts[s].match(match)[1];
    }
    eval(js);
  }
}
// WEB2.0 - END


// ACCORDION SEARCH - BEGIN
function changeSE(varIDLink, varIDForm, varFunction) {
  if(varFunction == "close") {
    document.getElementById(varIDForm).style.display = "none";      
    document.getElementById(varIDLink).className = "aAccordion closed";
    document.getElementById(varIDLink).href = "javascript:void(changeSE('idSE1', 'searchExtended', 'open'))";
  }
  if(varFunction == "open") {
    document.getElementById(varIDForm).style.display = "block";      
    document.getElementById(varIDLink).className = "aAccordion open";
    document.getElementById(varIDLink).href = "javascript:void(changeSE('idSE1', 'searchExtended', 'close'))";
  }
}
// ACCORDION SEARCH - END


// COOKIE LESEN - BEGIN
function getCookie(NameOfCookie) {
  if(document.cookie.length > 0){
    begin = document.cookie.indexOf(NameOfCookie+"=");
    if(begin != -1) {
      begin += NameOfCookie.length+1;
      end = document.cookie.indexOf(";", begin);
      if(end == -1) {
        end = document.cookie.length;
      }
      return unescape(document.cookie.substring(begin, end));
    }
  }
  return null;
}
// COOKIE LESEN- END 


// ALLE COOKIES FUER STARS LESEN - BEGIN
function catch_cookie_stars() {
  vodafone_login=getCookie("VODAFONELOGIN");
  vodafone_status=getCookie("VODAFONESTATUS");
  vodafone_points=getCookie("VODAFONEPOINTS");
  vodafone_expiredpoints=getCookie("VODAFONEEXPIREDPOINTS");
  return unescape(vodafone_login);
}
// ALLE COOKIES FUER STARS LESEN - END 


// COOKIE-FARBE ERMITTELN - BEGIN
function catch_cookie_color(vodafone_status) {
  switch(vodafone_status) {
    case "99999": {
      vodafone_color="";
      break;
    }
    case "10005": {
      vodafone_color="rot";
      break;
    }
    case "10004": {
      vodafone_color="rot";
      break;
    }
    case "10003": {
      vodafone_color="silber";
      break;
    }
    case "10002": {
      vodafone_color="gold";
      break;
    }
    case "10001": {
      vodafone_color="platin";
      break;
    }
    default: {
      vodafone_color="";
    }
  }
  return unescape(vodafone_color);
}
// ALLE COOKIES FUER STARS LESEN - END


// ANZAHL DER BONUSPUNKTE ANZEIGEN - BEGIN
function show_cookie_points(cookie_text) {
  catch_cookie_stars();
  if(!vodafone_points) {
    vodafone_points="0";
  }
  if(!vodafone_expiredpoints) {
    vodafone_expiredpoints="0";
  }
  if(vodafone_login == "1") {
    if(cookie_text == "t") {
      document.write("Sie haben ");
    }
    document.write(vodafone_points);
    if(cookie_text == "t") {
      document.write(" Punkte.");
      if(vodafone_expiredpoints == "0") {
        document.write("<BR><BR>");
      } else {
        expiredPoints = vodafone_expiredpoints.split("|");
        expired = " Am<BR>"+expiredPoints[0]+ "<BR>verfallen "+expiredPoints[1]+" Punkte.<BR><BR>";
        document.write(expired);
      }
    } else {
      document.write(" ");
    }
  } else {
    if(cookie_text == "t") {
      document.write("Sie sind nicht eingeloggt.<br><br>");
    } else {
      document.write("0 ");
    }
  }
}
// ANZAHL DER BONUSPUNKTE ANZEIGEN - END


// SUCHPARAMETER ERSTELLEN - BEGIN
function make_search_par(cookie_segment) {
  catch_cookie_stars();
  switch(vodafone_status) {
    case "10004": {
      vodafone_colork="r";
      break;
    }
    case "10003": {
      vodafone_colork="s";
      break;
    }
    case "10002": {
      vodafone_colork="g";
      break;
    }
    case "10001": {
      vodafone_colork="p";
      break;
    }
    default: {
      vodafone_colork="";
    }
  }
  cookie_par1 = "";
  if(cookie_segment == "business") {
    cookie_par1 = "b";
  }
  if(cookie_segment == "live") {
    cookie_par1 = "l";
  }
  if(cookie_segment == "ueber") {
    cookie_par1 = "u";
  }
  if(cookie_segment == "meinvodafone") {
    cookie_par1 = "m";
  }
  if(cookie_segment == "hilfe_support") {
    cookie_par1 = "h";
  }
  search_parameter = cookie_par1+vodafone_colork+"htdig";
  hidden_field = "<input type='hidden' name='config' value='"+search_parameter+"'>";
  document.write(hidden_field);
}
// SUCHPARAMETER ERSTELLEN - END


// STARS-STATE TO OMNITURE - BEGIN
function getStarsState() {
  switch(getCookie("VODAFONESTATUS")) {
    case "10004": {
      omnitureStarsState = "Red";
      break;
    }
    case "10003": {
      omnitureStarsState = "Silver";
      break;
    }
    case "10002": {
      omnitureStarsState = "Gold";
      break;
    }
    case "10001": {
      omnitureStarsState = "Platinum";
      break;
    }
    default: {
      omnitureStarsState = "None";
    }
  }
  return unescape(omnitureStarsState);
}
// STARS-STATE TO OMNITURE - END


// OPEN WINDOW - BEGIN
function openWindow (varLink, varName, varOptions) {
  varWindow = window.open(varLink, varName, varOptions);
  varWindow.focus();
}
// OPEN WINDOW - END


// SEND A FRIEND - BEGIN
function sendafriend() {
  var url = "https://" + window.location.hostname + "/taf/start?url="+escape(document.location);
  openWindow(url, "SendAFriend", "height=780,width=594,location=no,menubar=no,resizable=yes,toolbar=no");
}
// SEND A FRIEND - END


// SEND A FRIEND UNIVERSAL - BEGIN
function sendafriend2() {
  var url = "https://www.vodafone.de/taf/start?url="+escape(document.location);
  openWindow(url, "SendAFriend", "height=780,width=594,location=no,menubar=no,resizable=yes,toolbar=no");
}
// SEND A FRIEND - END



// CHECK FORM - BEGIN
function checkForm() {
  if(!document.getElementById("pushform").checkbox.checked) {
    alert("Ohne Bestätigung der Versandbedingungen dürfen wir Ihre Empfehlung nicht versenden!");
    // document.getElementById("pushform").phone.focus();
    return false;
  }
  return true;
}
// CHECK FORM - END


// DO FORM - BEGIN
function doForm() {
  ret=checkForm();
  if (ret) document.getElementById("pushform").submit();
}
// DO FORM - END


// CHECKLOGIN - BEGIN 
function checkLogin(NameOfCookie) {
  var cookieValue = null;
  if(document.cookie.length > 0) {
    begin = document.cookie.indexOf(NameOfCookie+"=");
    if(begin != -1) {
      begin += NameOfCookie.length+1;
      end = document.cookie.indexOf(";", begin);
      if(end == -1) {
        end = document.cookie.length;
      }
      cookieValue = unescape(document.cookie.substring(begin, end));
      if(cookieValue == "1") {
        return true;
      }
    } else {
      return false;
    }
  }
  return false;
}
// CHECKLOGIN - END


// SET PERSONALISED-MODE - BEGIN
function setPersonalisedMode() {        
  varCheckLogin = checkLogin("VODAFONELOGIN");
  if($("#divContentID").hasClass("contentPersonalisedA") || $("#divContentID").hasClass("contentPersonalisedB") || $("#divContentID").hasClass("contentPersonalisedC")) {
    varStatusPersonalised = true;
  } else {
    varStatusPersonalised = false;
  }
  if(varCheckLogin == true) {
    //document.getElementById("divContentID").className = "divContent contentPersonalisedA";
    if(varStatusPersonalised == false) {    
      $("#divContentID").addClass("contentPersonalisedA");
    }
    if(VF.includeLoginLoaded == true) {
      document.getElementById("liLoginID").style.display = "none";
      document.getElementById("liLogoutID").style.display = "inline";
    }
  } else if(varCheckLogin == false) {
    //document.getElementById("divContentID").className = "divContent";
    if(varStatusPersonalised == false) {
      $("#divContentID").removeClass("contentPersonalisedA");
    }
    if(VF.includeLoginLoaded == true) {
      document.getElementById("liLoginID").style.display = "inline";
      document.getElementById("liLogoutID").style.display = "none";
    }
  }
}
// SET PERSONALISED-MODE - END




// MVF LOGINBOX - BEGIN
function switchInput(varID) {
  if(varID == "pwd") {
    document.getElementById("inetinfo").style.display = "none";
    document.getElementById("inetpassword").style.display = "";
  }
}
function initLogin() {
  document.getElementById("inetinfo").style.display = "";
  document.getElementById("inetpassword").style.display = "none";
}
// MVF LOGINBOX - END

// AVS LOGINBOX - BEGIN
function switchPinInput(varID) {
  if(varID == "pin") {
    document.getElementById("pininfo").style.display = "none";
    document.getElementById("pin").style.display = "block";
    document.getElementById("pin").focus();
  }
}
function initPinLogin() {
  document.getElementById("pininfo").style.display = "block";
  document.getElementById("pin").style.display = "none";
}
// AVS LOGINBOX - END

// ESEARCH - BEGIN R17 
/**
* Javascript functions for the search form,
* which is located in the global header snippet.
*
* $Id: search-form.js 79269 2009-08-07 11:54:17Z dfilzhut $
*
**/
/**
* Modifies form behaviour when user changes search target.
**/
function changeSelect(searchFormId) {
    var form = document.forms[searchFormId];
    var targetSelector = form.elements['fromShopOrGoogle'];
    var successURL = form.elements['successURL'];
    for (var i = 0; i < targetSelector.length; i++) {
        if (targetSelector[i].checked) {
            var checkedValue = targetSelector[i].value;
            if (checkedValue == "Google") {
                $("#question").autocompleteEnabled(false);
                form.action = VF.websearchURL;
                successURL.value = "";
                form.method = "get";
                if (form.elements["question"]) {
                    form.elements["question"].name = "q";
                }
            } else {
                $("#question").autocompleteEnabled(true);
                form.action = VF.eSearchURL;
                successURL.value = "/Suche/searchResult.jsp?submenu=1";
                form.method = "post";
                if (form.elements["q"]) {
                    form.elements["q"].name = "question";
                }
            }
        }
    }
    return true;
}
/**
* Removes certain characters from search string to avoid errors.
**/
function fixSpecialCharacter(input) {
    input.value = input.value.replace(/[^a-zA-Z0-9\u00E4\u00F6\u00FC\u00C4\u00D6\u00DC\u00DF\u0022\&\+\-\:\? ]/g, " ");
}
/**
* Removes input field inline label when user focuses 'empty' input field.
**/
function fixFocusQuestion(input) {
    if (input.value == 'Suchbegriff eingeben') {
        input.value = '';
    }
}
/**
* Sets input field inline label when user leaves input field
* and did not enter any search keyword.
**/
function fixBlurQuestion(input) {
    if (input.value) {
        return;
    }
    else {
        input.value = 'Suchbegriff eingeben';
    }
}
/**
* Checks whether the user entered a valid searchstring.
**/
function checkInput(input) {
    var subVar = (input.q ? input.q : input.question);
    if (subVar.value == "Suchbegriff eingeben") {
        return false;
    }
    else {
        return true;
    }
}
/**
* Submits search form if it contains valid data.
**/
function submitForm(alink) {
    if (checkInput(document.formGlobalSearch)) {
        document.forms.formGlobalSearch.submit();
    }
}
/**
* Safely tries to submit search form and performs all necessary actions
* before doing so.
*
*     searchFormId    Search from DOM element
*    checkOnly        If this is set to TRUE, the form
*                    is not submitted, only TRUE/FALSE is returned.
**/
function submitSearchForm(searchFormId, checkOnly) {
    var searchFormNode = document.getElementById(searchFormId);
    // Check selected search target
    changeSelect(searchFormId);
    // Check for user input validity
    if (checkInput(searchFormNode)) {
        // Submit form only if requested
        if (!checkOnly) {
            searchFormNode.submit();
        }
        return true;
    } else {
        return false;
    }
}
/**
* Initializes the suggest feature of the search form.
*
*        $                jQuery object
*        inputObj        input object autosuggest should apply to
*        myWidth            inital width of autosuggest box
*        myTopOffset        inital top offset of autosuggest box
*
**/
function snSetup($, inputObj, myWidth, myTopOffset, onShow, onHide) {
    function myCallback(event, data, formatted) {
        // handle the selection
        window.location.href = data.URL;
    }
    $(inputObj).result(myCallback);
    // To send the input value to the proxy script for use in eg the Keywords
    // field, simply add 'Keywords: getInputValue' to the list of extraParams
    // in the call to autocomplete() below.
    function getInputValue() {
        return $(inputObj).val();
    }
    function formatRow(row) {
        var inHtml = row.SN_value;
        var varReplace = row.Category;
        var varTriggerClass = "replaceColumn1" + varReplace.replace(/ /g, "");
        if (row.SN_type.split("_")[0] == "item") {
            inHtml = "<a href='" + row.URL + "' class='col1 TT_1000_0204 " + varTriggerClass + "'>" + row.SN_value + "</a>";
        }
        return inHtml;
    }
    // add functionality for footer
    function formatFooter() {
        var inHtml = "<span><a href=\"#\" onclick=\"submitSearchForm(\'formGlobalSearch\'); return false;\">Alle Suchergebnisse</a></span>";
        return inHtml;
    }
    // calculate left offset for a given width
    var myLeftOffset = (parseInt($(inputObj).css("width"))-parseInt(myWidth) ) / 2;
    // firefox needs extra treatment
    if ($.browser.mozilla) {
        myLeftOffset = Math.floor(myLeftOffset);
    }
    $(inputObj).snAutocomplete("/Suche/mmsn", {
        max: 10,
        extraParams: { Bias: 100, Keywords: "5-0-5-" },
        formatItem: formatRow,
        formatFooter: formatFooter,
        highlight: false,
        showLogo: false,
        width: myWidth,
        leftOffset: myLeftOffset,
        topOffset: myTopOffset,
        onShow: onShow,
        onHide: onHide
    });
}
// ESEARCH - END


// INTRO HIDDEN FUNCTION - BEGIN
function closeIntro(varID) {
  document.getElementById(varID).className = "displayNone";
}
function setIntro(varID, varAction) {
  if(varAction == "open") {
    document.getElementById(varID).className = "divIntroOpen showOverlay";
  }
  if(varAction == "close") {
    document.getElementById(varID).className = "divIntroClose showNormal";
  }
}
// INTRO HIDDEN FUNCTION - END

// NPS UMFRAGE POPUP - BEGIN
function loadNPS(valPath) {
  if($.cookieASCII('vfnps') == null) {
    var valResultRandom = Math.floor(Math.random()*10);
    if(valResultRandom == 7) {
      window.open(valPath, 'VodafoneUmfage', 'width=610, height=650, scrollbars=auto, toolbar=no, status=no, resizable=yes, menubar=no, location=no, directories=no, top=50, left=50');
    }
  }
}
// NPS UMFRAGE POPUP - END

// BREADCRUMB + SOCIAL BOOKMARK - BEGIN
jQuery(document).ready(function($){
    var varValue = $("#breadcrumb li b").get();
    if(varValue != "") {
        var varCompleteWidth = 0;
        var varCountItems = varValue.length;
        var varLengthLastItem = varValue[varValue.length-1].offsetWidth;
        var varLengthLItem = 0;
        VF.varLengthSItem = 50;
        for (i = 1; i < varValue.length; i++) {
            varCompleteWidth = varCompleteWidth + varValue[i].offsetWidth;
            if(varValue[i].offsetWidth > varLengthLItem) {
                varLengthLItem = varValue[i].offsetWidth;
            }
            if(varValue[i].offsetWidth < VF.varLengthSItem) {
                VF.varLengthSItem = varValue[i].offsetWidth;
            }
        }
        varItemWidth = Math.round((varCompleteWidth - varLengthLItem) / varCountItems);
        if(varCompleteWidth > $("#breadcrumb").innerWidth()) {
            $("#breadcrumb").css("height", "18px");
            $("#breadcrumb li:not(.lastItem, .homeItem)").css("width", VF.varLengthSItem+"px");
            $("#breadcrumb li:not(.lastItem, .homeItem)").hover( makeBreadcrumbTall, makeBreadcrumbShort );
        }
        $("#social li:not(.infoLink)").hover( makeSocialBookmarkTall, makeSocialBookmarkShort );
        $("#social li b a").attr({title: ""});
    }
});
function makeBreadcrumbTall() {
    var valueWidth = $(this).children().innerWidth();
    $(this).animate({"width":valueWidth}, 125);
}
function makeBreadcrumbShort() {
    $(this).animate({"width":VF.varLengthSItem},125);
}
function makeSocialBookmarkTall() {
    var valueWidth = $(this).children().innerWidth();
    $(this).animate({"width":valueWidth},75);
}
function makeSocialBookmarkShort() {
    $(this).animate({"width":20},75);
}
// BREADCRUMB + SOCIAL BOOKMARK - END

// ----------- END