// JavaScript Document
function isIdAvailable(val){
    if(val){
        var a = document.getElementById("avail");
		if(val.indexOf(" ") >= 0){
			with(a.style){
				textDecoration = "none";
				color = "red";
			}
	        a.innerHTML = "Whitespace Not Allowed!";
			return;
		}
        with(a.style){
            textDecoration = "none";
            color = "black";
        }
        a.innerHTML = "checking availability...";
        ajax.callurl("process.php?action=idcheck&u=" + val, "lia");
        ajax.obj = a;
    }
}

function loadZones(country){
	if(country){
		document.getElementById('zonelabel').style.visibility = "visible";
		document.getElementById('zonecol').style.visibility = "visible";
		ajax.callurl("process.php?action=zones&c="+country, "zn");
	}
	else{
		document.getElementById('zonelabel').style.visibility = "hidden";
		document.getElementById('zonecol').style.visibility = "hidden";
	}
}

function populateList(obj, ops){
	obj.options.length = 1;
	var o = ops.split('|');
	var ol = o.length;
	if(o[0]){
		for(var i = 0; i < ol; i++){
			obj.options[i + 1] = new Option(o[i], o[i], false, false);
		}
	}
}

function countChars(obj){ document.getElementById(obj.name).innerHTML = obj.value.length; }