﻿// JScript File

function validatePostCode(){
/** Validate postcodes so that they are between 4000 and 4999 or between 9000 and 9999 **/
    var pCode=parseFloat(document.getElementById("_ctl0_ContentPlaceHolder1_txtPostCode").value);
    var fVL4=(pCode>=4000); //>=4000 = true
    var fVG4=(pCode<=4999); //<=4999 = true
    var fVL9=(pCode>=9000); //>=9000 = true
    var fVG9=(pCode<=9999); //<=9999 = true 
    var fV4=(fVL4&&fVG4);   //Between 4000 and 4999 = true
    var fV9=(fVL9&&fVG9);   //Between 9000 and 9999 = true
    var fV=(fV4||fV9);      //is fV4 or fV9 true?
    //alert("fVL4:" +fVL4 + ";\n\rfVG4:" + fVG4 + ";\n\rfVL9:" + fVL9 + ";\n\rfVG9:" + fVG9 + ";\n\rfV4:" + fV4 + ";\n\rfV9:" + fV9 + ";\n\rfV:" + fV);
    
    if(fV==true){
        //alert("Valid");
        return true;
    }else{
        //alert("Not Valid");
        return false;
    }
}

function InputHelp(s){
    var msg = 'Please enter either:\n\nThe QCT Registration Number of the ' + s + ' (if you know it)\nOr\nThe ' + s + '\'s name.\n\nIf there is more than one match,\na selection of Teacher\'s will apear for you to choose from.';
    alert(msg);
}  


/*********************************************************************************************/
/*********************************************************************************************/
/**                                                                                         **/
/** JavaScript Email Obscuring function                                                     **/
/** Added by Rod Coate                                                                      **/
/** 16 July 2007                                                                            **/
/** Based on code from :                                                                    **/
/** http://diagrammes-modernes.blogspot.com/2006/05/obscuring-your-email-from-spammers.html **/
/**                                                                                         **/
/*********************************************************************************************/
/*********************************************************************************************/
function InsertEmail(d,a) {  
//d = Display Text
//a = Address (first part)
    var chardot = '.'; 
    var charat = '@'; 
    var TheArray = new Array('au', 'edu', 'qct', 'btt'); 
    document.write('<a href="ma'); 
    document.write('ilto:'); 
    document.write(a); 
    document.write(charat); 
	document.write(TheArray[3]);
    document.write(chardot); 
    document.write(TheArray[2]); 
    document.write(chardot); 
    document.write(TheArray[1]);
    document.write(chardot);
    document.write(TheArray[0]); 
    document.write('">'); 
    document.write(d); 
    document.write('</a>');
}
