function open_window(url)
{ myWin1= window.open(url,"myWin2","width=750,height=600,status=no,toolbar=no,resizable=yes,scrollbars=yes,menubar=no"); if (navigator.appName != "Microsoft Internet Explorer") { if (window.focus) myWin1.focus();}
}
function Popup(url){ window.open( url, 'window', 'width=700, height=600, resizable=no, scrollbars=no, location=no,  toolbar=no, menubar=no, status=no' );}
function Validate() { if (document.forms.search.q.value.length < 3) { alert('Use more caracters!'); return false;}
return true;}
function do_refresh(){
window.opener.location.reload(true);
window.close();
}
function do_back_load(url){
window.opener.location.replace(url);
window.close();
}
function clearText(field){
    if (field.defaultValue == field.value) field.value = '';
    else if (field.value == '') field.value = field.defaultValue;
}

 function changeUrl(urlString){
        var language = document.getElementById('lng');
        var selectedlng = language.options[language.selectedIndex];
        if (selectedlng.value != "nothing"){
                window.location = urlString + selectedlng.value;
        }
    }
function bgcolor(nr) { document.getElementById("rand"+nr).style.backgroundColor = '#eeeeee';}
function removebg(nr) { 
document.getElementById("rand"+nr).style.backgroundColor = ''; 
if(document.getElementById("mem"+nr))if(document.getElementById("mem"+nr).checked == true){ 
document.getElementById("rand"+nr).style.backgroundColor = '#eeeeee';
}
}
function cek_box(nr) { if(document.getElementById("mem"+nr).checked == true){ document.getElementById("mem"+nr).checked = false;}else{ document.getElementById("mem"+nr).checked = true;}
}
function swich(value, sel1,sel2){
if(sel1)sel1 = document.getElementById(sel1);
if(sel2)sel2 = document.getElementById(sel2);    
if(value>0){
if(sel1)sel1.style.display = 'table-row'; 
 if(sel2)sel2.style.display = 'none';   
    }else{
if(sel1)sel1.style.display = 'none';       
if(sel2)sel2.style.display = 'table-row';        
    }
}
function do_show_hyde(value, sel1, sel2, sel3){
if(sel1)sel1 = document.getElementById(sel1);
if(sel2)sel2 = document.getElementById(sel2);
if(sel3)sel3 = document.getElementById(sel3);
if(value>0){
if(sel1)sel1.style.display = 'table-row';
if(sel2)sel2.style.display = 'table-row';
if(sel3)sel3.style.display = 'table-row';
}else{
 if(sel1)sel1.style.display = 'none';
 if(sel2)sel2.style.display = 'none';
 if(sel3)sel3.style.display = 'none';
}
} 
var state = 'none';
function showhide(layer_ref) {
if (state == 'block') state = 'none';
else state = 'block';
if (document.all) eval( "document.all." + layer_ref + ".style.display = state");
if (document.layers)document.layers[layer_ref].display = state;
if (document.getElementById && !document.all) {
maxwell_smart = document.getElementById(layer_ref);
maxwell_smart.style.display = state;
}
}

function ftp_test(url,s,u,p){
    
 http.abort();
  http.open("GET", url +"/ajax/validate.php?ftp_test&s=" + s+"&u="+ u+ "&p="+p, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      alert(http.responseText);
     }
  }
  http.send(null);   
}
function scrhval(value){
 if(value)document.getElementById('q').value=value;   
 document.getElementById('suggest').style.display = 'none';   
}

function update_software (url, pad_url){
  document.getElementById('suggest').style.display = 'block';     
  http.abort();
  http.open("GET", url +"/sources/cron_2.php?update=" + pad_url, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById('if_new_version').innerHTML = http.responseText;
     }
  }
  http.send(null);
}
function update_file(url, row,file){
  document.getElementById('rand'+row).className ='updating';     
  http.abort();
  http.open("GET", url + "/ajax/validate.php?update_file=" + file, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
         alert(http.responseText);
          setTimeout(function(){
               document.getElementById('rand'+row).className =''; 
                document.getElementById('img_'+row).innerHTML ='';
             document.getElementById('text_'+row).innerHTML ='';
            },500);
         //setTimeout("window.location.reload()",3000);  
    }
  }
  http.send(null);
}
function delete_file(url, row,file){
  document.getElementById('rand'+row).className ='updating';     
  http.abort();
  http.open("GET", url + "/ajax/validate.php?delete_file=" + file, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
        alert(http.responseText);
            setTimeout(function(){document.getElementById('rand'+row).className =''; document.getElementById('rand'+row).style.display = 'none'; },500);
             
    }
  }
  http.send(null);
}
function download_file(url, row,file){
  document.getElementById('rand'+row).className ='updating';     
  http.abort();
  http.open("GET", url + "/ajax/validate.php?download_file=" + file, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
        alert(http.responseText);
            setTimeout(function(){
                document.getElementById('text_'+row).innerHTML ='';
                 document.getElementById('img_'+row).innerHTML ='';
                document.getElementById('rand'+row).className =''; 
                 },500);
             
    }
  }
  http.send(null);
}

var http = false;
if(navigator.appName == "Microsoft Internet Explorer") {
  http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
  http = new XMLHttpRequest();
}

function suggest (url, value){
  document.getElementById('suggest').style.display = 'block';     
  http.abort();
  http.open("GET", url +"/ajax/validate.php?suggest=" + value, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById('suggest').innerHTML = http.responseText;
    }
  }
  http.send(null);
}
function ajax (value, url, field){
  http.abort();
  http.open("GET", url +"/ajax/validate.php?"+ field +"=" + value, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById('res_'+ field).innerHTML = http.responseText;
    }
  }
  http.send(null);
}


function validate_file(value, url, field) {
   document.getElementById(field).className ='loading';
     var xmlhttp = null;
    if (window.XMLHttpRequest) { 
        xmlhttp = new XMLHttpRequest();
    } else
    if (window.ActiveXObject) { 
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    if (xmlhttp) {
        xmlhttp.onreadystatechange = function () {
            if (this.readyState == 4 && this.status == 200) {
                document.getElementById('error_'+field).innerHTML = this.responseText;
                document.getElementById(field).className ='';
            }
        }
        xmlhttp.open("GET", url + "/ajax/validate.php?" + field + "=" + value, true);

        xmlhttp.send();
    }
}
function valid_url(value, url, field) {
   document.getElementById(field).className ='loading';
     var xmlhttp = null;
    if (window.XMLHttpRequest) { 
        xmlhttp = new XMLHttpRequest();
    } else
    if (window.ActiveXObject) { 
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    if (xmlhttp) {
        xmlhttp.onreadystatechange = function () {
            if (this.readyState == 4 && this.status == 200) {
                document.getElementById(field).style.borderColor = this.responseText;
                document.getElementById(field).className ='select_mic';
            }
        }
        xmlhttp.open("GET", url + "/ajax/validate.php?border&" + field + "=" + value, true);

        xmlhttp.send();
    }
}
function valid_f(value, url, field) {
  http.abort();
  http.open("GET", url +"/ajax/validate.php?border&"+ field +"=" + value, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById(field).style.borderColor  = http.responseText;
    }
  }
  http.send(null);
}
function cek_folder(value, url, field) {
  http.abort();
  http.open("GET", url +"/ajax/validate.php?folder="+ field +"&value=" + value, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById(field).style.borderColor  = http.responseText;
    }
  }
  http.send(null);
}
function validate_user(value, url) {
  document.getElementById('username').className ='loading';  
  http.abort();
  http.open("GET", url +"/ajax/validate.php?user=" + value, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById('username_er').innerHTML = http.responseText;
       document.getElementById('username').className ='';
    }
  }
  http.send(null);
}
function validate_pass(value, url) {
  http.abort();
  http.open("GET", url +"/ajax/validate.php?pass=" + value, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById('pass').innerHTML = http.responseText;
    }
  }
  http.send(null);
}
function validate_old_pass(value, url) {
  http.abort();
  http.open("GET", url +"/ajax/validate.php?old_pass=" + value, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById('old_pass').innerHTML = http.responseText;
    }
  }
  http.send(null);
}
function validate_lost_pw(value, url) {
  http.abort();
  http.open("GET", url +"/ajax/validate.php?lost_pw=" + value, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById('er_lost_pw').innerHTML = http.responseText;
    }
  }
  http.send(null);
}

function validate_re_pass(value1, value2, url) {
  http.abort();
  http.open("GET", url +"/ajax/validate.php?pass=" + value1 +"&re_pass="+value2, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById('re_pass').innerHTML = http.responseText;
    }
  }
  http.send(null);
}
function validate_compare_pass(value1, value2, url) {
  http.abort();
  http.open("GET", url +"/ajax/validate.php?compare=" + value1 +"&oldpass="+value2, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById('err_pass').innerHTML = http.responseText;
    }
  }
  http.send(null);
}
function validate_email(value, url) {
  document.getElementById('email').className ='loading';    
  http.abort();
  http.open("GET", url +"/ajax/validate.php?email=" + value, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById('er_email').innerHTML = http.responseText;
       document.getElementById('email').className ='';
    }
  }
  http.send(null);
}
function validate_resend_email(value, url) {
  http.abort();
  http.open("GET", url +"/ajax/validate.php?resend_email=" + value, true);
  http.onreadystatechange=function() {
    if(http.readyState == 4) {
      document.getElementById('er_username').innerHTML = http.responseText;
    }
  }
  http.send(null);
}
function change(id){
     ID = document.getElementById(id);
    
     if(ID.style.display == "")
          ID.style.display = "none";
     else
          ID.style.display = "";
      }
function select_all(value)
{
var text_val=eval(document.getElementById(value));
text_val.focus();
text_val.select();
}

