// JavaScript Document

// Form Validation

function validate(form) {var e = form.elements, m = '';

//regular for field required
if(!e['Name'].value) {m += '- Name is required.\n';}

// Email validation
if(!/.+@[^.]+(\.[^.]+)+/.test(e['email'].value)) {m += '- E-mail requires a valid e-mail address.\n';}

// write out the errors
if(m) {
alert('The following error(s) occurred:\n\n' + m);
return false;
}
return true;
}



// The following function is Dreamweavers show hide layers

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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

// The following script is used to perform the calculations in the workspace calculator

  //VISITOR
   	function this_smallroom(){
  	thisfieldvalue = document.form.smallroom.value ;
 	document.form.smallroom_m.value = Math.round((thisfieldvalue * 5)*100)/100 ;
 	document.form.smallroom_f.value = Math.round(((thisfieldvalue * 5)* 10.764)*100)/100 ;
	this_visitor();
	}
	
	function this_medroom(){
  	thisfieldvalue = document.form.medroom.value ;
 	document.form.medroom_m.value = Math.round((thisfieldvalue * 15)*100)/100 ;
 	document.form.medroom_f.value = Math.round(((thisfieldvalue * 15)* 10.764)*100)/100 ;
	this_visitor();
	}
	
	function this_largeroom(){
  	thisfieldvalue = document.form.largeroom.value ;
 	document.form.largeroom_m.value = Math.round((thisfieldvalue * 30)*100)/100 ;
 	document.form.largeroom_f.value = Math.round(((thisfieldvalue * 30)* 10.764)*100)/100 ;
	this_visitor();
	}
	
	function this_visitor(){
	document.form.visitor_m.value = Math.round((document.form.smallroom_m.value*1 + document.form.medroom_m.value*1 + document.form.largeroom_m.value*1)*100)/100 ;
 	document.form.visitor_f.value = Math.round((document.form.smallroom_f.value*1 + document.form.medroom_f.value*1 + document.form.largeroom_f.value*1)*100)/100 ;
	this_areastotal()
	}
	
	//OFFICES
	
	function this_offices1(){
  	thisfieldvalue = document.form.offices1.value ;
 	document.form.offices1_m.value = Math.round((thisfieldvalue * 24)*100)/100 ;
 	document.form.offices1_f.value = Math.round(((thisfieldvalue * 24) * 10.764)*100)/100 ;
	this_officesTotal();
	}
	
	function this_offices2(){
  	thisfieldvalue = document.form.offices2.value ;
 	document.form.offices2_m.value = Math.round((thisfieldvalue * 15)*100)/100 ;
 	document.form.offices2_f.value = Math.round(((thisfieldvalue * 15) * 10.764)*100)/100 ;
	this_officesTotal();
	}
	
	function this_offices3(){
  	thisfieldvalue = document.form.offices3.value ;
 	document.form.offices3_m.value = Math.round((thisfieldvalue * 12)*100)/100 ;
 	document.form.offices3_f.value = Math.round(((thisfieldvalue * 12) * 10.764)*100)/100 ;
	this_officesTotal();
	}
	
	function this_officesTotal(){
	
	document.form.officesTotal_m.value = Math.round((document.form.offices1_m.value*1 + document.form.offices2_m.value*1 + document.form.offices3_m.value*1)*100)/100 ;
	document.form.officesTotal_f.value = Math.round((document.form.offices1_f.value*1 + document.form.offices2_f.value*1 + document.form.offices3_f.value*1)*100)/100  ;
	this_areastotal()
	}

		//Open Plan
	
	function this_openplan1(){
  	thisfieldvalue = document.form.openplan1.value ;
 	document.form.openplan1_m.value = Math.round((thisfieldvalue * 18)*100)/100 ;
 	document.form.openplan1_f.value = Math.round(((thisfieldvalue * 18) * 10.764)*100)/100 ;
	this_openplanTotal();
	}
	
	function this_openplan2(){
  	thisfieldvalue = document.form.openplan2.value ;
 	document.form.openplan2_m.value = Math.round((thisfieldvalue * 15)*100)/100 ;
 	document.form.openplan2_f.value = Math.round(((thisfieldvalue * 15) * 10.764)*100)/100 ;
	this_openplanTotal();
	}
	
	function this_openplan3(){
  	thisfieldvalue = document.form.openplan3.value ;
 	document.form.openplan3_m.value = Math.round((thisfieldvalue * 9)*100)/100 ;
 	document.form.openplan3_f.value = Math.round(((thisfieldvalue * 9) * 10.764)*100)/100 ;
	this_openplanTotal();
	}
	
	function this_openplan4(){
  	thisfieldvalue = document.form.openplan4.value ;
 	document.form.openplan4_m.value = Math.round((thisfieldvalue * 6)*100)/100 ;
 	document.form.openplan4_f.value = Math.round(((thisfieldvalue * 6) * 10.764)*100)/100 ;
	this_openplanTotal();
	}
	
	function this_openplanTotal(){
	
	document.form.openplanTotal_m.value = Math.round((document.form.openplan1_m.value*1 + document.form.openplan2_m.value*1 + document.form.openplan3_m.value*1 + document.form.openplan4_m.value*1)*100)/100 ;
	document.form.openplanTotal_f.value = Math.round((document.form.openplan1_f.value*1 + document.form.openplan2_f.value*1 + document.form.openplan3_f.value*1 + document.form.openplan4_f.value*1)*100)/100 ;
	this_areastotal()
	}
	

		//Training
	
	function this_training1(){
  	thisfieldvalue = document.form.training1.value ;
 	document.form.training1_m.value = Math.round((thisfieldvalue * 60)*100)/100 ;
 	document.form.training1_f.value = Math.round(((thisfieldvalue * 60) * 10.764)*100)/100 ;
	this_trainingTotal();
	}
	
	function this_training2(){
  	thisfieldvalue = document.form.training2.value ;
 	document.form.training2_m.value = Math.round((thisfieldvalue * 40)*100)/100 ;
 	document.form.training2_f.value = Math.round(((thisfieldvalue * 40) * 10.764)*100)/100 ;
	this_trainingTotal();
	}
	
	function this_training3(){
  	thisfieldvalue = document.form.training3.value ;
 	document.form.training3_m.value = Math.round((thisfieldvalue * 24)*100)/100 ;
 	document.form.training3_f.value = Math.round(((thisfieldvalue * 24) * 10.764)*100)/100 ;
	this_trainingTotal();
	}
	
	function this_training4(){
  	thisfieldvalue = document.form.training4.value ;
 	document.form.training4_m.value = Math.round((thisfieldvalue * 12)*100)/100 ;
 	document.form.training4_f.value = Math.round(((thisfieldvalue * 12) * 10.764)*100)/100 ;
	this_trainingTotal();
	}
	
	
	function this_training5(){
  	thisfieldvalue = document.form.training5.value ;
 	document.form.training5_m.value = Math.round((thisfieldvalue * 9)*100)/100 ;
 	document.form.training5_f.value = Math.round(((thisfieldvalue * 4) * 10.764)*100)/100 ;
	this_trainingTotal();
	}
	
	
	function this_training6(){
  	thisfieldvalue = document.form.training6.value ;
 	document.form.training6_m.value = Math.round((thisfieldvalue * 40)*100)/100 ;
 	document.form.training6_f.value = Math.round(((thisfieldvalue * 40) * 10.764)*100)/100 ;
	this_trainingTotal();
	}
	
	
	function this_training7(){
  	thisfieldvalue = document.form.training7.value ;
 	document.form.training7_m.value = Math.round((thisfieldvalue * 18)*100)/100 ;
 	document.form.training7_f.value = Math.round(((thisfieldvalue * 18) * 10.764)*100)/100 ;
	this_trainingTotal();
	}
	
	function this_trainingTotal(){
	
	document.form.trainingTotal_m.value = Math.round((document.form.training1_m.value*1 + document.form.training2_m.value*1 + document.form.training3_m.value*1 + document.form.training4_m.value*1 + document.form.training5_m.value*1 + document.form.training6_m.value*1 + document.form.training7_m.value*1)*100)/100 ;
	document.form.trainingTotal_f.value = Math.round((document.form.training1_f.value*1 + document.form.training2_f.value*1 + document.form.training3_f.value*1 + document.form.training4_f.value*1 + document.form.training5_f.value*1 + document.form.training6_f.value*1 + document.form.training7_f.value*1)*100)/100 ;
	this_areastotal()
	}
	






	//Storage + Dedicated IT Areas
	
	function this_storage1(){
  	thisfieldvalue = document.form.storage1.value ;
 	document.form.storage1_m.value = Math.round((thisfieldvalue * 1.5)*100)/100 ;
 	document.form.storage1_f.value = Math.round(((thisfieldvalue * 1.5) * 10.764)*100)/100 ;
	this_storageTotal();
	}
	
	function this_storage2(){
  	thisfieldvalue = document.form.storage2.value ;
 	document.form.storage2_m.value = Math.round((thisfieldvalue * 1)*100)/100 ;
 	document.form.storage2_f.value = Math.round(((thisfieldvalue * 1) * 10.764)*100)/100 ;
	this_storageTotal();
	}
	
	function this_storage3(){
  	thisfieldvalue = document.form.storage3.value ;
 	document.form.storage3_m.value = Math.round((thisfieldvalue * 0.5)*100)/100 ;
 	document.form.storage3_f.value = Math.round(((thisfieldvalue * 0.5) * 10.764)*100)/100 ;
	this_storageTotal();
	}
	
	function this_storage4(){
  	thisfieldvalue = document.form.storage4.value ;
 	document.form.storage4_m.value = Math.round((thisfieldvalue * 12)*100)/100 ;
 	document.form.storage4_f.value = Math.round(((thisfieldvalue * 12) * 10.764)*100)/100 ;
	this_storageTotal();
	}
	
	
	function this_storage5(){
  	thisfieldvalue = document.form.storage5.value ;
 	document.form.storage5_m.value = Math.round((thisfieldvalue * 6)*100)/100 ;
 	document.form.storage5_f.value = Math.round(((thisfieldvalue * 6) * 10.764)*100)/100 ;
	this_storageTotal();
	}
	
	
	function this_storage6(){
  	thisfieldvalue = document.form.storage6.value ;
 	document.form.storage6_m.value = Math.round((thisfieldvalue * 15)*100)/100 ;
 	document.form.storage6_f.value = Math.round(((thisfieldvalue * 15) * 10.764)*100)/100 ;
	this_storageTotal();
	}
	
	
	function this_storage7(){
  	thisfieldvalue = document.form.storage7.value ;
 	document.form.storage7_m.value = Math.round((thisfieldvalue * 12)*100)/100 ;
 	document.form.storage7_f.value = Math.round(((thisfieldvalue * 12) * 10.764)*100)/100 ;
	this_storageTotal();
	}	
	
	function this_storage8(){
  	thisfieldvalue = document.form.storage8.value ;
 	document.form.storage8_m.value = Math.round((thisfieldvalue * 9)*100)/100 ;
 	document.form.storage8_f.value = Math.round(((thisfieldvalue * 9) * 10.764)*100)/100 ;
	this_storageTotal();
	}	
	
	function this_storage9(){
  	thisfieldvalue = document.form.storage9.value ;
 	document.form.storage9_m.value = Math.round((thisfieldvalue * 20)*100)/100 ;
 	document.form.storage9_f.value = Math.round(((thisfieldvalue * 20) * 10.764)*100)/100 ;
	this_storageTotal();
	}
	
	function this_storageTotal(){
	
	document.form.storageTotal_m.value = Math.round((document.form.storage1_m.value*1 + document.form.storage2_m.value*1 + document.form.storage3_m.value*1 + document.form.storage4_m.value*1 + document.form.storage5_m.value*1 + document.form.storage6_m.value*1 + document.form.storage7_m.value*1 + document.form.storage8_m.value*1 + document.form.storage9_m.value*1)*100)/100 ;
	document.form.storageTotal_f.value = Math.round((document.form.storage1_f.value*1 + document.form.storage2_f.value*1 + document.form.storage3_f.value*1 + document.form.storage4_f.value*1 + document.form.storage5_f.value*1 + document.form.storage6_f.value*1 + document.form.storage7_f.value*1 + document.form.storage8_f.value*1 + document.form.storage9_f.value*1)*100)/100 ;
	this_areastotal()
	}



		//Staff + Utility
	
	function this_staff1(){
  	thisfieldvalue = document.form.staff1.value ;
 	document.form.staff1_m.value = Math.round((thisfieldvalue * 60)*100)/100 ;
 	document.form.staff1_f.value = Math.round(((thisfieldvalue * 60) * 10.764)*100)/100 ;
	this_staffTotal();
	}
	
	function this_staff2(){
  	thisfieldvalue = document.form.staff2.value ;
 	document.form.staff2_m.value = Math.round((thisfieldvalue * 40)*100)/100 ;
 	document.form.staff2_f.value = Math.round(((thisfieldvalue * 40) * 10.764)*100)/100 ;
	this_staffTotal();
	}
	
	function this_staff3(){
  	thisfieldvalue = document.form.staff3.value ;
 	document.form.staff3_m.value = Math.round((thisfieldvalue * 20)*100)/100 ;
 	document.form.staff3_f.value = Math.round(((thisfieldvalue * 20) * 10.764)*100)/100 ;
	this_staffTotal();
	}
	
	function this_staff4(){
  	thisfieldvalue = document.form.staff4.value ;
 	document.form.staff4_m.value = Math.round((thisfieldvalue * 12)*100)/100 ;
 	document.form.staff4_f.value = Math.round(((thisfieldvalue * 12) * 10.764)*100)/100 ;
	this_staffTotal();
	}
	
	
	function this_staff5(){
  	thisfieldvalue = document.form.staff5.value ;
 	document.form.staff5_m.value = Math.round((thisfieldvalue * 6)*100)/100 ;
 	document.form.staff5_f.value = Math.round(((thisfieldvalue * 6) * 10.764)*100)/100 ;
	this_staffTotal();
	}
	
	
	
	function this_staffTotal(){
	
	document.form.staffTotal_m.value = Math.round((document.form.staff1_m.value*1 + document.form.staff2_m.value*1 + document.form.staff3_m.value*1 + document.form.staff4_m.value*1 + document.form.staff5_m.value*1)*100)/100 ;
	document.form.staffTotal_f.value = Math.round((document.form.staff1_f.value*1 + document.form.staff2_f.value*1 + document.form.staff3_f.value*1 + document.form.staff4_f.value*1 + document.form.staff5_f.value*1)*100)/100 ;
	this_areastotal()
	}
	

		
	//AREAS TOTAL
	
	function this_areastotal(){
	document.form.areastotal_m.value = Math.round((document.form.visitor_m.value*1 + document.form.officesTotal_m.value*1 + document.form.openplanTotal_m.value*1 + document.form.storageTotal_m.value*1 + document.form.trainingTotal_m.value*1 + document.form.staffTotal_m.value*1)*100)/100 ;
	document.form.areastotal_f.value = Math.round((document.form.visitor_f.value*1 + document.form.officesTotal_f.value*1 + document.form.openplanTotal_f.value*1 + document.form.storageTotal_f.value*1 + document.form.trainingTotal_f.value*1 + document.form.staffTotal_f.value*1)*100)/100 ;	
	this_modernoffice()
	}


	//MODERN OFFICE PERCENTAGE and grand total
	
	function this_modernoffice(){
	document.form.modernoffice_m.value = Math.round(((document.form.areastotal_m.value)/100)*10) ;
	document.form.modernoffice_f.value = Math.round(((document.form.areastotal_f.value)/100)*10) ;
	
	document.form.grandtotal_m.value = Math.round(((document.form.areastotal_m.value)/100)*110) ;
	document.form.grandtotal_f.value = Math.round(((document.form.areastotal_f.value)/100)*110) ;
	}
	
	

	
	
	
	
