// Define browser version.
var ns4 = (document.layers)? true:false;
var ns6 = (document.getElementById)? true:false;
var ie4 = (document.all)? true:false;
var ie5 = false;

if (ie4) {
 if ((navigator.userAgent.indexOf('MSIE 5') > 0) || (navigator.userAgent.indexOf('MSIE 6') > 0)) { ie5 = true; }
 if (ns6) { ns6 = false; }
}

// Define the image swap function.
function imgSwap_tooltip(name, src) {
 document[name].src = eval( src + ".src" );
}

// Popup Script

function openWin(url,x,y,width,height,id,i_status,i_scroll)
{
    var win_status="yes";
 var win_scroll="yes";
 if (i_status) { win_status=i_status; }
    if (i_scroll) { win_scroll=i_scroll; }
 winparams='toolbar=no,location=no,directories=no,menubar=no,status='+win_status+',';
 winparams+='scrollbars='+win_scroll+',resizable=yes';
 if (navigator.appName.indexOf("Microsoft")>=0)
 {
  winparams+=',left=' + x + ',top=' + y + ',width=' + width + ',height=' + height;
 }
 else
 {
  winparams+=',screenX=' + x + ',screenY=' + y + ',width=' + width + ',height=' + height;
 }
 if (id == '0')
  {
  popup=window.open(url,"vodafonepopup",winparams);
  }
 if (id == 'Druck')
  {
  popup=window.open(url,"Druckansicht",winparams);
  }
 if (id != 'Druck' && id != '0')
  {
  popup=window.open(url,"vodafonepopup"+ id,winparams);
  }
 popup.focus();
}

// Zentrierung des PopUps (fuer Spiele etc.)

function openWinCenter(url,width1,height1,id,win_stat,win_scroll)
{
if (screen.width <= 800)
{
if((width1 + 10) > screen.availWidth){width1 = screen.availWidth - 10;}
if((height1 + 29) > screen.availHeight){height1 = screen.availHeight - 29;}
screen_width = (screen.availWidth - width1 - 10) / 2;
screen_height = (screen.availHeight - height1 - 29) / 2;
}
if (screen.width > 800){
screen_width = (screen.availWidth - width1 - 10) / 2;
screen_height = (screen.availHeight - height1 - 29) / 2;
}
width=width1;
height=height1;
y=screen_height;
x=screen_width;
openWin(url,x,y,width,height,id,win_stat,win_scroll)
}

// flash Detection Script - v0.1 - catalin@cabanova.ro

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;


 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('</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.charAt(flashDescription.indexOf(".") - 1));
   flash2Installed = flashVersion == 2;
   flash3Installed = flashVersion == 3;
   flash4Installed = flashVersion == 4;
   flash5Installed = flashVersion == 5;
   flash6Installed = flashVersion == 6;
   flash7Installed = flashVersion == 7;
   flash8Installed = flashVersion == 8;
   flash9Installed = flashVersion == 9;
  }
 }

 for (var i = 2; i < 10; i++) {
  if (eval("flash" + i + "Installed") == true) flashVer = i;
 }
 return flashVer;
}
// Flashfile anzeigen
function flash_show(requiredFlashVer,film_name,film_breite,film_hoehe,ersatz_grafik,alt_tag)
{
    flashVer = flash_detect();

 if (flashVer<requiredFlashVer || !film_name)
 {
    document.write('<img src="'+ersatz_grafik+'" alt="'+alt_tag+'" width="'+film_breite+'" height="'+film_hoehe+'">');
 }
 else
 {
 document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"   codebase="http://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+'">');
 document.write('<param name=quality value=high>');
 document.write('<param name=wmode value=opaque>');
 document.write('<embed src="'+film_name+'" quality=high pluginspage="http://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>');
 }
}

// Cookie lesen
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;
        }

// Alle Cookies fuer Stars lesen
function catch_cookie_stars()
        {
            vodafone_login=getCookie("VODAFONELOGIN");
            vodafone_status=getCookie("VODAFONESTATUS");
            vodafone_points=getCookie("VODAFONEPOINTS");
            vodafone_expiredpoints=getCookie("VODAFONEEXPIREDPOINTS");
         return unescape(vodafone_login);
        // return unescape(vodafone_status);never executed, Christian Schepp, 7.9.05
        // return unescape(vodafone_points);never executed, Christian Schepp, 7.9.05
        }

// Cookie-Farbe ermitteln
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);
  }

// Anzahl der Bonuspunkte anzeigen
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 "); }
   }
}

// Alternative Anzeige einloggen bzw. ausloggen
function login_grafik(cookie_abmelden,cookie_anmelden,grafik_breite,grafik_hoehe)
{
 mystatus=getCookie("VODAFONELOGIN");

 g_breite=52; g_hoehe=15;
 if (grafik_breite > 1) { g_breite=grafik_breite; }
 if (grafik_hoehe > 1) { g_hoehe=grafik_hoehe; }

 if (mystatus == "1")
 {
  document.write("<img src='"+cookie_abmelden+"' width='"+g_breite+"' height='"+g_hoehe+"' alt='abmelden' border='0'>");
 }
 else
 {
  document.write("<img src='"+cookie_anmelden+"' width='"+g_breite+"' height='"+g_hoehe+"' border='0' alt='anmelden'>");
 }
 document.write("</a>");
}

// Vom Cookie abhaengig untersch. Kontaktlinks anzeigen
function nav_kontakt_cookie(cookie_linkstars,cookie_linkrot,cookie_linksilber,cookie_linkgold,cookie_linkplatin,cookie_mouseover)
{
 catch_cookie_stars();
 if (vodafone_status)
 {
  catch_cookie_color(vodafone_status);
 }
 else
 {
  vodafone_color="";
 }
 document.write("<a href='");
 switch (vodafone_color)
 {
   case "rot":
   {
  link1=cookie_linkrot;
     break;
   }
   case "silber":
   {
     link1=cookie_linksilber;
     break;
   }
   case "gold":
   {
     link1=cookie_linkgold;
     break;
   }
   case "platin":
   {
     link1=cookie_linkplatin;
     break;
   }
   default:
   {
     link1=cookie_linkstars;
   }
 }
 document.write(link1);
 document.write("' ");
 document.write(cookie_mouseover);
}

// Suchparameter erstellen
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"; }
 search_parameter=cookie_par1+vodafone_colork+"htdig";
 hidden_field="<input type='hidden' name='config' value='"+search_parameter+"'>";
 document.write(hidden_field);
}


// neues popup ohne gr&ouml;ssenver&auml;nderung

function openWinResize(url,x,y,width,height,id,i_status,i_scroll,i_resize)
{
 var win_status="yes";
 var win_scroll="yes";
 var win_resize="no"; // Default
 if (i_status) { win_status=i_status; }
 if (i_scroll) { win_scroll=i_scroll; }
 if (i_resize) { win_resize=i_scroll; }

 winparams='toolbar=no,location=no,directories=no,menubar=no,status='+win_status+',';
 winparams+='scrollbars='+win_scroll+',resizable='+win_resize;
 if (navigator.appName.indexOf("Microsoft")>=0)
 {
  winparams+=',left=' + x + ',top=' + y + ',width=' + width + ',height=' + height;
 }
 else
 {
  winparams+=',screenX=' + x + ',screenY=' + y + ',width=' + width + ',height=' + height;
 }
 if (id == '0')
  {
  popup=window.open(url,"vodafonepopup",winparams);
  }
 if (id == 'Druck')
  {
  popup=window.open(url,"Druckansicht",winparams);
  }
 if (id != 'Druck' && id != '0')
  {
  popup=window.open(url,"vodafonepopup"+ id,winparams);
  }
 popup.focus();
}