function user_delete(user_id,user_mail)
{
   var r=confirm("Czy napewno chcesz usunąć użytkownika?\n Adres email: "+ user_mail + " ID: "+ user_id);
if (r==true)
  {
    document.forms['form::del'].elements["user_id"].value = user_id;
    document.forms['form::del'].submit();
  }
}

function register() {

  var mail = document.getElementById( "user_login" );
  var mail1 = document.getElementById( "user_login1" );


   var error = 0;
   var fName = '';
  
   fName = 'user_login'; if( !$(fName) || $(fName).value == '' ) { if($(fName) && $('dsc_' + fName)) { $(fName).style.borderColor = '#FF0000'; $('dsc_' + fName).style.color = '#FF0000'; } error++; } else { if($(fName) && $('dsc_' + fName)) { $(fName).style.borderColor = '#5CA8A8'; $('dsc_' + fName).style.color = '#555'; } }
   fName = 'user_login1'; if( !$(fName) || $(fName).value == '' ) { if($(fName) && $('dsc_' + fName)) { $(fName).style.borderColor = '#FF0000'; $('dsc_' + fName).style.color = '#FF0000'; } error++; } else { if($(fName) && $('dsc_' + fName)) { $(fName).style.borderColor = '#5CA8A8'; $('dsc_' + fName).style.color = '#555'; } }
   fName = 'user_surname'; if( !$(fName) || $(fName).value == '' ) { if($(fName) && $('dsc_' + fName)) { $(fName).style.borderColor = '#FF0000'; $('dsc_' + fName).style.color = '#FF0000'; } error++; } else { if($(fName) && $('dsc_' + fName)) { $(fName).style.borderColor = '#5CA8A8'; $('dsc_' + fName).style.color = '#555'; } }
   fName = 'user_name'; if( !$(fName) || $(fName).value == '' ) { if($(fName) && $('dsc_' + fName)) { $(fName).style.borderColor = '#FF0000'; $('dsc_' + fName).style.color = '#FF0000'; } error++; } else { if($(fName) && $('dsc_' + fName)) { $(fName).style.borderColor = '#5CA8A8'; $('dsc_' + fName).style.color = '#555'; } }
  
  
   fName = 'dataAuth';
   if( !$(fName) || $(fName).checked == 0 )
   {
	   if($('dataAuthDesc'))
	   {
		   $('dataAuthDesc').style.border = '1px solid #FF0000';
		   $('dataAuthDesc').style.color = '#FF0000';
	   } error++;
   }
   else
   {
	   if($('dataAuthDesc'))
	   {
		   $('dataAuthDesc').style.border = '0';
	   	 $('dataAuthDesc').style.color = '#000000';
	   }
   }
  
  

  if(mail.value != mail1.value || mail.value == "")
  {
     alert("Podaj poprawny adres email");
  }
  else if(error)
  {
	  alert('Aby się zarejestrować musisz zaakceptować regulamin');
  }
  else
     document.forms['reg'].submit();


}
function chngpwd() {

  var pwd = document.getElementById( "new_pwd" );
  var pwd1 = document.getElementById( "new_pwd1" );



  if(pwd.value != pwd1.value || pwd.value == "" )
     alert("Nowe hasła nie zgadzają się");
  else
     document.forms['pwd'].submit();


}
function save() {
     document.forms['edit'].submit();
}
function delacc() {
	if (confirm("Czy napewno chcesz usun±ć swoje konto?")) {
     document.forms['del'].submit();
	}
}
function login() {

  var user_login = document.getElementById( "user_login" );
  var user_password = document.getElementById( "user_password" );



  if(user_login.value == "" || user_password.value == "" )
     alert("Podaj login i hasło");
  else
     document.forms['login_form'].submit();


}

function loadInfoBox( myid , param, act )
{
 advAJAX.get({
 url: "?act="+myid+"&id=2&mode=ajax&do="+param+"&action="+act,
 onLoading : function(obj) { document.getElementById( "box" ).innerHTML = '<div class="wait" style="margin-bottom: 10px; margin-top: 10px;"><!-- --></div>'; },
 onError : function(obj) { document.getElementById( "box" ).innerHTML = '<div class="error" style="margin-bottom: 10px; margin-top: 10px;"><!-- --></div>'; },
 onSuccess : function(obj) { document.getElementById( "box" ).innerHTML = obj.responseText; }
 });
}
function delete_old( myid )
{
 advAJAX.get({
 url: "?act="+myid+"&id=2&mode=ajax&do=1&action=1",
 onLoading : function(obj) { document.getElementById( "del_old" ).innerHTML = '<div class="wait" style="margin-bottom: 10px; margin-top: 10px;"><!-- --></div>'; },
 onError : function(obj) { document.getElementById( "del_old" ).innerHTML = '<div class="error" style="margin-bottom: 10px; margin-top: 10px;"><!-- --></div>'; },
 onSuccess : function(obj) { document.getElementById( "del_old" ).innerHTML = obj.responseText; }
 });
}
function sendForm( id )
{
   advAJAX.submit(document.getElementById(id), {
    onSuccess : function(obj) { document.getElementById( 'box' ).innerHTML = '' + (obj.responseText) + ''; },
    onLoading : function(obj) { document.getElementById( 'box' ).innerHTML = '<div class="wait" style="margin-bottom: 10px; margin-top: 10px;"><!-- --></div>'; },
    onError : function(obj) { document.getElementById( 'box' ).innerHTML = '<div class="error" style="margin-bottom: 10px; margin-top: 10px;"><!-- --></div>'; }
   });
}
function showUsers( where, myid )
{
   advAJAX.get({
    url: "?act="+myid+"&id=2&mode=ajax&do=4&action=" + where,
    onSuccess : function(obj) { document.getElementById( 'database' ).innerHTML = '' + (obj.responseText) + ''; },
    onLoading : function(obj) { document.getElementById( 'database' ).innerHTML = '<div class="wait" style="margin-bottom: 10px; margin-top: 10px;"><!-- --></div>'; },
    onError : function(obj)   { document.getElementById( 'database' ).innerHTML = '<div class="error" style="margin-bottom: 10px; margin-top: 10px;"><!-- --></div>'; }
   });
}

function AddGroup( myid )
{
 advAJAX.submit(document.getElementById('form::allgroups'), {
 onLoading : function(obj) { document.getElementById( "group_button" ).innerHTML = '<div class="wait" style="margin-bottom: 10px; margin-top: 10px;"><!-- --></div>'; },
 onError : function(obj) { document.getElementById( "group_button" ).innerHTML = '<div class="error" style="margin-bottom: 10px; margin-top: 10px;"><!-- --></div>'; },
 onSuccess : function(obj) { 
   document.getElementById( "active_groups" ).innerHTML = obj.responseText;
   document.getElementById( "group_button" ).innerHTML = '<input class="button" type="button" onclick="DelGroup( '+myid+' ); return false;" name="del" value=">>" /><br /><input onclick="AddGroup( '+myid+' ); return false;" class="button" type="button" name="add" value="<<" />';
    }
 });
}
function DelGroup( myid )
{
 advAJAX.submit(document.getElementById('form::usergroups'), {
 onLoading : function(obj) { document.getElementById( "group_button" ).innerHTML = '<div class="wait" style="margin-bottom: 10px; margin-top: 10px;"><!-- --></div>'; },
 onError : function(obj) { document.getElementById( "group_button" ).innerHTML = '<div class="error" style="margin-bottom: 10px; margin-top: 10px;"><!-- --></div>'; },
 onSuccess : function(obj) {
   document.getElementById( "active_groups" ).innerHTML = obj.responseText;
   document.getElementById( "group_button" ).innerHTML = '<input class="button" onclick="DelGroup( '+myid+' ); return false;" type="button" name="del" value=">>" /><br /><input class="button" onclick="AddGroup( '+myid+' ); return false;" type="button" name="add" value="<<" />';
    }
 });
}
function openCtgEditor(_myid, _target)
{
   _size = ',width=750,height=500';

   var _link = 'myadmin.php?act=' + _myid + '&id=3&target=' + _target;

   var _config = 'toolbar=no,location=no,directories=no,status=no,menubar=no' + _size + ',scrollbars=yes,resizable=yes';
   window.open (_link,"",_config);

}
