/*
*   Wechseltool für Kabel Deutschland
*   JS AJAX/Dom Application
*   Author: Dawid Sochacki (ion2s systems GmbH)
*   Copyright: 2009, Kabel Deutschland
*/

function Wechseltool(div){
    /********************************
    *   Contentattributs (Constants)
    ********************************/
    /* General */
    
	this.path = "/static/app/wechseltool/";
    
    //this.imagePath = this.path+"img/";
	this.imagePath = "/static/img/";
    this.prop3 = "Teaser Content: FT: Wechselberater";
    
    /* Headline */
	this.headlineImageSrc = new Array();
	this.headlineImageAltText = new Array();
    this.headlineImageSrc[2] = this.imagePath+"h2_beantworten_sie_einfach_folgende_fragen.gif";
    this.headlineImageAltText[2] = "Beantworten sie einfach folgende Fragen";
    this.headlineImageSrc[3] = this.imagePath+"h2_so_geht_es_weiter.gif";
    this.headlineImageAltText[3] = "So geht es weiter";
    this.headlineName = "headline123";
    
    /* Menu */
    this.menuItemsNumber = 3;
    this.menuName = "menu";
    this.menuRoAddition = "_hi";
    this.menuImageEnding = ".gif";
    
    /* Root Container */
    this.rootContainerName = "rootContainer";
    
    /* Left Container */
    this.leftContainerName = "leftContainer";
    
    /* Left Content Div */
    this.leftContentDivName = "leftContentDiv";
    
    /* Image */
    this.imageName = "image";
    this.imageImageEnding = ".jpg";
    
    /* Center Container */
    this.containerName = "container";
    this.contentHeight = new Array(
    "",
    "373px",
    "360px",
    "520px"
    );
    
    /* XML */
    this.xmlPath = this.path+"xml/wechseltool.xml";
    
    /* button */
    this.buttonName = "next";
    this.buttonImageSrc = "btn_weiter_weiss.gif";
    
    /* button */
    this.button2Name = "ratesOverview";
    this.button2ImageSrc = "btn_zur_tarifuebersicht.gif";

    /* button */
    this.backButtonName = "backButton";
    this.backButtonImageSrc = "btn_zurueck.gif";
    
    /* button */
    this.editButtonName = "editButton";
    this.editButtonImageSrc = "btn_zurueck.gif";
    
    /* Logic Arrays */
    this.products = new Array(
    'Bitte auswählen',
    'Kabel Internet & Telefon',
    'Kabel Internet',
    'Kabel Telefon'
    );
    
    this.provider = new Array(
    'Bitte auswählen',
    '1&amp;1',
    'Alice',
    'Arcor',
    'Deutsche Telekom',
    'Freenet',
    'T-Home',
    'Versatel',
    '------------------------------------------------------------------------------------------------',
    '3U Telekommunikation AG',
    '42 Consulting-Group GmbH',
    'access: sevenL Communications GmbH',
    'accom Ges. f. Telekommunikationsnetze u. -dienstleist.',
    'AugustaKom Telekommunikation GmbH u. Co. KG.',
    'Beacom GmbH &amp; Co. KG',
    'BerliKomm Telekommunikationsgesellschaft mbH',
    'BITel Ges. für kommunale Telekommunikation mbH',
    'BreisNet Telekommunikations- und Carrier-Dienste GmbH',
    'Breitbandkabelgesellschaft mbH',
    'Broadnet Mediascape Communications AG',
    'BT (Germany) GmbH u. Co. OHG',
    'Cable u. Wireless Deutschland GmbH',
    'Callax Telecom Holding GmbH',
    'Carrier 1 AG',
    'CATEL Communications AG',
    'Chem-Tel Telekommunikations GmbH',
    'CityKom Münster GmbH',
    'CNE Corporate Network Essen Ges. f. Telekommunikation mbH',
    'Colt Telecom GmbH',
    'Cybernet Internet-Dienstleistungen AG',
    'Daten- und Telekommunikations GmbH Dessau',
    'Deutsche LandTel GmbH',
    'Deutsche Telefon- u. Marketing Service GmbH',
    'DNS:NET Internet Service GmbH',
    'DOKOM GmbH',
    'EINSTEINet GmbH',
    'envia tel GmbH',
    'E-Plus Mobilfunk GmbH',
    'European Telecommunication Holding E.T.H. AG',
    'EWE TEL GmbH',
    'Global Network Telephone GmbH',
    'GöTel GmbH, Göttingen',
    'Group 3G UMTS, München',
    'Hannovers Telefon Partner GmbH',
    'HanseNet Telekommunikation GmbH',
    'HEAG MediaNet GmbH',
    'HeliNet',
    'Henken und Hormann GmbH',
    'HL komm Telekommunikations GmbH',
    'ID Net GmbH',
    'IN-telegence GmbH u. Co.KG',
    'Intelicom GmbH',
    'IntelliNet GmbH',
    'Interroute Telecom Deutschland GmbH',
    'ish GmbH u. Co.KG',
    'ISIS Multimedia Net GmbH',
    'jetz! GmbH u. Co. KG',
    'Jippii GmbH, Frankfurt',
    'Kabel Baden-Württemberg GmbH u. Co.KG',
    'Kabelfernsehen München ServiceCenter GmbH &amp; Co.KG',
    'KEVAG Telekom GmbH',
    'KielNet Gesellschaft für Kommunikation mbH',
    'KPN Telecom BV',
    'LeuCom Telekommunikationsgesellschaft mbH',
    'Level 3 Communications GmbH',
    'Long Distance International Ltd.',
    'M-net Telekommunikations GmbH',
    'Maestro GmbH',
    'Mcn tele.com AG',
    'MDCC Magdeburg City-Com GmbH',
    'MEGASAT GmbH',
    'MEOCOM GmbH u. Co KG',
    'MobilCom Multimedia GmbH',
    'MR.NET Services GmbH',
    'NEFKom Telekommunikation GmbH u. Co KG',
    'NetCologne GmbH',
    'NETCOM Kassel GmbH',
    'netzquadrat Gesellschaft für Telekommunikation mbH',
    'NEXNET GmbH',
    'nordcom GmbH',
    'o.tel.o communications GmbH',
    'One.Tel GmbH',
    'Osnatel GmbH',
    'PfalzKom Gesellschaft für Telekommunikation mbH',
    'PM2 Telecommunication GmbH',
    'Primus Telekommunikations GmbH',
    'prompt GmbH u. Co KG',
    'pulsaar Ges. für Telekommunikation mbH',
    'QSC AG',
    'Rapid Link Telecommunications GmbH',
    'R-KOM Regensburger Telekom. GmbH',
    'RSL COM Deutschland GmbH',
    'SD Telekommunikations GmbH',
    'SNT Multiconnect GmbH &amp; Co.KG',
    'Sontheimer Datentechnik GmbH',
    'SpaceKomm GmbH',
    'Startec Global Communications GmbH',
    'T-Com Deutschland GmbH',
    'TELE/OS Gesellschaft für Telekommunikation',
    'TeleBel Telekommunikation Bergisches Land GmbH',
    'TELECALL Vertriebs GmbH',
    'Telediscount',
    'Telefonica Deutschland GmbH',
    'Telegate AG für telefonische Informationsdie.',
    'telelev Telekommunikation GmbH',
    'TeleNec Telekommunikation Neustadt GmbH u. Co KG',
    'Telia International Carrier GmbH',
    'TELTA Citynetz Eberswalde GmbH',
    'T-Mobile Deutschland GmbH',
    'TNG-Network Management GmbH',
    'tnp telenet potsdam, Kommunikationsges. mbH',
    'T-Online International AG',
    'Tritone Telecom Deutschland GmbH',
    'Tropolys Service GmbH',
    'Ventelo GmbH und Co.KG',
    'Vodafone D2 GmbH, Düsseldorf',
    'VSE Net GmbH',
    'Wikom Elektrik GmbH',
    'wilhelm.tel GmbH, Norderstedt',
    'WOBCOM GmbH',
    'Würzburger Telekommunikationsgesellschaft mbH',
    'Yellow Access Operating Services AG'
    );
    
    this.yesNo = new Array(
    'Bitte auswählen',
    'Ja',
    'Nein'
    );
    
    this.myContracts = new Array(
    'Bitte auswählen',
    'Ja, Telefon und Internet',
    'Ja, nur Telefon',
    'Ja, nur Internet'
    );
    
    this.numberOfContracts = new Array(
    'Bitte auswählen',
    '1 Vertrag',
    '2 Verträge'
    );
    
    /********************************
    *   Contentelements (Variables)
    ********************************/
    this.mainDiv = document.getElementById(div);
    this.xmlData = null;
    this.headline = null;
    this.headlineImage = null;
    this.menu = null;
    this.menuItems = new Array();
    this.rootContainer = null;
    this.leftContainer = null;
    this.leftContentDiv = null;
    this.container = null;
    this.image = null;
    this.button = null;
    this.button2 = null;
    this.editButton = null;
    this.backButton = null;
    this.buttonImage = null;
    this.button2Image = null;
    this.editButtonImage = null;
    this.backButtonImage = null;
    
    /********************************
    *   Uservariables
    ********************************/
    this.userProduct = null;
    this.userProviderInternet = null;
    this.userProviderPhone = null;
    this.userPhoneNumber = null;
    this.userContractNumber = null;
	
	this.page = null;

    return this;
}

/********************************
*   Contentfunctions
********************************/

Wechseltool.prototype.write = function(page, text){
	this.page = page;


    if(this.mainDiv)
        this.mainDiv.innerHTML = "";
    
    if(text == 20) if(this.userProviderInternet != this.userProviderPhone) text = 23;
    //if(text == 27) if(this.userProviderPhone == 4) text = 40; //Wenn Telekom dann soll statt der normalen Seite 
    
    this.writeHeadline(page);
    //this.writeMenu(page);
    this.writeRootContainer();
    //this.writeLeftContainer();

    //this.writeImage(page);
    this.writeContainer(page);
    this.writeContent(this.container, text);

    if(page == 3){
      this.writeResult(text);
      this.writeBackButton();
      this.rewriteVLinks();
      this.writeButton2();
    }
}

Wechseltool.prototype.writeHeadline = function(n){
    this.headline = document.createElement("div");
    this.headline.setAttribute("id", this.headlineName);
	this.headline.setAttribute("className", "tabsContentWidth");
	this.headline.setAttribute("class", "tabsContentWidth");
    this.headlineImage = document.createElement("img");
    this.headlineImage.setAttribute("src", this.headlineImageSrc[n]);
    this.headlineImage.setAttribute("alt", this.headlineImageAltText[n]);
    this.headline.appendChild(this.headlineImage);
		
    this.mainDiv.appendChild(this.headline);
	this.writeSeperator(this.mainDiv);
}

Wechseltool.prototype.writeSeperator = function(container){
	this.seperator = document.createElement("div");
	this.seperator.setAttribute("className", "formSeparatorLarge");
	this.seperator.setAttribute("class", "formSeparatorLarge");
	container.appendChild(this.seperator);
}

Wechseltool.prototype.writeMenu = function(act){
    this.menu = document.createElement("div");
    this.menu.setAttribute("id", this.menuName);
    for(i = 1; i <= this.menuItemsNumber; i++){
        this.menuItems[i] = document.createElement("img");
        if(i == act)
            this.menuItems[i].setAttribute("src", this.imagePath+this.menuName+i+this.menuRoAddition+this.menuImageEnding);
        else
            this.menuItems[i].setAttribute("src", this.imagePath+this.menuName+i+this.menuImageEnding);
        this.menuItems[i].onclick = function(){
          //wechseltool.write(i, i); //klick über die leiste oben!
        }
        this.menuItems[i].setAttribute("id", this.menuName+i);
        this.menu.appendChild(this.menuItems[i]);
    }
    this.mainDiv.appendChild(this.menu);
}

Wechseltool.prototype.writeRootContainer = function(){
    this.rootContainer = document.createElement("div");
    this.rootContainer.setAttribute("id", this.rootContainerName);
    this.mainDiv.appendChild(this.rootContainer);
}

Wechseltool.prototype.writeLeftContainer = function(){
    this.leftContainer = document.createElement("div");
    this.leftContainer.setAttribute("id", this.leftContainerName);
    this.rootContainer.appendChild(this.leftContainer);
}

Wechseltool.prototype.writeResult = function(id){

    if(id != '14'){ 
		div = document.createElement("div");
	    div.setAttribute("id", "downloads");
		div.setAttribute("className", "tabsContentWidth");
		div.setAttribute("class", "tabsContentWidth");
	    divImage = document.createElement("img");
	    divImage.setAttribute("src", this.imagePath+"h2_downloads.gif");
	    divImage.setAttribute("alt", "Downloads");
	    div.appendChild(divImage);
			
	    this.container.appendChild(div);
    }
    
    div = document.createElement("div");
	div.innerHTML = '<div class="downloadContainer">';

    /*** Internet, Internet != Phone ***/
    if(this.userProviderInternet != null && (this.userProviderInternet != this.userProviderPhone)){
      if(this.userProviderInternet == 56 || this.userProviderInternet == 97 || this.userProviderInternet == 99 ){
        //this.leftContentDiv.innerHTML += '<a href="'+this.path+'pdf/static/Internetvertrag.pdf" class="downloadlink" target="_blank" id="linkInternet" onclick="trackLink(\'Kündigung Internetvertrag ('+this.provider[this.userProviderInternet]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung Internet (PDF)</a>';
		div.innerHTML += '<div class="downloadRow"><div class="downloadTitle">Kündigung Internet (PDF)</div><div class="downloadDate">&nbsp;</div><div class="downloadFilesize">&nbsp;</div><div class="downloadLink"><a target="_blank" href="'+this.path+'pdf/static/Internetvertrag.pdf" id="linkInternet"><img alt="Download" src="'+this.imagePath+'btn_download.gif"></a></div></div><div class="downloadSeparator"></div>';
      }
      else if(this.userProviderInternet > 7){
        //this.leftContentDiv.innerHTML += '<a href="'+this.path+'pdf/kuendigung.php?adresse='+this.userProviderInternet+'&typ=1" class="downloadlink" target="_blank" id="linkInternet" onclick="trackLink(\'Kündigung Internetvertrag ('+this.provider[this.userProviderInternet]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung Internet (PDF)</a>';
		div.innerHTML += '<div class="downloadRow"><div class="downloadTitle">Kündigung Internet (PDF)</div><div class="downloadDate">&nbsp;</div><div class="downloadFilesize">&nbsp;</div><div class="downloadLink"><a target="_blank" href="'+this.path+'pdf/kuendigung.php?adresse='+this.userProviderInternet+'&typ=1" id="linkInternet"><img alt="Download" src="'+this.imagePath+'btn_download.gif"></a></div></div><div class="downloadSeparator"></div>';
      }
      else
        //this.leftContentDiv.innerHTML += '<a href="'+this.path+'pdf/static/'+this.provider[this.userProviderInternet]+' - Internetvertrag.pdf" class="downloadlink" target="_blank" id="linkInternet" onclick="trackLink(\'Kündigung Internetvertrag ('+this.provider[this.userProviderInternet]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung Internet (PDF)</a>';
		div.innerHTML += '<div class="downloadRow"><div class="downloadTitle">Kündigung Internet (PDF)</div><div class="downloadDate">&nbsp;</div><div class="downloadFilesize">&nbsp;</div><div class="downloadLink"><a target="_blank" href="'+this.path+'pdf/static/'+this.provider[this.userProviderInternet]+' - Internetvertrag.pdf" id="linkInternet"><img alt="Download" src="'+this.imagePath+'btn_download.gif"></a></div></div><div class="downloadSeparator"></div>';
    }
    
    /*** Phone und Internet, keine Rufnummermitnahme und Internet == Phone ***/
    if(this.userPhoneNumber == 2 && (this.userProviderInternet == this.userProviderPhone)){
      if(this.userProviderPhone == 56 || this.userProviderPhone == 97 || this.userProviderPhone == 99){
        //this.leftContentDiv.innerHTML += '<a href="'+this.path+'pdf/static/Telefon- und Internetvertrag.pdf" class="downloadlink" target="_blank" id="linkInternet" onclick="trackLink(\'Kündigung Telefon- und Internetvertrag ('+this.provider[this.userProviderPhone]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung (PDF)</a>';
		div.innerHTML += '<div class="downloadRow"><div class="downloadTitle">Kündigung Telefon und Internet (PDF)</div><div class="downloadDate">&nbsp;</div><div class="downloadFilesize">&nbsp;</div><div class="downloadLink"><a target="_blank" href="'+this.path+'pdf/static/Telefon- und Internetvertrag.pdf" id="linkInternet"><img alt="Download" src="'+this.imagePath+'btn_download.gif"></a></div></div><div class="downloadSeparator"></div>';
      }
      else if(this.userProviderPhone > 7){
        //this.leftContentDiv.innerHTML += '<a href="'+this.path+'pdf/kuendigung.php?adresse='+this.userProviderPhone+'&typ=3" class="downloadlink" target="_blank" id="linkPhone" onclick="trackLink(\'Kündigung Telefon- und Internetvertrag  ('+this.provider[this.userProviderPhone]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung (PDF)</a>';
		div.innerHTML += '<div class="downloadRow"><div class="downloadTitle">Kündigung Telefon und Internet (PDF)</div><div class="downloadDate">&nbsp;</div><div class="downloadFilesize">&nbsp;</div><div class="downloadLink"><a target="_blank" href="'+this.path+'pdf/kuendigung.php?adresse='+this.userProviderPhone+'&typ=3" id="linkPhone"><img alt="Download" src="'+this.imagePath+'btn_download.gif"></a></div></div><div class="downloadSeparator"></div>';
      }
      else{
        //this.leftContentDiv.innerHTML += '<a href="'+this.path+'pdf/static/'+this.provider[this.userProviderPhone]+' - Telefon- und Internetvertrag.pdf" class="downloadlink" target="_blank" id="linkPhone" onclick="trackLink(\'Kündigung Telefon- und Internetvertrag ('+this.provider[this.userProviderPhone]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung (PDF)</a>';
		div.innerHTML += '<div class="downloadRow"><div class="downloadTitle">Kündigung Telefon und Internet (PDF)</div><div class="downloadDate">&nbsp;</div><div class="downloadFilesize">&nbsp;</div><div class="downloadLink"><a target="_blank" href="'+this.path+'pdf/static/'+this.provider[this.userProviderPhone]+' - Telefon- und Internetvertrag.pdf" id="linkPhone"><img alt="Download" src="'+this.imagePath+'btn_download.gif"></a></div></div><div class="downloadSeparator"></div>';
        }
      
      /*if(this.userProviderPhone == 4){
        alert("Telekom: Extra Text!");
        this.writeContent(this.container, 40);
      }*/
    }
    
    /*** Phone, keine Rufnummermitnahme ***/
    else if(this.userPhoneNumber == 2){
      if(this.userProviderPhone == 56 || this.userProviderPhone == 97 || this.userProviderPhone == 99){
        //this.leftContentDiv.innerHTML += '<a href="'+this.path+'pdf/static/Telefonvertrag.pdf" class="downloadlink" target="_blank" id="linkPhone" onclick="trackLink(\'Kündigung Telefonvertrag ('+this.provider[this.userProviderPhone]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung Telefon (PDF)</a>';
		div.innerHTML += '<div class="downloadRow"><div class="downloadTitle">Kündigung Telefon (PDF)</div><div class="downloadDate">&nbsp;</div><div class="downloadFilesize">&nbsp;</div><div class="downloadLink"><a target="_blank" href="'+this.path+'pdf/static/Telefonvertrag.pdf" id="linkPhone"><img alt="Download" src="'+this.imagePath+'btn_download.gif"></a></div></div><div class="downloadSeparator"></div>';
      }
      else if(this.userProviderPhone > 7)
        //this.leftContentDiv.innerHTML += '<a href="'+this.path+'pdf/kuendigung.php?adresse='+this.userProviderPhone+'&typ=2" class="downloadlink" target="_blank" id="linkPhone" onclick="trackLink(\'Kündigung Telefonvertrag ('+this.provider[this.userProviderPhone]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung Telefon (PDF)</a>';
		div.innerHTML += '<div class="downloadRow"><div class="downloadTitle">Kündigung Telefon (PDF)</div><div class="downloadDate">&nbsp;</div><div class="downloadFilesize">&nbsp;</div><div class="downloadLink"><a target="_blank" href="'+this.path+'pdf/kuendigung.php?adresse='+this.userProviderPhone+'&typ=2" id="linkPhone"><img alt="Download" src="'+this.imagePath+'btn_download.gif"></a></div></div><div class="downloadSeparator"></div>';
      else
        //this.leftContentDiv.innerHTML += '<a href="'+this.path+'pdf/static/'+this.provider[this.userProviderPhone]+' - Telefonvertrag.pdf" class="downloadlink" target="_blank" id="linkPhone" onclick="trackLink(\'Kündigung Telefonvertrag ('+this.provider[this.userProviderPhone]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung Telefon (PDF)</a>';
		div.innerHTML += '<div class="downloadRow"><div class="downloadTitle">Kündigung Telefon (PDF)</div><div class="downloadDate">&nbsp;</div><div class="downloadFilesize">&nbsp;</div><div class="downloadLink"><a target="_blank" href="'+this.path+'pdf/static/'+this.provider[this.userProviderPhone]+' - Telefonvertrag.pdf" id="linkPhone"><img alt="Download" src="'+this.imagePath+'btn_download.gif"></a></div></div><div class="downloadSeparator"></div>';
    }
    
    /*** 2 Verträge ***/
    else if(this.userContractNumber == 2){ //Wenn 2 Verträge
      if(this.userProviderPhone == 56 || this.userProviderPhone == 97 || this.userProviderPhone == 99){
        //this.leftContentDiv.innerHTML += '<a href="'+this.path+'pdf/static/Internetvertrag.pdf" class="downloadlink" target="_blank" id="linkInternet" onclick="trackLink(\'Kündigung Internetvertrag ('+this.provider[this.userProviderInternet]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung Internet (PDF)</a>';
		div.innerHTML += '<div class="downloadRow"><div class="downloadTitle">Kündigung Internet (PDF)</div><div class="downloadDate">&nbsp;</div><div class="downloadFilesize">&nbsp;</div><div class="downloadLink"><a target="_blank" href="'+this.path+'pdf/static/Internetvertrag.pdf" id="linkInternet"><img alt="Download" src="'+this.imagePath+'btn_download.gif"></a></div></div><div class="downloadSeparator"></div>';
      }
      else if(this.userProviderInternet > 7){
        //this.leftContentDiv.innerHTML += '<a href="'+this.path+'pdf/kuendigung.php?adresse='+this.userProviderInternet+'&typ=1" class="downloadlink" target="_blank" id="linkInternet" onclick="trackLink(\'Kündigung Internetvertrag ('+this.provider[this.userProviderInternet]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung Internet (PDF)</a>';
		div.innerHTML += '<div class="downloadRow"><div class="downloadTitle">Kündigung Internet (PDF)</div><div class="downloadDate">&nbsp;</div><div class="downloadFilesize">&nbsp;</div><div class="downloadLink"><a target="_blank" href="'+this.path+'pdf/kuendigung.php?adresse='+this.userProviderInternet+'&typ=1" id="linkInternet"><img alt="Download" src="'+this.imagePath+'btn_download.gif"></a></div></div><div class="downloadSeparator"></div>';
      }
      else{
        //this.leftContentDiv.innerHTML += '<a href="'+this.path+'pdf/static/'+this.provider[this.userProviderInternet]+' - Internetvertrag.pdf" class="downloadlink" target="_blank" id="linkInternet" onclick="trackLink(\'Kündigung Internetvertrag ('+this.provider[this.userProviderInternet]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung Internet (PDF)</a>';
		div.innerHTML += '<div class="downloadRow"><div class="downloadTitle">Kündigung Internet (PDF)</div><div class="downloadDate">&nbsp;</div><div class="downloadFilesize">&nbsp;</div><div class="downloadLink"><a target="_blank" href="'+this.path+'pdf/static/'+this.provider[this.userProviderInternet]+' - Internetvertrag.pdf" id="linkInternet"><img alt="Download" src="'+this.imagePath+'btn_download.gif"></a></div></div><div class="downloadSeparator"></div>';
      }
    }
    
    if(id == '9'){ //Kabel Phone
      //this.leftContentDiv.innerHTML += '<a href="'+this.path+'pdf/static/checkliste_01.pdf" class="downloadlink" target="_blank" onclick="trackLink(\'Checkliste 1\', \'Teaser Content: FT: Wechselberater\')">Die nächsten Schritte (PDF)</a>';
	  div.innerHTML += '<div class="downloadRow"><div class="downloadTitle">Checkliste (PDF)</div><div class="downloadDate">&nbsp;</div><div class="downloadFilesize">&nbsp;</div><div class="downloadLink"><a target="_blank" href="'+this.path+'pdf/static/checkliste_01.pdf"><img alt="Download" src="'+this.imagePath+'btn_download.gif"></a></div></div><div class="downloadSeparator"></div>';
    }
    
    if(id == '20'){ //Kabel Phone und Internet, Internet & Telefon, gleiche Anbieter
      //this.leftContentDiv.innerHTML += '<a href="'+this.path+'pdf/static/checkliste_02.pdf" class="downloadlink" target="_blank" onclick="trackLink(\'Checkliste 2\', \'Teaser Content: FT: Wechselberater\')">Die nächsten Schritte (PDF)</a>';
	  div.innerHTML += '<div class="downloadRow"><div class="downloadTitle">Checkliste (PDF)</div><div class="downloadDate">&nbsp;</div><div class="downloadFilesize">&nbsp;</div><div class="downloadLink"><a target="_blank" href="'+this.path+'pdf/static/checkliste_02.pdf"><img alt="Download" src="'+this.imagePath+'btn_download.gif"></a></div></div><div class="downloadSeparator"></div>';
    }
    
    if(id == '23'){ //Kabel Phone und Internet, Internet & Telefon, verschiedene Anbieter
      //this.leftContentDiv.innerHTML += '<a href="'+this.path+'pdf/static/checkliste_03.pdf" class="downloadlink" target="_blank" onclick="trackLink(\'Checkliste 2\', \'Teaser Content: FT: Wechselberater\')">Die nächsten Schritte (PDF)</a>';
	  div.innerHTML += '<div class="downloadRow"><div class="downloadTitle">Checkliste (PDF)</div><div class="downloadDate">&nbsp;</div><div class="downloadFilesize">&nbsp;</div><div class="downloadLink"><a target="_blank" href="'+this.path+'pdf/static/checkliste_03.pdf"><img alt="Download" src="'+this.imagePath+'btn_download.gif"></a></div></div><div class="downloadSeparator"></div>';
    }
    if(id == '30'){ //Kabel Phone und Internet, Telefon
      //this.leftContentDiv.innerHTML += '<a href="'+this.path+'pdf/static/checkliste_04.pdf" class="downloadlink" target="_blank" onclick="trackLink(\'Checkliste 3\', \'Teaser Content: FT: Wechselberater\')">Die nächsten Schritte (PDF)</a>';
	  div.innerHTML += '<div class="downloadRow"><div class="downloadTitle">Checkliste (PDF)</div><div class="downloadDate">&nbsp;</div><div class="downloadFilesize">&nbsp;</div><div class="downloadLink"><a target="_blank" href="'+this.path+'pdf/static/checkliste_04.pdf"><img alt="Download" src="'+this.imagePath+'btn_download.gif"></a></div></div><div class="downloadSeparator"></div>';
    }
    
    div.innerHTML += '</div>';
    
    
    this.container.appendChild(div);
	this.writeSeperator(this.container);


}














Wechseltool.prototype.writeLeftContentDiv = function(id){ //Write LeftBox in step 3
    this.leftContentDiv = document.createElement("div");
    this.leftContentDiv.setAttribute("id", this.leftContentDivName);
    
    this.leftContentDiv.innerHTML = 
    '<div class="headlineLeft" style="padding-top:12px; padding-bottom:2px;">Ihre Angaben</div>' +
    '<div class="miniseparator"></div>' +
    '<div class="headlineLeft">Gewünschtes Produkt:</div>' +
    '<div class="lefttext" style="margin-bottom:0px;">' + this.products[this.userProduct] + '</div>';
    
    if(this.userProviderInternet != null){
      this.leftContentDiv.innerHTML += 
      '<div class="headlineLeft">Internetanschluss:</div>' +
      '<div class="lefttext fix">' + this.provider[this.userProviderInternet] + '</div>';
    }
    
    if(this.userProviderPhone != null){
      this.leftContentDiv.innerHTML += 
      '<div class="headlineLeft">Telefonanschluss:</div>' +
      '<div class="lefttext fix">' + this.provider[this.userProviderPhone] + '</div>';
    }
    
    if(this.userPhoneNumber != null){
      this.leftContentDiv.innerHTML += 
      '<div class="headlineLeft">Rufnummernmitnahme:</div>' +
      '<div class="lefttext fix">' + this.yesNo[this.userPhoneNumber] + '</div>';
    }
    
    if(id != '14'){
      this.leftContentDiv.innerHTML += 
      '<div class="miniseparator" style="margin-top:4px;"></div>' +
      '<div class="headlineLeft">Downloads</div>' +
      '<div class="miniseparator"></div>' +
      '<div class="downloads">';
    }
    
    
    /*** Internet, Internet != Phone ***/
    if(this.userProviderInternet != null && (this.userProviderInternet != this.userProviderPhone)){
      if(this.userProviderInternet == 56 || this.userProviderInternet == 97 || this.userProviderInternet == 99 ){
        this.leftContentDiv.innerHTML += 
      '<a href="'+this.path+'pdf/static/Internetvertrag.pdf" class="downloadlink" target="_blank" id="linkInternet" onclick="trackLink(\'Kündigung Internetvertrag ('+this.provider[this.userProviderInternet]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung Internet (PDF)</a>';
      }
      else if(this.userProviderInternet > 7){
        this.leftContentDiv.innerHTML += 
      '<a href="'+this.path+'pdf/kuendigung.php?adresse='+this.userProviderInternet+'&typ=1" class="downloadlink" target="_blank" id="linkInternet" onclick="trackLink(\'Kündigung Internetvertrag ('+this.provider[this.userProviderInternet]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung Internet (PDF)</a>';
      }
      else
        this.leftContentDiv.innerHTML += 
      '<a href="'+this.path+'pdf/static/'+this.provider[this.userProviderInternet]+' - Internetvertrag.pdf" class="downloadlink" target="_blank" id="linkInternet" onclick="trackLink(\'Kündigung Internetvertrag ('+this.provider[this.userProviderInternet]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung Internet (PDF)</a>';
    }
    
    /*** Phone und Internet, keine Rufnummermitnahme und Internet == Phone ***/
    if(this.userPhoneNumber == 2 && (this.userProviderInternet == this.userProviderPhone)){
      if(this.userProviderPhone == 56 || this.userProviderPhone == 97 || this.userProviderPhone == 99){
        this.leftContentDiv.innerHTML += 
      '<a href="'+this.path+'pdf/static/Telefon- und Internetvertrag.pdf" class="downloadlink" target="_blank" id="linkInternet" onclick="trackLink(\'Kündigung Telefon- und Internetvertrag ('+this.provider[this.userProviderPhone]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung (PDF)</a>';
      }
      else if(this.userProviderPhone > 7){
        this.leftContentDiv.innerHTML += 
      '<a href="'+this.path+'pdf/kuendigung.php?adresse='+this.userProviderPhone+'&typ=3" class="downloadlink" target="_blank" id="linkPhone" onclick="trackLink(\'Kündigung Telefon- und Internetvertrag  ('+this.provider[this.userProviderPhone]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung (PDF)</a>';
      }
      else{
        this.leftContentDiv.innerHTML += 
        '<a href="'+this.path+'pdf/static/'+this.provider[this.userProviderPhone]+' - Telefon- und Internetvertrag.pdf" class="downloadlink" target="_blank" id="linkPhone" onclick="trackLink(\'Kündigung Telefon- und Internetvertrag ('+this.provider[this.userProviderPhone]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung (PDF)</a>';
        }
      
      /*if(this.userProviderPhone == 4){
        alert("Telekom: Extra Text!");
        this.writeContent(this.container, 40);
      }*/
    }
    
    /*** Phone, keine Rufnummermitnahme ***/
    else if(this.userPhoneNumber == 2){
      if(this.userProviderPhone == 56 || this.userProviderPhone == 97 || this.userProviderPhone == 99){
        this.leftContentDiv.innerHTML += 
      '<a href="'+this.path+'pdf/static/Telefonvertrag.pdf" class="downloadlink" target="_blank" id="linkPhone" onclick="trackLink(\'Kündigung Telefonvertrag ('+this.provider[this.userProviderPhone]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung Telefon (PDF)</a>';
      }
      else if(this.userProviderPhone > 7)
        this.leftContentDiv.innerHTML += 
      '<a href="'+this.path+'pdf/kuendigung.php?adresse='+this.userProviderPhone+'&typ=2" class="downloadlink" target="_blank" id="linkPhone" onclick="trackLink(\'Kündigung Telefonvertrag ('+this.provider[this.userProviderPhone]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung Telefon (PDF)</a>';
      else
        this.leftContentDiv.innerHTML += 
        '<a href="'+this.path+'pdf/static/'+this.provider[this.userProviderPhone]+' - Telefonvertrag.pdf" class="downloadlink" target="_blank" id="linkPhone" onclick="trackLink(\'Kündigung Telefonvertrag ('+this.provider[this.userProviderPhone]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung Telefon (PDF)</a>';
    }
    
    /*** 2 Verträge ***/
    else if(this.userContractNumber == 2){ //Wenn 2 Verträge
      if(this.userProviderPhone == 56 || this.userProviderPhone == 97 || this.userProviderPhone == 99){
        this.leftContentDiv.innerHTML += 
      '<a href="'+this.path+'pdf/static/Internetvertrag.pdf" class="downloadlink" target="_blank" id="linkInternet" onclick="trackLink(\'Kündigung Internetvertrag ('+this.provider[this.userProviderInternet]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung Internet (PDF)</a>';
      }
      else if(this.userProviderInternet > 7){
        this.leftContentDiv.innerHTML += 
      '<a href="'+this.path+'pdf/kuendigung.php?adresse='+this.userProviderInternet+'&typ=1" class="downloadlink" target="_blank" id="linkInternet" onclick="trackLink(\'Kündigung Internetvertrag ('+this.provider[this.userProviderInternet]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung Internet (PDF)</a>';
      }
      else{
        this.leftContentDiv.innerHTML += 
      '<a href="'+this.path+'pdf/static/'+this.provider[this.userProviderInternet]+' - Internetvertrag.pdf" class="downloadlink" target="_blank" id="linkInternet" onclick="trackLink(\'Kündigung Internetvertrag ('+this.provider[this.userProviderInternet]+')\', \'Teaser Content: FT: Wechselberater\')">Kündigung Internet (PDF)</a>';
      }
    }
    
    if(id == '9'){ //Kabel Phone
      this.leftContentDiv.innerHTML += 
      '<a href="'+this.path+'pdf/static/checkliste_01.pdf" class="downloadlink" target="_blank" onclick="trackLink(\'Checkliste 1\', \'Teaser Content: FT: Wechselberater\')">Die nächsten Schritte (PDF)</a>';
    }
    
    if(id == '20'){ //Kabel Phone und Internet, Internet & Telefon, gleiche Anbieter
      this.leftContentDiv.innerHTML += 
      '<a href="'+this.path+'pdf/static/checkliste_02.pdf" class="downloadlink" target="_blank" onclick="trackLink(\'Checkliste 2\', \'Teaser Content: FT: Wechselberater\')">Die nächsten Schritte (PDF)</a>';
    }
    
    if(id == '23'){ //Kabel Phone und Internet, Internet & Telefon, verschiedene Anbieter
      this.leftContentDiv.innerHTML += 
      '<a href="'+this.path+'pdf/static/checkliste_03.pdf" class="downloadlink" target="_blank" onclick="trackLink(\'Checkliste 2\', \'Teaser Content: FT: Wechselberater\')">Die nächsten Schritte (PDF)</a>';
    }
    if(id == '30'){ //Kabel Phone und Internet, Telefon
      this.leftContentDiv.innerHTML += 
      '<a href="'+this.path+'pdf/static/checkliste_04.pdf" class="downloadlink" target="_blank" onclick="trackLink(\'Checkliste 3\', \'Teaser Content: FT: Wechselberater\')">Die nächsten Schritte (PDF)</a>';
    }
    
    this.leftContentDiv.innerHTML += '</div>';
    
    
    this.leftContainer.appendChild(this.leftContentDiv);
}

Wechseltool.prototype.writeContainer = function(page){
    this.container = document.createElement("div");
    this.container.setAttribute("id", this.containerName);

    this.container.style.height = this.contentHeight[page];
    //this.container.setAttribute("style", "height:"+(this.imageImage.height-20)+"px;");
    
    this.rootContainer.appendChild(this.container);
}

Wechseltool.prototype.writeImage = function(act){
    this.image = document.createElement("div");
    this.image.setAttribute("id", this.imageName);
    this.imageImage = document.createElement("img");
    this.imageImage.setAttribute("src", this.imagePath+this.imageName+act+this.imageImageEnding);
    
    if(act == 2){
      var imageHeight = this.contentHeight[act].split('px');
      this.imageImage.setAttribute("height", imageHeight[0]); //New
    }
    
    this.image.appendChild(this.imageImage);
    this.leftContainer.appendChild(this.image);
}

Wechseltool.prototype.writeContent = function(actContainer, text){
    //alert(text);
    
    text -= 1;
    data = this.xmlData;
    data = data.getElementsByTagName("page");
    var div = document.createElement("div");
    div.setAttribute("id", "textStep"+this.page);
	
    div.innerHTML = data[text].firstChild.nodeValue;
    actContainer.appendChild(div);
    
    this.writeLogic(text+1);
	
	if(data[text].getAttribute("linkName") != "Weiter zu Step03")
		this.writeSeperator(this.container);
    
    if(data[text].getAttribute("pid") != 0){
      var onclick = "wechseltool.write('"+data[text].getAttribute("pid")+"', '"+data[text].getAttribute("link")+"');";
      
      if(data[text].getAttribute("linkName") != "")
        onclick = "trackLink('"+data[text].getAttribute("linkName")+"','"+this.prop3+"');"+onclick;
      
      this.writeButton(onclick);
    }
      
      
    if(text > 1 && this.backButton == null){
      this.writeEditButton();
    }
    
}

Wechseltool.prototype.writeButton = function(onclick){
    this.button = document.createElement("div");
    this.button.setAttribute("id", this.buttonName);
    this.buttonImage = document.createElement("img");
    this.buttonImage.setAttribute("src", this.imagePath+this.buttonImageSrc);
    this.button.onclick = function(){
        eval(onclick);
    }
    this.button.appendChild(this.buttonImage);
    this.rootContainer.appendChild(this.button);
}

Wechseltool.prototype.writeButton2 = function(){
    this.button2 = document.createElement("div");
    this.button2.setAttribute("id", this.button2Name);
    
    var link = document.createElement("a");
    if(this.userProduct == '2')
      link.setAttribute("href", "/internet-telefon/telefontarif.html");
    else
      link.setAttribute("href", "/internet-telefon/internet-und-telefon-angebote.html");
      
    link.onclick = function(){
        trackLink('Zur Tarifübersicht', wechseltool.prop3);
    }  
    
    this.button2.appendChild(link);
    
    this.button2Image = document.createElement("img");
    this.button2Image.setAttribute("src", this.imagePath+this.button2ImageSrc);
    
    link.appendChild(this.button2Image);
    
    this.rootContainer.appendChild(this.button2);
}

Wechseltool.prototype.writeEditButton = function(){
	if(this.editButton != null) return 0;
    this.editButton = document.createElement("div");
    this.editButton.setAttribute("id", this.editButtonName);
    this.editButtonImage = document.createElement("img");
    this.editButtonImage.setAttribute("src", this.imagePath+this.editButtonImageSrc);
    this.editButton.onclick = function(){
        wechseltool.editButton = null;
        wechseltool.backButton = null;
        wechseltool.userProduct = null;
        wechseltool.userProviderInternet = null;
        wechseltool.userProviderPhone = null;
        wechseltool.userPhoneNumber = null;
        wechseltool.userContractNumber = null;
        wechseltool.write(2, 2);
    }
    this.editButton.appendChild(this.editButtonImage);
    this.rootContainer.appendChild(this.editButton);
}

Wechseltool.prototype.writeBackButton = function(){
    this.backButton = document.createElement("div");
    this.backButton.setAttribute("id", this.backButtonName);
    this.backButtonImage = document.createElement("img");
    this.backButtonImage.setAttribute("src", this.imagePath+this.backButtonImageSrc);
    this.backButton.onclick = function(){
        wechseltool.editButton = null;
        wechseltool.backButton = null;
        wechseltool.userProduct = null;
        wechseltool.userProviderInternet = null;
        wechseltool.userProviderPhone = null;
        wechseltool.userPhoneNumber = null;
        wechseltool.userContractNumber = null;
        wechseltool.write(2, 2);
    }
    this.backButton.appendChild(this.backButtonImage);
    this.rootContainer.appendChild(this.backButton);
}

Wechseltool.prototype.writeLogic = function(pageno){
    switch (pageno){
        case 2:
            this.writeChoseProduct();
            break;
        case 3:
            this.writeChoseProvider("Internet");
            break;
        case 6:
            this.writeYesNo("writeChosenPhone");
            break;
        case 7:
            this.writeYesNo("writeChosenPhoneNumber");
            break;
        case 10:
            this.writeChoseProvider("Phone");
            break;
        case 15:
          this.writeChoseMyContract();
          break;
        case 16:
          this.writeYesNo("writeChosenPINumber");
          break;
        case 17:
            this.writeChoseProvider("PhoneInternet1_2");
            break;        
        case 18:
            this.writeChoseProvider("PhoneInternet1_1");
            break;
        case 24:
            this.writeChoseProvider("PhoneInternet2_2");
            break;    
        case 25:
            this.writeChoseProvider("PhoneInternet2_1");
            break;
        case 28:
            this.writeYesNo("writeChosenPIPhone");
            break;
        case 32:
            this.writeChoseProvider("PhoneInternet3_1");
            break;    
        case 35:
            this.writeChoseProvider("PhoneInternet4_1");
            break;
        case 40:
            this.writeNumberOfContracts();
            break;            
    }
}
Wechseltool.prototype.writeChoseProduct = function(){
    var div = document.createElement("div");
    div.setAttribute("id", "select");
    var select = document.createElement("select");
    select.onchange = function(){
        wechseltool.writeChosenProduct(this.selectedIndex);
        this.disabled = "disabled";
    }
    var option;
    for(i=0;i<this.products.length;i++){
        option = document.createElement("option");
        option.setAttribute("id", i);
        option.innerHTML = this.products[i];
        select.appendChild(option);
    }
    div.appendChild(select);
    this.container.appendChild(div);
}

Wechseltool.prototype.writeChosenProduct = function(chosenItem){
    this.userProduct = chosenItem;

    switch(chosenItem){
        case 1: //Kabel Internet & Kabel Phone
            this.writeContent(this.container, '15');
            break;
        case 2: //Kabel Internet
            this.writeContent(this.container, '3');
            break;
        case 3: //Kabel Phone
            this.writeContent(this.container, '6');
            break;
    }
}

Wechseltool.prototype.writeChoseProvider = function(type){
    var div = document.createElement("div");
    div.setAttribute("id", "select");
    var select = document.createElement("select");
    select.onchange = function(){
        wechseltool.writeChosenProvider(this.selectedIndex, type);
        this.disabled = "disabled";
    }
    var option;
    for(i=0;i<this.provider.length;i++){
        option = document.createElement("option");
        option.setAttribute("id", i);
        if(this.provider[i] == "------------------------------------------------------------------------------------------------")
          option.setAttribute("disabled", "disabled");
        option.innerHTML = this.provider[i];
        select.appendChild(option);
    }
    div.appendChild(select);
    this.container.appendChild(div);
}
Wechseltool.prototype.writeChosenProvider = function(chosenItem, type){
    this.chosenProvider = chosenItem;
    switch(chosenItem){
        case 1: //1&1
            break;
        case 2: //Alice
            break;
        case 3: //AOL
            break;
    }
    
    if(type == "Internet"){
      this.writeContent(this.container, '4');
      this.userProviderInternet = chosenItem;
    }
    else if(type == "Phone"){
      this.writeContent(this.container, '11');
      this.userProviderPhone = chosenItem;
    }
    else if(type == "PhoneInternet1_1"){
      this.userProviderInternet = chosenItem;
      if(this.userProviderInternet == 4 && this.userProviderPhone == 4 || this.userProviderInternet == 97 && this.userProviderPhone == 97) //Telekom und Telekom oder T-Com und T-Com
        this.writeContent(this.container, '40');
      else
        this.writeContent(this.container, '19');
      
    }
    else if(type == "PhoneInternet1_2"){
      this.writeContent(this.container, '18');
      this.userProviderPhone = chosenItem; 
    }
    else if(type == "PhoneInternet2_1"){
      this.userProviderInternet = chosenItem;
      this.writeContent(this.container, '26');
      
    }
    else if(type == "PhoneInternet2_2"){
      this.writeContent(this.container, '25');
      this.userProviderPhone = chosenItem; 
    }
    else if(type == "PhoneInternet3_1"){
      this.writeContent(this.container, '33');
      this.userProviderPhone = chosenItem;
    }
    else if(type == "PhoneInternet4_1"){
      this.writeContent(this.container, '36');
      this.userProviderInternet = chosenItem; 
    }
}

Wechseltool.prototype.writeYesNo = function(submitFunc){
    var div = document.createElement("div");
    div.setAttribute("id", "select");
    var select = document.createElement("select");
    select.onchange = function(){
        eval("wechseltool."+submitFunc+"(this.selectedIndex)");
        this.disabled = "disabled";
    }
    var option;
    for(i=0;i<this.yesNo.length;i++){
        option = document.createElement("option");
        option.setAttribute("id", i);
        option.innerHTML = this.yesNo[i];
        select.appendChild(option);
    }
    div.appendChild(select);
    this.container.appendChild(div);
}

Wechseltool.prototype.writeChosenPhone = function(chosenItem){
    this.chosenProvider = chosenItem;
    switch(chosenItem){
        case 1: //Yes
            this.writeContent(this.container, '7');
            break;
        case 2: //No
            this.writeContent(this.container, '13');
            break;
    }
    
}

Wechseltool.prototype.writeChosenPhoneNumber = function(chosenItem){
    this.chosenProvider = chosenItem;
    switch(chosenItem){
        case 1: //Yes
            this.writeContent(this.container, '8');
            this.userPhoneNumber = 1;
            break;
        case 2: //No
            this.writeContent(this.container, '10');
            this.userPhoneNumber = 2;
            break;
    }  
}

Wechseltool.prototype.writeChoseMyContract = function(){
    var div = document.createElement("div");
    div.setAttribute("id", "select");
    var select = document.createElement("select");
    select.onchange = function(){
        wechseltool.writeChosenMyContract(this.selectedIndex);
        this.disabled = "disabled";
    }
    var option;
    for(i=0;i<this.myContracts.length;i++){
        option = document.createElement("option");
        option.setAttribute("id", i);
        option.innerHTML = this.myContracts[i];
        select.appendChild(option);
    }
    div.appendChild(select);
    this.container.appendChild(div);
}

Wechseltool.prototype.writeChosenMyContract = function(chosenItem){
    this.chosenProvider = chosenItem;
    switch(chosenItem){
        case 1: //Yes Phone & Internet
            this.writeContent(this.container, '16');
            break;
        case 2: //Yes Phone
            this.writeContent(this.container, '28');
            break;
        case 3: //Yes Internet
            this.writeContent(this.container, '35');
            break;
        case 4: //No
            this.writeContent(this.container, '38');
            break;
    }  
}

Wechseltool.prototype.writeChosenPINumber = function(chosenItem){
    this.chosenProvider = chosenItem;
    switch(chosenItem){
        case 1: //Yes
            this.writeContent(this.container, '17');
            this.userPhoneNumber = 1;
            break;
        case 2: //No
            this.writeContent(this.container, '24');
            this.userPhoneNumber = 2;
            break;
    }  
}

Wechseltool.prototype.writeChosenPIPhone = function(chosenItem){
    this.chosenProvider = chosenItem;
    switch(chosenItem){
        case 1: //Yes
            this.writeContent(this.container, '29');
            this.userPhoneNumber = 1;
            break;
        case 2: //No
            this.writeContent(this.container, '32');
            this.userPhoneNumber = 2;
            break;
    }  
}
Wechseltool.prototype.writeNumberOfContracts = function(){
    var div = document.createElement("div");
    div.setAttribute("id", "select");
    var select = document.createElement("select");
    select.onchange = function(){
        wechseltool.writeChosenNumberOfContracts(this.selectedIndex);
        this.disabled = "disabled";
    }
    var option;
    for(i=0;i<this.numberOfContracts.length;i++){
        option = document.createElement("option");
        option.setAttribute("id", i);
        option.innerHTML = this.numberOfContracts[i];
        select.appendChild(option);
    }
    div.appendChild(select);
    this.container.appendChild(div);
}

Wechseltool.prototype.writeChosenNumberOfContracts = function(chosenItem){
    this.chosenNumberOfContracts = chosenItem;
    switch(chosenItem){
        case 1: //1 Vertrag
            this.writeContent(this.container, '19');
            this.userContractNumber = 1;
            break;
        case 2: //2 Verträge
            this.writeContent(this.container, '41');
            this.userContractNumber = 2;
            break;
    } 
}

Wechseltool.prototype.rewriteVLinks = function(){
  if(document.getElementById("linkInternet") && document.getElementById("vlinkInternet")){
    document.getElementById("vlinkInternet").href = document.getElementById("linkInternet").href;
    document.getElementById("vlinkInternet").onclick = document.getElementById("linkInternet").onclick;
  }
  else if(document.getElementById("linkPhone") && document.getElementById("vlinkInternet")){
    document.getElementById("vlinkInternet").href = document.getElementById("linkPhone").href;
    document.getElementById("vlinkInternet").onclick = document.getElementById("linkPhone").onclick;
  }
  
  if(document.getElementById("linkPhone") && document.getElementById("vlinkPhone")){
    document.getElementById("vlinkPhone").href = document.getElementById("linkPhone").href;
    document.getElementById("vlinkPhone").onclick = document.getElementById("linkPhone").onclick;
  }

}

Wechseltool.prototype.start = function (){
    var http = null;
    if (window.XMLHttpRequest) {
        http = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        http = new ActiveXObject("Microsoft.XMLHTTP");
    }

    if (http != null) {
        http.open("GET", this.xmlPath, true);

        http.onreadystatechange = function(){
            if (http.readyState == 4) {
                wechseltool.xmlData = http.responseXML;
                wechseltool.write(2, 2);
                
            }
        };
        http.send(null);
   }
}