<!-- 
// Hide script from older browsers
var urlAddress = "http://www.SuccessOnlineLearning.com.au/default.htm";
var pageName = "Welcome to Success Online Learning Academy";

/*
    addToFavorites ()   
    Adds our web page as a favorite
*/
function addToFavorites() {
   if (window.external) { window.external.AddFavorite(urlAddress, pageName) } else { alert("Sorry! Your browser doesn't support this function.");	}
}

/*
    DoOpenWindow(url,iwidth,iheight)
    Opens a new web browser window with a specified width and height.
*/
function DoOpenWindow(url,iwidth,iheight)
{
	window.open(url,"_blank","height="+iheight+",width="+iwidth+",status=yes,toolbar=no,menubar=no,location=no,scrollbars=1,resizable=yes");
}

/*
    DoInstantMessage (person, screen)   
    Sends an instant message to a Hotmail contact
*/
function DoInstantMessage(person, screen)
{
  // Check if person has messenger installed
  try { MsgrObj.classid="clsid:B69003B3-C55E-4B48-836C-BC5946FC3B28"; }
  catch(e){if(!(e.number && 2148139390) == 2148139390)return;}

  // Check if you are logged in
  if(MsgrObj.MyStatus == 1) {
     alert("You are not logged into Messenger.\nYou must login to Messenger before continuing.");
     return;
  }

  // Check if person is already in contact list
  try{var contact = MsgrObj.GetContact(person,"");}
  catch(e)
  {
    if((e.number && 2164261642) == 2164261642) //MSGR_E_USER_NOT_FOUND
    {
      if(confirm("Add "+screen+" to your contact list?")==true)MsgrObj.AddContact(0,person);
    }
  }
  // Ask to send an instant message
  if(confirm("Send "+screen+" an instant message?")==true)MsgrObj.InstantMessage(person);
}

/*
    showScreenshot (sDivName)   
    Shows or Hides a section of the screen contents.
*/
function showScreenshot(sDivName){
	if(document.all(sDivName).style.display=="none"){		
		document.all(sDivName).style.display = "block";
	}
	else{document.all(sDivName).style.display = "none";}
}
/*
    hideScreenshot (sDivName)   
    Hides a section of the screen contents.
*/
function hideScreenshot(sDivName){
	if(document.all(sDivName).style.display=="block"){	document.all(sDivName).style.display = "none";}
}
/*
    CalculateAge (object, DateOfBirth, WriteTo)   
    Calculates a persons age based on their date of birth
*/
function CalculateAge(object, birthDay){
  now = new Date();
  bD = birthDay.value.split('/');
  
  if(bD.length==3){
     born = new Date(bD[2], bD[1]*1-1, bD[0]);
     years = new Date(now.getTime() - born.getTime());
     base = new Date(0);
     document.all['AGE'].value = years.getFullYear()-base.getFullYear();
   }
   if (birthDay.value == '') document.all['AGE'].value = '';
}

/*
    checkText (textData)   
    Validates a textstring to see if it is empty.
*/
function checkText(textData)
{
 	for(var i=0;i<textData.length;i++){
 		if (textData.charAt(i)!=" ") return true;
 	}
 	return false;
}              
/*
    checkMail (textData)   
    Validates an email address to see if it is valid
*/
function checkMail(textData)
{
	if (textData.length <=3) return false;
	for(var i = 0; i < textData.length; i++) {
		if (textData.charAt(i)=="@") return true;
	}return false;
}              

// Check to see how many Lower School subjects have been selected.
function IsLowerSchoolChecked() 
{           
	var LWRS_Checks  = new Array();  // array to hold all checkbox elements      
	var LWRS_LIMIT   = 8;            // Maximum limit allowed for Lower School.
    var count        = 0;   
    var checkcount   = 0;   
    var checkstmp    = document.getElementsByName("LWRS");   

    // Populate all checkbox items into an array.
    for (var j = 0; j < checkstmp.length; ++j) {
         if (checkstmp[j].type == "checkbox") {      
             LWRS_Checks[count] = checkstmp[j];      
             ++count;    
         }   
    } 

    // Process all items that have been selected and make sure that they do not exceed the max allowed limit.
    for (var j = 0; j < LWRS_Checks.length; j++) {
        if (checkcount <= LWRS_LIMIT) {
            if (LWRS_Checks[j].checked) { 
                ++checkcount; 
            }
        } else { alert("You may only select a maximum of " + LWRS_LIMIT + " items at a time!"); return false; }
    }   
    return true;
} 

// Check to see how many Upper School subjects have been selected.
function IsUpperSchoolChecked() 
{        
    var UPRS_Checks  = new Array();  // array to hold all checkbox elements      
    var UPRS_LIMIT   = 5;            // Maximum limit allowed for Lower School.
    var count        = 0;   
    var checkcount   = 0;   
    var checkstmp    = document.getElementsByName("UPRS");   

    // Populate all checkbox items into an array.
    for (var j = 0; j < checkstmp.length; ++j) {
         if (checkstmp[j].type == "checkbox") {      
             UPRS_Checks[count] = checkstmp[j];      
             ++count;    
         }   
    } 

    // Process all items that have been selected and make sure that they do not exceed the max allowed limit.
    for (var j = 0; j < UPRS_Checks.length; j++) {
        if (checkcount <= UPRS_LIMIT) {
            if (UPRS_Checks[j].checked) { 
                ++checkcount; 
            }
        } else { alert("You may only select a maximum of " + UPRS_LIMIT + " items at a time!"); return false; }
    }   
    return true;
}

// Check to see how many Electives subjects have been selected. MAX = 2
function IsElectivesChecked() 
{        
    var ELECT_Checks = new Array();  // array to hold all checkbox elements      
    var ELECT_LIMIT  = 2;            // Maximum limit allowed for School Electives.
    var count        = 0;   
    var checkcount   = 0;   
    var checkstmp    = document.getElementsByName("ELECT");   

    // Populate all checkbox items into an array.
    for (var j = 0; j < checkstmp.length; ++j) {
         if (checkstmp[j].type == "checkbox") {      
             ELECT_Checks[count] = checkstmp[j];      
             ++count;    
         }   
    } 

    // Process all items that have been selected and make sure that they do not exceed the max allowed limit.
    for (var j = 0; j < ELECT_Checks.length; j++) {
        if (checkcount <= ELECT_LIMIT) {
            if (ELECT_Checks[j].checked) { 
                ++checkcount; 
            }
        } else { alert("You may only select a maximum of " + ELECT_LIMIT + " items at a time!"); return false; }
    }   
    return true;
}
// -->
