
<!--
function showLeadOther() {
	if (document.getElementById("Flead").value == "Other...") {
		document.getElementById('otherBox').style.display = 'block';	
	} else {
		document.getElementById('otherBox').style.display = 'none';	
	}
}

//<![CDATA[
window.onload = setupScripts;
function setupScripts()
{
	var anOrder1 = new OrderForm();
}
//]]>

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_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}



// This is just a sample function to show how you could use it
function GetRate()
{
	var name = document.getElementById("Facco_accommodationSF").value;
	var wks = document.getElementById("Facco_weekSF").value;

	if (name == "" || wks == "") {
		return false;
	}
	document.getElementById("accom_price").value = currAccom.howMuch(name, wks);
	if (document.getElementById("accom_price").value == false) {
		document.getElementById("accom_price").value = 0;
	}
	name = name.replace(/_/g," ");
	document.getElementById("accomName").value = name;
	document.getElementById("accom_weeks").value = wks;
	totalit();
}
function totalit() {
	var accomPrice1 = document.getElementById("accom_price").value * 1;
	var coursetotalit = document.getElementById("txtTotal").value * 1;
	//document.getElementById("FcoursesTotal").value = coursetotalit;
	var totaltotalit = coursetotalit + accomPrice1;
	document.getElementById("totalAmount").value = coursetotalit + accomPrice1;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function classObject()
{
	/* EDIT COURSE PRICING HERE
	 * 
	 * Field names must match up with dropdown values on form
	 *
	 * The array contains prices per week based on the number of weeks selected:
	 * 									(0, 1, 2, 3, 4-7, 8-12, 13-24, 25+)
	 */
	 
	this.General_English_P1 = new Array(0,1825,1685,1685,1605,1565,0,0);
	this.General_English_P2 = new Array(0,1825,1685,1685,1605,1565,0,0);
	this.General_English_P3 = new Array(0,1165,1025,1025,945,905,0,0);
	this.Exec_1 = new Array(0,2485,2345,2345,2345,1565,0,0);
	this.Exec_1 = new Array(0,2485,2345,2345,2345,1565,0,0);
	this.howMuch = function (name, wks)
	{
		if (this[name])
		{
 		
			if (wks >= 25)//7
			{
				return (wks * this[name][7]);
			}			
			if (wks > 12 && wks < 25)//6
			{
				return (wks * this[name][6]);
			}				
			if (wks > 7 && wks < 13)//5
			{
				return (wks * this[name][5]);
			}			
			if (wks > 3 && wks < 8)//4
			{
				return (wks * this[name][4]);
			}	
			if (wks == 3)//3
			{
				return (wks * this[name][3]);
			}			
			if (wks == 2)//3
			{
				return (wks * this[name][2]);
			}
			
			if (wks == 1)//2
			{
				return (wks * this[name][1]);
			}
			
			if (wks == 0)//1
			{
				return(this[name][0]);
			}
			
			
		}
		return false;
	}



	this.perweek = function (name, wks)	
	{
		if (this[name]) {
			if (wks >= 25)//7
			{
				return(this[name][7]);
			}			
			if (wks > 12 && wks < 25)//6
			{
				return(this[name][6]);
			}				
			if (wks > 7 && wks < 13)//5
			{
				return(this[name][5]);
			}			
			if (wks > 3 && wks < 8)//4
			{
				return(this[name][4]);
			}
			if (wks == 3)//3
			{
				return(this[name][3]);
			}			
			if (wks == 2)//3
			{
				return(this[name][2]);
			}
			
			if (wks == 1)//2
			{
				return(this[name][1]);
			}
			
			if (wks == 0) //1
			{
				return(this[name][0]);
			}
		}
		return false;
	}
}

// This causes the variable defined above to come into being 
var currClass = new classObject();


// This casues the per week amount to come into being
var currClassWeek = new classObject(); //classWeekObject();




function classTotal(name, wks)
{
var clsttls = 0;
var perWeek = name + "_Per";
var localTotal = name + "_local";


	if (name == "" || wks == "")
	{
		return false;
	}
	
	document.getElementById(perWeek).value = currClassWeek.perweek(name, wks);
	document.getElementById(localTotal).value = currClass.howMuch(name, wks);	
	clsttls = clsttls + document.getElementById("General_English_P1_local").value * 1;
	clsttls = clsttls + document.getElementById("General_English_P2_local").value * 1;
	clsttls = clsttls + document.getElementById("General_English_P3_local").value * 1;
	clsttls = clsttls + document.getElementById("Exec_1_local").value * 1;
	clsttls = clsttls + document.getElementById("Exec_2_local").value * 1;
	document.getElementById("txtTotal").value = clsttls;
	totalit();
	
	}
	
function termTotal(name, wks)
{
var perWeek = name + "_Per";
var localTotal = name + "_local";
var clsttls = 0;

	if (name == "" || wks == "")
	{
		return false;
	}
	
	document.getElementById(localTotal).value = currClassWeek.perweek(name, wks);	
	clsttls = clsttls + document.getElementById("General_English_P1_local").value * 1;
	clsttls = clsttls + document.getElementById("General_English_P2_local").value * 1;
	clsttls = clsttls + document.getElementById("General_English_P3_local").value * 1;
	clsttls = clsttls + document.getElementById("Exec_1_local").value * 1;
	clsttls = clsttls + document.getElementById("Exec_2_local").value * 1;
	document.getElementById("txtTotal").value = clsttls;
	totalit();

	-->
}

//-->

