 /* ********************************************************************** */        /* *********************** FOR PRICE-ADMINS : *************************** */        /* ********************************************************************** */                // ID OF THE PHONE:        var PHONE_ID='1146';        // ID OF BASE-PRODUCT FLEX (0 Month)        var FLEX_TYPE_ID='212';        // ID OF BASE-PRODUCT KOMBI (24 Month)        var KOMBI_TYPE_ID='213';        // ID OF SMS100-OPTION        var SMS100_ID='252';        /* THE BASIC-PRICE MONTHLY: */         var price_monthly_basic = 0.09;        /* THE BASIC-PRICE ONCE */        var price_once_basic = 9.99;        /* THE PRICE FOR THE MOBILE WICH IS PAYED AT OPTION 'BUY' : */        var price_payonce = 249.99;        /* THE PRICE FOR THE MOBILE AT OPTION '5 EURO' : */        var price_pay5 = 119.99;        /* THE PRICE FOR THE MOBILE AT OPTION '10 EURO' : */        var price_pay10 = 1.00;        /* THE PRICE FOR THE SMS-100-OPTION: */        var price_sms100 = 9.99;        /* OPTION-STARTER : 24-Option / Null-Option   */        var startoption_24='24'; // value='24' or '0';        /* OPTION-STARTER : SMS100 */        var startoption_sms100=0; // value=0 (means no) or value=1 (means yes)        /* VALUE OF FOOTER-NOTE, DEPENDING ON HANDY-OPTION (5 / 10 / nothing) : Value 5.-Euro /Month: */        var footnote_option5='2';        /* VALUE OF FOOTER-NOTE, DEPENDING ON HANDY-OPTION (5 / 10 / nothing) : Value 10.-Euro /Month: */        var footnote_option10='3';        /* VALUE OF FOOTER-NOTE, DEPENDING ON HANDY-OPTION (5 / 10 / nothing) : Value 0.-E /Month: */        var footnote_optiononce='';        /* DESCRIPTION IN HANDY-OPTION, DEPENDING ON 24- OR 0-MONTH RUNTIME(once) (THIS VALUE: once). !!! BREAKS MADE BY '\n', NOT '<br>' !!! */        var descriptiontext_handyoption_once="Eine Handy-Option kann nur in Verbindung mit einem Mobilfunktarif mit 24 Monaten Laufzeit gebucht werden.";        /* DESCRIPTION IN HANDY-OPTION, DEPENDING ON 24- OR 0-MONTH RUNTIME(once) (THIS VALUE: 24). !!! BREAKS MADE BY '\n', NOT '<br>' !!! */        var descriptiontext_handyoption_24="Bestellen Sie Ihr Handy entweder zum Einmalpreis oder mit einer monatlichen Handy-Option";                        /* ********************************************************************** */        /* ****************   FOR PROGRAMMERS ONLY : **************************** */        /* ********************************************************************** */                        /* The tag-type, in which the total-prices are wrapped (eg. 'div' or 'span'): */        var price_wrap_type = "span";        /* The tag-ID  in which the total-prices is wrapped (eg. 'div' or 'span'): */        var price_wrap_id_monthly = "price_monthly";        /* The tag-ID  in which the once-prices is wrapped (eg. 'div' or 'span'): */        var price_wrap_id_once = "price_once";        /* The tag-type, in which the footernotes is wrapped (eg. 'div' or 'span'): */        var footernote_wrap_type = "sup";        /* The tag-ID  in which the footer-note is wrapped (eg. 'div' or 'span'): */        var footernote_priceonce_wrap_id = "footnoteonce";        /* The tag-type, in which the Handyoption-text is wrapped (eg. 'div' or 'span'): */        var descr_handyopt_wrap_type = "div";        /* The tag-ID  in which the footer-note is wrapped (eg. 'div' or 'span'): */        var descr_handyopt_wrap_id = "handybeschreibung";                /* ---------THE IMAGEPATH OF THE CHANGABLE DIV-BACKGROUNDS:-------- */        /* BACKGROUND RUNTIME ACTIVE (THE BULLET) */        var path_runtimeimage_background_active="/fileadmin/landingpages/images/Tarife_FullFlat/btn_option_act_orange.gif";		/* BACKGROUND RUNTIME INACTIVE (THE BULLET) */		var path_runtimeimage_background_inactive="/fileadmin/landingpages/images/Tarife_FullFlat/btn_option_in_orange.gif";		/* BACKGROUND SMSOPTION-100 ACTIVE */		var path_sms100_background_active="/fileadmin/landingpages/images/Tarife_FullFlat/SMS_Active.gif";		/* BACKGROUND SMSOPTION-100 INACTIVE */		var path_sms100_background_inactive="/fileadmin/landingpages/images/Tarife_FullFlat/SMS_Inative.gif";                /* STARTOPTIONEN BEIM LADEN DES SCRIPTS */        var smsopt_memory=0; 							// SMS-Option ist beim start NICHT angewaehlt (ansonsten: value 1 = angwaehlt!)        var runtime24_memory=1; 						// 24er-Option ist beim start angewaehlt!        var extra_option_memory='month10';				// ''=KEINE Zusatzoption gewaehlt / 'month10' = 10er-option  / 'month5'= 5er-option         var footnote_once_memory=footnote_option10;		// Fussnote-Einmalzahlung beim start (Wert der oben angegebenen Variablen)                                /* ********************************************************************** */        /* ******************* UP FROM HERE : DONT TOUCH !!!!! ****************** */        /* ********************************************************************** */                // var price_total_once=price_monthly_basic;        var price_total_monthly=price_monthly_basic;                var price_monthly_memory;        var price_once_memory;                     /*  formatZahl() - */     /* 'zahl' 	: Die Zahl, die formatiert werden soll   */     /* 'k' 	: (optional):Die Anzahl der Nachkommastellen auf die die Zahl gerundet werden soll (default: 0)  |      /* 'fix'	: bool (optional): Dieser Parameter bestimmt, ob die formatierte Zahl eine feste Anzahl von Nachkommastellen haben soll. Ist der Wert true, dann werden evtl. fehlende Stellen mit einer Null aufgeüllt.*/    function formatZahl(zahl, k, fix)     {        if(!k) k = 0;        var neu = '';        var dec_point = ',';        var thousands_sep = '.';        // Runden        var f = Math.pow(10, k);        zahl = '' + parseInt(zahl * f + (.5 * (zahl > 0 ? 1 : -1)) ) / f ;        // Komma ermittlen        var idx = zahl.indexOf('.');        // fehlende Nullen einfügen        if(fix)    {             zahl += (idx == -1 ? '.' : '' )             + f.toString().substring(1);        }        var sign = zahl < 0;        if(sign) zahl = zahl.substring(1);        idx = zahl.indexOf('.');        // Nachkommastellen ermittlen        if( idx == -1) idx = zahl.length;        else neu = dec_point + zahl.substr(idx + 1, k);        while(idx > 0)    {            if(idx - 3 > 0)            neu = thousands_sep + zahl.substring( idx - 3, idx) + neu;            else            neu = zahl.substring(0, idx) + neu;            idx -= 3;        }        return (sign ? '-' : '') + neu;    }		// sorgt fuer einen Bilderwechsel (IE-KOMPATIBEL!!!) und ein 'no-repeat' im style	function changeruntimebackground(nameofid,imagepath)	{		document.getElementById(nameofid).style.backgroundRepeat = 'no-repeat';		document.getElementById(nameofid).style.backgroundImage = 'url('+imagepath+')';		}		// berechnet neu die uebergebenen einmal - und monats-werte:	function calculate_new()	{		// Lokale hilfsvariablen bauen:		var loc_monthly=price_monthly_basic;		var loc_once=price_once_basic;		if (extra_option_memory=='once'){loc_once=price_payonce;}		if (extra_option_memory=='month5')		{			loc_once=price_pay5;			// loc_monthly=loc_monthly+5; 		// Die monatliche belastung der Einmalzahlung wird in V2 rausgenommen (ignoriert)		}		if (extra_option_memory=='month10')		{			loc_once=price_pay10;			// loc_monthly=loc_monthly+10;		// Die monatliche belastung der Einmalzahlung wird in V2 rausgenommen (ignoriert)		}				// if (smsopt_memory==1){loc_monthly=loc_monthly+price_sms100;}				// change_pricedeclaration(price_wrap_id_monthly,loc_monthly);		change_pricedeclaration(price_wrap_id_once,loc_once);		// Fussnote direkt schreiben:		document.getElementsByTagName(footernote_wrap_type)[footernote_priceonce_wrap_id].firstChild.data = footnote_once_memory ;	}		// wird ausgefuehrt, wenn SMS-Option angeklickt wird.	function smsoption()	{		// pruefen: IST es bereits aktiv?		if (smsopt_memory==0)// war noch nicht angeklickt -> jetzt aktivieren		{			smsopt_memory=1; // speichern: JETZT ist sms-option angeklickt!						//document.getElementById("smsoption").setAttribute("class", "SMSActive");			changeruntimebackground("smsoption",path_sms100_background_active);			//document.getElementById("smsoption").style.backgroundImage = 'none';				//document.getElementById("smsoption").style.backgroundImage = 'url(Images/SMS_Active.gif)';				calculate_new()		}		else // ist aktiv -> inaktiv setzen:		{			smsopt_memory=0; 				// speichern: smsoption wurde deaktiviert!			//document.getElementById("smsoption").setAttribute("class", "SMSInactive");			//document.getElementById("smsoption").style.backgroundImage = 'url(Images/SMS_Inative.gif)';				changeruntimebackground("smsoption",path_sms100_background_inactive);			calculate_new() 		// Neu berechnen 		}	}		// Schaltet auf OnMouseOver um - achtung, bei ausgewaehlter option muss invertiert werden!!!	function switch_smsoption(thisstatus)	{		var thispath;		if ((thisstatus=='1')&&(smsopt_memory==0)){thispath=path_sms100_background_active;}		if ((thisstatus=='1')&&(smsopt_memory==1)){thispath=path_sms100_background_inactive;}		if ((thisstatus=='0')&&(smsopt_memory==0)){thispath=path_sms100_background_inactive;}		if ((thisstatus=='0')&&(smsopt_memory==1)){thispath=path_sms100_background_active;}		// jetzt das background-image aendern (ja, so umstaendlich dank des IE ) 		changeruntimebackground("smsoption",thispath);	}		// Speichert die Laufzeit (24 / 0 Monate), aendert die Hintergrund-Styles,  und schreibt die dazugehoerigen Hinweistexte unter die Handy-option )	function changeruntime(seltime)	{		if (seltime=='24')		{			document.forms[0].elements[0].disabled=false;	// Selectfeld ist anwaehlbar			runtime24_memory=1;								// Speichern: laufzeit24 ist angewaehlt			//extra_option_memory='month10';				// DISABLED: Bei 24er laufzeit: Nicht automatisch eine extraOption angeben!			//document.getElementById("laufzeit24").setAttribute("class", "option2Active"); // Funzzt nicht im IE			// Hintergrundbild der Laufzeit aendern:			changeruntimebackground("laufzeit24",path_runtimeimage_background_active);		// Lfzeit24 ist aktiv			changeruntimebackground("laufzeit0",path_runtimeimage_background_inactive);		// Lfzeit 0 ist inaktiv			// Textbeschreibung der handyoption aendern:			document.getElementsByTagName(descr_handyopt_wrap_type)[descr_handyopt_wrap_id].firstChild.data = descriptiontext_handyoption_24;		}		if (seltime=='0')		{			document.forms[0].elements[0].disabled=true;	// Selectfeld ist NICHT anwaehlbar			document.forms[0].elements[0].selectedIndex = 0;			runtime24_memory=0;								// Speichern: laufzeit '0 Monate' ist angewaehlt			//document.getElementById("laufzeit0").setAttribute("class", "option2Active"); // Funzzt nicht im IE			//document.getElementById("laufzeit24").setAttribute("class", "option");// Funzzt nicht im IE			// Hintergrundbild der Laufzeit aendern:			changeruntimebackground("laufzeit24",path_runtimeimage_background_inactive);	// Lfzeit24 ist inaktiv			changeruntimebackground("laufzeit0",path_runtimeimage_background_active);		// Lfzeit 0 ist aktiv						// Extra-optionen : Einmalzahlung Merken!			extra_option_memory='once';			// fussnote bei einmalzahlung stylen / setzen:			footnote_once_memory=footnote_optiononce;			// Textbeschreibung der handyoption aendern:			document.getElementsByTagName(descr_handyopt_wrap_type)[descr_handyopt_wrap_id].firstChild.data = descriptiontext_handyoption_once;		}		// Neu berechnen:		calculate_new()	}		// Select-Feld : Auswahlen speichern, und Footernoten aendern:	function change_add_options()	{		this_option=window.document.forms[0].elements[0].value;		switch(this_option)		{			case'once': 				extra_option_memory='once';				footnote_once_memory=footnote_optiononce;			break;			case'month5': 				extra_option_memory='month5';				footnote_once_memory=footnote_option5;			break;			case'month10': 				extra_option_memory='month10';				footnote_once_memory=footnote_option10;			break;			case'': 				extra_option_memory='';				footnote_once_memory='';			break;		}		// neu berechnen:		calculate_new();	}			// Hilfsfunktion: schreibt in ein ID-Feld einen uebergebenen Preis:	function change_pricedeclaration(price_wrap_id,the_price)	{		var Thisprice=formatZahl(the_price,2,1);		document.getElementsByTagName(price_wrap_type)[price_wrap_id].firstChild.data = Thisprice ;	}		// Jetzt-Bestellen : generiert aus den gespeicherten Memory-Werten einen Link und ruft die congstar-Orderseite auf:	function ordernow()	{		var thislink;		// bp = (tarifprodukt)		// zo=252 (=smsflat), (PHONE_ID = 1143)		// ho=  (handyoption 5.- (=1) / 10.-Euro (=2) / nichts: ho= (leer lassen!!!))				// BASIS: Beginn des Links		thislink="https://www.congstar.de/-/de_DE/dynamic/order/directCheckout.html?bp=";		// Laufzeit-Link bauen:		if (runtime24_memory==0)		{thislink=thislink+FLEX_TYPE_ID;}		if (runtime24_memory==1)		{thislink=thislink+KOMBI_TYPE_ID;}				// ZUBUCH-OPTIONEN:		thislink=thislink+"&zo=";		// Wenn SMS-100-Option ausgewaehlt:		if (smsopt_memory==1)		{thislink=thislink+SMS100_ID+",";}		// HIER: IMMER: PHONE-ID RANHAENGEN!		thislink=thislink+PHONE_ID;					// EXTRA-OPTIONS:		switch (extra_option_memory)		{			case'month5':thislink=thislink+"&ho=1";break;			case'month10':thislink=thislink+"&ho=2";break;			default:thislink=thislink+"&ho=";		}					// alert(thislink);		window.open(thislink,"_blank","");		}		// Wird beim start ausgefuehrt, setzt hintergruende und startwerte der optionen:	function start()	{		// erst einmal: die flexiblen hintergruende der divs einstellen:		changeruntimebackground("laufzeit24",path_runtimeimage_background_active);		// Laufzeit24 ist aktiviert		changeruntimebackground("laufzeit0",path_runtimeimage_background_inactive);		// Laufzeit 0 ist deaktiviert		//changeruntimebackground("smsoption",path_sms100_background_inactive);			// sms-100-option ist deaktiviert				this_montly_basic=price_monthly_basic;			//alert("start");										// Beim start: monatspreis ist der basispreis		if (startoption_24=='24') // Wenn vorgewaehlt 24er-option: Werte setzen:		{			runtime24_memory=1; // beim start speichern: laufzeit 24 monate: JA, wenn option in den JS angewaehlt			// Dann: Hinweistext dazu schreiben ('ein handy gib es nur bei der 24-option dazu... usw')			document.getElementsByTagName(descr_handyopt_wrap_type)[descr_handyopt_wrap_id].firstChild.data = descriptiontext_handyoption_24;					}		else // Keine 24er-option		{			runtime24_memory=0;// beim start speichern: laufzeit 24 monate: NEIN, wenn option in den JS angewaehlt			// Dann: Hinweistext dazu schreiben ('ein handy gib es nur bei der 24-option dazu... usw')			document.getElementsByTagName(descr_handyopt_wrap_type)[descr_handyopt_wrap_id].firstChild.data = descriptiontext_handyoption_once;					}				// Beim Start: Wenn sms100-Option vor-ausgewaehlt ist: Preis dazuaddieren!		/*if (startoption_sms100==1)		{smsopt_memory=1;}		else		{smsopt_memory=0;} */						// Werte in die Felder schreiben, neu berechnen:		calculate_new();			}