

function getElementPosition(elemID){
   var offsetTrail = document.getElementById(elemID);
   var offsetLeft = 0;
   var offsetTop = 0;
   while (offsetTrail){
   offsetLeft += offsetTrail.offsetLeft;
   offsetTop += offsetTrail.offsetTop;
   offsetTrail = offsetTrail.offsetParent;
   }
   if (navigator.userAgent.indexOf('Mac') != -1 && typeof document.body.leftMargin != 'undefined'){
   offsetLeft += document.body.leftMargin;
   offsetTop += document.body.topMargin;
   }
   return {left:offsetLeft,top:offsetTop};
}


function titlePosition()  {

// TURNED OFF

   //var leftpos = getElementPosition('main').left;
   //var toppos = getElementPosition('main').top;
   
    //alert(leftpos);
  
   //var titletop = '345';
   //var titleleft = leftpos + 295;
   
   //document.getElementById('pagetitle').top = titletop;
   //document.getElementById('pagetitle').left = titleleft;

   //document.getElementById('pagetitle').style.visibility = 'visible';
  



}




// SCRIPT REQUIRED BY SIDE DROP MENUS //
var anytest="PASS";
var newsletter_test="PASS";

function ViewCrossReference (selSelectObject)
{
   if (selSelectObject.options[selSelectObject.selectedIndex].value != "")
   {
     location.href=selSelectObject.options[selSelectObject.selectedIndex].value
   }
}


// SCRIPT REQUIRED BY POPUP LAYERS //

function getObj(elementID){

		return document.getElementById(elementID);
	 }

		 

function show(element){
     
		 getObj(element).style.visibility= "visible";  
		 getObj(element).style.display= "block";  
	 }



function hide(element){

     		getObj(element).style.visibility= "hidden";    
			getObj(element).style.display= "none";  
     	}







// SCRIPT REQUIRED HOME PAGE AJAX AND VALIDATION //
	
	// clean up fields on click
  function cleanfields(fieldname) {
	  	document.getElementById(fieldname).style.backgroundColor="#FFFFFF";
	  	document.getElementById(fieldname).value='';
	  }


	function checknumber(fieldname) {
		var sText=document.getElementById(fieldname).value
			var ValidChars = "0123456789.";
  			var IsNumber=true;
   			var Char;
		   for (i = 0; i < sText.length && IsNumber == true; i++) 
      			{ 
      			Char = sText.charAt(i); 
      			if (ValidChars.indexOf(Char) == -1) 
         		{
         		IsNumber = false;
         		}
      		}
   			return IsNumber;
	 }


	

// validation for sls online

function slsonlineformvalidatecheck()
		{
			
			//alert("hello slsonline");

			var anytest="PASS";
			
			var checkbox=document.sls_onlineform.terms_conditions.checked;
				
			
			if (!(checkbox))
			{
			   	// Trap error and provide feedback
				
					document.getElementById('terms_conditions_box').style.backgroundColor="#7bd9db";	
						
		 
					  							  
					  var anytest="FAIL";
			}
			
			
			
			
			
			
			var emailsubscribe=document.sls_onlineform.email.value;
						
			// variable used to only provide one error message for email
			var emailATtest1="PASS";
			
			if ((emailsubscribe == "") || (emailsubscribe == "Please provide an email"))
			{
			   	// Trap error and provide feedback
				
					 document.sls_onlineform.email.style.backgroundColor="#7bd9db";
					  document.sls_onlineform.email.value="Please provide an email";
					  
					  var emailATtest1="FAIL";
					  var anytest="FAIL";
			}
			
			if (((emailsubscribe.indexOf("@")==-1) && (emailATtest1=="PASS")) || (emailsubscribe == "This is NOT a valid email"))
			{
			   	// Trap error and provide feedback
				//alert("Please input a valid email address, like john@bigpond.com")
					 document.sls_onlineform.email.style.backgroundColor="#7bd9db";
					 document.sls_onlineform.email.value="This is NOT a valid email";
					  
					   var anytest="FAIL";
					
			}
			
			var firstname=document.sls_onlineform.firstname.value;
				
			
			if ((firstname == "") || (firstname == "Please provide your first name"))
			{
			   	// Trap error and provide feedback
				
					 document.sls_onlineform.firstname.style.backgroundColor="#7bd9db";
					  document.sls_onlineform.firstname.value="Please provide your first name";
					  							  
					  var anytest="FAIL";
			}
			
			var lastname=document.sls_onlineform.lastname.value;
			if ((lastname == "") || (lastname == "Please provide your last name"))
			{
			   	// Trap error and provide feedback
				
					 document.sls_onlineform.lastname.style.backgroundColor="#7bd9db";
					  document.sls_onlineform.lastname.value="Please provide your last name";
					  							  
					  var anytest="FAIL";
			}
			
			
			
			
			
			
			// SUBMIT FORM VIA AJAX ONLY IF ALL TEST PASS - display connecting message
			
			if (anytest=="PASS")
			
					 {
										
					
					document.sls_onlineform.submit();
					
					}

		}



function translationformvalidatecheck()
		{
			//alert("hello translate");			

			var anytest="PASS";
			
						
			var checkbox2=document.translation.terms_conditions2.checked;
				
			
			if (!(checkbox2))
			{
			   	// Trap error and provide feedback
				
				document.getElementById('terms_conditions_box2').style.backgroundColor="#7bd9db";	
				    var anytest="FAIL";		 
					
			}
			
			
			
			var firstname=document.translation.firstname.value;
			
			if ((firstname == "") || (firstname == "Please provide a name"))
			{
			   	// Trap error and provide feedback
				
					 document.translation.firstname.style.backgroundColor="#7bd9db";
					  document.translation.firstname.value="Please provide a name";
					  							  
					  var anytest="FAIL";
			}
			
			var contactNo=document.translation.contactNo.value;
			if ((contactNo == "") || (contactNo == "Please provide a contact number"))
			{
			   	// Trap error and provide feedback
				
					 document.translation.contactNo.style.backgroundColor="#7bd9db";
					  document.translation.contactNo.value="Please provide a contact number";
					  							  
					  var anytest="FAIL";
			}
			
						
			var assign_contact=document.translation.assign_contact.value;
			if ((assign_contact == "") || (assign_contact == "Please provide a name"))
			{
			   	// Trap error and provide feedback
				
					 document.translation.assign_contact.style.backgroundColor="#7bd9db";
					  document.translation.assign_contact.value="Please provide a name";
					  							  
					  var anytest="FAIL";
			}
		    
			var assign_phone=document.translation.assign_phone.value;
			if ((assign_phone == "") || (assign_phone == "Please provide a phone number"))
			{
			   	// Trap error and provide feedback
				
					 document.translation.assign_phone.style.backgroundColor="#7bd9db";
					  document.translation.assign_phone.value="Please provide a phone number";
					  							  
					  var anytest="FAIL";
			}
			
			var assign_address=document.translation.assign_address.value;
			if ((assign_address == "") || (assign_address == "Please provide an address"))
			{
			   	// Trap error and provide feedback
				
					 document.translation.assign_address.style.backgroundColor="#7bd9db";
					  document.translation.assign_address.value="Please provide an address";
					  							  
					  var anytest="FAIL";
			}
			
			var assign_suburb=document.translation.assign_suburb.value;
			if ((assign_suburb == "") || (assign_suburb == "Please provide a suburb"))
			{
			   	// Trap error and provide feedback
				
					 document.translation.assign_suburb.style.backgroundColor="#7bd9db";
					  document.translation.assign_suburb.value="Please provide a suburb";
					  							  
					  var anytest="FAIL";
			}
			
			var assign_state=document.translation.assign_state.value;
			if ((assign_state == "") || (assign_state == "Please provide a state"))
			{
			   	// Trap error and provide feedback
				
					 document.translation.assign_state.style.backgroundColor="#7bd9db";
					  document.translation.assign_state.value="Please provide a state";
					  							  
					  var anytest="FAIL";
			}
			
			var assign_postcode=document.translation.assign_postcode.value;
			if ((assign_postcode == "") || (assign_postcode == "Please provide a postcode"))
			{
			   	// Trap error and provide feedback
				
					 document.translation.assign_postcode.style.backgroundColor="#7bd9db";
					  document.translation.assign_postcode.value="Please provide a postcode";
					  							  
					  var anytest="FAIL";
			}
			
			var assign_time=document.translation.assign_time.value;
			if ((assign_time == "") || (assign_time == "Please provide a time"))
			{
			   	// Trap error and provide feedback
				
					 document.translation.assign_time.style.backgroundColor="#7bd9db";
					  document.translation.assign_time.value="Please provide a time";
					  							  
					  var anytest="FAIL";
			}
			
			var assign_duration=document.translation.assign_duration.value;
			if ((assign_duration == "") || (assign_duration == "Please provide a time period"))
			{
			   	// Trap error and provide feedback
				
					 document.translation.assign_duration.style.backgroundColor="#7bd9db";
					  document.translation.assign_duration.value="Please provide a time period";
					  							  
					  var anytest="FAIL";
			}
			
			var assign_date=document.translation.assign_date.value;
			if ((assign_date == "") || (assign_date == "Please provide a date"))
			{
			   	// Trap error and provide feedback
				
					 document.translation.assign_date.style.backgroundColor="#7bd9db";
					  document.translation.assign_date.value="Please provide a date";
					  							  
					  var anytest="FAIL";
			}
			
			var interp=document.translation.interp.value;
			if ((interp == "") || (interp == "Please provide number of interpreters required"))
			{
			   	// Trap error and provide feedback
				
					 document.translation.interp.style.backgroundColor="#7bd9db";
					  document.translation.interp.value="Please provide number of interpreters required";
					  							  
					  var anytest="FAIL";
			}
			
			var emailsubscribe=document.translation.email.value;
						
			// variable used to only provide one error message for email
			var emailATtest1="PASS";
			
			if ((emailsubscribe == "") || (emailsubscribe == "Please provide an email"))
			{
			   	// Trap error and provide feedback
				
					 document.translation.email.style.backgroundColor="#7bd9db";
					  document.translation.email.value="Please provide an email";
					  
					  var emailATtest1="FAIL";
					  var anytest="FAIL";
			}
			
			if (((emailsubscribe.indexOf("@")==-1) && (emailATtest1=="PASS")) || (emailsubscribe == "This is NOT a valid email"))
			{
			   	// Trap error and provide feedback
				//alert("Please input a valid email address, like john@bigpond.com")
					 document.translation.email.style.backgroundColor="#7bd9db";
					 document.translation.email.value="This is NOT a valid email";
					  
					   var anytest="FAIL";
					
			}
			
			var source_language=document.translation.source_language.value;
				
			
			if (source_language=="bad")
			{
			   	// Trap error and provide feedback
				
					document.getElementById('source_language').style.backgroundColor="#7bd9db";	
				    var anytest="FAIL";		 
					
			}
			
			var target_language=document.translation.target_language.value;
				
			
			if (target_language=="bad")
			{
			   	// Trap error and provide feedback
				
					document.getElementById('target_language').style.backgroundColor="#7bd9db";	
				    var anytest="FAIL";		 
					
			}
			
			
			// SUBMIT FORM VIA AJAX ONLY IF ALL TEST PASS - display connecting message
			
			if (anytest=="PASS")
			
					 {
										
					document.translation.submit();
					
					}

		}


// check fields are correct and provide feedback then send form 

function slsone2oneformvalidatecheck()
		{
			//alert("hello sls one 2 one");				

			var anytest="PASS";
			
			var checkbox=document.sls_onlineform_tutor.terms_conditions.checked;
				
			
			if (!(checkbox))
			{
			   	// Trap error and provide feedback
				
					document.getElementById('terms_conditions_box').style.backgroundColor="#7bd9db";	
				    var anytest="FAIL";		 
					
			}
			
			
			
			
			var checkbox2=document.sls_onlineform_tutor.tutorTime.checked;
						
			if (!(checkbox2))
			{
			   	// Trap error and provide feedback
				
					document.getElementById('tutorTime_box').style.backgroundColor="#7bd9db";	
					  							  
					  var anytest="FAIL";
					  
			}
			
			
			
			
			
			
			var emailsubscribe=document.sls_onlineform_tutor.email.value;
						
			// variable used to only provide one error message for email
			var emailATtest1="PASS";
			
			if ((emailsubscribe == "") || (emailsubscribe == "Please provide an email"))
			{
			   	// Trap error and provide feedback
				
					 document.sls_onlineform_tutor.email.style.backgroundColor="#7bd9db";
					  document.sls_onlineform_tutor.email.value="Please provide an email";
					  
					  var emailATtest1="FAIL";
					  var anytest="FAIL";
			}
			
			if (((emailsubscribe.indexOf("@")==-1) && (emailATtest1=="PASS")) || (emailsubscribe == "This is NOT a valid email"))
			{
			   	// Trap error and provide feedback
				//alert("Please input a valid email address, like john@bigpond.com")
					 document.sls_onlineform_tutor.email.style.backgroundColor="#7bd9db";
					 document.sls_onlineform_tutor.email.value="This is NOT a valid email";
					  
					   var anytest="FAIL";
					
			}
			
			var firstname=document.sls_onlineform_tutor.firstname.value;
				
			
			if ((firstname == "") || (firstname == "Please provide your first name"))
			{
			   	// Trap error and provide feedback
				
					 document.sls_onlineform_tutor.firstname.style.backgroundColor="#7bd9db";
					  document.sls_onlineform_tutor.firstname.value="Please provide your first name";
					  							  
					  var anytest="FAIL";
			}
			
			var lastname=document.sls_onlineform_tutor.lastname.value;
			if ((lastname == "") || (lastname == "Please provide your last name"))
			{
			   	// Trap error and provide feedback
				
					 document.sls_onlineform_tutor.lastname.style.backgroundColor="#7bd9db";
					  document.sls_onlineform_tutor.lastname.value="Please provide your last name";
					  							  
					  var anytest="FAIL";
			}
			
			var contactNo=document.sls_onlineform_tutor.contactNo.value;
			if ((contactNo == "") || (contactNo == "Please provide a contact number"))
			{
			   	// Trap error and provide feedback
				
					 document.sls_onlineform_tutor.contactNo.style.backgroundColor="#7bd9db";
					  document.sls_onlineform_tutor.contactNo.value="Please provide a contact number";
					  							  
					  var anytest="FAIL";
			}
			
			
			
			
			
			
			// SUBMIT FORM VIA AJAX ONLY IF ALL TEST PASS - display connecting message
			
			if (anytest=="PASS")
			
					 {
										
					
					document.sls_onlineform_tutor.submit();
					
					}

		}


  

// check corp client form provide feedback then send form 

function corpclientformvalidatecheck()
		{
			
			var anytest="PASS";
			
			//alert("hello corp client");					
			
			var emailsubscribe=document.corpclientform.email_address.value;
						
			// variable used to only provide one error message for email
			var emailATtest1="PASS";
			
			if ((emailsubscribe == "") || (emailsubscribe == "Please provide an email"))
			{
			   	// Trap error and provide feedback
				
					 document.corpclientform.email_address.style.backgroundColor="#7bd9db";
					  document.corpclientform.email_address.value="Please provide an email";
					  
					  var emailATtest1="FAIL";
					  var anytest="FAIL";
			}
			
			if (((emailsubscribe.indexOf("@")==-1) && (emailATtest1=="PASS")) || (emailsubscribe == "This is NOT a valid email"))
			{
			   	// Trap error and provide feedback
				//alert("Please input a valid email address, like john@bigpond.com")
					 document.corpclientform.email_address.style.backgroundColor="#7bd9db";
					 document.corpclientform.email_address.value="This is NOT a valid email";
					  
					   var anytest="FAIL";
					
			}
			
			var firstname=document.corpclientform.clientname.value;
				
			
			if ((firstname == "") || (firstname == "Please provide your name"))
			{
			   	// Trap error and provide feedback
				
					 document.corpclientform.clientname.style.backgroundColor="#7bd9db";
					  document.corpclientform.clientname.value="Please provide your name";
					  							  
					  var anytest="FAIL";
			}
			
			var lastname=document.corpclientform.contactname.value;
			if ((lastname == "") || (lastname == "Please provide a contact name"))
			{
			   	// Trap error and provide feedback
				
					 document.corpclientform.contactname.style.backgroundColor="#7bd9db";
					  document.corpclientform.contactname.value="Please provide a contact name";
					  							  
					  var anytest="FAIL";
			}
			
			var contactNo=document.corpclientform.pref_contactno.value;
			if ((contactNo == "") || (contactNo == "Please provide a contact number"))
			{
			   	// Trap error and provide feedback
				
					 document.corpclientform.pref_contactno.style.backgroundColor="#7bd9db";
					  document.corpclientform.pref_contactno.value="Please provide a contact number";
					  							  
					  var anytest="FAIL";
			}
			
			var contactNo=document.corpclientform.contacttime.value;
			if ((contactNo == "") || (contactNo == "Please provide a contact time"))
			{
			   	// Trap error and provide feedback
				
					 document.corpclientform.contacttime.style.backgroundColor="#7bd9db";
					  document.corpclientform.contacttime.value="Please provide a contact time";
					  							  
					  var anytest="FAIL";
			}
			
			
			
			
			
			
			// SUBMIT FORM VIA AJAX ONLY IF ALL TEST PASS - display connecting message
			
			if (anytest=="PASS")
			
					 {
										
					
					document.corpclientform.submit();
					
					}

		}




// check edit request form fields are correct and provide feedback then send form 

function editrequestformvalidatecheck()
		{
			
			
			//alert("hello edit request");	

			var anytest="PASS";
			
			var emailsubscribe=document.edit_request_form.email_address.value;		
						
			// variable used to only provide one error message for email
			var emailATtest1="PASS";
			
			if ((emailsubscribe == "") || (emailsubscribe == "Please provide an email"))
			{
			   	// Trap error and provide feedback
			
					 document.edit_request_form.email_address.style.backgroundColor="#7bd9db";
					  document.edit_request_form.email_address.value="Please provide an email";

					  var emailATtest1="FAIL";
					  var anytest="FAIL";
			}
			
			if (((emailsubscribe.indexOf("@")==-1) && (emailATtest1=="PASS")) || (emailsubscribe == "This is NOT a valid email"))
			{
			   	// Trap error and provide feedback
				//alert("Please input a valid email address, like john@bigpond.com")
					 document.edit_request_form.email_address.style.backgroundColor="#7bd9db";
					 document.edit_request_form.email_address.value="This is NOT a valid email";
					  
					   var anytest="FAIL";
					
			}
			
			
			
			var clientname=document.edit_request_form.clientname.value;
				
			
			if ((clientname == "") || (clientname == "Please provide a name"))
			{
			   	// Trap error and provide feedback
				
					 document.edit_request_form.clientname.style.backgroundColor="#7bd9db";
					  document.edit_request_form.clientname.value="Please provide a name";
					  							  
					  var anytest="FAIL";
			}
			
			var authorname=document.edit_request_form.authorname.value;
			if ((authorname == "") || (authorname == "Please provide the author's name"))
			{
			   	// Trap error and provide feedback
				
					 document.edit_request_form.authorname.style.backgroundColor="#7bd9db";
					  document.edit_request_form.authorname.value="Please provide the author's name";
					  							  
					  var anytest="FAIL";
			}
			
			
			var contactno=document.edit_request_form.contactno.value;
			if ((contactno == "") || (contactno == "Please provide a contact number"))
			{
			   	// Trap error and provide feedback
				
					 document.edit_request_form.contactno.style.backgroundColor="#7bd9db";
					  document.edit_request_form.contactno.value="Please provide a contact number";
					  							  
					  var anytest="FAIL";
			}
			
			var doc_edit=document.edit_request_form.doc_edit.value;
			if ((doc_edit == "") || (doc_edit == "Please provide the document name"))
			{
			   	// Trap error and provide feedback
				
					 document.edit_request_form.doc_edit.style.backgroundColor="#7bd9db";
					  document.edit_request_form.doc_edit.value="Please provide the document name";
					  							  
					  var anytest="FAIL";
			}
			
			
			var wordcount=document.edit_request_form.wordcount.value;
			if ((wordcount == "") || (wordcount == "Please provide the documents length"))
			{
			   	// Trap error and provide feedback
				
					 document.edit_request_form.wordcount.style.backgroundColor="#7bd9db";
					  document.edit_request_form.wordcount.value="Please provide the documents length";
					  							  
					  var anytest="FAIL";
			}
			
			
			
			
			// SUBMIT FORM VIA AJAX ONLY IF ALL TEST PASS - display connecting message
			
			if (anytest=="PASS")
			
					 {
										
					document.edit_request_form.submit();
					
					}

		}


  
	// check trial class fields are correct and provide feedback then send form 
	function trialformvalidatecheck()
		{
			
			var anytest="PASS";
			
			
			var emailsubscribe=document.sls_trial_class.email.value;
						
			// variable used to only provide one error message for email
			var emailATtest1="PASS";
			
			if ((emailsubscribe == "") || (emailsubscribe == "Please provide an email"))
			{
			   	// Trap error and provide feedback
				
					 document.sls_trial_class.email.style.backgroundColor="#7bd9db";
					  document.sls_trial_class.email.value="Please provide an email";
					  
					  var emailATtest1="FAIL";
					  var anytest="FAIL";
			}
			
			if (((emailsubscribe.indexOf("@")==-1) && (emailATtest1=="PASS")) || (emailsubscribe == "This is NOT a valid email"))
			{
			   	// Trap error and provide feedback
				//alert("Please input a valid email address, like john@bigpond.com")
					 document.sls_trial_class.email.style.backgroundColor="#7bd9db";
					 document.sls_trial_class.email.value="This is NOT a valid email";
					  
					   var anytest="FAIL";
					
			}
			
			var firstname=document.sls_trial_class.firstname.value;
				
			
			if ((firstname == "") || (firstname == "Please provide your first name"))
			{
			   	// Trap error and provide feedback
				
					 document.sls_trial_class.firstname.style.backgroundColor="#7bd9db";
					  document.sls_trial_class.firstname.value="Please provide your first name";
					  							  
					  var anytest="FAIL";
			}
			
			var lastname=document.sls_trial_class.lastname.value;
			if ((lastname == "") || (lastname == "Please provide your last name"))
			{
			   	// Trap error and provide feedback
				
					 document.sls_trial_class.lastname.style.backgroundColor="#7bd9db";
					  document.sls_trial_class.lastname.value="Please provide your last name";
					  							  
					  var anytest="FAIL";
			}
					
			
			
			
			
			// SUBMIT FORM VIA AJAX ONLY IF ALL TEST PASS - display connecting message
			
			if (anytest=="PASS")
			
					 {
										
					
					document.sls_trial_class.submit();
					
					}

		}









// Newsletter check 
function submit_newsletter() 
			{

			var newsletter_test="PASS";
			var news_emailsubscribe=document.newsletter.email_input.value;
						
			// variable used to only provide one error message for email
			var emailATtest2="PASS";
			
			if ((news_emailsubscribe == "") || (news_emailsubscribe == "Please provide an email"))
			{
			   	// Trap error and provide feedback
				
					 document.newsletter.email_input.style.backgroundColor="#7bd9db";
					 document.newsletter.email_input.value="Please provide an email";				  
					 
					 var emailATtest2="FAIL";
			}
			
			if (((news_emailsubscribe.indexOf("@")==-1) && (emailATtest2=="PASS")) || (news_emailsubscribe == "This is NOT a valid email"))
			{
			   	// Trap error and provide feedback
				//alert("Please input a valid email address, like john@bigpond.com")
					 document.newsletter.email_input.style.backgroundColor="#7bd9db";
					 document.newsletter.email_input.value="This is NOT a valid email";	
					 
					 var newsletter_test="FAIL";
			}
			
			var email_name=document.newsletter.news_name.value;
				
			
			if ((email_name == "") || (email_name == "Please provide a name"))
			{
			   	// Trap error and provide feedback
				
					 document.newsletter.news_name.style.backgroundColor="#7bd9db";
					 document.newsletter.news_name.value="Please provide a name";
					  
					  var newsletter_test="FAIL";
			}
			
if (newsletter_test=="PASS")
			
	{
		document.newsletter.submit();
		alert("Thank you for your newsletter registration");

	}
}



