// No rightclick script v.2.5
// (c) 1998 barts1000
// barts1000@aol.com
// Don't delete this header!

var message="Sorry, that function is disabled.\n\nContents & Graphics Copyright ©Turquoise Moon Trading 173 (Pty) Ltd\nOur work is not Public Domain, and should NOT be taken from this site."; // Message for the alert box

// Don't edit below!

function click(e) {
if (document.all) {
if (event.button == 2) {
alert(message);
return false;
}
}
if (document.layers) {
if (e.which == 3) {
alert(message);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;

function bookmarksite(url, title){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}

function clearFields() {
	document.all.Username.focus();
	document.all.Username.value = "";
	document.all.Password.value = "";
}


function write_it(status_text) {
	window.status=status_text;
}

function setFormAction(selObj){ 
	location.href = selObj.value; 
} 

function getObject( obj ) {

  // step 1
  if ( document.getElementById ) {
    obj = document.getElementById( obj );

  // step 2
  } else if ( document.all ) {
    obj = document.all.item( obj );

  //step 3
  } else {
    obj = null;
  }

  //step 4
  return obj;
}

function displayObject( obj, show ) {

  // step 1
  obj = getObject( obj );
  if (obj==null) return;

  // step 2
  obj.style.display = show ? 'block' : 'none';
  obj.style.visibility = show ? 'visible' : 'hidden';
 }
 
function switchDivision(name)	{

	if (prev == '') {
		eval("document.all." + name + ".style.display = ''");
		prev = 'home';
		eval("document.all." + prev + ".style.display = 'none'");
		}
	
	else	{
		eval("document.all." + name + ".style.display = ''");
		eval("document.all." + prev + ".style.display = 'none'");
		}
	prev = name;

	}


function toggleDivision(name)	{

	if (navigator.appName == "Netscape")	{
		if (eval("document.layers." + name + ".display == 'none'")) {
			eval("document.layers." + name + ".display = ''");
			}
		else {
			eval("document.layers." + name + ".display = 'none'");
			}
		}

	else	{
		if (eval("document.all." + name + ".style.display == 'none'")) {
			eval("document.all." + name + ".style.display = ''");
			}
		else {
			eval("document.all." + name + ".style.display = 'none'");
			}
	}
	}


function showDivision(which_division)
	{
	if (navigator.appName == "Netscape")
		{
		document.layers[which_division].display = "";
		}
	else
		{
		document.all[which_division].style.display = "";
		}
	}


function hideDivision(which_division)
	{
	if (navigator.appName == "Netscape")
		{
		document.layers[which_division].display = "none";
		}
	else
		{
		document.all[which_division].style.display = "none";
		}
	}
	
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()	{
	if (navigator.appName == "Netscape") {
		window.print();
	}
	else {
		document.all.print.style.display = "none";
		window.print();
	}
}

var spr = false;
function doSaveAs(){
if (document.execCommand){
if (spr){document.execCommand("SaveAs");}
}
else{}
}


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 updateE(limit) {
   var old = document.frm1.counterE.value;
   document.frm1.counterE.value=limit-document.frm1.Overview.value.length;
   if(document.frm1.counterE.value < 0 && old >= 0) {
     if(document.styleSheets) {
       document.frm1.counterE.style.color = '#ff0000'; } }
   else if(document.frm1.counterE.value >= 0 && old < 0
	   && document.styleSheets ) {
       document.frm1.counterE.style.color = '#000000'; }
}

function validateForm(form, action) {

	form.action = action;
	
	if (form.DisclaimerRead.checked == false) {
  		alert('Please read and accept the Terms and Conditions before continuing.');
    	form.DisclaimerRead.focus();
      	return false;
	}
	
    if (form.Company.value == '') {
		alert('Please supply a Company Name');
		form.Company.focus();
		return false;
    }
	
    if (form.PhysicalAddress.value == '') {
      alert('Please supply a Physical Address');
      form.PhysicalAddress.focus();
      return false;
	}
	
    if (form.Town.value == '') {
      alert('Please supply a City / Town');
      form.Town.focus();
      return false;
    }			
	
    if (form.ProvinceID.selectedIndex == 0) {
  		if (form.CountryID.value == 195 ) {
			alert('Please make a Province selection');
	       	form.ProvinceID.focus();
    	   	return false;
		}
	}
	if (form.CountryID.selectedIndex == 0) {
		alert('Please make a Country selection');
       	form.CountryID.focus();
       	return false;
    }
	
    if (form.CategoryID.selectedIndex == 0) {
		alert('Please make a Category selection');
       	form.CategoryID.focus();
       	return false;
    }
	if (form.SubCategoryID.value == 0) {
		alert('Please make a Sub Category selection');
       	form.SubCategoryID.focus();
       	return false;
    }
	
	var arSelected = new Array();

    while (form.SubCategoryID.selectedIndex != -1)
    {
        arSelected.push(form.SubCategoryID.options[form.SubCategoryID.selectedIndex].value);
        form.SubCategoryID.options[form.SubCategoryID.selectedIndex].selected = false;
    }
	
	for (var i=0; i<form.SubCategoryID.length; i++) {
		for (var j=0; j<arSelected.length; j++) {
			if (form.SubCategoryID.options[i].value == arSelected[j]) {
				form.SubCategoryID.options[i].selected = true;
				arSelected[j] = 0;
			}
		}
	}
	
    if (form.PostalAddress.value == '') {
      alert('Please supply a Postal Address');
      form.PostalAddress.focus();
      return false;
	}
	
    if (form.Telephone.value == '') {
      alert('Please supply a Telephone Number');
      form.Telephone.focus();
      return false;
	}
	
    if (form.Fax.value == '') {
      alert('Please supply a Fax Number');
      form.Fax.focus();
      return false;
	}
	
    if (form.Overview.value == '') {
      alert('Please supply an Overview/Introduction');
      form.Overview.focus();
      return false;
	}
	
    if (form.FirstName.value == '') {
      alert('Please supply a First Name for your Contact Person');
      form.FirstName.focus();
      return false;
	}

    if (form.LastName.value == '') {
      alert('Please supply a Last Name for your Contact Person');
      form.LastName.focus();
      return false;
	}

    if (form.Designation.value == '') {
      alert('Please supply a Designation for your Contact Person');
      form.Designation.focus();
      return false;
	}

    if (form.Cellphone.value == '') {
      alert('Please supply a Cellphone Number for your Contact Person');
      form.Cellphone.focus();
      return false;
	}
		
    if (form.Email.value == '') {
      alert('Please supply an e-mail address');
      form.Email.focus();
      return false;
    }
    var splitted = form.Email.value.match("^(.+)@(.+)$");
    if(splitted == null) {
    	alert('Please supply a valid e-mail address');
        form.Email.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');
        form.Email.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');
            form.Email.focus();
    	    return false;
            }
      }
    }

    myUsername = form.Username.value
    if (myUsername == '') {
      alert('Please supply a username');
      form.Username.focus();
      return false;
    }
    var pattern = /^[a-z0-9_\s]+$/i;
    var StringMatches = myUsername.match(pattern);
    if (!StringMatches) {
      alert('Please supply a username with alphanumeric characters only');
        form.Username.focus();
      return false;
    }
    
    myPassword = form.Password.value;
    if (myPassword == '') {
      alert('Please supply a password');
      form.Password.focus();
      return false;
    }
    var pattern = /^[a-z0-9_\s]+$/i;
    var StringMatches = myPassword.match(pattern);
    if (!StringMatches) {
      alert('Please supply a password with alphanumeric characters only');
      form.Password.focus();
      return false;
    }
  return true;
}

function validateSubscriberForm(form, action) {

	form.action = action;
	
    if (form.Company.value == '') {
		alert('Please supply a Company Name');
		form.Company.focus();
		return false;
    }
	
    if (form.PhysicalAddress.value == '') {
      alert('Please supply a Physical Address');
      form.PhysicalAddress.focus();
      return false;
	}
	
    if (form.Town.value == '') {
      alert('Please supply a City / Town');
      form.Town.focus();
      return false;
    }			
	
    if (form.ProvinceID.selectedIndex == 0) {
  		if (form.CountryID.value == 195 ) {
			alert('Please make a Province selection');
	       	form.ProvinceID.focus();
    	   	return false;
		}
	}
	if (form.CountryID.selectedIndex == 0) {
		alert('Please make a Country selection');
       	form.CountryID.focus();
       	return false;
    }
	
    if (form.CategoryID.selectedIndex == 0) {
		alert('Please make a Category selection');
       	form.CategoryID.focus();
       	return false;
    }
	
    if (form.Size.selectedIndex == 0) {
		alert('Please make a Size of Enterprise selection');
       	form.Size.focus();
       	return false;
    }
	
    if (form.PostalAddress.value == '') {
      alert('Please supply a Postal Address');
      form.PostalAddress.focus();
      return false;
	}
	
    if (form.Telephone.value == '') {
      alert('Please supply a Telephone Number');
      form.Telephone.focus();
      return false;
	}
	
    if (form.Fax.value == '') {
      alert('Please supply a Fax Number');
      form.Fax.focus();
      return false;
	}
	
    if (form.FirstName.value == '') {
      alert('Please supply a First Name for your Contact Person');
      form.FirstName.focus();
      return false;
	}

    if (form.LastName.value == '') {
      alert('Please supply a Last Name for your Contact Person');
      form.LastName.focus();
      return false;
	}

    if (form.Designation.value == '') {
      alert('Please supply a Designation for your Contact Person');
      form.Designation.focus();
      return false;
	}
	if (form.Cellphone.value == '') {
      alert('Please supply a Cellphone Number for your Contact Person');
      form.Cellphone.focus();
      return false;
	}
		
    if (form.Email.value == '') {
      alert('Please supply an e-mail address');
      form.Email.focus();
      return false;
    }
    var splitted = form.Email.value.match("^(.+)@(.+)$");
    if(splitted == null) {
    	alert('Please supply a valid e-mail address');
        form.Email.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');
        form.Email.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');
            form.Email.focus();
    	    return false;
            }
      }
    }

    myUsername = form.Username.value
    if (myUsername == '') {
      alert('Please supply a username');
      form.Username.focus();
      return false;
    }
    var pattern = /^[a-z0-9_\s]+$/i;
    var StringMatches = myUsername.match(pattern);
    if (!StringMatches) {
      alert('Please supply a username with alphanumeric characters only');
        form.Username.focus();
      return false;
    }
    
    myPassword = form.Password.value;
    if (myPassword == '') {
      alert('Please supply a password');
      form.Password.focus();
      return false;
    }
    var pattern = /^[a-z0-9_\s]+$/i;
    var StringMatches = myPassword.match(pattern);
    if (!StringMatches) {
      alert('Please supply a password with alphanumeric characters only');
      form.Password.focus();
      return false;
    }
  return true;
}

function validateLoginForm(form) {
    myUsername = form.Username.value
    if (myUsername == '') {
      alert('Please supply a username');
      form.Username.focus();
      return false;
    }
    var pattern = /^[a-z0-9_\s]+$/i;
    var StringMatches = myUsername.match(pattern);
    if (!StringMatches) {
      alert('Please supply a username with alphanumeric characters only');
        form.Username.focus();
      return false;
    }
    
    myPassword = form.Password.value;
    if (myPassword == '') {
      alert('Please supply a password');
      form.Password.focus();
      return false;
    }
    var pattern = /^[a-z0-9_\s]+$/i;
    var StringMatches = myPassword.match(pattern);
    if (!StringMatches) {
      alert('Please supply a password with alphanumeric characters only');
      form.Password.focus();
      return false;
    }
  return true;
}

function validateProductForm(form) {

    if (form.Product.value == '') {
      alert('Please enter a Product');
      form.Product.focus();
      return false;
	}
  return true;
}

function validateClassifiedForm(form, action) {

	if (form.CategoryID.selectedIndex == 0) {
		alert('Please make a Category selection');
       	form.CategoryID.focus();
       	return false;
    }
	
	if (form.SubCategoryID.value == 0) {
		alert('Please make a Sub Category selection');
       	form.SubCategoryID.focus();
       	return false;
    }
	
	var arSelected = new Array();

    while (form.SubCategoryID.selectedIndex != -1)
    {
        arSelected.push(form.SubCategoryID.options[form.SubCategoryID.selectedIndex].value);
        form.SubCategoryID.options[form.SubCategoryID.selectedIndex].selected = false;
    }
	
	for (var i=0; i<form.SubCategoryID.length; i++) {
		for (var j=0; j<arSelected.length; j++) {
			if (form.SubCategoryID.options[i].value == arSelected[j]) {
				form.SubCategoryID.options[i].selected = true;
				arSelected[j] = 0;
			}
		}
	}
	
	if (form.Title.value == '') {
      alert('Please supply a Title');
      form.Title.focus();
      return false;
	}
	
	if (form.Overview.value == '') {
      alert('Please supply Content');
      form.Overview.focus();
      return false;
	}
	
	form.action = action;
  return true;
}

function validateOtherForm(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 != '') {
    			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 validateLoginDetailsForm(form) {
    myUsername = form.Username.value
    if (myUsername == '') {
      alert('Please supply a username');
      form.Username.focus();
      return false;
    }
    var pattern = /^[a-z0-9_\s]+$/i;
    var StringMatches = myUsername.match(pattern);
    if (!StringMatches) {
      alert('Please supply a username with alphanumeric characters only');
        form.Username.focus();
      return false;
    }
    
    myPassword = form.Password.value;
    if (myPassword == '') {
      alert('Please supply a password');
      form.Password.focus();
      return false;
    }
    var pattern = /^[a-z0-9_\s]+$/i;
    var StringMatches = myPassword.match(pattern);
    if (!StringMatches) {
      alert('Please supply a password with alphanumeric characters only');
      form.Password.focus();
      return false;
    }
	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 != '') {
    			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 validateSMSForm(form) {
  for (var e = 0; e < form.elements.length; e++) {
    var el = form.elements[e];
    
    if (el.type == 'text' && el.name == 'SMSID') {
    myUsername = el.value;
    if (el.value == '') {
      alert('Verskaf asb. \'n gebruikernaam');
      el.focus();
      return false;
    }
    }
    
    if (el.type == 'password' && el.name == 'SMSPassword') {
    myPassword = el.value;
    if (el.value == '') {
      alert('Verskaf asb. \'n wagwoord');
      el.focus();
      return false;
    }
    var pattern = /^[a-z0-9_\s]+$/i;
    var StringMatches = myPassword.match(pattern);
    if (!StringMatches) {
      alert('Verskaf asb. \'n wagwoord met slegs alfanumeriese karakters');
        el.focus();
      return false;
    }
    }
}
  return true;
}

function validateEmailForm(form) {
  for (var e = 0; e < form.elements.length; e++) {
    var el = form.elements[e];
    
    if (el.type == 'text' && (el.name == 'AfrOpskrif' || el.name == 'EngHeading')) {
    if (el.value == '') {
      alert('Verskaf asb. \'n opskrif');
      el.focus();
      return false;
    }
    }
    
    if (el.type == 'textarea') { 
      if (el.value == '') {
        alert('Voltooi asb. die inhoud');
        el.focus();
        return false;
      }
    }
}
  return true;
}


function validateAppFormE(form) {
  for (var e = 0; e < form.elements.length; e++) {
    var el = form.elements[e];

    if (el.type == 'text' && el.name == 'Username') {
    myUsername = el.value;
    if (el.value == '') {
      alert('Please supply a username');
      el.focus();
      return false;
    }
    var pattern = /^[a-z0-9_\s]+$/i;
    var StringMatches = myUsername.match(pattern);
    if (!StringMatches) {
      alert('Please supply a username with alphanumeric characters only');
        el.focus();
      return false;
    }
    }
    
    if (el.type == 'password' && el.name == 'Password') {
    myPassword = el.value;
    if (el.value == '') {
      alert('Please supply a password');
      el.focus();
      return false;
    }
    var pattern = /^[a-z0-9_\s]+$/i;
    var StringMatches = myPassword.match(pattern);
    if (!StringMatches) {
      alert('Please supply a password with alphanumeric characters only');
        el.focus();
      return false;
    }
    }
    
    
    
    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;
            }
      }
    }
    }
    
    if (el.type == 'text' && el.name == 'EmailN' && el.value != '') {
    email = el.value;
    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;
            }
      }
    }
    }
  
    if (el.type == 'text' && el.name != 'WebsiteURL' && el.name != 'EmailN') { 
      if (el.value == '') {
        alert('Please fill out all the text fields');
        el.focus();
        return false;
      }
    }
    else if (el.type == 'textarea') { 
      if (el.value == '') {
        alert('Please complete all the text areas');
        el.focus();
        return false;
      }
    }
    else if (el.type.indexOf('select') != -1) {
      if (el.selectedIndex == -1 || el.selectedIndex == 0 && el.name != 'DepositConfirm') {
        alert('Please make a selection');
        el.focus();
        return false;
      }
    }
    else if (el.type == 'radio') {
      var group = form[el.name];
      var checked = false;
      if (!group.length)
        checked = el.checked;
      else
        for (var r = 0; r < group.length; r++)
          if ((checked = group[r].checked))
            break;
      if (!checked) {
        alert('Please select a radio button');
        el.focus();
        return false;
      }
    }
    else if (el.type == 'checkbox') {
      var group = form[el.name];
      if (group.length) {
        var checked = false;
        for (var r = 0; r < group.length; r++)
          if ((checked = group[r].checked))
            break;
        if (!checked) {
          alert('Please check at least one of the checkboxes');
          el.focus();
          return false;
        }
      }
    }
  }
  return true;
}


function validateAppFormA(form) {
  for (var e = 0; e < form.elements.length; e++) {
    var el = form.elements[e];
    
    if (el.type == 'text' && el.name == 'Username') {
    myUsername = el.value;
    if (el.value == '') {
      alert('Verskaf asb. \'n gebruikernaam');
      el.focus();
      return false;
    }
    var pattern = /^[a-z0-9_\s]+$/i;
    var StringMatches = myUsername.match(pattern);
    if (!StringMatches) {
      alert('Verskaf asb. \'n gebruikernaam met slegs alfanumeriese karakters');
        el.focus();
      return false;
    }
    }
    
    if (el.type == 'password' && el.name == 'Password') {
    myPassword = el.value;
    if (el.value == '') {
      alert('Verskaf asb. \'n wagwoord');
      el.focus();
      return false;
    }
    var pattern = /^[a-z0-9_\s]+$/i;
    var StringMatches = myPassword.match(pattern);
    if (!StringMatches) {
      alert('Verskaf asb. \'n wagwoord met slegs alfanumeriese karakters');
        el.focus();
      return false;
    }
    }
    
    
    
    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;
            }
      }
    }
    }

    if (el.type == 'text' && el.name == 'EmailN' && el.value != '') {
    email = el.value;
    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;
            }
      }
    }
    }

    if (el.type == 'text' && el.name != 'WebsiteURL' && el.name != 'EmailN') { 
      if (el.value == '') {
        alert('Voltooi asb. al die teksvelde');
        el.focus();
        return false;
      }
    }
    else if (el.type == 'textarea') { 
      if (el.value == '') {
        alert('Voltooi asb. al die teksareas');
        el.focus();
        return false;
      }
    }
    else if (el.type.indexOf('select') != -1) {
      if (el.selectedIndex == -1 || el.selectedIndex == 0 && el.name != 'DepositConfirm') {
        alert('Maak asb. \'n keuse');
        el.focus();
        return false;
      }
    }
    else if (el.type == 'radio') {
      var group = form[el.name];
      var checked = false;
      if (!group.length)
        checked = el.checked;
      else
        for (var r = 0; r < group.length; r++)
          if ((checked = group[r].checked))
            break;
      if (!checked) {
        alert('Maak asb. \'n keuse');
        el.focus();
        return false;
      }
    }
    else if (el.type == 'checkbox') {
      var group = form[el.name];
      if (group.length) {
        var checked = false;
        for (var r = 0; r < group.length; r++)
          if ((checked = group[r].checked))
            break;
        if (!checked) {
          alert('Merk asb. ten minste een opsie');
          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+""
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=no,scrollbars=yes,width=700,height=600");
}


function newWindow2(href) {

	window.open(href,"","toolbar=no,status=no,menubar=no,resizable=no,scrollbars=no,width=500,height=200");
}

function newWindow3(href) {

	window.open(href,"","toolbar=no,status=no,menubar=no,resizable=no,scrollbars=no,width=10,height=10");
}

function newWindow4(href) {

	window.open(href,"","toolbar=no,status=no,menubar=no,resizable=yes,scrollbars=yes,width=840,height=600");
}

function newWindow5(href) {

	window.open(href,"","toolbar=no,status=no,menubar=no,resizable=yes,scrollbars=yes,width=750,height=600");
}

function newWindow6(href) {

	window.open(href,"","toolbar=no,status=no,menubar=no,resizable=no,scrollbars=no,width=250,height=300");
}

function newWindow7(href) {

	window.open(href,"","toolbar=no,status=no,menubar=no,resizable=no,scrollbars=no,width=600,height=500");
}

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 myVoid() { ; } // do nothing

function DatePosition(dateString,dateType) {
/*
   function DatePosition 
   parameters: dateString dateType
   returns: integer (-1, 0, 1)
   
   dateString is a date passed as a string in the following
   formats:

   type 1 : 19970529
   type 2 : 970529
   type 3 : 29/05/1997
   type 4 : 29/05/97
   type 5 : 05/29/1997
   type 6 : 05291997
   type 7 : 052997
   
   dateType is a numeric integer from 1 to 7, representing
   the type of dateString passed, as defined above.

   Returns -1 if the date passed is behind todays date
   Returns 0 if the date passed is equal to todays date
   or if dateType is not 1 to 7
   Returns 1 if the date passed is ahead of todays date
   
   Added Y2K checking.  (Works for any century cross over)
*/


    var now = new Date();
    var today = new Date(now.getYear(),now.getMonth(),now.getDate());
    var century = parseInt(now.getYear()/100)*100;
        
    if (dateType == 1)
        var date = new Date(dateString.substring(0,4),
                            dateString.substring(4,6)-1,
                            dateString.substring(6,8));
    else if (dateType == 2)
    {
        if ((now.getYear()%100)>=parseInt(dateString.substring(0,2)))
        {
            var date = new Date(century+parseInt(dateString.substring(4,6)),
                            parseInt(dateString.substring(2,4)-1),
                            dateString.substring(4,6));
        }
        else
        {
            var date = new Date(century-100+parseInt(dateString.substring(0,2)),
                            parseInt(dateString.substring(2,4)-1),
                            dateString.substring(4,6));
        }
        
    }
    else if (dateType == 3)
        var date = new Date(dateString.substring(6,10),
                            dateString.substring(3,5)-1,
                            dateString.substring(0,2));
    else if (dateType == 4)
    {
        if ((now.getYear()%100)>=parseInt(dateString.substring(6,8)))
        {
            document.write(century+parseInt(dateString.substring(6,8)),'<P>');
            var date = new Date(century+parseInt(dateString.substring(4,6)),
                            parseInt(dateString.substring(3,5)-1),
                            dateString.substring(0,2));
        }
        else
        {
            document.write(century-100+parseInt(dateString.substring(6,8)),'<P>');
            var date = new Date(century-100+parseInt(dateString.substring(4,6)),
                            parseInt(dateString.substring(3,5)-1),
                            dateString.substring(0,2));
        }
        
    }
    else if (dateType == 5)
        var date = new Date(dateString.substring(6,10),
                            dateString.substring(0,2)-1,
                            dateString.substring(3,5));
    else if (dateType == 6)
        var date = new Date(dateString.substring(4,8),
                            dateString.substring(0,2)-1,
                            dateString.substring(2,4));
    else if (dateType == 7)
    {
        if ((now.getYear()%100)>=parseInt(dateString.substring(4,6)))
        {
            document.write('datestring Century:',century+parseInt(dateString.substring(4,6)),'<P>');
            var date = new Date(century+parseInt(dateString.substring(4,6)),
                            parseInt(dateString.substring(0,2)-1),
                            dateString.substring(2,4));
        }
        else
        {
            document.write('datestring Century:',century-100+parseInt(dateString.substring(4,6)),'<P>');
            var date = new Date(century-100+parseInt(dateString.substring(4,6)),
                            parseInt(dateString.substring(0,2)-1),
                            dateString.substring(2,4));
        }
        
    }
    else
        return false;

    if (date < today)
    {
        return -1;
    }
    else if (date > today)
    {
        return 1;
        
    }
    else
    {
        return 0;
    }
}


