function get_Image()
	{
	var img_rnd = new Array ("images/footer_images/footer_img1.jpg", "images/footer_images/footer_img2.jpg", "images/footer_images/footer_img3.jpg", "images/footer_images/footer_img4.jpg", "images/footer_images/footer_img5.jpg");
	var i = Math.round(4*Math.random());
	document.write('<td colspan = "3" align = "center" height = "110"><IMG SRC="' + img_rnd[i] + '" border = "0" width = "759" height = "100" alt = "ExperienceSwaziland"></td>');
}

// ----------------------------------------------------------------------
// Javascript form validation routines.
// Author: Stephen Poley
//
// Simple routines to quickly pick up obvious typos.
// All validation routines return true if executed by an older browser:
// in this case validation must be left to the server.
//
// Update Aug 2004: have tested that IE 5.0 and IE 5.5 both support DOM model
// sufficiently well, so innerHTML option removed (redundant).
//
// Update Jun 2005: discovered that reason IE wasn't setting focus was
// due to an IE timing bug. Added 0.1 sec delay to fix.
//
// Update Oct 2005: minor tidy-up: unused parameter removed
// ----------------------------------------------------------------------

var nbsp = 160;    // non-breaking space char
var node_text = 3; // DOM text node-type
var emptyString = /^\s*$/
var glb_vfld;      // retain vfld for timer thread

// -----------------------------------------
//                  trim
// Trim leading/trailing whitespace off string
// -----------------------------------------

function trim(str)
{
  return str.replace(/^\s+|\s+$/g, '')
};


// -----------------------------------------
//                  setfocus
// Delayed focus setting to get around IE bug
// -----------------------------------------

function setFocusDelayed()
{
  glb_vfld.focus()
}

function setfocus(vfld)
{
  // save vfld in global variable so value retained when routine exits
  glb_vfld = vfld;
  setTimeout( 'setFocusDelayed()', 100 );
}


// -----------------------------------------
//                  msg
// Display warn/error message in HTML element
// commonCheck routine must have previously been called
// -----------------------------------------

function msg(fld,     // id of element to display message in
             msgtype, // class to give element ("warn" or "error")
             message) // string to display
{
  // setting an empty string can give problems if later set to a
  // non-empty string, so ensure a space present. (For Mozilla and Opera one could
  // simply use a space, but IE demands something more, like a non-breaking space.)
  var dispmessage;
  if (emptyString.test(message))
    dispmessage = String.fromCharCode(nbsp);
  else
    dispmessage = message;

  var elem = document.getElementById(fld);
  elem.firstChild.nodeValue = dispmessage;

  elem.className = msgtype;   // set the CSS class to adjust appearance of message
};

// -----------------------------------------
//            commonCheck
// Common code for all validation routines to:
// (a) check for older / less-equipped browsers
// (b) check if empty fields are required
// Returns true (validation passed),
//         false (validation failed) or
//         proceed (don't know yet)
// -----------------------------------------

var proceed = 2;

function commonCheck    (vfld,   // element to be validated
                         ifld,   // id of element to receive info/error msg
                         reqd)   // true if required
{
  if (!document.getElementById)
    return true;  // not available on this browser - leave validation to the server
  var elem = document.getElementById(ifld);
  if (!elem.firstChild)
    return true;  // not available on this browser
  if (elem.firstChild.nodeType != node_text)
    return true;  // ifld is wrong type of node

  if (emptyString.test(vfld.value)) {
    if (reqd) {
      msg (ifld, "error", "*");
      setfocus(vfld);
      return false;
    }
    else {
      msg (ifld, "warn", "");   // OK
      return true;
    }
  }
  return proceed;
}

// -----------------------------------------
//            validatePresent
// Validate if something has been entered
// Returns true if so
// -----------------------------------------

function validatePresent(vfld,   // element to be validated
                         ifld )  // id of element to receive info/error msg
{
  var stat = commonCheck (vfld, ifld, true);
  if (stat != proceed) return stat;
  msg (ifld, "warn", "");
  return true;

};

// -----------------------------------------

//              compareEmail

// -----------------------------------------


function compareEmail  (vfld,   // 1st email

                        vfld2,  // 2nd email

                        ifld)   // id of element to receive info/error msg

{

  if (vfld.value==vfld2.value) {

    return true;

  }

  msg (ifld, "error", "No match");

  return false;

};


// -----------------------------------------
//               validateEmail
// Validate if e-mail address
// Returns true if so (and also if could not be executed because of old browser)
// -----------------------------------------

function validateEmail  (vfld,   // element to be validated
                         ifld,   // id of element to receive info/error msg
                         reqd)   // true if required
{
  var stat = commonCheck (vfld, ifld, reqd);
  if (stat != proceed) return stat;

  var tfld = trim(vfld.value);  // value of field with whitespace trimmed off
  var email = /^[^@]+@[^@.]+\.[^@]*\w\w$/
  if (!email.test(tfld)) {
    msg (ifld, "error", "*");
    setfocus(vfld);
    return false;
  }

  var email2 = /^[A-Za-z][\w.-]+@\w[\w.-]+\.[\w.-]*[A-Za-z][A-Za-z]$/
  if (!email2.test(tfld))
    msg (ifld, "warn", "Unusual");
  else
    msg (ifld, "warn", "");
  return true;
};


// -----------------------------------------
//            validateTelnr
// Validate telephone number
// Returns true if so (and also if could not be executed because of old browser)
// Permits spaces, hyphens, brackets and leading +
// -----------------------------------------

function validateTelnr  (vfld,   // element to be validated
                         ifld,   // id of element to receive info/error msg
                         reqd)   // true if required
{
  var stat = commonCheck (vfld, ifld, reqd);
  if (stat != proceed) return stat;

  var tfld = trim(vfld.value);  // value of field with whitespace trimmed off
  var telnr = /^\+?[0-9 ()-]+[0-9]$/
  if (!telnr.test(tfld)) {
    msg (ifld, "error", "ERROR: not a valid telephone number. Characters permitted are digits, space ()- and leading +");
    setfocus(vfld);
    return false;
  }

  var numdigits = 0;
  for (var j=0; j<tfld.length; j++)
    if (tfld.charAt(j)>='0' && tfld.charAt(j)<='9') numdigits++;

  if (numdigits<6) {
    msg (ifld, "error", "ERROR: " + numdigits + " digits - too short");
    setfocus(vfld);
    return false;
  }

  if (numdigits>14)
    msg (ifld, "warn", numdigits + " digits - check if correct");
  else {
    if (numdigits<10)
      msg (ifld, "warn", "Only " + numdigits + " digits - check if correct");
    else
      msg (ifld, "warn", "");
  }
  return true;
};

// -----------------------------------------
//             validateAge
// Validate person's age
// Returns true if OK
// -----------------------------------------

function validateAge    (vfld,   // element to be validated
                         ifld,   // id of element to receive info/error msg
                         reqd)   // true if required
{
  var stat = commonCheck (vfld, ifld, reqd);
  if (stat != proceed) return stat;

  var tfld = trim(vfld.value);
  var ageRE = /^[0-9]{1,3}$/
  if (!ageRE.test(tfld)) {
    msg (ifld, "error", "ERROR: not a valid age");
    setfocus(vfld);
    return false;
  }

  if (tfld>=200) {
    msg (ifld, "error", "ERROR: not a valid age");
    setfocus(vfld);
    return false;
  }

  if (tfld>110) msg (ifld, "warn", "Older than 110: check correct");
  else {
    if (tfld<7) msg (ifld, "warn", "Bit young for this, aren't you?");
    else        msg (ifld, "warn", "");
  }
  return true;
};



function checkNumeric(objName,period)
{
	var numberfield = objName;
	if (chkNumeric(objName,period) == false)
	{
		numberfield.select();
		numberfield.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function chkNumeric(objName,period)
{
var checkOK = "0123456789" + period ;
var checkStr = objName;
var allValid = true;
var decPoints = 0;
var allNum = "";

for (i = 0;  i < checkStr.value.length;  i++)
{
ch = checkStr.value.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alertsay = "This field requires numerical input  "
alert(alertsay);
return (false);
}
}


var c = 1;
function addSame()
	{
	if(c == 1)
		{
		document.thisForm.ShipAddress.value = document.thisForm.BillAddress.value;
		document.thisForm.ShipCity.value = document.thisForm.city.value;
		document.thisForm.ShipStateProv.value = document.thisForm.StateProv.value;
		document.thisForm.ShipCode.value = document.thisForm.postCode.value;
		//document.thisForm.ShipCountry.value = document.thisForm.Country.value;
		c = 0;
	}
	else
	if(c == 0)
		{
		document.thisForm.ShipAddress.value = "";
		document.thisForm.ShipCity.value = "";
		document.thisForm.ShipStateProv.value = "";
		document.thisForm.ShipCode.value = "";
		//document.thisForm.ShipCountry.value = "";
		c = 1;
		}
	}

function billName()
	{
	var billName;
	var firstName = document.thisForm.firstName.value;
	var surname = document.thisForm.lastName.value;
	billName = ""+firstName+" "+surname+"";
	document.thisForm.BillName.value = billName;
	}




	function Form1_Validator(theForm)
	{
	  if (theForm.ServiceDesc.value == ""){
	   alert("Please Enter a Service Description!");
	   theForm.ServiceDesc.focus();
	   return false;
	  }

	  return (true);
	  document.getElementById('tuition').disabled=true;
	}

	function ChangeCounter() {
	document.all.chars.value = document.all.ServiceDesc.value.length + 1;
	//document.all.messages.value = Math.floor(document.all.message.value.length / 160) + 1;
	if ((document.all.ServiceDesc.value.length + 1) > 300) {
		alert ('Your message may not be longer than 300 characters.');
		document.all.ServiceDesc.focus();
	 }
	}

	function ChangeCounter2() {
	document.all.chars.value = document.all.ServiceDesc.value.length;
	//document.all.messages.value = Math.floor((document.all.message.value.length -1) / 160) + 1;
	if ((document.all.ServiceDesc.value.length) > 300) {
		alert ('Your message may not be longer than 300 characters.');
		document.all.ServiceDesc.focus();
	}

}


function ChangeCounter5() {
	document.all.chars.value = document.all.classDesc.value.length + 1;
	//document.all.messages.value = Math.floor(document.all.message.value.length / 160) + 1;
	if ((document.all.classDesc.value.length + 1) > 400) {
		alert ('Your message may not be longer than 400 characters.');
		document.all.classDesc.focus();
	 }
	}

	function ChangeCounter6() {
	document.all.chars.value = document.all.classDesc.value.length;
	//document.all.messages.value = Math.floor((document.all.message.value.length -1) / 160) + 1;
	if ((document.all.classDesc.value.length) > 400) {
		alert ('Your message may not be longer than 400 characters.');
		document.all.classDesc.focus();
	}

	}


function dosubmit() {}

function deleteOption(object,index) {
object.options[index] = null;
}

function addOption(object,text,value) {
var defaultSelected = true;
var selected = true;
var optionName = new Option(text, value, defaultSelected, selected)
object.options[object.length] = optionName;
}

function copySelected(fromObject,toObject) {
for (var i=0, l=fromObject.options.length;i<l;i++) {
if (fromObject.options[i].selected)
addOption(toObject,fromObject.options[i].text,fromObject.options[i].value);
}
for (var i=fromObject.options.length-1;i>-1;i--) {
if (fromObject.options[i].selected)
deleteOption(fromObject,i);
}
}

function copyAll(fromObject,toObject) {
for (var i=0, l=fromObject.options.length;i<l;i++) {
addOption(toObject,fromObject.options[i].text,fromObject.options[i].value);
}
for (var i=fromObject.options.length-1;i>-1;i--) {
deleteOption(fromObject,i);
}
}


function selectAllPartner(fromObject)
	{
	for (var i=0, l=fromObject.options.length;i<l;i++)
		{
		//addOption(toObject,fromObject.options[i].text,fromObject.options[i].value);
		fromObject.options[i].selected = true;
		}
	}

function selectAllElement(fromObject)
	{
	for (var i=0, l=fromObject.options.length;i<l;i++)
		{
		//addOption(toObject,fromObject.options[i].text,fromObject.options[i].value);
		fromObject.options[i].selected = true;
		}
	}

function selectAllEnd(numObject)
	{

	for (var x=1; x<=numObject; x++)
   	{
   	for (var i=0, l=document.yyyForm['book2_'+x].options.length;i<l;i++)
			{

			document.yyyForm['book2_'+x].options[i].selected = true;
			}
   	}
	}


function clearKeyword(){
if (document.myForm.keyword.value == "keyword")
	document.myForm.keyword.value = "";
}

function clearQuickcode(){
if (document.myForm.quick.value == "quickcode")
	document.myForm.quick.value = "";
}


function doButtons(textimage, picimage, imageid)
	{
	var txt
	txt = "txt"+imageid;
	document.all[txt].innerHTML = textimage+"";
	document['picture'+imageid].src=picimage;
}

function openWin(page,winName,xWidth,yHeight){
  	window.open(page,winName,'width='+xWidth+',height='+yHeight+',toolbar=no,location=no,status=no,menubar=no,scrollbars=Yes,resizable=Yes,top=0,left=0');
  }
  function openPic(page,winName,xWidth,yHeight){
  	window.open(page,winName,'width='+xWidth+',height='+yHeight+',toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,top=0,left=0');
  }
  function openWith(page,winName,xWidth,yHeight){
	window.open(page,winName,'width='+xWidth+',height='+yHeight+',toolbar=yes,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=0,left=0');
  }


