<!--
function isGreaterThan(argInput, argMin)

{ if (argInput.length >= argMin)
        {return true;}
  else
        {return false;}
}

// ##############################################################

function setFocus(theID,theOnColor)
{
eval("document.getElementById('"+theID+"').style.backgroundColor='" + theOnColor + "';");
}

function releaseFocus(theID,theOffColor)
{
eval("document.getElementById('"+theID+"').style.backgroundColor='" + theOffColor + "';");
}

// ##############################################################

function startWin(TheWindow,scrollBar,theWidth,theHeight)
{
var desktop=window.open(TheWindow,"_blank","toolbar=no,location=no,status=no,menubar=no,scrollbars="+scrollBar+",width="+theWidth+",height="+theHeight+",resizable");
var screenwidth=screen.width
var screenheight=screen.height
var leftcoord=(screen.width-theWidth)/2
var topcoord=(screen.height-theHeight-30)/2
desktop.moveTo(leftcoord,topcoord);
}

function startPrintWin(TheWindow,scrollBar,theWidth,theHeight)
{
var desktop=window.open(TheWindow,"_blank","toolbar=no,location=no,status=no,menubar=yes,scrollbars="+scrollBar+",width="+theWidth+",height="+theHeight+",resizable");
var screenwidth=screen.width
var screenheight=screen.height
var leftcoord=(screen.width-theWidth)/2
var topcoord=(screen.height-theHeight-30)/2
desktop.moveTo(leftcoord,topcoord);
}

// ##############################################################

function isEmailOK(s) {

  invalidCharsList = " /:,;~#";
 
  if (s.value.indexOf('@',0)==-1 || s.value.indexOf('@',0)== 0 || s.value.indexOf('.',0)==-1) {
    s.select();
    s.focus();
    return (false);
  }
  for (i = 0; i < invalidCharsList.length; i++) {
    errorChar = invalidCharsList.charAt(i);
    if (s.value.indexOf(errorChar,0) != -1) {
      s.select();
      s.focus();
      return (false);
    }
  }
    return (true);
}

function isEmail()

{
invalidCharsList = " /:,;~#";

if (document.theForm.emailaddr.value.indexOf('@',0)==-1 || document.theForm.emailaddr.value.indexOf('@',0)== 0 || document.theForm.emailaddr.value.indexOf('.',0)==-1)
        {
    document.theForm.emailaddr.select();
    document.theForm.emailaddr.focus();
    return (false);
     }
    for (i = 0; i < invalidCharsList.length; i++) {
    errorChar = invalidCharsList.charAt(i);
    if (document.theForm.emailaddr.value.indexOf(errorChar,0) != -1) {
    document.theForm.emailaddr.select();
    document.theForm.emailaddr.focus();
    return (false);
    }
}
    return (true);
}

// ##############################################################

function isEmailFriend()

{
invalidCharsList = " /:,;~#";

if (document.theForm.friend_email.value.indexOf('@',0)==-1 || document.theForm.friend_email.value.indexOf('@',0)== 0 || document.theForm.friend_email.value.indexOf('.',0)==-1) 
        {
    document.theForm.friend_email.select();
    document.theForm.friend_email.focus();
    return (false);
     }
    for (i = 0; i < invalidCharsList.length; i++) {
    errorChar = invalidCharsList.charAt(i);
    if (document.theForm.friend_email.value.indexOf(errorChar,0) != -1) {
    document.theForm.friend_email.select();
    document.theForm.friend_email.focus();
    return (false);
    }
}
    return (true);
}

// ##############################################################

function isEmail_1()

{
invalidCharsList = " /:,;~#";

if (document.theForm.emailaddr_1.value.indexOf('@',0)==-1 || document.theForm.emailaddr_1.value.indexOf('@',0)== 0 || document.theForm.emailaddr_1.value.indexOf('.',0)==-1)
        {
    document.theForm.emailaddr_1.select();
    document.theForm.emailaddr_1.focus();
    return (false);
     }
    for (i = 0; i < invalidCharsList.length; i++) {
    errorChar = invalidCharsList.charAt(i);
    if (document.theForm.emailaddr_1.value.indexOf(errorChar,0) != -1) {
    document.theForm.emailaddr_1.select();
    document.theForm.emailaddr_1.focus();
    return (false);
    }
}
    return (true);
}

// ##############################################################

function isEmail_2()

{
invalidCharsList = " /:,;~#";

if (document.theForm.emailaddr_2.value.indexOf('@',0)==-1 || document.theForm.emailaddr_2.value.indexOf('@',0)== 0 || document.theForm.emailaddr_2.value.indexOf('.',0)==-1) 
        {
    document.theForm.emailaddr_2.select();
    document.theForm.emailaddr_2.focus();
    return (false);
     }
    for (i = 0; i < invalidCharsList.length; i++) {
    errorChar = invalidCharsList.charAt(i);
    if (document.theForm.emailaddr_2.value.indexOf(errorChar,0) != -1) {
    document.theForm.emailaddr_2.select();
    document.theForm.emailaddr_2.focus();
    return (false);
    }
}
    return (true);
}

// ##############################################################

function isEmail1()

{
invalidCharsList = " /:,;~#";

if (document.theForm.ref1_email.value.indexOf('@',0)==-1 || document.theForm.ref1_email.value.indexOf('@',0)== 0 || document.theForm.ref1_email.value.indexOf('.',0)==-1) 
        {
    document.theForm.ref1_email.select();
    document.theForm.ref1_email.focus();
    return (false);
     }
    for (i = 0; i < invalidCharsList.length; i++) {
    errorChar = invalidCharsList.charAt(i);
    if (document.theForm.ref1_email.value.indexOf(errorChar,0) != -1) {
    document.theForm.ref1_email.select();
    document.theForm.ref1_email.focus();
    return (false);
    }
}
    return (true);
}

// ##############################################################

function isEmail2()

{
invalidCharsList = " /:,;~#";

if (document.theForm.ref2_email.value.indexOf('@',0)==-1 || document.theForm.ref2_email.value.indexOf('@',0)== 0 || document.theForm.ref2_email.value.indexOf('.',0)==-1) 
        {
    document.theForm.ref2_email.select();
    document.theForm.ref2_email.focus();
    return (false);
     }
    for (i = 0; i < invalidCharsList.length; i++) {
    errorChar = invalidCharsList.charAt(i);
    if (document.theForm.ref2_email.value.indexOf(errorChar,0) != -1) {
    document.theForm.ref2_email.select();
    document.theForm.ref2_email.focus();
    return (false);
    }
}
    return (true);
}

// ##############################################################

function isEmail3()

{
invalidCharsList = " /:,;~#";

if (document.theForm.ref3_email.value.indexOf('@',0)==-1 || document.theForm.ref3_email.value.indexOf('@',0)== 0 || document.theForm.ref3_email.value.indexOf('.',0)==-1) 
        {
    document.theForm.ref3_email.select();
    document.theForm.ref3_email.focus();
    return (false);
     }
    for (i = 0; i < invalidCharsList.length; i++) {
    errorChar = invalidCharsList.charAt(i);
    if (document.theForm.ref3_email.value.indexOf(errorChar,0) != -1) {
    document.theForm.ref3_email.select();
    document.theForm.ref3_email.focus();
    return (false);
    }
}
    return (true);
}

// ##############################################################

function isEmail4()

{
invalidCharsList = " /:,;~#";

if (document.theForm.ref4_email.value.indexOf('@',0)==-1 || document.theForm.ref4_email.value.indexOf('@',0)== 0 || document.theForm.ref4_email.value.indexOf('.',0)==-1) 
        {
    document.theForm.ref4_email.select();
    document.theForm.ref4_email.focus();
    return (false);
     }
    for (i = 0; i < invalidCharsList.length; i++) {
    errorChar = invalidCharsList.charAt(i);
    if (document.theForm.ref4_email.value.indexOf(errorChar,0) != -1) {
    document.theForm.ref4_email.select();
    document.theForm.ref4_email.focus();
    return (false);
    }
}
    return (true);
}

// ##############################################################

function isEmail5()

{
invalidCharsList = " /:,;~#";

if (document.theForm.ref5_email.value.indexOf('@',0)==-1 || document.theForm.ref5_email.value.indexOf('@',0)== 0 || document.theForm.ref5_email.value.indexOf('.',0)==-1) 
        {
    document.theForm.ref5_email.select();
    document.theForm.ref5_email.focus();
    return (false);
     }
    for (i = 0; i < invalidCharsList.length; i++) {
    errorChar = invalidCharsList.charAt(i);
    if (document.theForm.ref5_email.value.indexOf(errorChar,0) != -1) {
    document.theForm.ref5_email.select();
    document.theForm.ref5_email.focus();
    return (false);
    }
}
    return (true);
}

// ##############################################################

function round(num)
{
    return Math.round(num*Math.pow(10,2))/Math.pow(10,2);
}

function FormatMoney(num)
{
        if (isNaN(parseInt(num))) return "NaN";

        var tmpNum = num;
        var iSign = num < 0 ? -1 : 1;           // Get sign of number
 
        // Adjust number so only the specified number of numbers after
        // the decimal point are shown.
        tmpNum *= 100;
        tmpNum = Math.round(Math.abs(tmpNum))
        tmpNum /= 100;
        tmpNum *= iSign;                                        // Readjust for sign
 
        // Create a string object to do our formatting on
        var tmpNumStr = new String(tmpNum);
 
        var iStart = tmpNumStr.indexOf(".");
        if (iStart < 0)
          tmpNumStr += ".00";
        else
          if ((tmpNumStr.length - iStart) == 2) tmpNumStr += "0";

        return tmpNumStr;               // Return our formatted string!
}

// ##############################################################

function isEmpty(s)
{
        if ((s == null) || (s.length == 0) || (s == '' ))
                { return true;
                }
        else
                { return false;
                }
} 

// ##############################################################

function isDigit (c)
{   return ((c >= "0") && (c <= "9"))
}

// ##############################################################

function isTelephoneDigit (c)
{   return (((c >= "0") && (c <= "9")) || (c == " ") || (c == "(") || (c == ")") || (c == "-"))
}

// ##############################################################

function isMoneyDigit (c)
{   return (((c >= "0") && (c <= "9")) || (c == "R") || (c == " ") || (c == ",") || (c == "."))}

// ##############################################################

function isNumeric (argInput)

{   var i;
    for (i = 0; i < argInput.length; i++)
    {   
        var c = argInput.charAt(i);
        if (!isDigit(c)) return false;
    }
    return true;
}

// ##############################################################

function isID(argInput)

{   var i;
    for (i = 0; i < argInput.length; i++)
    {   
        var c = argInput.charAt(i);
        if (!isDigit(c)) return false;
    }
    return true;
}

// ##############################################################

function isMoney (argInput)

{   var i;
    for (i = 0; i < argInput.length; i++)
    {   
        var c = argInput.charAt(i);
        if (!isMoneyDigit(c)) return false;
    }
    return true;
}

// ##############################################################

function isTelephone (argInput)

{   var i;
    for (i = 0; i < argInput.length; i++)
    {   
        var c = argInput.charAt(i);
        if (!isTelephoneDigit(c)) return false;
    }
    return true;
}

// ##############################################################

function isCellphone (argInput)

{   var i;
    for (i = 0; i < argInput.length; i++)
    {   
        var c = argInput.charAt(i);
        if (!isDigit(c)) return false;
    }

    return true;
}

// ##############################################################
// ##############################################################

function disableButton()
{
document.theForm.submitbutton.disabled=false;
}

// ##############################################################
// ##############################################################

<!-- Original:  Sandeep V. Tamhankar (stamhankar@hotmail.com) -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function isValidDate(dateStr,blnID) {
// Vadi-Start : below lines are added to convert the date in to the required format
   if (isEmpty(dateStr)) {return true}
   if (blnID) dateStr = dateStr.substr(2, 2) + '/' + dateStr.substr(4, 2) + '/' + dateStr.substr(0, 2)
// Vadi-End

// Checks for the following valid date formats:
// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY
// Also separates date into month, day, and year variables

var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;

// To require a 4 digit year entry, use this line instead:
// var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;

var matchArray = dateStr.match(datePat); // is the format ok?
if (matchArray == null) {
alert("Date is not in a valid format.")
return false;
}
month = matchArray[1]; // parse date into variables
day = matchArray[3];
year = matchArray[4];
if (month < 1 || month > 12) { // check month range
alert("Date Format : Month must be between 1 and 12.");
return false;
}
if (day < 1 || day > 31) {
alert("Date Format : Day must be between 1 and 31.");
return false;
}
if ((month==4 || month==6 || month==9 || month==11) && day==31) {
alert("Date Format : "+"Month "+month+" doesn't have 31 days!")
return false
}
if (month == 2) { // check for february 29th
var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
if (day>29 || (day==29 && !isleap)) {
alert("Date Format"+"February " + year + " doesn't have " + day + " days!");
return false;
   }
}
return true;  // date is valid
}
//  End -->

// ##############################################################
// ##############################################################

function isValidTime(timeStr) {
   if (isEmpty(timeStr)) {return true}

var timePat = /^(\d{2})(:)(\d{2})$/;

var matchArray = timeStr.match(timePat); // is the format ok?
if (matchArray == null) {
return false;
}
hour = matchArray[1]; // parse time into variables
minute = matchArray[3];
if (hour < 0 || hour > 23) { // check hour range
alert("Time Format : Hour must be between 0 and 23.");
return false;
}
if (minute < '00' || minute > '59') {
alert("Date Format : Minute must be between 0 and 59.");
return false;
}
return true;  // time is valid
}

function validateRegistration()
{
if (isEmpty(document.theForm.company.value))
        { alert('Please specify your company name.');
        document.theForm.company.focus();
        return false;}
 
else if (isEmpty(document.theForm.contactperson.value))
        { alert('Please specify a contact person at your company.');
        document.theForm.contactperson.focus();
        return false;}
 
else if (isEmpty(document.theForm.telephone_code.value))
        { alert('Please specify a telephone dialling code for your company.');
        document.theForm.telephone_code.focus();
        return false;}
 
else if (isEmpty(document.theForm.telephone.value))
        { alert('Please specify a telephone number for your company.');
        document.theForm.telephone.focus();
        return false;}

//else if (isEmpty(document.theForm.address.value))
//      { alert('Please specify a postal address for your company.');
//      document.theForm.address.focus();
//      return false;}

else if ((document.theForm.delegatecount[0].checked==false) && (document.theForm.delegatecount[1].checked==false) && (document.theForm.delegatecount[2].checked==false) && (document.theForm.delegatecount[3].checked==false) && (document.theForm.delegatecount[4].checked==false) && (document.theForm.delegatecount[5].checked==false))
        { alert('Please specify how many delegates you would like to register.');
        document.theForm.delegatecount[0].focus();
        return false;}

// DELEGATE 1
 
else if (document.theForm.title_1.selectedIndex==0)
        { alert('Please specify the delegate\'s title.');
        document.theForm.title_1.focus();
        return false;}

else if (isEmpty(document.theForm.firstname_1.value))
        { alert('Please specify the delegate\'s first name.');
        document.theForm.firstname_1.focus();
        return false;}
 
else if (isEmpty(document.theForm.surname_1.value))
        { alert('Please specify the delegate\'s surname.');
        document.theForm.surname_1.focus();
        return false;}
 
//else if (isEmpty(document.theForm.idno_1.value))
//        { alert('Please specify the delegate\'s ID number.');
//        document.theForm.idno_1.focus();
//        return false;}
 
else if ((!isNumeric(document.theForm.cellphone_1.value)) || (isEmpty(document.theForm.cellphone_1.value) || (document.theForm.cellphone_1.value.length!==10)))
        { alert('Please specify the delegate\'s cellphone number - no spaces allowed.');
        document.theForm.cellphone_1.focus();
        return false;}
 
else if ((isEmpty(document.theForm.emailaddr_1.value)) || (!isEmail_1(document.theForm.emailaddr_1.value)))
        { alert('Please specify a valid e-mail address for the delegate.');
        document.theForm.emailaddr_1.focus();
        return false;}
 
// DELEGATE 2

else if ((document.theForm.delegatecount[1].checked==true) && (document.theForm.title_2.selectedIndex==0))
        { alert('Please specify the second delegate\'s title.');
        document.theForm.title_2.focus();
        return false;}

else if ((document.theForm.delegatecount[1].checked==true) && (isEmpty(document.theForm.firstname_2.value)))
        { alert('Please specify the second delegate\'s first name.');
        document.theForm.firstname_2.focus();
        return false;}
 
else if ((document.theForm.delegatecount[1].checked==true) && (isEmpty(document.theForm.surname_2.value)))
        { alert('Please specify the second delegate\'s surname.');
        document.theForm.surname_2.focus();
        return false;}
 
//else if ((document.theForm.delegatecount[1].checked==true) && (isEmpty(document.theForm.idno_2.value)))
//        { alert('Please specify the second delegate\'s ID number.');
//        document.theForm.idno_2.focus();
//        return false;}
 
// DELEGATE 3

// -----------------------------------------------------------------------------------------------------------------------------

else if ((document.theForm.delegatecount[2].checked==true) && (document.theForm.title_2.selectedIndex==0))
        { alert('Please specify the second delegate\'s title.');
        document.theForm.title_2.focus();
        return false;}

else if ((document.theForm.delegatecount[2].checked==true) && (isEmpty(document.theForm.firstname_2.value)))
        { alert('Please specify the second delegate\'s first name.');
        document.theForm.firstname_2.focus();
        return false;}

else if ((document.theForm.delegatecount[2].checked==true) && (isEmpty(document.theForm.surname_2.value)))
        { alert('Please specify the second delegate\'s surname.');
        document.theForm.surname_2.focus();
        return false;}
 
//else if ((document.theForm.delegatecount[2].checked==true) && (isEmpty(document.theForm.idno_2.value)))
//        { alert('Please specify the second delegate\'s ID number.');
//        document.theForm.idno_2.focus();
//        return false;}
 
else if ((document.theForm.delegatecount[2].checked==true) && (document.theForm.title_3.selectedIndex==0))
        { alert('Please specify the third delegate\'s title.');
        document.theForm.title_3.focus();
        return false;}

else if ((document.theForm.delegatecount[2].checked==true) && (isEmpty(document.theForm.firstname_3.value)))
        { alert('Please specify the third delegate\'s first name.');
        document.theForm.firstname_3.focus();
        return false;}

else if ((document.theForm.delegatecount[2].checked==true) && (isEmpty(document.theForm.surname_3.value)))
        { alert('Please specify the third delegate\'s surname.');
        document.theForm.surname_3.focus();
        return false;}
 
//else if ((document.theForm.delegatecount[2].checked==true) && (isEmpty(document.theForm.idno_3.value)))
//        { alert('Please specify the third delegate\'s ID number.');
//        document.theForm.idno_3.focus();
//        return false;}
 
// DELEGATE 4

// -----------------------------------------------------------------------------------------------------------------------------

else if ((document.theForm.delegatecount[3].checked==true) && (document.theForm.title_2.selectedIndex==0))
        { alert('Please specify the second delegate\'s title.');
        document.theForm.title_2.focus();
        return false;}

else if ((document.theForm.delegatecount[3].checked==true) && (isEmpty(document.theForm.firstname_2.value)))
        { alert('Please specify the second delegate\'s first name.');
        document.theForm.firstname_2.focus();
        return false;}

else if ((document.theForm.delegatecount[3].checked==true) && (isEmpty(document.theForm.surname_2.value)))
        { alert('Please specify the second delegate\'s surname.');
        document.theForm.surname_2.focus();
        return false;}
 
//else if ((document.theForm.delegatecount[2].checked==true) && (isEmpty(document.theForm.idno_2.value)))
//        { alert('Please specify the second delegate\'s ID number.');
//        document.theForm.idno_2.focus();
//        return false;}

else if ((document.theForm.delegatecount[3].checked==true) && (document.theForm.title_3.selectedIndex==0))
        { alert('Please specify the third delegate\'s title.');
        document.theForm.title_3.focus();
        return false;}

else if ((document.theForm.delegatecount[3].checked==true) && (isEmpty(document.theForm.firstname_3.value)))
        { alert('Please specify the third delegate\'s first name.');
        document.theForm.firstname_3.focus();
        return false;}

else if ((document.theForm.delegatecount[3].checked==true) && (isEmpty(document.theForm.surname_3.value)))
        { alert('Please specify the third delegate\'s surname.');
        document.theForm.surname_3.focus();
        return false;}
 
//else if ((document.theForm.delegatecount[3].checked==true) && (isEmpty(document.theForm.idno_3.value)))
//        { alert('Please specify the third delegate\'s ID number.');
//        document.theForm.idno_3.focus();
//        return false;}
        
else if ((document.theForm.delegatecount[3].checked==true) && (document.theForm.title_4.selectedIndex==0))
        { alert('Please specify the fourth delegate\'s title.'); 
        document.theForm.title_4.focus(); 
        return false;}  

else if ((document.theForm.delegatecount[3].checked==true) && (isEmpty(document.theForm.firstname_4.value)))
        { alert('Please specify the fourth delegate\'s first name.'); 
        document.theForm.firstname_4.focus(); 
        return false;}

else if ((document.theForm.delegatecount[3].checked==true) && (isEmpty(document.theForm.surname_4.value)))
        { alert('Please specify the fourth delegate\'s surname.'); 
        document.theForm.surname_4.focus(); 
        return false;}  
        
//else if ((document.theForm.delegatecount[3].checked==true) && (isEmpty(document.theForm.idno_4.value)))
//        { alert('Please specify the fourth delegate\'s ID number.');
//        document.theForm.idno_4.focus();
//        return false;}                  
        
// DELEGATE 5

// -----------------------------------------------------------------------------------------------------------------------------

else if ((document.theForm.delegatecount[4].checked==true) && (document.theForm.title_2.selectedIndex==0))
        { alert('Please specify the second delegate\'s title.'); 
        document.theForm.title_2.focus();
        return false;}  

else if ((document.theForm.delegatecount[4].checked==true) && (isEmpty(document.theForm.firstname_2.value)))
        { alert('Please specify the second delegate\'s first name.'); 
        document.theForm.firstname_2.focus(); 
        return false;}  

else if ((document.theForm.delegatecount[4].checked==true) && (isEmpty(document.theForm.surname_2.value)))
        { alert('Please specify the second delegate\'s surname.'); 
        document.theForm.surname_2.focus(); 
        return false;}  
        
//else if ((document.theForm.delegatecount[4].checked==true) && (isEmpty(document.theForm.idno_2.value)))
//        { alert('Please specify the second delegate\'s ID number.');
//        document.theForm.idno_2.focus();
//        return false;}          
        
else if ((document.theForm.delegatecount[4].checked==true) && (document.theForm.title_3.selectedIndex==0))
        { alert('Please specify the third delegate\'s title.'); 
        document.theForm.title_3.focus(); 
        return false;}  

else if ((document.theForm.delegatecount[4].checked==true) && (isEmpty(document.theForm.firstname_3.value)))
        { alert('Please specify the third delegate\'s first name.'); 
        document.theForm.firstname_3.focus(); 
        return false;}  

else if ((document.theForm.delegatecount[4].checked==true) && (isEmpty(document.theForm.surname_3.value)))
        { alert('Please specify the third delegate\'s surname.'); 
        document.theForm.surname_3.focus(); 
        return false;}
 
//else if ((document.theForm.delegatecount[4].checked==true) && (isEmpty(document.theForm.idno_3.value)))
//        { alert('Please specify the third delegate\'s ID number.');
//        document.theForm.idno_3.focus();
//        return false;}  
        
else if ((document.theForm.delegatecount[4].checked==true) && (document.theForm.title_4.selectedIndex==0))
        { alert('Please specify the fourth delegate\'s title.'); 
        document.theForm.title_4.focus(); 
        return false;}  

else if ((document.theForm.delegatecount[4].checked==true) && (isEmpty(document.theForm.firstname_4.value)))
        { alert('Please specify the fourth delegate\'s first name.'); 
        document.theForm.firstname_4.focus();
        return false;}  

else if ((document.theForm.delegatecount[4].checked==true) && (isEmpty(document.theForm.surname_4.value)))
        { alert('Please specify the fourth delegate\'s surname.');
        document.theForm.surname_4.focus(); 
        return false;}          
        
//else if ((document.theForm.delegatecount[4].checked==true) && (isEmpty(document.theForm.idno_4.value)))
//        { alert('Please specify the fourth delegate\'s ID number.');
//        document.theForm.idno_4.focus();
//        return false;}          
        
else if ((document.theForm.delegatecount[4].checked==true) && (document.theForm.title_5.selectedIndex==0))
        { alert('Please specify the fifth delegate\'s title.'); 
        document.theForm.title_5.focus(); 
        return false;}  

else if ((document.theForm.delegatecount[4].checked==true) && (isEmpty(document.theForm.firstname_5.value)))
        { alert('Please specify the fifth delegate\'s first name.'); 
        document.theForm.firstname_5.focus(); 
        return false;}  

else if ((document.theForm.delegatecount[4].checked==true) && (isEmpty(document.theForm.surname_5.value)))
        { alert('Please specify the fifth delegate\'s surname.'); 
        document.theForm.surname_5.focus(); 
        return false;}  
        
//else if ((document.theForm.delegatecount[4].checked==true) && (isEmpty(document.theForm.idno_5.value)))
//        { alert('Please specify the fifth delegate\'s ID number.');
//        document.theForm.idno_5.focus();
//        return false;}
        
// DELEGATE 6

// -----------------------------------------------------------------------------------------------------------------------------

else if ((document.theForm.delegatecount[5].checked==true) && (document.theForm.title_2.selectedIndex==0))
        { alert('Please specify the second delegate\'s title.'); 
        document.theForm.title_2.focus(); 
        return false;}  

else if ((document.theForm.delegatecount[5].checked==true) && (isEmpty(document.theForm.firstname_2.value)))
        { alert('Please specify the second delegate\'s first name.'); 
        document.theForm.firstname_2.focus(); 
        return false;}  

else if ((document.theForm.delegatecount[5].checked==true) && (isEmpty(document.theForm.surname_2.value)))
        { alert('Please specify the second delegate\'s surname.'); 
        document.theForm.surname_2.focus();
        return false;}  
        
else if ((document.theForm.delegatecount[5].checked==true) && (isEmpty(document.theForm.surname_2.value)))
        { alert('Please specify the second delegate\'s ID number.');
        document.theForm.surname_2.focus(); 
        return false;}  
        
else if ((document.theForm.delegatecount[5].checked==true) && (document.theForm.title_3.selectedIndex==0))
        { alert('Please specify the third delegate\'s title.'); 
        document.theForm.title_3.focus(); 
        return false;}  

else if ((document.theForm.delegatecount[5].checked==true) && (isEmpty(document.theForm.firstname_3.value)))
        { alert('Please specify the third delegate\'s first name.'); 
        document.theForm.firstname_3.focus(); 
        return false;}  

else if ((document.theForm.delegatecount[5].checked==true) && (isEmpty(document.theForm.surname_3.value)))
        { alert('Please specify the third delegate\'s surname.'); 
        document.theForm.surname_3.focus(); 
        return false;}  
        
else if ((document.theForm.delegatecount[5].checked==true) && (isEmpty(document.theForm.surname_3.value)))
        { alert('Please specify the third delegate\'s ID number.'); 
        document.theForm.surname_3.focus(); 
        return false;}  
        
else if ((document.theForm.delegatecount[5].checked==true) && (document.theForm.title_4.selectedIndex==0))
        { alert('Please specify the fourth delegate\'s title.'); 
        document.theForm.title_4.focus();
        return false;}  

else if ((document.theForm.delegatecount[5].checked==true) && (isEmpty(document.theForm.firstname_4.value)))
        { alert('Please specify the fourth delegate\'s first name.'); 
        document.theForm.firstname_4.focus();
        return false;}

else if ((document.theForm.delegatecount[5].checked==true) && (isEmpty(document.theForm.surname_4.value)))
        { alert('Please specify the fourth delegate\'s surname.'); 
        document.theForm.surname_4.focus(); 
        return false;}          

else if ((document.theForm.delegatecount[5].checked==true) && (isEmpty(document.theForm.surname_4.value)))
        { alert('Please specify the fourth delegate\'s ID number.'); 
        document.theForm.surname_4.focus(); 
        return false;}          
        
else if ((document.theForm.delegatecount[5].checked==true) && (document.theForm.title_5.selectedIndex==0))
        { alert('Please specify the fifth delegate\'s title.');
        document.theForm.title_5.focus(); 
        return false;}  

else if ((document.theForm.delegatecount[5].checked==true) && (isEmpty(document.theForm.firstname_5.value)))
        { alert('Please specify the fifth delegate\'s first name.'); 
        document.theForm.firstname_5.focus(); 
        return false;}  

else if ((document.theForm.delegatecount[5].checked==true) && (isEmpty(document.theForm.surname_5.value)))
        { alert('Please specify the fifth delegate\'s surname.'); 
        document.theForm.surname_5.focus(); 
        return false;}                  
        
else if ((document.theForm.delegatecount[5].checked==true) && (isEmpty(document.theForm.surname_5.value)))
        { alert('Please specify the fifth delegate\'s ID number.'); 
        document.theForm.surname_5.focus(); 
        return false;}          
        
else if ((document.theForm.delegatecount[5].checked==true) && (document.theForm.title_6.selectedIndex==0))
        { alert('Please specify the sixth delegate\'s title.'); 
        document.theForm.title_6.focus(); 
        return false;}  

else if ((document.theForm.delegatecount[5].checked==true) && (isEmpty(document.theForm.firstname_6.value)))
        { alert('Please specify the sixth delegate\'s first name.'); 
        document.theForm.firstname_6.focus(); 
        return false;}  

else if ((document.theForm.delegatecount[5].checked==true) && (isEmpty(document.theForm.surname_6.value)))
        { alert('Please specify the sixth delegate\'s surname.'); 
        document.theForm.surname_6.focus(); 
        return false;}                          
        
else if ((document.theForm.delegatecount[5].checked==true) && (isEmpty(document.theForm.surname_6.value)))
        { alert('Please specify the sixth delegate\'s ID number.'); 
        document.theForm.surname_6.focus();
        return false;}          
        
// -----------------------------------------------------------------------------------------------------------------------------                        
        
else if (document.theForm.cancel_confirm.checked==false)
        { alert('Please confirm that you agree to the terms and conditions.'); 
        document.theForm.cancel_confirm.focus(); 
        return false;}          
        
else 
        {
        return true;
        }
}


// ##############################################################
// ##############################################################
function validatefeedbackform()
{
if (isEmpty(document.theForm.firstname.value))
        { alert('Please specify the first name.'); 
        document.theForm.firstname.focus(); 
        return false;}  

else if (isEmpty(document.theForm.surname.value))
        { alert('Please specify the surname.'); 
        document.theForm.surname.focus(); 
        return false;}  

else if ((isEmpty(document.theForm.emailaddr.value)) || (!isEmail(document.theForm.emailaddr.value)))
        { alert('Please specify a valid e-mail address'); 
        document.theForm.emailaddr.focus(); 
        return false;}

else if (isEmpty(document.theForm.comments.value))
        { alert('Please enter comments'); 
        document.theForm.comments.focus(); 
        return false;}
else 
        {
        return true;
        }
}               

// ##############################################################
// ##############################################################

function setTextBoxes(getDelegates)
{

// alert('Discount: '+DiscountNo+' Delegates: ' + Delegates)

if (getDelegates==1)
        {
        setFocus('row_1','#009900');
        releaseFocus('row_2','#FFFFCC');        
        releaseFocus('row_3','#FFFFCC');        
        releaseFocus('row_4','#FFFFCC');        
        releaseFocus('row_5','#FFFFCC');        
        releaseFocus('row_6','#FFFFCC');                
        }
        
if (getDelegates==2)
        {
        setFocus('row_1','#009900');
        setFocus('row_2','#009900');    
        releaseFocus('row_3','#FFFFCC');        
        releaseFocus('row_4','#FFFFCC');        
        releaseFocus('row_5','#FFFFCC');        
        releaseFocus('row_6','#FFFFCC');                
        }       
        
if (getDelegates==3)
        {
        setFocus('row_1','#009900');
        setFocus('row_2','#009900');    
        setFocus('row_3','#009900');    
        releaseFocus('row_4','#FFFFCC');        
        releaseFocus('row_5','#FFFFCC');        
        releaseFocus('row_6','#FFFFCC');        
        }
        
if (getDelegates==4)
        {
        setFocus('row_1','#009900');
        setFocus('row_2','#009900');    
        setFocus('row_3','#009900');    
        setFocus('row_4','#009900');    
        releaseFocus('row_5','#FFFFCC');        
        releaseFocus('row_6','#FFFFCC');        
        }       
        
if (getDelegates==5)
        {
        setFocus('row_1','#009900');
        setFocus('row_2','#009900');    
        setFocus('row_3','#009900');
        setFocus('row_4','#009900');
        setFocus('row_5','#009900');
        releaseFocus('row_6','#FFFFCC');
        }
 
if (getDelegates==6)
        {
        setFocus('row_1','#009900');
        setFocus('row_2','#009900');
        setFocus('row_3','#009900');
        setFocus('row_4','#009900');
        setFocus('row_5','#009900');
        setFocus('row_6','#009900');
        }
 
}

// ##############################################################
// ##############################################################

function calculateBooking(getDelegates,getFee,getDiscount,getDiscountNo,getVAT)
{

var TotalFee = 0
var DiscountFee = 0
var FinalFee = 0
var Delegates = getDelegates
var Fee = getFee
var Discount = getDiscount
var DiscountNo = getDiscountNo
var VAT = getVAT

if (Delegates==1)
        {
        document.theForm.fee_1.value = Fee;
        document.theForm.fee_2.value = 0;
        document.theForm.fee_3.value = 0;
        document.theForm.fee_4.value = 0;
        document.theForm.fee_5.value = 0;
        document.theForm.fee_6.value = 0;
        document.theForm.fee_discount.value = 0;
        document.theForm.fee_vat.value = 0;
        document.theForm.fee_totalwithvat.value = 0;
        TotalFee = Fee;
        document.theForm.fee_total.value = TotalFee;
        document.theForm.fee_vat.value = FormatMoney(VAT*TotalFee,2);
        document.theForm.fee_totalwithvat.value = FormatMoney(TotalFee + parseFloat(document.theForm.fee_vat.value),2);
        }

if (Delegates==2)
        {
        document.theForm.fee_1.value = Fee;
        document.theForm.fee_2.value = Fee;
        document.theForm.fee_3.value = 0;
        document.theForm.fee_4.value = 0;
        document.theForm.fee_5.value = 0;
        document.theForm.fee_6.value = 0;
        document.theForm.fee_discount.value = 0;
        document.theForm.fee_vat.value = 0;
        document.theForm.fee_totalwithvat.value = 0;
        TotalFee = Fee*2;
        document.theForm.fee_total.value = TotalFee;
        document.theForm.fee_vat.value = FormatMoney(VAT*TotalFee,2);
        document.theForm.fee_totalwithvat.value = FormatMoney(TotalFee + parseFloat(document.theForm.fee_vat.value),2);

        if (DiscountNo <= Delegates)
                {
                DiscountFee = ((TotalFee * Discount)/100);
                document.theForm.fee_discount.value = DiscountFee;
                document.theForm.fee_total.value = TotalFee - DiscountFee;
                document.theForm.fee_vat.value = FormatMoney(VAT*TotalFee,2);
                document.theForm.fee_totalwithvat.value = FormatMoney(TotalFee - DiscountFee + parseFloat(document.theForm.fee_vat.value),2);
                }
        }
 
if (Delegates==3)
        {
        document.theForm.fee_1.value = Fee;
        document.theForm.fee_2.value = Fee;
        document.theForm.fee_3.value = Fee;
        document.theForm.fee_4.value = 0;
        document.theForm.fee_5.value = 0;
        document.theForm.fee_6.value = 0;
        document.theForm.fee_discount.value = 0;
        document.theForm.fee_vat.value = 0;
        document.theForm.fee_totalwithvat.value = 0;
        TotalFee = Fee*3;
        document.theForm.fee_total.value = TotalFee;
        document.theForm.fee_vat.value = FormatMoney(VAT*TotalFee,2);
        document.theForm.fee_totalwithvat.value = FormatMoney(TotalFee + parseFloat(document.theForm.fee_vat.value),2);
        }
        if (DiscountNo <= Delegates)
                {
                DiscountFee = ((TotalFee * Discount)/100);
                document.theForm.fee_discount.value = DiscountFee;
                document.theForm.fee_total.value = TotalFee - DiscountFee;
                document.theForm.fee_vat.value = FormatMoney(VAT*TotalFee,2);
                document.theForm.fee_totalwithvat.value = FormatMoney(TotalFee - DiscountFee + parseFloat(document.theForm.fee_vat.value),2);
                }
 
if (Delegates==4)
        {
        document.theForm.fee_1.value = Fee;
        document.theForm.fee_2.value = Fee;
        document.theForm.fee_3.value = Fee;
        document.theForm.fee_4.value = Fee;
        document.theForm.fee_5.value = 0;
        document.theForm.fee_6.value = 0;
        document.theForm.fee_discount.value = 0;
        document.theForm.fee_vat.value = 0;
        document.theForm.fee_totalwithvat.value = 0;
        TotalFee = Fee*4;
        document.theForm.fee_total.value = TotalFee;
        document.theForm.fee_vat.value = FormatMoney(VAT*TotalFee,2);
        document.theForm.fee_totalwithvat.value = FormatMoney(TotalFee + parseFloat(document.theForm.fee_vat.value),2);
        }
        if (DiscountNo <= Delegates)
                {
                DiscountFee = ((TotalFee * Discount)/100);
                document.theForm.fee_discount.value = DiscountFee;
                document.theForm.fee_total.value = TotalFee - DiscountFee;
                document.theForm.fee_vat.value = FormatMoney(VAT*TotalFee,2);
                document.theForm.fee_totalwithvat.value = FormatMoney(TotalFee - DiscountFee + parseFloat(document.theForm.fee_vat.value),2);
                }
 
if (Delegates==5)
        {
        document.theForm.fee_1.value = Fee;
        document.theForm.fee_2.value = Fee;
        document.theForm.fee_3.value = Fee;
        document.theForm.fee_4.value = Fee;
        document.theForm.fee_5.value = Fee;
        document.theForm.fee_6.value = 0;
        document.theForm.fee_discount.value = 0;
        document.theForm.fee_vat.value = 0;
        document.theForm.fee_totalwithvat.value = 0;
        TotalFee = Fee*5;
        document.theForm.fee_total.value = TotalFee;
        document.theForm.fee_vat.value = FormatMoney(VAT*TotalFee,2);
        document.theForm.fee_totalwithvat.value = FormatMoney(TotalFee + parseFloat(document.theForm.fee_vat.value),2);
        }
        if (DiscountNo <= Delegates)
                {
                DiscountFee = ((TotalFee * Discount)/100);
                document.theForm.fee_discount.value = DiscountFee;
                document.theForm.fee_total.value = TotalFee - DiscountFee;
                document.theForm.fee_vat.value = FormatMoney(VAT*TotalFee,2);
                document.theForm.fee_totalwithvat.value = FormatMoney(TotalFee - DiscountFee + parseFloat(document.theForm.fee_vat.value),2);
                }
 
if (Delegates==6)
        {
        document.theForm.fee_1.value = Fee;
        document.theForm.fee_2.value = Fee;
        document.theForm.fee_3.value = Fee;
        document.theForm.fee_4.value = Fee;
        document.theForm.fee_5.value = Fee;
        document.theForm.fee_6.value = Fee;
        document.theForm.fee_discount.value = 0;
        document.theForm.fee_vat.value = 0;
        document.theForm.fee_totalwithvat.value = 0;
        TotalFee = Fee*6;
        document.theForm.fee_total.value = TotalFee;
        document.theForm.fee_vat.value = FormatMoney(VAT*TotalFee,2);
        document.theForm.fee_totalwithvat.value = FormatMoney(TotalFee + parseFloat(document.theForm.fee_vat.value),2);
        }
        if (DiscountNo <= Delegates)
                {
                DiscountFee = ((TotalFee * Discount)/100);
                document.theForm.fee_discount.value = DiscountFee;
                document.theForm.fee_total.value = TotalFee - DiscountFee;
                document.theForm.fee_vat.value = FormatMoney(VAT*TotalFee,2);
                document.theForm.fee_totalwithvat.value = FormatMoney(TotalFee - DiscountFee + parseFloat(document.theForm.fee_vat.value),2);
                }
 
}


// ##############################################################
// ##############################################################

function validateReferences()
{

if ((isEmpty(document.theForm.ref1_name.value)) && (isEmpty(document.theForm.ref1_email.value)))
        { alert('Please specify for your first referral\'s name.');
        document.theForm.ref1_name.focus();
        return false;}
        
if ((!isEmpty(document.theForm.ref1_name.value)) && (isEmpty(document.theForm.ref1_email.value)))
        { alert('Please specify a valid e-mail address for your first referral.'); 
        document.theForm.ref1_email.focus();
        return false;}                  

else if ((!isEmpty(document.theForm.ref1_email.value)) && (!isEmail1(document.theForm.ref1_email.value)))
        { alert('Please specify a valid e-mail address for your first referral.'); 
        document.theForm.ref1_email.focus(); 
        return false;}          
        
else if ((!isEmpty(document.theForm.ref2_email.value)) && (!isEmail2(document.theForm.ref2_email.value)))
        { alert('Please specify a valid e-mail address for your second referral.'); 
        document.theForm.ref2_email.focus(); 
        return false;}          
        
else if ((!isEmpty(document.theForm.ref3_email.value)) && (!isEmail3(document.theForm.ref3_email.value)))
        { alert('Please specify a valid e-mail address for your third referral.'); 
        document.theForm.ref3_email.focus(); 
        return false;}          
        
else 
        {
        document.theForm.submitbutton.disabled=true;
        return true;
        }
}

// ##############################################################
// ##############################################################

function validateUnsubscribeDelegate()
{

if ((isEmpty(document.theForm.emailaddr_1.value)) || (!isEmail_1(document.theForm.emailaddr_1.value)))
        { alert('Please specify a valid e-mail address.'); 
        document.theForm.emailaddr_1.focus(); 
        return false;}          
        
else 
        {
        return true;
        }
}

// ##############################################################
// ##############################################################

function validatesubscribeDelegate()
{


if ((isEmpty(document.theForm.emailaddr_1.value)) || (!isEmail_1(document.theForm.emailaddr_1.value)))
        { alert('Please specify a valid e-mail address.'); 
        document.theForm.emailaddr_1.focus(); 
        return false;}
else if ((isEmpty(document.theForm.remailaddr_1.value)) || (!isEmail_1(document.theForm.remailaddr_1.value)))
        { alert('Please specify a valid e-mail address.'); 
        document.theForm.remailaddr_1.focus(); 
        return false;}
else if (document.theForm.emailaddr_1.value != document.theForm.remailaddr_1.value)
        { alert('e-mail address in both the column should be the same'); 
        document.theForm.emailaddr_1.focus(); 
        return false;}
else if (isEmpty(document.theForm.stitle.value))
        { alert('Please specify your Title.'); 
        document.theForm.stitle.focus(); 
        return false;}
else if (isEmpty(document.theForm.sfirstname.value))
        { alert('Please specify your first name.'); 
        document.theForm.sfirstname.focus(); 
        return false;}
else if (isEmpty(document.theForm.ssurname.value))
        { alert('Please specify your surname.'); 
        document.theForm.ssurname.focus(); 
        return false;}
else 
        {
        return true;
        }
}

// ##############################################################
// ##############################################################

function sendEnquiry()
{
if (document.theForm.title.selectedIndex==0)
        { alert('Please specify your title.'); 
        document.theForm.title.focus(); 
        return false;}          

else if (isEmpty(document.theForm.firstname.value))
        { alert('Please specify your first name.'); 
        document.theForm.firstname.focus(); 
        return false;}
        
else if (isEmpty(document.theForm.surname.value))
        { alert('Please specify your surname.'); 
        document.theForm.surname.focus(); 
        return false;}  
 
else if ((isEmpty(document.theForm.emailaddr.value)) || (!isEmail(document.theForm.emailaddr.value)))
        { alert('Please specify your e-mail address.'); 
        document.theForm.emailaddr.focus(); 
        return false;}                                  

else if ((isEmpty(document.theForm.telephonecode.value)) || (isEmpty(document.theForm.telephone.value)))
        { alert('Please specify your contact telephone dialling code and number.'); 
        document.theForm.telephonecode.focus();
        return false;}
        
else 
        {
        return true;
        }
}

// ##############################################################
// ##############################################################

function validateSpeaker() {

if (document.theForm.cancel_confirm.checked==false)
        { alert('Please confirm that you agree to the terms and conditions.');
        document.theForm.cancel_confirm.focus();
        return false;}
 
else
        {
        return true;
        }
}

// ##############################################################
// ##############################################################

function validateRequest() {

var it = 0;

if (isEmpty(document.theForm.name.value))
        { alert('Please specify your name.');
        document.theForm.name.focus();
        return false;}
 
else if ((isEmpty(document.theForm.emailaddr.value)) || (!isEmail(document.theForm.emailaddr.value)))
        { alert('Please specify a valid e-mail address.');
        document.theForm.emailaddr.focus();
        return false;}
 
else if (isEmpty(document.theForm.address.value))
        { alert('Please specify the address of the venue.');
        document.theForm.address.focus();
        return false;}
 
else if (isEmpty(document.theForm.city.value))
        { alert('Please specify the city.');
        document.theForm.city.focus();
        return false;}
 
else if (isEmpty(document.theForm.event_date.value))
        { alert('Please specify the date of the event.');
        document.theForm.event_date.focus();
        return false;}
 
else if (isEmpty(document.theForm.est_attend.value))
        { alert('Please specify the estimated attendance.');
        document.theForm.est_attend.focus();
        return false;}
 
else
        {
        for (i=0;i<document.theForm.topic.length;i++) {
                if (document.theForm.topic[i].checked==true) {
                        it++;
                        break;
                }
        }
        if (it == 0)
                { alert('Please select at least one topic.');
                document.theForm.topic[0].focus();
                return false;}

        else if (isEmpty(document.theForm.theme.value))
                { alert('Please specify theme or purpose.');
                document.theForm.theme.focus();
                return false;}
 
        else if (isEmpty(document.theForm.addl_info.value))
                { alert('Please specify additional information.');
                document.theForm.addl_info.focus();
                return false;}
 
        else
                {
                return true;
                }
        }
}

// ##############################################################
// ##############################################################

function validateRating() {

if (isEmpty(document.theForm.event_date.value))
        { alert('Please specify the date of the presentation.');
        document.theForm.event_date.focus();
        return false;}
 
else if ((!isEmpty(document.theForm.emailaddr.value)) && (!isEmail(document.theForm.emailaddr.value)))
        { alert('Please specify a valid e-mail address.');
        document.theForm.emailaddr.focus();
        return false;}
 
else if (isEmpty(document.theForm.organisation.value))
        { alert('Please specify the organisation who engaged the speaker.');
        document.theForm.organisation.focus();
        return false;}

else if ((isEmpty(document.theForm.SpeechTitle.value)) && (document.theForm.SpeechID.selectedIndex == document.theForm.SpeechID.length))
        { alert('Please specify the title of the speech that was delivered.');
        document.theForm.SpeechID.focus();
        return false;}
 
else
        {
        return true;
        }
}


// ##############################################################
// ##############################################################

function sendEmailTofriend()
{
if (isEmpty(document.theForm.friend_name.value))
        { alert('Please specify your friends name.'); 
        document.theForm.friend_name.focus(); 
        return false;}
        
else if ((isEmpty(document.theForm.friend_email.value)) || (!isEmailFriend(document.theForm.friend_email.value)))
        { alert('Please specify your friends e-mail address.'); 
        document.theForm.friend_email.focus(); 
        return false;}                                  
        
else if (isEmpty(document.theForm.sender.value))
        { alert('Please specify your name.'); 
        document.theForm.sender.focus(); 
        return false;}  
        
else if ((isEmpty(document.theForm.emailaddr.value)) || (!isEmailOK(document.theForm.emailaddr.value)))
        { alert('Please specify your e-mail address.');
        document.theForm.emailaddr.focus();
        return false;}
 
else
        {
        return true;
        }
}


// ##############################################################
// ##############################################################

function addLink()
{
alert(isEmpty(document.theForm.Name.value));
if (isEmpty(document.theForm.Requester.value))
        { alert('Please specify your name.');
        document.theForm.Requester.focus();
        return false;}
 
else if ((isEmpty(document.theForm.email.value)) || (!isEmailOK(document.theForm.email.value)))
        { alert('Please specify your e-mail address.');
        document.theForm.email.focus();
        return false;}
 
else if (isEmpty(document.theForm.Name.value))
        { alert('Please specify the site name.');
        document.theForm.Name.focus();
        return false;}
 
//else if (isEmpty(document.theForm.URL[1].value))
//        { alert('Please specify the site URL.');
//        document.theForm.URL[1].focus();
//        return false;}
 
else
        {
        return true;
        }
}

//-->
