
/**
 * Popup mit AGB anzeigen
 */
function showagb(){
    // Popup mit AGB anzeigen
	myleft=30;
    mytop=50;
    var parameter="width=640,height=480,top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=yes,dependent=no";
	win = window.open("agb.php",'agb',parameter);    
	win.focus();
}

/**
 * User als Freund bestätigen
 */
function confirmFriend(id, typ) {
    //
        $.ajax({ 
          type: "POST", 
          url: "action/confirmfriend.php", 
          data: "id="+id + "&typ=1",
          dataType: "json" ,  
          success: function(j){ 
              var res = parseInt(j["resultcode"]);
              if (res == 1) {
                //$("div#newfriend_"+id).hide();
                $("#newfriendaction_"+id).html("<img src='images/buttons/done.gif' alt='bestätigt' title='bestätigt' border='0' />");                
              }              
              
          } 
        });          
}


/**
 * Freundesanfrage ablehnen
 */
function removeNewFriend(id) {
    //
        $.ajax({ 
          type: "POST", 
          url: "action/confirmfriend.php", 
          data: "id="+id + "&typ=2",
          dataType: "json" ,  
          success: function(j){ 
              var res = parseInt(j["resultcode"]);
              if (res == 1) {
               //$("div#newfriend_"+id).hide();
               $("#newfriendaction_"+id).html("<img src='images/buttons/xing.gif' alt='entfernt' title='entfernt' border='0' />");
              }                     
          } 
        });          
}


function evalKeyForSubmit(event, frm) {

   if ((event && event.which == 13) || (event.keyCode && event.keyCode == 13)) {
      // IE: ...event.keyCode...
      // ENTER gedrückt, also Formular abschicken
      if (frm.username.value != "" && frm.passwort.value != "")
            frm.submit();
   }
   else {
      return true;
   }
}


/**
 * Ergebnis Updaten
 *
 */
function ErgebnisSave(s) {

        $.ajax({ 
          type: "POST", 
          url: "action/do_updateergebnis.php", 
          data: $('#ergebnis').serialize() + '&status='+ s,
          dataType: "json" ,  
          success: function(s){ 
           		if (s == 1) {
           			$('#message').html('Dein Ergebnis wurde veröffentlicht.').fadeIn(2000);
           			}
           		if (s == 0) {
           			$('#message').html('Deine Änderungen wurden gespeichert.');
           			}
          }});  
}

