function write_it(status_text) {
	window.status=status_text;
}


function displaySubs(the_sub) {
	if (document.getElementById(the_sub).style.display == "") {
		document.getElementById(the_sub).style.display = "none";return
	}
	
	for (i=0;i<subs_array.length;i++) {
		var my_sub = document.getElementById(subs_array[i]);
		my_sub.style.display = "none";
		}
	document.getElementById(the_sub).style.display = "";
}
	
function printForm()	{
	document.all.print.style.display = 'none';
	window.print();
}

function displayDate()	{
var today = new Date();
var year  = today.getYear();
var month = today.getMonth() + 1;
var day  = today.getDate();
if (day < 10)	{
	day = "0" + day;
	}
if (month < 10)	{
	month = "0" + month;
	}
mydate = day + "/" + month + "/" + year;
window.document.forms[0].Date.value = mydate;
}

function validateFormE(form) {
  for (var e = 0; e < form.elements.length; e++) {
    var el = form.elements[e];

    
    if (el.type == 'text' && el.name == 'Email') {
    email = el.value;
    if (el.value == '') {
      alert('Please supply an e-mail address');
      el.focus();
      return false;
    }
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) {
    	alert('Please supply a valid e-mail address');
        el.focus();
    	return false;
    }
    if(splitted[1] != null) {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) {
    	alert('Please supply a valid e-mail address');
        el.focus();
    	return false;
      }
    }
    if(splitted[2] != null) {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) {
      var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) {
    	    alert('Please supply a valid e-mail address');
            el.focus();
    	    return false;
            }
      }
    }
    }
}
  return true;
}


function validateFormA(form) {
  for (var e = 0; e < form.elements.length; e++) {
    var el = form.elements[e];
    
    if (el.type == 'text' && el.name == 'Email') {
    email = el.value;
    if (el.value == '') {
      alert('Verskaf asb. \'n e-pos adres');
      el.focus();
      return false;
    }
    var splitted = email.match("^(.+)@(.+)$");
    if(splitted == null) {
    	alert('Verskaf asb. \'n geldige e-pos adres');
        el.focus();
    	return false;
    }
    if(splitted[1] != null) {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) {
    	alert('Verskaf asb. \'n geldige e-pos adres');
        el.focus();
    	return false;
      }
    }
    if(splitted[2] != null) {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) {
      var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) {
    	    alert('Verskaf asb. \'n geldige e-pos adres');
            el.focus();
    	    return false;
            }
      }
    }
    }
}
  return true;
}

function ValidDate(dateStr, e) {


var datePat = /^(\d{4})(\/)(\d{2})\2(\d{2})$/;
var DateArray = dateStr.match(datePat);

if (DateArray == null) {
alert("Date is not in a valid format.");
eval("document.all.txtDate" + e + ".value = ''");
eval("document.all.txtDate" + e + ".focus()");
return false;
}

return true;
}

function isValidDate(dateStr, e) {
// Checks for the following valid date formats:
// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY
// Also separates date into month, day, and year variables


var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;


var matchArray = dateStr.match(datePat); // is the format ok?
if (matchArray == null) {
alert("Date is not in a valid format.");
eval("document.all.txtDate" + e + ".value = ''");
eval("document.all.txtDate" + e + ".focus()");
return false;
}
day = matchArray[1]; // parse date into variables
month = matchArray[3];
year = matchArray[4];

if (month < 1 || month > 12) { // check month range
alert("Month must be between 1 and 12.");
return false;
}
if (day < 1 || day > 31) {
alert("Day must be between 1 and 31.");
return false;
}
if ((month==4 || month==6 || month==9 || month==11) && day==31) {
alert("Month "+month+" doesn't have 31 days!")
return false
}
if (month == 2) { // check for february 29th
var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
if (day>29 || (day==29 && !isleap)) {
alert("February " + year + " doesn't have " + day + " days!");
return false;
   }
}
return true;  // date is valid
}

var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")

function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
//change font size here
var cdate=""+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" "+hours+":"+minutes+":"+seconds+" "+dn+" " + " &nbsp;"
if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock").innerHTML=cdate
else
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate()
function timeDisplay(){
if (document.all||document.getElementById)
setInterval("getthedate()",1000)
}

function newWindow(href) {

	window.open(href,"","toolbar=no,status=no,menubar=no,resizable=yes,scrollbars=yes,width=600,height=500");
}


function newWindow2(href) {

	window.open(href,"","toolbar=no,status=no,menubar=no,resizable=no,scrollbars=no,width=550,height=650");
}

function newWindow3(href) {

	window.open(href,"","toolbar=no,status=no,menubar=no,resizable=no,scrollbars=no,width=10,height=10");
}

function downloadInstructions() {
	alert("Save the zip file that will open next, to your hard drive.\n\r" + 
	"Unzip the file to a new folder.\n\r" +
	"Open the .htm file."); 

}

function aflaaiInstruksies() {
	alert("Stoor die zip lêer wat volgende gaan verskyn, op jou harde skyf.\n\r" + 
	"\"Unzip\" die lêer na 'n nuwe \"folder\".\n\r" +
	"Maak die .htm lêer oop."); 

}

function printPage() {
	if (navigator.appName == "Netscape") {
		window.print();
	}
	else {
		document.all.print.style.display = "none";
		window.print();
	}
}

