
	
	function hideLoginBox(){
			
		var logo=document.getElementById("loginBox");
		logo.style.opacity=0;
		
	}
	
	function showLoginBox(){
	
		var fade=0,logo=document.getElementById("loginBox").style,ms=(logo.opacity==0)?0:1,pace=setInterval(Fade,5);
		
		function Fade(){
			if(fade<100){
				fade+=1;
				if(ms){
					logo.filter="alpha(opacity="+fade+")";
				}
				else{
					logo.opacity=(fade/100);
				}
			}
			else{
				clearInterval(pace);
			}
		}
		
		document.getElementById("username").select();
		
	}
	
	function showAgentImage(arg){
			
		var el = document.getElementById('pop');
		el.innerHTML = "<img src=\"img/agents/" + arg + ".jpg\" onerror=\"this.src='img/agents/ni.jpg'\" />";
		el.style.display = 'block';
	
	}

	function checklength(arg){
		if(arg.value.length > 199){
			alert('<ini:getProperty baseName="messages" name="200CharsPerNote"/>');
		}
		arg.value = arg.value.substring(0,199);		
	}
	
	function checkArgLength(arg){
		if(arg.length==5){
			ajaxGetAgentNameFromId(arg);
		}
	}
	
	function ajaxGetAgentNameFromId(arg){
		
		var xmlHttp = null;
		
		try{// Firefox, Opera 8.0+, Safari
			xmlHttp = new XMLHttpRequest();
		}
		catch(e){// Internet Explorer 6+
			try{
				xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e){// Internet Explorer 5.5+
				try{
					xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e){
					alert("Your browser does not support AJAX!");
					return false;
				}
			}
		}
		
		
		xmlHttp.onreadystatechange = function(){	
		
			
			if(xmlHttp.readyState==4){
			
				document.getElementById("agentName").value = xmlHttp.responseText;
				
			}
		}
		var strUrl = "ajaxGetAgentName.do?aid=" + arg;
		
		xmlHttp.open("GET", strUrl, true);
		xmlHttp.send(null);	
		
		showAgentImage(arg);
		
	}
	
	function deleteDependant(id, aid){
		if(confirm("Are you sure you want to delete this dependancy?")){
			window.location="deleteDependancy.do?id=" + id + "&aid=" + aid
		}
	}
	
	function addDependant(){
		
		if(confirm("Are you sure you want to add this dependant?")){
				document.addDependantForm.submit();
		}
	}
	
	