var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
  try {
  xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
 } catch (e) {
  try {
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  } catch (E) {
   xmlhttp=false
  }
 }
@else
 xmlhttp=false
@end @*/


if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 try {
  xmlhttp = new XMLHttpRequest();
 } catch (e) {
  xmlhttp=false
 }
}

function isAvailable(input) {
	  var usernameField = document.getElementById("login");
    	  var username = usernameField.value;
	  if (username != '') {
		  var availability = document.getElementById("available");
		  if (lang) url= base_url + "/" + lang + "/ajax/isavailablelogin/"+username;
		  else url= base_url + "/ajax/isavailablelogin/"+username;
		  xmlhttp.open("GET",url,true)
		  xmlhttp.onreadystatechange=function() {
		  	if (xmlhttp.readyState==4) {
				chkbx = xmlhttp.responseText;
				availability.innerHTML = chkbx;
			  }
		  }
		  xmlhttp.setRequestHeader('Accept','message/x-formresult')
		  xmlhttp.send(null)
		  return false
	}
}

function ocultar(id) {
	var ocultar = document.getElementById(id);
	ocultar.style.display = 'none';
}
function mostrar(id) {
	var mostrar = document.getElementById(id);
	mostrar.style.display = 'block';
}

function showInline(id) {
	var mostrar = document.getElementById(id);
	mostrar.style.display = 'inline';
}
function addclassname(id1, id2, clase) {
	document.getElementById(id1).className=clase;
	document.getElementById(id2).className='';
}

Array.prototype.contains = function (ele) {
    for (var i = 0; i < this.length; i++) {
        if (this[i] == ele) {
            return true;
        }
    }
    return false;
};

Array.prototype.remove = function (ele) {
    var arr = new Array();
    var count = 0;
    for (var i = 0; i < this.length; i++) {
        if (this[i] != ele) {
            arr[count] = this[i];
            count++;
        }
    }
    return arr;
};
