   	function checkForLoginError() {
	   	query = window.location.search.substr(1).split("&");	
			if (query == 'invalid_user') alert('Invalid User Name');
			if (query == 'invalid_pass') alert('Invalid Password');
			if (query == 'norecord') alert('Could not locate agent master record for login name.');
			if (query == 'notactive') alert('Your contract has been made inactive. Please contact our helpdesk at TPN on 0861 876 000 for further information.');
			if (query == 'suspended') alert('Your contract has been suspended. Please contact our helpdesk at TPN on 0861 876 000 for further information.');
			if (query == 'expired') alert('Your contract has expired. Please contact our helpdesk at TPN on 0861 876 000 for further information.');
			if (query == 'blacklisted') alert('Your IP address has been blacklisted. Please contact our helpdesk at TPN on 0861 876 000 for further information.');
			return false;
		}
		
		var loginBusy=false;
		
		function doLogin() {
			if (loginBusy == false) {
				loginBusy=true;
				document.forms[0].trigger.value='sub_GlbLogon';
				document.forms[0].submit();
				return false;
			}
		}
		
		function checkForEnter() {
			if (window.event.keyCode == '13') doLogin();
		}
		
		function setMainImageSource() {
		  var ran_number=0;
		  while(ran_number == 0) {
        ran_number = Math.floor(Math.random()*4);
      }
       
		  document.getElementById('MainImage').src = '/website/images/main'+ran_number+'.jpg';
		  if (ran_number == 1) setDisplayText("1000mē in downtown Johannesburg","R12 500");
		  if (ran_number == 2) setDisplayText("798mē house in a secure neighborhood","R15 700");
		  if (ran_number == 3) setDisplayText("400mē A-Grade office in Sandton","R40 000");
    }
    
    function setDisplayText(text,rental) {
      if (document.getElementById != null && document.getElementById('picdesc') != null) {
        if (document.getElementById('picdesc').textContent != null) 
          document.getElementById('picdesc').textContent = text;
        else if (document.getElementById('picdesc').innerText != null)
          document.getElementById('picdesc').innerText = text;
      }
      if (document.getElementById != null && document.getElementById('picprice') != null) {
        if (document.getElementById('picprice').textContent != null) 
          document.getElementById('picprice').textContent = rental;
        else if (document.getElementById('picprice').innerText != null)
          document.getElementById('picprice').innerText = rental;
      }
    }

    var myimages=new Array();
    function preloadimages(){
      for (i=0;i<preloadimages.arguments.length;i++){
        myimages[i]=new Image();
        myimages[i].src=preloadimages.arguments[i];
      }
    }

    preloadimages("/website/images/bg_header5.png","/website/images/key.gif");
