
var tickettyp = "";
var ticketanz = 0;

function getAnzahl(typ , name)
{
	elm = document.getElementById(name);
	
	tickettyp = typ;
	
	document.getElementById("step2").style.display = 'block';
	document.getElementById("step3").style.display = 'none';
	
	document.getElementById("eurobill").innerHTML = "";
	
	if(typ == 0)
	{
		elm.innerHTML = "";
		document.getElementById("step2").style.display = 'none';
	}
	else if(typ == "vip")
	{
		elm.innerHTML = "<select style='width:200px' name='anzahl' onchange=\"getDaten(this.options[this.selectedIndex].value , 'daten')\"><option value='0' selected='selected'>Bitte ausw&auml;hlen</option><option value='1'>1 Ticket</option></select>";
	}
	else
	{
		elm.innerHTML = "<select style='width:200px' name='anzahl' onchange=\"getDaten(this.options[this.selectedIndex].value , 'daten')\"><option value='0' selected='selected'>Bitte ausw&auml;hlen</option><option value='1'>1 Ticket</option><option value='2'>2 Tickets</option><option value='3'>3 Tickets</option><option value='4'>4 Tickets</option><option value='5'>5 Tickets</option></select>";
	}
}

function getDaten(anz , name)
{
	ticketanz = anz;
	
	var ticketnummer = "MDHTICKET-" + rand(5444444,12213123123);
	
	var pw = rand(5444444,12213123123);

	document.getElementById("step3").style.display = 'block';
	
	if(tickettyp == "vip")
	{
		var aid = 17;
	}
	else
	{
		var gesamt = ticketanz * 8;
		
		switch(gesamt)
		{
		case 8:
		  aid = 12
		  break;
		case 16:
		  aid = 13
		  break;
		case 24:
		  aid = 14
		  break;
		case 32:
		  aid = 15
		  break;
		case 40:
		  aid = 16
		  break;
		case 16:
		  aid = 17
		  break;		  		  		  
		default:
		  document.getElementById("step3").style.display = 'none';
		}
	}


	var link = "https://www.eurobill.com/cgi/mastergate/signupform.cgi?wmid=cash4members&siteid=mydirtynight.com&username=" + ticketnummer + "&password=" + pw + "&aid=" + aid + "&loginurl=http%3A%2F%2Fwww.mydirtynight.com%2Fsuccess%2F&declineurl=http%3A%2F%2Fwww.mydirtynight.com%2Ferror%2F";

	var elm = document.getElementById("eurobill");
	
	elm.innerHTML = "<a href='" + link + "'>Jetzt online Zahlung durchf&uuml;hren</a>";
}


function rand (start, end) 
{

    return Math.floor(Math.random() * (end - start + 5));
}

