 var req = null;
 function handleTranslation(){            
    switch(req.readyState) {
        case 4:
            if(req.status!=200) {
                alert("Fehler:"+req.status); 
            }else{    

                //antwort des servers
               xml = req.responseXML;
               
               var sback = xml.getElementsByTagName("mychange")[0].firstChild.nodeValue;
                if (sback == 1)
                {
                // ------------ Select1 einfügen ------------
                    if (document.form1.auswahl2.options.length > 0)
                    {
                        for (var s=0; s <= document.form1.auswahl2.options.length; s++)
                        {
							document.form1.auswahl2.options[document.form1.auswahl2.options.length - s] = null;
                        }
                    }
                    for(var i=0; i< xml.getElementsByTagName("ausgabe1").length; i++)
                    {
                        var base = xml.getElementsByTagName("ausgabe1")[i];
						var id = base.getElementsByTagName("id")[0].firstChild.nodeValue;
						var name = base.getElementsByTagName("name")[0].firstChild.nodeValue;

						document.form1.auswahl2.options[i] = new Option(name,id)								
					}
													
					if (i > 0)
					{         
						document.form1.auswahl2.style.visibility = "visible";
						document.form1.auswahl3.style.visibility = "hidden";
						document.form1.auswahl4.style.visibility = "hidden";
			
						
					}
					else
					{                    
						document.form1.auswahl2.style.visibility = "hidden";
						document.form1.auswahl3.style.visibility = "hidden";
						document.form1.auswahl4.style.visibility = "hidden";
					}
				}
				
				if (sback == 2)
                {
                // ------------ Select2 einfügen ------------
                    if (document.form1.auswahl3.options.length > 0)
                    {
                        for (var s=0; s <= document.form1.auswahl3.options.length; s++)
                        {
							document.form1.auswahl3.options[document.form1.auswahl3.options.length - s] = null;
                        }
                    }
                    for(var i=0; i< xml.getElementsByTagName("ausgabe2").length; i++)
                    {
                        var base = xml.getElementsByTagName("ausgabe2")[i];
						var id = base.getElementsByTagName("id")[0].firstChild.nodeValue;
						var name = base.getElementsByTagName("name")[0].firstChild.nodeValue;

						document.form1.auswahl3.options[i] = new Option(name,id)								
					}
													
					if (i > 0)
					{         
						document.form1.auswahl3.style.visibility = "visible";
						document.form1.auswahl4.style.visibility = "hidden";
			
						
					}
					else
					{                    
						document.form1.auswahl3.style.visibility = "hidden";
						document.form1.auswahl4.style.visibility = "hidden";
					}
				}
				
				if (sback == 3)
                {
                // ------------ Select3 einfügen ------------
                    if (document.form1.auswahl4.options.length > 0)
                    {
                        for (var s=0; s <= document.form1.auswahl4.options.length; s++)
                        {
							document.form1.auswahl4.options[document.form1.auswahl4.options.length - s] = null;
                        }
                    }
                    for(var i=0; i< xml.getElementsByTagName("ausgabe3").length; i++)
                    {
                        var base = xml.getElementsByTagName("ausgabe3")[i];
						var id = base.getElementsByTagName("id")[0].firstChild.nodeValue;
						var name = base.getElementsByTagName("name")[0].firstChild.nodeValue;

						document.form1.auswahl4.options[i] = new Option(name,id)								
					}
													
					if (i > 0)
					{         
						document.form1.auswahl4.style.visibility = "visible";
					}
					else
					{                    
						document.form1.auswahl4.style.visibility = "hidden";
					}
				}
					
            }
        break;

        default:
            return false;
        break;     
    }
}

 function translate(sart){         
     //erstellen des requests
     
    try{
        req = new XMLHttpRequest();
    }
    catch (e){
        try{
            req = new ActiveXObject("Msxml2.XMLHTTP");
        } 
        catch (e){
            try{
                req = new ActiveXObject("Microsoft.XMLHTTP");
            } 
            catch (failed){
                req = null;
            }
        }  
    }

    if (req == null)
          alert("Error creating request object!");
      
      //anfrage erstellen (GET, url ist localhost,
      //request ist asynchron 

      var url = 'mysel.php?artID=' + sart + '&sel1='+ document.form1.auswahl.value + '&sel2='+ document.form1.auswahl2.value + '&sel3='+ document.form1.auswahl3.value;

      req.open("GET", url, true);

    //Beim abschliessen des request wird diese Funktion ausgeführt
    req.onreadystatechange = handleTranslation;

      req.setRequestHeader("Content-Type",
                          "application/x-www-form-urlencoded");
    req.send(null);
} 



function chColor(id,stype) 
{
	if (stype == '1')
	{
		if (cindex > 3)
  			cindex=0;
		
  		cindex++;

  		an = window.setTimeout("chColor(cindex,1)", 2200);
	}	
	else
	{
		window.clearTimeout(an); 	
	}
	
	bg1 = 'images/bgverlauf_grau.jpg';
	bg2 = 'images/bgverlauf_grau.jpg';
	bg3 = 'images/bgverlauf_grau.jpg';
	bg4 = 'images/bgverlauf_grau.jpg';

	
	color1 = '#666666';
	color2 = '#666666';
	color3 = '#666666';
	color4 = '#666666';

	
	if (id == 1)
	{
		bg1 = 'images/bg_grau.jpg';	
		color1 = '#FF0000';
		bildurl = 'images/partyofyourlife_changer.jpg';
		blinks = 'partyofyourlife.php';
	}
	else if (id == 2)
	{
		bg2 = 'images/bg_grau.jpg';
		color2 = '#FF0000';
		bildurl = 'images/dailyhundred_changer_hu.jpg';
		blinks = 'dailyhundred.php';
	}
	else if (id == 3)
	{
		bg3 = 'images/bg_grau.jpg';
		color3 = '#FF0000';
		bildurl = 'images/mates_changer.jpg';
		blinks = 'mates.php';
	}
	else if (id == 4)
	{
		bg4 = 'images/bg_grau.jpg';
		color4 = '#FF0000';
		bildurl = 'images/partyboat_changer.jpg';
		blinks = 'partyboat.php';
	}

		
	if (document.all) 
   	{
		document.all['nav1'].style.backgroundImage='url(' + bg1 + ')';
   		document.all['nav2'].style.backgroundImage='url(' + bg2 + ')';
		document.all['nav3'].style.backgroundImage='url(' + bg3 + ')';
   		document.all['nav4'].style.backgroundImage='url(' + bg4 + ')';
		
		document.all['lnav1'].style.color=color1;
   		document.all['lnav2'].style.color=color2;
		document.all['lnav3'].style.color=color3;
   		document.all['lnav4'].style.color=color4;
   		
   		document.all['bildausgabe'].src = bildurl;
   		document.all['links'].href = blinks;
	}
	else
	{
		if (document.getElementById)
		{
        	document.getElementById('nav1').style.backgroundImage='url(' + bg1 + ')';
        	document.getElementById('nav2').style.backgroundImage='url(' + bg2 + ')';
			document.getElementById('nav3').style.backgroundImage='url(' + bg3 + ')';
        	document.getElementById('nav4').style.backgroundImage='url(' + bg4 + ')';
			
			document.getElementById('lnav1').style.color=color1;
        	document.getElementById('lnav2').style.color=color2;
			document.getElementById('lnav3').style.color=color3;
        	document.getElementById('lnav4').style.color=color4;

   			document.getElementById('bildausgabe').src = bildurl;
   			document.getElementById('links').href = blinks;

    	}
	}   		    	 	
} 



var CountdownJahr = 2009;
var CountdownMonat = 12;
var CountdownTag = 4;
var CountdownStunde = 0;
var CountdownMinute = 1;
var CountdownSekunde = 1;

function CountdownAnzeigen()
{
    var Jetzt = new Date();
    var Countdown = new Date(CountdownJahr, CountdownMonat-1, CountdownTag, CountdownStunde, CountdownMinute, CountdownSekunde);
    var MillisekundenBisCountdown = Countdown.getTime()-Jetzt.getTime();
    var Rest = Math.floor(MillisekundenBisCountdown/1000);
    var CountdownText1 = "";
	var CountdownText2 = "";
	var CountdownText3 = "";
	var CountdownText4 = "";
	var CountdownText5 = "";

    if(Rest >= 31536000)
    {
        var Jahre = Math.floor(Rest/31536000);
        Rest = Rest-Jahre*31536000;

        if(Jahre > 1 || Jahre == 0)
        {
            CountdownText1 = Jahre + " Jahre ";
        }
        else if(Jahre == 1)
        {
            CountdownText = Jahre + " Jahr ";
        }
    }
    if(Rest >= 86400)
    {
        var Tage = Math.floor(Rest/86400);
        Rest = Rest-Tage*86400;

        if(Tage > 1 || Tage == 0)
        {
            CountdownText2 = Tage + " days  ";
        }
        else if(Tage == 1)
        {
            CountdownText2 = Tage + " day  ";
        }
    }
    if(Rest >= 3600)
    {
        var Stunden = Math.floor(Rest/3600);
        Rest = Rest-Stunden*3600;

        if(Stunden > 1 || Stunden == 0)
        {
            CountdownText3 = Stunden + " hours  ";
        }
        else if(Stunden == 1)
        {
            CountdownText3 = Stunden + " hour  ";
        }
    }
    if(Rest >= 60)
    {
        var Minuten = Math.floor(Rest/60);
        Rest = Rest-Minuten*60;

        if(Minuten > 1 || Minuten == 0)
        {
            CountdownText4 = Minuten + " min  ";
        }
        else if(Minuten == 1)
        {
            CountdownText4 = Minuten + " min  ";
        }
    }

    if(Rest > 1 || Rest == 0)
    {
        CountdownText5 = Rest + " sec ";
    }
    else if(Rest==1)
    {
        CountdownText5 = Rest + " sec ";
    }

    document.getElementById('Countdown_T').innerHTML = CountdownText2;
	document.getElementById('Countdown_h').innerHTML = CountdownText3;
	document.getElementById('Countdown_m').innerHTML = CountdownText4;
    window.setTimeout("CountdownAnzeigen()", 1000);
}           
