var http = null;
if (window.XMLHttpRequest) {
   http = new XMLHttpRequest();
} else if (window.ActiveXObject) {
   http = new ActiveXObject("Microsoft.XMLHTTP");
}
div_id = '';
	function ausgeben() {
				if (http.readyState == 1) {
			
		}else{

		if (http.readyState == 4) {
			if (div_id != '') {
				document.getElementById(div_id).innerHTML = http.responseText;
			}
		}
	}
	}
	

function getRTE(loc)
{	var params = "location=no,status=no,toolbar=no,menubar=no,resizable=no,scrollbars=no";
    var tp = Math.ceil((screen.height - "410") / 2);
    var lf = Math.ceil((screen.width - "410") / 2);
    if (params.length > 0)
	    params = "," + params;

    var win = window.open(loc, "rte", "width=410,height=410,top=" + tp + ",left=" + lf + params);
    win.focus();
    return win;
}
function getGame(loc)
{	var params = "location=no,status=no,toolbar=no,menubar=no,resizable=no,scrollbars=no";
    var tp = Math.ceil((screen.height - "400") / 2);
    var lf = Math.ceil((screen.width - "800") / 2);
    if (params.length > 0)
	    params = "," + params;

    var win = window.open(loc, "rte", "width=800,height=400,top=" + tp + ",left=" + lf + params);
    win.focus();
    return win;
}
function getLiveChat(str)
{	var params = "location=no,status=no,toolbar=no,menubar=no,resizable=no,scrollbars=no";
    var tp = Math.ceil((screen.height - "400") / 2);
    var lf = Math.ceil((screen.width - "700") / 2);
    if (params.length > 0)
	    params = "," + params;
	var wd = Math.round(Math.random());
    var win = window.open("/liveChat.php?"+str, "_blank", "width=700,height=400,top=" + tp + ",left=" + lf + params);
    win.focus();
    return win;
}
function getPlayer()
{	var params = "location=no,status=no,toolbar=no,menubar=no,resizable=no,scrollbars=no";
    var tp = Math.ceil((screen.height - "120") / 2);
    var lf = Math.ceil((screen.width - "300") / 2);
    if (params.length > 0)
	    params = "," + params;

    var win = window.open("http://stream.rumix-deluxe.de", "Radio", "width=300,height=120,top=" + tp + ",left=" + lf + params);
    win.focus();
    return win;
}


function mouseEvent(tbl,state,color) {
if(state == true){
document.getElementById(tbl).style.backgroundColor = color;		
}else{
document.getElementById(tbl).style.background = 'none';	
}
}
function read_mail(ioo,mid) {
	
   div_id = "mail_ind";
   http.open("GET", "/gl/js/php/mailLesen.php?in_or_out=" + ioo + "&mid=" + mid, true);
   http.onreadystatechange = ausgeben;
   http.send(null);
   

};
function startUpload(){
if(document.up_foto.agb.checked == true) {



      document.getElementById('f1_upload_process').style.display = '';
      document.getElementById('f1_upload_form').style.display = 'none';
	  document.up_foto.submit();
	  

	  }else{
		displayAlert('Bitte die Upload-AGB\'s akzeptieren!',false,300,120);
	return false;
}

}

function stopUpload(success,imglink,width,height){
      var result = '';
      if (success == 1){
         result = '';
		 		 document.getElementById('fileD').innerHTML = '<br /> \
      Bild w&auml;hlen:<br /> \
      <input style="font-family:Verdana, Geneva, sans-serif; font-size:10px; border:1px solid #CCC;" id="myfile" name="myfile" type="file" size="40" />';
				 displayUpload('',false,width+175,height+10);
					

      }
      else {
         
		 displayAlert('Foto zu klein! Min. 300px Breit & 420px Hoch!',false,300,120);
      }      
	  document.getElementById('f1_upload_form').style.display = '';
      document.getElementById('f1_upload_process').style.display = 'none';
      
      return true;   
}


function startGalleryUpload(){

      document.getElementById('f1_upload_process').style.display = '';
      document.getElementById('f1_upload_form').style.display = 'none';
	  document.up_foto.submit();


}

function stopGalleryUpload(success){
      var result = '';
      if (success == 1){
         result = '';
		 		 document.getElementById('fileD').innerHTML = '<br /> \
      Bild w&auml;hlen:<br /> \
      <input style="font-family:Verdana, Geneva, sans-serif; font-size:10px; border:1px solid #CCC;" id="myfile" name="myfile" type="file" size="40" />&nbsp;&nbsp;\
      <input style="font-family:Verdana, Geneva, sans-serif; font-size:10px; border:1px solid #CCC;" onClick="startGalleryUpload();" type="button" name="submitBtn" value="Hochladen" />';
				 displayInfo('Foto wurde erfolgreich hochgeladen!',false,300,120,'Info','?gt=gallery');

      }
      else {
         
		 displayAlert('Bitte ein Foto w&auml;hlen!',false,300,120);
      }      
	  document.getElementById('f1_upload_form').style.display = '';
      document.getElementById('f1_upload_process').style.display = 'none';
      
      return true;   
}
 function get_plz() {
		var _get_plz = document.getElementById('plz').value.replace(/[^0-9]/g,'');
		

		if(_get_plz.length==5){
			div_id = "get_staat";
			content_plz =  document.getElementById("plz").value;
			http.open("GET", "/gl/js/php/get_plz.php?plz=" + escape(content_plz), true);
			http.onreadystatechange = ausgeben;
			http.send(null);			
		}
		}	
		
function usr_check() {

	var usr = document.getElementById("nick").value;

   div_id = "check_usr";
   document.getElementById(div_id).style.display = "";

   http.open("GET", "/gl/js/php/check_usr.php?nm=" + usr, true);
   http.onreadystatechange = ausgeben;
   http.send(null);
}

function gebot_abgeben(datei,id) {
	
	
	var b_form = document.f_gebot;
	
	if(b_form.gebot.value == "") {
	var	menge = "";
	}else{
	var menge = b_form.gebot.value;
	}

	var die_datei = "/gl/js/php/auktionBieten.php?id="+id;
	


	
	div_id = "load_bieten";

	http.open("POST", die_datei, true);
	http.onreadystatechange = ausgeben;
	http.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	http.send("bieten=1&gebot=" + menge );

}

function load_bieten(datei,id) {

	var die_datei = "/gl/js/php/auktionBieten.php?id="+id;
	

div_id = "load_bieten";	 
   http.open("GET", die_datei, true);
   http.onreadystatechange = ausgeben;
   http.send(null);
      
   

};
function CountdownAnzeigen(j,m,t,s,mm,se)
{

var CountdownJahr = j;
var CountdownMonat = m;
var CountdownTag = t;
var CountdownStunde = s;
var CountdownMinute = mm;
var CountdownSekunde = se;

    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 CountdownText = "";
	var tag = "";
	var std = "";
	var mnt = "";
	var sek = "";
    if(Rest >= 31536000)
    {
        var Jahre = Math.floor(Rest/31536000);
        Rest = Rest-Jahre*31536000;

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

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

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

        if(Minuten > 1 || Minuten == 0)
        {
            mnt += Minuten + " Minuten ";
        }
        else if(Minuten == 1)
        {
            mnt += Minuten + " Minute ";
        }
    }

    if(Rest > 1 || Rest == 0)
    {
        sek += Rest + " Sekunden ";
    }
    else if(Rest==1)
    {
        sek += Rest + " Sekunde ";
    }
	


if(tag == "" && std == "" && mnt == "" && sek == "") {
	 var txt = "Die Auktion ist Beendet!";
	 location.reload();

}else{
	
	var txt = "";
	
	if(tag >= '1') {
	txt += tag;
	}
	
	
	
	if(std == '') {	
	}
	else						
	{ 
		if(tag == "") {
		txt += std+mnt;
		}
		else
		{
		txt += std;
		}
	}
		
if(tag == '' && std == '') {
	
	
txt +=  mnt+sek;	

    document.getElementById('Countdown').style.color = "#ff0000";
    document.getElementById('Countdown').style.fontWeight = "bold";

}

}

    document.getElementById('Countdown').innerHTML = txt;
    window.setTimeout("CountdownAnzeigen('"+j+"','"+m+"','"+t+"','"+s+"','"+mm+"','"+se+"')", 1000);
}
var blk;
function neueMail() {
	window.clearTimeout(blk);
  var obj = document.getElementById("new").style;
  if(document.title == "** NEUE-MAIL's **") {
	  document.title = "*****************"; 
  }else{
	  document.title = "** NEUE-MAIL's **";
  
  }
	  
  
  if(obj.color == "red") {
    obj.color = "black";
  }
  else {
    obj.color = "red";
  }
 blk = window.setTimeout(neueMail, 500);
}


             function doIt(){
             
                 //erstellen des requests
                 var req = null;

                try{
                    req = new XMLHttpRequest();
                }
                catch (ms){
                    try{
                        req = new ActiveXObject("Msxml2.XMLHTTP");
                    } 
                    catch (nonms){
                        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      
                  req.open("GET", '/gl/js/php/newMail.php', true);

                //Beim abschliessen des request wird diese Funktion ausgeführt
                req.onreadystatechange = function(){            
                    switch(req.readyState) {
                            case 4:
                            if(req.status!=200) {
                            }else{    
								if(req.responseText == "1") {
								neueMail();
								}
                            }
                            break;
                    
                            default:
                                return false;
                            break;     
                        }
                    };
  
                  req.setRequestHeader("Content-Type",
                                      "application/x-www-form-urlencoded");
                req.send(null);
            }


function editUser() {
var b_form = document.editUSR;

                 var req = null;

                try{
                    req = new XMLHttpRequest();
                }
                catch (ms){
                    try{
                        req = new ActiveXObject("Msxml2.XMLHTTP");
                    } 
                    catch (nonms){
                        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      
                  req.open("POST", '/gl/js/admin/editUser.php', true);

                //Beim abschliessen des request wird diese Funktion ausgeführt
                req.onreadystatechange = function(){            
                    switch(req.readyState) {
                            case 4:
                            if(req.status!=200) {
                            }else{    
	
								alert(req.responseText);
								displayEditUser('allo',false,'500','600',b_form.uId.value);
	
                            }
                            break;
                    
                            default:
                                return false;
                            break;     
                        }
                    };
  
                  req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
                req.send("edit=" + b_form.uId.value + "&nick=" + b_form.nick.value + "&email="+ b_form.email.value +"&vorname="+ b_form.vorname.value +"&geschlecht="+ b_form.geschlecht.value +"&gtag="+b_form.g_tag.value +"&gmonat="+ b_form.g_monat.value +"&gjahr="+ b_form.g_jahr.value +"&plusPoints="+ b_form.plusPoints.value +"&meinStatus="+ b_form.status.value +"&admin="+ b_form.admin.value +"&moderator="+ b_form.moderator.value +"&vip="+ b_form.vip.value +"&confirm="+ b_form.confirmm.value +"");
}

