function popUp(URL) {
	day 	= new Date();
	id 	= day.getTime();
	hilfe_window	= window.open(URL, 'Hilfe', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=366,height=442,left = 100,top = 100');
	hilfe_window.setTimeout('window.close()',30000);
	hilfe_window.setTimeout('window.focus()');
	hilfe_window.setTimeout('window.focus()',500);
}	
	
function ausrechnen(){    
    	spieleranzahl = window.document.rechner.playercount.options[window.document.rechner.playercount.selectedIndex].value;
    	
    	if(window.document.rechner.servertyp[0].checked){
      		grundpreis 	= 0;
		slotpreis	= 1.10;
    	}else{
      		grundpreis 	= 0;
		slotpreis	= 1.50;      		
    	}
    	
	
 	if ( spieleranzahl == "6" && slotpreis == "4"){
 		
  		grundpreis = grundpreis + (slotpreis * spieleranzahl) ;
  	}else{
  		grundpreis = grundpreis + (slotpreis * spieleranzahl) ;
  	}
  	
  	if (window.document.rechner.poweredby.checked){
    		poweredbyrabatt = 0.05;
  	}else{
    		poweredbyrabatt = 0;
  	}    
   	
  	if (window.document.rechner.gametype.selectedIndex == 0){
  		multigamepreis = 5;  		
  	}else{
  		multigamepreis = 0;
  	}
  	
  	
  	if (window.document.rechner.webhosting.checked){
  		webhostingpreis = 9;
  	}else{
  		webhostingpreis = 0;
  	}
  	
  	
  	if (window.document.rechner.voicetype.options[window.document.rechner.voicetype.selectedIndex].value != "Kein Voiceserver"){
  		voiceserverpreis = window.document.rechner.voiceslots.options[window.document.rechner.voiceslots.selectedIndex].value * 0.3;
  		window.document.rechner.voiceslots.disabled	= false;
  	}else{
  		voiceserverpreis 	= 0;
  		window.document.rechner.voiceslots.disabled	= true;
  		
  	}
  	
  	if (window.document.rechner.shellaccount.checked){
  		shellaccountpreis = 3;
  	}else{
  		shellaccountpreis = 0;
  	}
  	  	
  	
  	
  	if (window.document.rechner.vertragslz.value > 0){
  		window.document.rechner.einmaligerrabatt.value = formatausgabe(window.document.rechner.vertragslz.value.toString(10)) + " EUR";  	  	  	
  	}else{
  		zahl = window.document.rechner.vertragslz.value * -1;
  		if (zahl > 0){
  			window.document.rechner.einmaligerrabatt.value = zahl + ".00 % Setupkosten";
  		}else{
  			window.document.rechner.einmaligerrabatt.value = "0.00 EUR ";
  		}
  		
  	}
  	  	
  	if ( window.document.rechner.exclusive.checked ){
  		exklusivpreis	= 25;
  	}else{
  		exklusivpreis  	= 0;
  	}
  	ergebnis = grundpreis - ( grundpreis *poweredbyrabatt ) + multigamepreis + webhostingpreis + voiceserverpreis + shellaccountpreis + exklusivpreis;
  	  	
  	
  	

  	if (ergebnis <= 0){
    		ergebnis = 0;
  	}

  	ergebnis = roundit(ergebnis);
  	window.document.rechner.ergebnis.value = formatausgabe(ergebnis.toString(10)) + " EUR";
}

function roundit(x){
  x *= 100;
  y = Math.round(x);
  y /= 100;
  return(y);
}

function prozent(wert, prozentsatz){
  	var x = wert*(prozentsatz/100.0);
  	return(x);
}

function formatausgabe(betrag){
  	if (betrag.lastIndexOf(".") <= 0){
    		betrag += ".00";
  	}else{
    		if (betrag.lastIndexOf(".") == (betrag.length - 2)){
      			betrag += "0"; 
    		}
  	}
  	return(betrag);
}
