function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_statusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

function printpg() {
	window.print();
}

function bookmarkpg() { 
  var bookmarktitle = document.title;
  var bookmarkurl = document.location;
  var netscape
  netscape="Attention Netscape Users. To Bookmark this page please click the page you would like to bookmark and press CTRL+D.";
  if (window.sidebar&&window.sidebar.addPanel) { 
    alert(netscape);
  } else if (document.all) {
    window.external.AddFavorite(bookmarkurl, bookmarktitle);
  } else if (window.opera && window.print) {
    return true;
  }
}

function showhide(id) { 
	lyr=document.getElementById(id);
	if (lyr.className!='mmhide_show'){
		lyr.className='mmhide_show';
	} else {
		lyr.className='mmhide_hide';			
	}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}

function validateContact () {
	var errorMsg = "";	
	if (document.contactform.firstname.value==""){errorMsg += "\n\tFirst name";}	
	if (document.contactform.lastname.value==""){errorMsg += "\n\tSurname";}	
	if (document.contactform.position.value==""){errorMsg += "\n\tPosition";}	
	if (document.contactform.company.value==""){errorMsg += "\n\tCompany";}
	if (document.contactform.telephone.value==""){errorMsg += "\n\tTelephone";}
	if (document.contactform.emailaddr.value==""){errorMsg += "\n\tEmail";}
	if (errorMsg != ""){
		msg = "______________________________________________\n\n";
		msg += "Your request has not been submitted because the form\n";
		msg += "has not been completed properly.\n\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";
		msg += "_____________________________________________\n\n";
		msg += "Please correct the following field(s): -\n";	
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}

function validateRequest () {
	var errorMsg = "";	
	if (document.requestform.firstname.value==""){errorMsg += "\n\tFirst name";}	
	if (document.requestform.lastname.value==""){errorMsg += "\n\tSurname";}	
	if (document.requestform.telephone.value==""){errorMsg += "\n\tTelephone";}
	if (document.requestform.emailaddr.value==""){errorMsg += "\n\tEmail";}
	if (errorMsg != ""){
		msg = "______________________________________________\n\n";
		msg += "Your request has not been submitted because the form\n";
		msg += "has not been completed properly.\n\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";
		msg += "_____________________________________________\n\n";
		msg += "Please correct the following field(s): -\n";	
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}

function valList(l) {
var cnt = -1;
for (var i=0; i < l.length; i++) {
   if (l[i].selected) {cnt = i; i = l.length;}
   }
if (cnt > -1) return l[cnt].value;
else return null;
}
function valRadioBtn(b) {
var cnt = -1;
for (var i=0; i < b.length; i++) {
   if (b[i].checked) {cnt = i; i = b.length;}
   }
if (cnt > -1) return b[cnt].value;
else return null;
}
function validateCourse () {
	var errorMsg = "";	
	var listMenu = valList(document.courseform.coursetitle);
 	if (listMenu == null){errorMsg += "\n\tCourse title(s)";}
	var radioBtn = valRadioBtn(document.courseform.courseloc);
	if (radioBtn == null){errorMsg += "\n\tCourse location";}
	if (document.courseform.firstname.value==""){errorMsg += "\n\tFirst name";}	
	if (document.courseform.lastname.value==""){errorMsg += "\n\tSurname";}	
	if (document.courseform.company.value==""){errorMsg += "\n\tCompany";}
	if (document.courseform.telephone.value==""){errorMsg += "\n\tTelephone";}
	if (document.courseform.emailaddr.value==""){errorMsg += "\n\tEmail";}
	if (errorMsg != ""){
		msg = "______________________________________________\n\n";
		msg += "Your request has not been submitted because the form\n";
		msg += "has not been completed properly.\n\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";
		msg += "_____________________________________________\n\n";
		msg += "Please correct the following field(s): -\n";	
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}

function validateVacancy () {
	var errorMsg = "";	
	if (document.vacancyform.firstname.value==""){errorMsg += "\n\tFirst name";}	
	if (document.vacancyform.lastname.value==""){errorMsg += "\n\tSurname";}	
	if (document.vacancyform.telephone.value==""){errorMsg += "\n\tTelephone";}
	if (document.vacancyform.emailaddr.value==""){errorMsg += "\n\tEmail";}
	if (errorMsg != ""){
		msg = "______________________________________________\n\n";
		msg += "Your request has not been submitted because the form\n";
		msg += "has not been completed properly.\n\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";
		msg += "_____________________________________________\n\n";
		msg += "Please correct the following field(s): -\n";	
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}

function validateGraduate () {
	var errorMsg = "";	
	if (document.graduateform.intake.selectedIndex == 0){errorMsg += "\n\tIntake";}
	if (document.graduateform.firstname.value==""){errorMsg += "\n\tFirst name";}	
	if (document.graduateform.lastname.value==""){errorMsg += "\n\tSurname";}	
	if (document.graduateform.telephone.value==""){errorMsg += "\n\tTelephone";}
	if (document.graduateform.emailaddr.value==""){errorMsg += "\n\tEmail";}
	if (errorMsg != ""){
		msg = "______________________________________________\n\n";
		msg += "Your request has not been submitted because the form\n";
		msg += "has not been completed properly.\n\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";
		msg += "_____________________________________________\n\n";
		msg += "Please correct the following field(s): -\n";	
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}

function validateRefer () {
	var errorMsg = "";	
	if (document.referform.sendername.value==""){errorMsg += "\n\tYour name";}	
	if (document.referform.senderemailaddr.value==""){errorMsg += "\n\tYour email address";}	
	if (document.referform.recipientname.value==""){errorMsg += "\n\tRecipient's name";}	
	if (document.referform.recipientemailaddr.value==""){errorMsg += "\n\tRecipient's email address";}	
	if (errorMsg != ""){
		msg = "______________________________________________\n\n";
		msg += "Your request has not been submitted because the form\n";
		msg += "has not been completed properly.\n\n";
		msg += "Please correct the problem(s) and re-submit the form.\n";
		msg += "_____________________________________________\n\n";
		msg += "Please correct the following field(s): -\n";	
		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}
