
function textCounter(field, countfield, linefield, maxlimit, maxlines) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}
function lineCounter(field, countfield, linefield, maxlimit, maxlines) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;	
linecount = escape(field.value).split('%0A').length 
linefield.value = maxlines - linecount;
}

var qstextschecked=false;
function qscheckedAll (qstextsform) {
	var aa= document.getElementById('qstextsform');
	 if (qstextschecked == false)
          {
           qstextschecked = true
          }
        else
          {
          qstextschecked = false
          }
	for (var i =0; i < aa.elements.length; i++) 
	{
	 aa.elements[i].checked = qstextschecked;
	}
      }

/***********************************************
 Fool-Proof Date Input Script with DHTML Calendar
 by Jason Moon - http://calendar.moonscript.com/dateinput.cfm
 ************************************************/

// Customizable variables
var DefaultDateFormat = 'YYYY/MM/DD'; // If no date format is supplied, this will be used instead
var HideWait = 3; // Number of seconds before the calendar will disappear
var Y2kPivotPoint = 76; // 2-digit years before this point will be created in the 21st century
var UnselectedMonthText = 'No Date'; // Text to display in the 1st month list item when the date isn't required
var FontSize = 11; // In pixels
var FontFamily = 'Tahoma';
var CellWidth = 18;
var CellHeight = 16;
var ImageURL = 'images/calendar.jpg';
var NextURL = 'images/next.gif';
var PrevURL = 'images/prev.gif';
var CalBGColor = 'white';
var TopRowBGColor = '#999999';
var DayBGColor = 'lightgrey';

// Global variables
var ZCounter = 100;
var Today = new Date();
var WeekDays = new Array('S','M','T','W','T','F','S');
var MonthDays = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
var MonthNames = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

// Write out the stylesheet definition for the calendar
with (document) {
   writeln('<style>');
   writeln('td.calendarDateInput {letter-spacing:normal;line-height:normal;font-family:' + FontFamily + ',Sans-Serif;font-size:' + FontSize + 'px;}');
   writeln('select.calendarDateInput {letter-spacing:.06em;font-family:Verdana,Sans-Serif;font-size:11px;}');
   writeln('input.calendarDateInput {letter-spacing:.06em;font-family:Verdana,Sans-Serif;font-size:11px;}');
   writeln('</style>');
}

// Only allows certain keys to be used in the date field
function YearDigitsOnly(e) {
   var KeyCode = (e.keyCode) ? e.keyCode : e.which;
   return ((KeyCode == 8) // backspace
        || (KeyCode == 9) // tab
        || (KeyCode == 37) // left arrow
        || (KeyCode == 39) // right arrow
        || (KeyCode == 46) // delete
        || ((KeyCode > 47) && (KeyCode < 58)) // 0 - 9
   );
}

// Gets the absolute pixel position of the supplied element
function GetTagPixels(StartTag, Direction) {
   var PixelAmt = (Direction == 'LEFT') ? StartTag.offsetLeft : StartTag.offsetTop;
   while ((StartTag.tagName != 'BODY') && (StartTag.tagName != 'HTML')) {
      StartTag = StartTag.offsetParent;
      PixelAmt += (Direction == 'LEFT') ? StartTag.offsetLeft : StartTag.offsetTop;
   }
   return PixelAmt;
}

// Is the specified select-list behind the calendar?
function BehindCal(SelectList, CalLeftX, CalRightX, CalTopY, CalBottomY, ListTopY) {
   var ListLeftX = GetTagPixels(SelectList, 'LEFT');
   var ListRightX = ListLeftX + SelectList.offsetWidth;
   var ListBottomY = ListTopY + SelectList.offsetHeight;
   return (((ListTopY < CalBottomY) && (ListBottomY > CalTopY)) && ((ListLeftX < CalRightX) && (ListRightX > CalLeftX)));
}

// For IE, hides any select-lists that are behind the calendar
function FixSelectLists(Over) {
   if (navigator.appName == 'Microsoft Internet Explorer') {
      var CalDiv = this.getCalendar();
      var CalLeftX = CalDiv.offsetLeft;
      var CalRightX = CalLeftX + CalDiv.offsetWidth;
      var CalTopY = CalDiv.offsetTop;
      var CalBottomY = CalTopY + (CellHeight * 9);
      var FoundCalInput = false;
      formLoop :
      for (var j=this.formNumber;j<document.forms.length;j++) {
         for (var i=0;i<document.forms[j].elements.length;i++) {
            if (typeof document.forms[j].elements[i].type == 'string') {
               if ((document.forms[j].elements[i].type == 'hidden') && (document.forms[j].elements[i].name == this.hiddenFieldName)) {
                  FoundCalInput = true;
                  i += 3; // 3 elements between the 1st hidden field and the last year input field
               }
               if (FoundCalInput) {
                  if (document.forms[j].elements[i].type.substr(0,6) == 'select') {
                     ListTopY = GetTagPixels(document.forms[j].elements[i], 'TOP');
                     if (ListTopY < CalBottomY) {
                        if (BehindCal(document.forms[j].elements[i], CalLeftX, CalRightX, CalTopY, CalBottomY, ListTopY)) {
                           document.forms[j].elements[i].style.visibility = (Over) ? 'hidden' : 'visible';
                        }
                     }
                     else break formLoop;
                  }
               }
            }
         }
      }
   }
}

// Displays a message in the status bar when hovering over the calendar days
function DayCellHover(Cell, Over, Color, HoveredDay) {
   Cell.style.backgroundColor = (Over) ? DayBGColor : Color;
   if (Over) {
      if ((this.yearValue == Today.getFullYear()) && (this.monthIndex == Today.getMonth()) && (HoveredDay == Today.getDate())) self.status = 'Click to select today';
      else {
         var Suffix = HoveredDay.toString();
         switch (Suffix.substr(Suffix.length - 1, 1)) {
            case '1' : Suffix += (HoveredDay == 11) ? 'th' : 'st'; break;
            case '2' : Suffix += (HoveredDay == 12) ? 'th' : 'nd'; break;
            case '3' : Suffix += (HoveredDay == 13) ? 'th' : 'rd'; break;
            default : Suffix += 'th'; break;
         }
         self.status = 'Click to select ' + this.monthName + ' ' + Suffix;
      }
   }
   else self.status = '';
   return true;
}

// Sets the form elements after a day has been picked from the calendar
function PickDisplayDay(ClickedDay) {
   this.show();
   var MonthList = this.getMonthList();
   var DayList = this.getDayList();
   var YearField = this.getYearField();
   FixDayList(DayList, GetDayCount(this.displayed.yearValue, this.displayed.monthIndex));
   // Select the month and day in the lists
   for (var i=0;i<MonthList.length;i++) {
      if (MonthList.options[i].value == this.displayed.monthIndex) MonthList.options[i].selected = true;
   }
   for (var j=1;j<=DayList.length;j++) {
      if (j == ClickedDay) DayList.options[j-1].selected = true;
   }
   this.setPicked(this.displayed.yearValue, this.displayed.monthIndex, ClickedDay);
   // Change the year, if necessary
   YearField.value = this.picked.yearPad;
   YearField.defaultValue = YearField.value;
}

// Builds the HTML for the calendar days
function BuildCalendarDays() {
   var Rows = 5;
   if (((this.displayed.dayCount == 31) && (this.displayed.firstDay > 4)) || ((this.displayed.dayCount == 30) && (this.displayed.firstDay == 6))) Rows = 6;
   else if ((this.displayed.dayCount == 28) && (this.displayed.firstDay == 0)) Rows = 4;
   var HTML = '<table width="' + (CellWidth * 7) + '" cellspacing="0" cellpadding="1" style="cursor:default">';
   for (var j=0;j<Rows;j++) {
      HTML += '<tr>';
      for (var i=1;i<=7;i++) {
         Day = (j * 7) + (i - this.displayed.firstDay);
         if ((Day >= 1) && (Day <= this.displayed.dayCount)) {
            if ((this.displayed.yearValue == this.picked.yearValue) && (this.displayed.monthIndex == this.picked.monthIndex) && (Day == this.picked.day)) {
               TextStyle = 'color:white;font-weight:bold;'
               BackColor = DayBGColor;
            }
            else {
               TextStyle = 'color:black;'
               BackColor = CalBGColor;
            }
            if ((this.displayed.yearValue == Today.getFullYear()) && (this.displayed.monthIndex == Today.getMonth()) && (Day == Today.getDate())) TextStyle += 'border:1px solid darkred;padding:0px;';
            HTML += '<td align="center" class="calendarDateInput" style="cursor:default;height:' + CellHeight + ';width:' + CellWidth + ';' + TextStyle + ';background-color:' + BackColor + '" onClick="' + this.objName + '.pickDay(' + Day + ')" onMouseOver="return ' + this.objName + '.displayed.dayHover(this,true,\'' + BackColor + '\',' + Day + ')" onMouseOut="return ' + this.objName + '.displayed.dayHover(this,false,\'' + BackColor + '\')">' + Day + '</td>';
         }
         else HTML += '<td class="calendarDateInput" style="height:' + CellHeight + '">&nbsp;</td>';
      }
      HTML += '</tr>';
   }
   return HTML += '</table>';
}

// Determines which century to use (20th or 21st) when dealing with 2-digit years
function GetGoodYear(YearDigits) {
   if (YearDigits.length == 4) return YearDigits;
   else {
      var Millennium = (YearDigits < Y2kPivotPoint) ? 2000 : 1900;
      return Millennium + parseInt(YearDigits,10);
   }
}

// Returns the number of days in a month (handles leap-years)
function GetDayCount(SomeYear, SomeMonth) {
   return ((SomeMonth == 1) && ((SomeYear % 400 == 0) || ((SomeYear % 4 == 0) && (SomeYear % 100 != 0)))) ? 29 : MonthDays[SomeMonth];
}

// Highlights the buttons
function VirtualButton(Cell, ButtonDown) {
   if (ButtonDown) {
      Cell.style.borderLeft = 'buttonshadow 1px solid';
      Cell.style.borderTop = 'buttonshadow 1px solid';
      Cell.style.borderBottom = 'buttonhighlight 1px solid';
      Cell.style.borderRight = 'buttonhighlight 1px solid';
   }
   else {
      Cell.style.borderLeft = 'buttonhighlight 1px solid';
      Cell.style.borderTop = 'buttonhighlight 1px solid';
      Cell.style.borderBottom = 'buttonshadow 1px solid';
      Cell.style.borderRight = 'buttonshadow 1px solid';
   }
}

// Mouse-over for the previous/next month buttons
function NeighborHover(Cell, Over, DateObj) {
   if (Over) {
      VirtualButton(Cell, false);
      self.status = 'Click to view ' + DateObj.fullName;
   }
   else {
      Cell.style.border = 'buttonface 1px solid';
      self.status = '';
   }
   return true;
}

// Adds/removes days from the day list, depending on the month/year
function FixDayList(DayList, NewDays) {
   var DayPick = DayList.selectedIndex + 1;
   if (NewDays != DayList.length) {
      var OldSize = DayList.length;
      for (var k=Math.min(NewDays,OldSize);k<Math.max(NewDays,OldSize);k++) {
         (k >= NewDays) ? DayList.options[NewDays] = null : DayList.options[k] = new Option(k+1, k+1);
      }
      DayPick = Math.min(DayPick, NewDays);
      DayList.options[DayPick-1].selected = true;
   }
   return DayPick;
}

// Resets the year to its previous valid value when something invalid is entered
function FixYearInput(YearField) {
   var YearRE = new RegExp('\\d{' + YearField.defaultValue.length + '}');
   if (!YearRE.test(YearField.value)) YearField.value = YearField.defaultValue;
}

// Displays a message in the status bar when hovering over the calendar icon
function CalIconHover(Over) {
   var Message = (this.isShowing()) ? 'hide' : 'show';
   self.status = (Over) ? 'Click to ' + Message + ' the calendar' : '';
   return true;
}

// Starts the timer over from scratch
function CalTimerReset() {
   eval('clearTimeout(' + this.timerID + ')');
   eval(this.timerID + '=setTimeout(\'' + this.objName + '.show()\',' + (HideWait * 1000) + ')');
}

// The timer for the calendar
function DoTimer(CancelTimer) {
   if (CancelTimer) eval('clearTimeout(' + this.timerID + ')');
   else {
      eval(this.timerID + '=null');
      this.resetTimer();
   }
}

// Show or hide the calendar
function ShowCalendar() {
   if (this.isShowing()) {
      var StopTimer = true;
      this.getCalendar().style.zIndex = --ZCounter;
      this.getCalendar().style.visibility = 'hidden';
      this.fixSelects(false);
   }
   else {
      var StopTimer = false;
      this.fixSelects(true);
      this.getCalendar().style.zIndex = ++ZCounter;
      this.getCalendar().style.visibility = 'visible';
   }
   this.handleTimer(StopTimer);
   self.status = '';
}

// Hides the input elements when the "blank" month is selected
function SetElementStatus(Hide) {
   this.getDayList().style.visibility = (Hide) ? 'hidden' : 'visible';
   this.getYearField().style.visibility = (Hide) ? 'hidden' : 'visible';
   this.getCalendarLink().style.visibility = (Hide) ? 'hidden' : 'visible';
}

// Sets the date, based on the month selected
function CheckMonthChange(MonthList) {
   var DayList = this.getDayList();
   if (MonthList.options[MonthList.selectedIndex].value == '') {
      DayList.selectedIndex = 0;
      this.hideElements(true);
      this.setHidden('');
   }
   else {
      this.hideElements(false);
      if (this.isShowing()) {
         this.resetTimer(); // Gives the user more time to view the calendar with the newly-selected month
         this.getCalendar().style.zIndex = ++ZCounter; // Make sure this calendar is on top of any other calendars
      }
      var DayPick = FixDayList(DayList, GetDayCount(this.picked.yearValue, MonthList.options[MonthList.selectedIndex].value));
      this.setPicked(this.picked.yearValue, MonthList.options[MonthList.selectedIndex].value, DayPick);
   }
}

// Sets the date, based on the day selected
function CheckDayChange(DayList) {
   if (this.isShowing()) this.show();
   this.setPicked(this.picked.yearValue, this.picked.monthIndex, DayList.selectedIndex+1);
}

// Changes the date when a valid year has been entered
function CheckYearInput(YearField) {
   if ((YearField.value.length == YearField.defaultValue.length) && (YearField.defaultValue != YearField.value)) {
      if (this.isShowing()) {
         this.resetTimer(); // Gives the user more time to view the calendar with the newly-entered year
         this.getCalendar().style.zIndex = ++ZCounter; // Make sure this calendar is on top of any other calendars
      }
      var NewYear = GetGoodYear(YearField.value);
      var MonthList = this.getMonthList();
      var NewDay = FixDayList(this.getDayList(), GetDayCount(NewYear, this.picked.monthIndex));
      this.setPicked(NewYear, this.picked.monthIndex, NewDay);
      YearField.defaultValue = YearField.value;
   }
}

// Holds characteristics about a date
function dateObject() {
   if (Function.call) { // Used when 'call' method of the Function object is supported
      var ParentObject = this;
      var ArgumentStart = 0;
   }
   else { // Used with 'call' method of the Function object is NOT supported
      var ParentObject = arguments[0];
      var ArgumentStart = 1;
   }
   ParentObject.date = (arguments.length == (ArgumentStart+1)) ? new Date(arguments[ArgumentStart+0]) : new Date(arguments[ArgumentStart+0], arguments[ArgumentStart+1], arguments[ArgumentStart+2]);
   ParentObject.yearValue = ParentObject.date.getFullYear();
   ParentObject.monthIndex = ParentObject.date.getMonth();
   ParentObject.monthName = MonthNames[ParentObject.monthIndex];
   ParentObject.fullName = ParentObject.monthName + ' ' + ParentObject.yearValue;
   ParentObject.day = ParentObject.date.getDate();
   ParentObject.dayCount = GetDayCount(ParentObject.yearValue, ParentObject.monthIndex);
   var FirstDate = new Date(ParentObject.yearValue, ParentObject.monthIndex, 1);
   ParentObject.firstDay = FirstDate.getDay();
}

// Keeps track of the date that goes into the hidden field
function storedMonthObject(DateFormat, DateYear, DateMonth, DateDay) {
   (Function.call) ? dateObject.call(this, DateYear, DateMonth, DateDay) : dateObject(this, DateYear, DateMonth, DateDay);
   this.yearPad = this.yearValue.toString();
   this.monthPad = (this.monthIndex < 9) ? '0' + String(this.monthIndex + 1) : this.monthIndex + 1;
   this.dayPad = (this.day < 10) ? '0' + this.day.toString() : this.day;
   this.monthShort = this.monthName.substr(0,3).toUpperCase();
   // Formats the year with 2 digits instead of 4
   if (DateFormat.indexOf('YYYY') == -1) this.yearPad = this.yearPad.substr(2);
   // Define the date-part delimiter
   if (DateFormat.indexOf('/') >= 0) var Delimiter = '/';
   else if (DateFormat.indexOf('-') >= 0) var Delimiter = '-';
   else var Delimiter = '';
   // Determine the order of the months and days
   if (/DD?.?((MON)|(MM?M?))/.test(DateFormat)) {
      this.formatted = this.dayPad + Delimiter;
      this.formatted += (RegExp.$1.length == 3) ? this.monthShort : this.monthPad;
   }
   else if (/((MON)|(MM?M?))?.?DD?/.test(DateFormat)) {
      this.formatted = (RegExp.$1.length == 3) ? this.monthShort : this.monthPad;
      this.formatted += Delimiter + this.dayPad;
   }
   // Either prepend or append the year to the formatted date
   this.formatted = (DateFormat.substr(0,2) == 'YY') ? this.yearPad + Delimiter + this.formatted : this.formatted + Delimiter + this.yearPad;
}

// Object for the current displayed month
function displayMonthObject(ParentObject, DateYear, DateMonth, DateDay) {
   (Function.call) ? dateObject.call(this, DateYear, DateMonth, DateDay) : dateObject(this, DateYear, DateMonth, DateDay);
   this.displayID = ParentObject.hiddenFieldName + '_Current_ID';
   this.getDisplay = new Function('return document.getElementById(this.displayID)');
   this.dayHover = DayCellHover;
   this.goCurrent = new Function(ParentObject.objName + '.getCalendar().style.zIndex=++ZCounter;' + ParentObject.objName + '.setDisplayed(Today.getFullYear(),Today.getMonth());');
   if (ParentObject.formNumber >= 0) this.getDisplay().innerHTML = this.fullName;
}

// Object for the previous/next buttons
function neighborMonthObject(ParentObject, IDText, DateMS) {
   (Function.call) ? dateObject.call(this, DateMS) : dateObject(this, DateMS);
   this.buttonID = ParentObject.hiddenFieldName + '_' + IDText + '_ID';
   this.hover = new Function('C','O','NeighborHover(C,O,this)');
   this.getButton = new Function('return document.getElementById(this.buttonID)');
   this.go = new Function(ParentObject.objName + '.getCalendar().style.zIndex=++ZCounter;' + ParentObject.objName + '.setDisplayed(this.yearValue,this.monthIndex);');
   if (ParentObject.formNumber >= 0) this.getButton().title = this.monthName;
}

// Sets the currently-displayed month object
function SetDisplayedMonth(DispYear, DispMonth) {
   this.displayed = new displayMonthObject(this, DispYear, DispMonth, 1);
   // Creates the previous and next month objects
   this.previous = new neighborMonthObject(this, 'Previous', this.displayed.date.getTime() - 86400000);
   this.next = new neighborMonthObject(this, 'Next', this.displayed.date.getTime() + (86400000 * (this.displayed.dayCount + 1)));
   // Creates the HTML for the calendar
   if (this.formNumber >= 0) this.getDayTable().innerHTML = this.buildCalendar();
}

// Sets the current selected date
function SetPickedMonth(PickedYear, PickedMonth, PickedDay) {
   this.picked = new storedMonthObject(this.format, PickedYear, PickedMonth, PickedDay);
   this.setHidden(this.picked.formatted);
   this.setDisplayed(PickedYear, PickedMonth);
}

// The calendar object
function calendarObject(DateName, DateFormat, DefaultDate) {

   /* Properties */
   this.hiddenFieldName = DateName;
   this.monthListID = DateName + '_Month_ID';
   this.dayListID = DateName + '_Day_ID';
   this.yearFieldID = DateName + '_Year_ID';
   this.monthDisplayID = DateName + '_Current_ID';
   this.calendarID = DateName + '_ID';
   this.dayTableID = DateName + '_DayTable_ID';
   this.calendarLinkID = this.calendarID + '_Link';
   this.timerID = this.calendarID + '_Timer';
   this.objName = DateName + '_Object';
   this.format = DateFormat;
   this.formNumber = -1;
   this.picked = null;
   this.displayed = null;
   this.previous = null;
   this.next = null;

   /* Methods */
   this.setPicked = SetPickedMonth;
   this.setDisplayed = SetDisplayedMonth;
   this.checkYear = CheckYearInput;
   this.fixYear = FixYearInput;
   this.changeMonth = CheckMonthChange;
   this.changeDay = CheckDayChange;
   this.resetTimer = CalTimerReset;
   this.hideElements = SetElementStatus;
   this.show = ShowCalendar;
   this.handleTimer = DoTimer;
   this.iconHover = CalIconHover;
   this.buildCalendar = BuildCalendarDays;
   this.pickDay = PickDisplayDay;
   this.fixSelects = FixSelectLists;
   this.setHidden = new Function('D','if (this.formNumber >= 0) this.getHiddenField().value=D');
   // Returns a reference to these elements
   this.getHiddenField = new Function('return document.forms[this.formNumber].elements[this.hiddenFieldName]');
   this.getMonthList = new Function('return document.getElementById(this.monthListID)');
   this.getDayList = new Function('return document.getElementById(this.dayListID)');
   this.getYearField = new Function('return document.getElementById(this.yearFieldID)');
   this.getCalendar = new Function('return document.getElementById(this.calendarID)');
   this.getDayTable = new Function('return document.getElementById(this.dayTableID)');
   this.getCalendarLink = new Function('return document.getElementById(this.calendarLinkID)');
   this.getMonthDisplay = new Function('return document.getElementById(this.monthDisplayID)');
   this.isShowing = new Function('return !(this.getCalendar().style.visibility != \'visible\')');

   /* Constructor */
   // Functions used only by the constructor
   function getMonthIndex(MonthAbbr) { // Returns the index (0-11) of the supplied month abbreviation
      for (var MonPos=0;MonPos<MonthNames.length;MonPos++) {
         if (MonthNames[MonPos].substr(0,3).toUpperCase() == MonthAbbr.toUpperCase()) break;
      }
      return MonPos;
   }
   function SetGoodDate(CalObj, Notify) { // Notifies the user about their bad default date, and sets the current system date
      CalObj.setPicked(Today.getFullYear(), Today.getMonth(), Today.getDate());
      if (Notify) alert('WARNING: The supplied date is not in valid \'' + DateFormat + '\' format: ' + DefaultDate + '.\nTherefore, the current system date will be used instead: ' + CalObj.picked.formatted);
   }
   // Main part of the constructor
   if (DefaultDate != '') {
      if ((this.format == 'YYYYMMDD') && (/^(\d{4})(\d{2})(\d{2})$/.test(DefaultDate))) this.setPicked(RegExp.$1, parseInt(RegExp.$2,10)-1, RegExp.$3);
      else {
         // Get the year
         if ((this.format.substr(0,2) == 'YY') && (/^(\d{2,4})(-|\/)/.test(DefaultDate))) { // Year is at the beginning
            var YearPart = GetGoodYear(RegExp.$1);
            // Determine the order of the months and days
            if (/(-|\/)(\w{1,3})(-|\/)(\w{1,3})$/.test(DefaultDate)) {
               var MidPart = RegExp.$2;
               var EndPart = RegExp.$4;
               if (/D$/.test(this.format)) { // Ends with days
                  var DayPart = EndPart;
                  var MonthPart = MidPart;
               }
               else {
                  var DayPart = MidPart;
                  var MonthPart = EndPart;
               }
               MonthPart = (/\d{1,2}/i.test(MonthPart)) ? parseInt(MonthPart,10)-1 : getMonthIndex(MonthPart);
               this.setPicked(YearPart, MonthPart, DayPart);
            }
            else SetGoodDate(this, true);
         }
         else if (/(-|\/)(\d{2,4})$/.test(DefaultDate)) { // Year is at the end
            var YearPart = GetGoodYear(RegExp.$2);
            // Determine the order of the months and days
            if (/^(\w{1,3})(-|\/)(\w{1,3})(-|\/)/.test(DefaultDate)) {
               if (this.format.substr(0,1) == 'D') { // Starts with days
                  var DayPart = RegExp.$1;
                  var MonthPart = RegExp.$3;
               }
               else { // Starts with months
                  var MonthPart = RegExp.$1;
                  var DayPart = RegExp.$3;
               }
               MonthPart = (/\d{1,2}/i.test(MonthPart)) ? parseInt(MonthPart,10)-1 : getMonthIndex(MonthPart);
               this.setPicked(YearPart, MonthPart, DayPart);
            }
            else SetGoodDate(this, true);
         }
         else SetGoodDate(this, true);
      }
   }
}

// Main function that creates the form elements
function DateInput(DateName, Required, DateFormat, DefaultDate) {
   if (arguments.length == 0) document.writeln('<span style="color:red;font-size:' + FontSize + 'px;font-family:' + FontFamily + ';">ERROR: Missing required parameter in call to \'DateInput\': [name of hidden date field].</span>');
   else {
      // Handle DateFormat
      if (arguments.length < 3) { // The format wasn't passed in, so use default
         DateFormat = DefaultDateFormat;
         if (arguments.length < 2) Required = false;
      }
      else if (/^(Y{2,4}(-|\/)?)?((MON)|(MM?M?)|(DD?))(-|\/)?((MON)|(MM?M?)|(DD?))((-|\/)Y{2,4})?$/i.test(DateFormat)) DateFormat = DateFormat.toUpperCase();
      else { // Passed-in DateFormat was invalid, use default format instead
         var AlertMessage = 'WARNING: The supplied date format for the \'' + DateName + '\' field is not valid: ' + DateFormat + '\nTherefore, the default date format will be used instead: ' + DefaultDateFormat;
         DateFormat = DefaultDateFormat;
         if (arguments.length == 4) { // DefaultDate was passed in with an invalid date format
            var CurrentDate = new storedMonthObject(DateFormat, Today.getFullYear(), Today.getMonth(), Today.getDate());
            AlertMessage += '\n\nThe supplied date (' + DefaultDate + ') cannot be interpreted with the invalid format.\nTherefore, the current system date will be used instead: ' + CurrentDate.formatted;
            DefaultDate = CurrentDate.formatted;
         }
         alert(AlertMessage);
      }
      // Define the current date if it wasn't set already
      if (!CurrentDate) var CurrentDate = new storedMonthObject(DateFormat, Today.getFullYear(), Today.getMonth(), Today.getDate());
      // Handle DefaultDate
      if (arguments.length < 4) { // The date wasn't passed in
         DefaultDate = (Required) ? CurrentDate.formatted : ''; // If required, use today's date
      }
      // Creates the calendar object!
      eval(DateName + '_Object=new calendarObject(\'' + DateName + '\',\'' + DateFormat + '\',\'' + DefaultDate + '\')');
      // Determine initial viewable state of day, year, and calendar icon
      if ((Required) || (arguments.length == 4)) {
         var InitialStatus = '';
         var InitialDate = eval(DateName + '_Object.picked.formatted');
      }
      else {
         var InitialStatus = ' style="visibility:hidden"';
         var InitialDate = '';
         eval(DateName + '_Object.setPicked(' + Today.getFullYear() + ',' + Today.getMonth() + ',' + Today.getDate() + ')');
      }
      // Create the form elements
      with (document) {
         writeln('<input type="hidden" name="' + DateName + '" value="' + InitialDate + '">');
         // Find this form number
         for (var f=0;f<forms.length;f++) {
            for (var e=0;e<forms[f].elements.length;e++) {
               if (typeof forms[f].elements[e].type == 'string') {
                  if ((forms[f].elements[e].type == 'hidden') && (forms[f].elements[e].name == DateName)) {
                     eval(DateName + '_Object.formNumber='+f);
                     break;
                  }
               }
            }
         }
         writeln('<table cellpadding="0" cellspacing="2"><tr>' + String.fromCharCode(13) + '<td valign="middle">');
         writeln('<select class="calendarDateInput" id="' + DateName + '_Month_ID" onChange="' + DateName + '_Object.changeMonth(this)">');
         if (!Required) {
            var NoneSelected = (DefaultDate == '') ? ' selected' : '';
            writeln('<option value=""' + NoneSelected + '>' + UnselectedMonthText + '</option>');
         }
         for (var i=0;i<12;i++) {
            MonthSelected = ((DefaultDate != '') && (eval(DateName + '_Object.picked.monthIndex') == i)) ? ' selected' : '';
            writeln('<option value="' + i + '"' + MonthSelected + '>' + MonthNames[i].substr(0,3) + '</option>');
         }
         writeln('</select>' + String.fromCharCode(13) + '</td>' + String.fromCharCode(13) + '<td valign="middle">');
         writeln('<select' + InitialStatus + ' class="calendarDateInput" id="' + DateName + '_Day_ID" onChange="' + DateName + '_Object.changeDay(this)">');
         for (var j=1;j<=eval(DateName + '_Object.picked.dayCount');j++) {
            DaySelected = ((DefaultDate != '') && (eval(DateName + '_Object.picked.day') == j)) ? ' selected' : '';
            writeln('<option' + DaySelected + '>' + j + '</option>');
         }
         writeln('</select>' + String.fromCharCode(13) + '</td>' + String.fromCharCode(13) + '<td valign="middle">');
         writeln('<input' + InitialStatus + ' class="calendarDateInput" type="text" id="' + DateName + '_Year_ID" size="' + eval(DateName + '_Object.picked.yearPad.length') + '" maxlength="' + eval(DateName + '_Object.picked.yearPad.length') + '" title="Year" value="' + eval(DateName + '_Object.picked.yearPad') + '" onKeyPress="return YearDigitsOnly(window.event)" onKeyUp="' + DateName + '_Object.checkYear(this)" onBlur="' + DateName + '_Object.fixYear(this)">');
         write('<td valign="middle">' + String.fromCharCode(13) + '<a' + InitialStatus + ' id="' + DateName + '_ID_Link" href="javascript:' + DateName + '_Object.show()" onMouseOver="return ' + DateName + '_Object.iconHover(true)" onMouseOut="return ' + DateName + '_Object.iconHover(false)"><img src="' + ImageURL + '" align="baseline" title="Calendar" border="0"></a>&nbsp;');
         writeln('<span id="' + DateName + '_ID" style="position:absolute;visibility:hidden;width:' + (CellWidth * 7) + 'px;background-color:' + CalBGColor + ';border:1px solid dimgray;" onMouseOver="' + DateName + '_Object.handleTimer(true)" onMouseOut="' + DateName + '_Object.handleTimer(false)">');
         writeln('<table width="' + (CellWidth * 7) + '" cellspacing="0" cellpadding="1">' + String.fromCharCode(13) + '<tr style="background-color:' + TopRowBGColor + ';">');
         writeln('<td id="' + DateName + '_Previous_ID" style="cursor:default" align="center" class="calendarDateInput" style="height:' + CellHeight + '" onClick="' + DateName + '_Object.previous.go()" onMouseDown="VirtualButton(this,true)" onMouseUp="VirtualButton(this,false)" onMouseOver="return ' + DateName + '_Object.previous.hover(this,true)" onMouseOut="return ' + DateName + '_Object.previous.hover(this,false)" title="' + eval(DateName + '_Object.previous.monthName') + '"><img src="' + PrevURL + '"></td>');
         writeln('<td id="' + DateName + '_Current_ID" style="cursor:pointer" align="center" class="calendarDateInput" style="height:' + CellHeight + '" colspan="5" onClick="' + DateName + '_Object.displayed.goCurrent()" onMouseOver="self.status=\'Click to view ' + CurrentDate.fullName + '\';return true;" onMouseOut="self.status=\'\';return true;" title="Show Current Month">' + eval(DateName + '_Object.displayed.fullName') + '</td>');
         writeln('<td id="' + DateName + '_Next_ID" style="cursor:default" align="center" class="calendarDateInput" style="height:' + CellHeight + '" onClick="' + DateName + '_Object.next.go()" onMouseDown="VirtualButton(this,true)" onMouseUp="VirtualButton(this,false)" onMouseOver="return ' + DateName + '_Object.next.hover(this,true)" onMouseOut="return ' + DateName + '_Object.next.hover(this,false)" title="' + eval(DateName + '_Object.next.monthName') + '"><img src="' + NextURL + '"></td></tr>' + String.fromCharCode(13) + '<tr>');
         for (var w=0;w<7;w++) writeln('<td width="' + CellWidth + '" align="center" class="calendarDateInput" style="height:' + CellHeight + ';width:' + CellWidth + ';font-weight:bold;border-top:1px solid dimgray;border-bottom:1px solid dimgray;">' + WeekDays[w] + '</td>');
         writeln('</tr>' + String.fromCharCode(13) + '</table>' + String.fromCharCode(13) + '<span id="' + DateName + '_DayTable_ID">' + eval(DateName + '_Object.buildCalendar()') + '</span>' + String.fromCharCode(13) + '</span>' + String.fromCharCode(13) + '</td>' + String.fromCharCode(13) + '</tr>' + String.fromCharCode(13) + '</table>');
      }
   }
}
function trimString (str) {
  str = this != window? this : str;
  return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v3.0
  window.open(theURL,winName,features);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function openWindow(url)
{
 var params="menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,dependent,left=20,top=20,width=500,height=144";
 popupWin = window.open(url, 'remote',params);
}

function openqsdocsWindow(url)
{
 var params="menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,dependent,left=400,top=200,width=500,height=380";
 popupWin = window.open(url, 'remote',params);
}

function openWindow2(url,width,height)
{
 if (window.screen)
 {
  var aw = screen.availWidth;
  var ah = screen.availHeight;
  var y = ah - height - 71;
  var x = aw - width - 30;
 }
 var params="menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,dependent,top="+y+",left="+x+",width="+width+",height="+height;
 popupWin = window.open(url, 'popup',params);
 popupWin.focus();
}

function filescheck()
{	
	var thefilename = document.filesform.newfile.value;
	thefilename = trimString(thefilename);
	if(thefilename != '')
	{
		if (thefilename.indexOf("'") != -1)
		{
			window.alert('Filenames cannot contain apostrophes. Please remove the apostrophes from the filename and try again');
 			document.filesform.newfile.focus();
  			return (false);
		}
		if (thefilename.indexOf('"') != -1)
		{
			window.alert('Filenames cannot contain quotation marks. Please remove the quotation marks from the filename and try again');
 			document.filesform.newfile.focus();
  			return (false);
		}
		if (thefilename.indexOf('@') != -1)
		{
			window.alert('Filenames cannot contain the @ character. Please remove the @ character from the filename and try again');
 			document.filesform.newfile.focus();
  			return (false);
		}
	}
 	return (true);
}
function qsadaddcheckpostcode()
{	
	var thepostcode = document.qsadaddform.postcode.value;
	thepostcode = trimString(thepostcode);
	if(thepostcode != '')
	{
		if (thepostcode.indexOf(' ') == -1)
		{
			window.alert('Postcodes must contain a space for example LS1 3BX');
 			document.qsadaddform.postcode.focus();
  			return (false);
		}
	}
 	return (true);
}
function uqsadaddcheckpostcode()
{	
	var thepostcode = document.uqsadaddform.postcode.value;
	thepostcode = trimString(thepostcode);
	if(thepostcode != '')
	{
		if (thepostcode.indexOf(' ') == -1)
		{
			window.alert('Postcodes must contain a space for example LS1 3BX');
 			document.uqsadaddform.postcode.focus();
  			return (false);
		}
	}
 	return (true);
}
function qsconfirm()
{	
  var r=confirm("Do you want to save any changes? Click OK to continue to Profiles or Cancel to stay where you are")
  if (r==true)
    {
    return (true);
    }
  else
    {
   return (false);
    }
}
function qsadeditcheckpostcode()
{	
	var thepostcode = document.qsadeditform.postcode.value;
	thepostcode = trimString(thepostcode);
	if(thepostcode != '')
	{
		if (thepostcode.indexOf(' ') == -1)
		{
			window.alert('Postcodes must contain a space for example LS1 3BX');
 			document.qsadeditform.postcode.focus();
  			return (false);
		}
	}
 	return (true);
}

function stusadaddcheckpostcode()
{	
	var thepostcode = document.stusadaddform.postcode.value;
	thepostcode = trimString(thepostcode);
	if(thepostcode != '')
	{
		if (thepostcode.indexOf(' ') == -1)
		{
			window.alert('Postcodes must contain a space for example LS1 3BX');
 			document.stusadaddform.postcode.focus();
  			return (false);
		}
	}
 	return (true);
}
function stusadeditcheckpostcode()
{	
	var thepostcode = document.stusadeditform.postcode.value;
	thepostcode = trimString(thepostcode);
	if(thepostcode != '')
	{
		if (thepostcode.indexOf(' ') == -1)
		{
			window.alert('Postcodes must contain a space for example LS1 3BX');
 			document.stusadeditform.postcode.focus();
  			return (false);
		}
	}
 	return (true);
}
function qschecksearchpostcode()
{	
	var thepostcode = document.qsocssearchform.postcode.value;
	thepostcode = trimString(thepostcode);
	if(thepostcode != '')
	{
		if (thepostcode.indexOf(' ') == -1)
		{
			window.alert('Postcodes must contain a space for example LS1 3BX');
 			document.qsocssearchform.postcode.focus();
  			return (false);
		}
	}
 	return (true);
}
function uqschecksearchpostcode()
{	
	var thepostcode = document.uqsocsssearchform.postcode.value;
	thepostcode = trimString(thepostcode);
	if(thepostcode != '')
	{
		if (thepostcode.indexOf(' ') == -1)
		{
			window.alert('Postcodes must contain a space for example LS1 3BX');
 			document.uqsocsssearchform.postcode.focus();
  			return (false);
		}
	}
 	return (true);
}
function stuschecksearchpostcode()
{	
	var thepostcode = document.stusocssearchform.postcode.value;
	thepostcode = trimString(thepostcode);
	if(thepostcode != '')
	{
		if (thepostcode.indexOf(' ') == -1)
		{
			window.alert('Postcodes must contain a space for example LS1 3BX');
 			document.stusocssearchform.postcode.focus();
  			return (false);
		}
	}
 	return (true);
}
function clientschecksearchpostcode()
{	
	var thepostcode = document.clientssearchform.postcode.value;
	thepostcode = trimString(thepostcode);
	if(thepostcode != '')
	{
		if (thepostcode.indexOf(' ') == -1)
		{
			window.alert('Postcodes must contain a space for example LS1 3BX');
 			document.clientssearchform.postcode.focus();
  			return (false);
		}
	}
 	return (true);
}
function cqvacancycheckpostcode()
{	
	var thepostcode = document.cqvacancyupdateform.spostcode.value;
	thepostcode = trimString(thepostcode);
	if(thepostcode != '')
	{
		if (thepostcode.indexOf(' ') == -1)
		{
			window.alert('Postcodes must contain a space for example LS1 3BX');
 			document.cqvacancyupdateform.spostcode.focus();
  			return (false);
		}
	}
 	return (true);
}

function mqvacancycheckpostcode()
{	
	var thepostcode = document.mqvacancyupdateform.spostcode.value;
	thepostcode = trimString(thepostcode);
	if(thepostcode != '')
	{
		if (thepostcode.indexOf(' ') == -1)
		{
			window.alert('Postcodes must contain a space for example LS1 3BX');
 			document.mqvacancyupdateform.spostcode.focus();
  			return (false);
		}
	}
 	return (true);
}

function checkpostcode()
{
 if (document.submitpostcode.postcode.value=='')
 {
  window.alert('Please enter a postcode!!');
  document.submitpostcode.postcode.focus();
  return (false);
 }	
	var thepostcode = document.submitpostcode.postcode.value;
	thepostcode = trimString(thepostcode);

	if (thepostcode.indexOf(' ') == -1)
	{
window.alert('Postcodes must contain a space for example LS1 3BX');
 document.submitpostcode.postcode.focus();
  return (false);
}
 return (true);
}
function checkaddvacancy()
{
 if (document.vacancyaddform.vacancypostcode.value=='')
 {
  window.alert('Please enter a vacancy postcode!!');
  document.vacancyaddform.vacancypostcode.focus();
  return (false);
 }	
	var thepostcode = document.vacancyaddform.vacancypostcode.value;
	thepostcode = trimString(thepostcode);

	if (thepostcode.indexOf(' ') == -1)
	{
		window.alert('Postcodes must contain a space for example LS1 3BX');
 		document.vacancyaddform.vacancypostcode.focus();
  		return (false);
	}
 if (document.vacancyaddform.vacancytype.options[document.vacancyaddform.vacancytype.selectedIndex].value=='')
 {
  window.alert('Please select a vacancy type!!');
  document.vacancyaddform.vacancytype.focus();
  return (false);
 }  
 return (true);
}
function checkupdatevacancy()
{
 if (document.vacancyupdateform.vacancypostcode.value=='')
 {
  window.alert('Please enter a vacancy postcode!!');
  document.vacancyupdateform.vacancypostcode.focus();
  return (false);
 }	
	var thepostcode = document.vacancyupdateform.vacancypostcode.value;
	thepostcode = trimString(thepostcode);

	if (thepostcode.indexOf(' ') == -1)
	{
		window.alert('Postcodes must contain a space for example LS1 3BX');
 		document.vacancyupdateform.vacancypostcode.focus();
  		return (false);
	}
 if (document.vacancyupdateform.vacancytype.options[document.vacancyupdateform.vacancytype.selectedIndex].value=='')
 {
  window.alert('Please select a vacancy type!!');
  document.vacancyupdateform.vacancytype.focus();
  return (false);
 }  
return (true);
}

function checkaddtextaccount()
{
    var theclickatell_username = document.textsaddform.clickatell_username.value;
	theclickatell_username = trimString(theclickatell_username);
	var theclickatell_password = document.textsaddform.clickatell_password.value;
	theclickatell_password = trimString(theclickatell_password);
	var theapi_id = document.textsaddform.api_id.value;
	theapi_id = trimString(theapi_id);
	var thesender_id = document.textsaddform.sender_id.value;
	thesender_id = trimString(thesender_id);			
 if (theclickatell_username=='')
 {
  window.alert('Please enter a Clickatell Username!!');
  document.textsaddform.clickatell_username.focus();
  return (false);
 }
 if (theclickatell_password=='')
 {
  window.alert('Please enter a Clickatell Password!!');
  document.textsaddform.clickatell_password.focus();
  return (false);
 }
 if (theapi_id=='')
 {
  window.alert('Please enter a api_id!!');
  document.textsaddform.api_id.focus();
  return (false);
 } 
 if (thesender_id=='')
 {
  window.alert('Please enter a sender_id!!');
  document.textsaddform.sender_id.focus();
  return (false);
 }  
    
 return (true);
}

function checkcl()
{
 if (document.clregform.orgname.value=='')
 {
  window.alert('Please enter the organisation name!!');
  document.clregform.orgname.focus();
  return (false);
 }
 if (document.clregform.teamname.options[document.clregform.teamname.selectedIndex].value=='')
 {
  window.alert('Please enter your team name!!');
  document.clregform.teamname.focus();
  return (false);
 } 
 if (document.clregform.address1.value=='')
 {
  window.alert('Please enter the full address of your organisation!!');
  document.clregform.address1.focus();
  return (false);
 }
 if (document.clregform.address2.value=='')
 {
  window.alert('Please enter the full address of your organisation!!');
  document.clregform.address2.focus();
  return (false);
 }
 if (document.clregform.county.options[document.clregform.county.selectedIndex].value=='')
 {
  window.alert('Please enter the county in which your organisation is located!!');
  document.clregform.county.focus();
  return (false);
 } 
 if (document.clregform.postcode.value=='')
 {
  window.alert('Please enter the postcode of your organisation!!');
  document.clregform.postcode.focus();
  return (false);
 }
 if (document.clregform.email.value=='')
 {
  window.alert('Please enter the email address of your organisation!!');
  document.clregform.email.focus();
  return (false);
 }
 if (document.clregform.telephone.value=='')
 {
  window.alert('Please enter the telephone number of your organisation!!');
  document.clregform.telephone.focus();
  return (false);
 }      	
 if (document.clregform.name_title.options[document.clregform.name_title.selectedIndex].value=='')
 {
  window.alert('Please enter a title for the contact!!');
 document.clregform.name_title.focus();
  return (false);
 }
 if (document.clregform.firstname.value=='')
 {
  window.alert('Please enter a contact first name(s)!!');
  document.clregform.firstname.focus();
  return (false);
 }
 if (document.clregform.surname.value=='')
 {
  window.alert('Please enter a contact surname!!');
  document.clregform.surname.focus();
  return (false);
 }    
 return (true);
}
function checkoss()
{
 if (document.ossocregform.name_title.options[document.ossocregform.name_title.selectedIndex].value=='')
 {
  window.alert('Please enter your title!!');
 document.ossocregform.name_title.focus();
  return (false);
 }
 if (document.ossocregform.firstname.value=='')
 {
  window.alert('Please enter your first name(s)!!');
  document.ossocregform.firstname.focus();
  return (false);
 }
 if (document.ossocregform.surname.value=='')
 {
  window.alert('Please enter your surname!!');
  document.ossocregform.surname.focus();
  return (false);
 }  
 if (document.ossocregform.telephone.value=='')
 {
  window.alert('Please enter your telephone number!!');
  document.ossocregform.telephone.focus();
  return (false);
 }
 if (document.ossocregform.email.value=='')
 {
  window.alert('Please enter your email address!!');
  document.ossocregform.email.focus();
  return (false);
 } 
 if (document.ossocregform.address1.value=='')
 {
  window.alert('Please enter your full address!!');
  document.ossocregform.address1.focus();
  return (false);
 }
 if (document.ossocregform.address2.value=='')
 {
  window.alert('Please enter your full address!!');
  document.ossocregform.address2.focus();
  return (false);
 }
 if (document.ossocregform.county.options[document.ossocregform.county.selectedIndex].value=='')
 {
  window.alert('Please enter your county!!');
  document.ossocregform.county.focus();
  return (false);
 } 
 if (document.ossocregform.postcode.value=='')
 {
  window.alert('Please enter your postcode!!');
  document.ossocregform.postcode.focus();
  return (false);
 }  
 if ((document.ossocregform.dobday.options[document.ossocregform.dobday.selectedIndex].value=='')||(document.ossocregform.dobmonth.options[document.ossocregform.dobmonth.selectedIndex].value=='')||(document.ossocregform.dobyear.options[document.ossocregform.dobyear.selectedIndex].value==''))
 {
  window.alert('Please enter your Date of Birth!!');
  document.ossocregform.dobday.focus();
  return (false);
 }

 if ((document.ossocregform.transport[0].checked==false)&&(document.ossocregform.transport[1].checked==false))
 {
  window.alert('Please say whether you have transport!!');
 document.ossocregform.transport[0].focus(); 
  return (false);
 }
 if (document.ossocregform.nationality.options[document.ossocregform.nationality.selectedIndex].value=='')
 {
  window.alert('Please enter your Nationality!!');
  document.ossocregform.nationality.focus();
  return (false);
 }
 if ((document.ossocregform.permit[0].checked==false)&&(document.ossocregform.permit[1].checked==false))
 {
  window.alert('Please say whether you need a work permit!!');
 document.ossocregform.permit[0].focus(); 
  return (false);
 } 
 if ((document.ossocregform.gscc[0].checked==false)&&(document.ossocregform.gscc[1].checked==false))
 {
  window.alert('Please say whether you are registered with the GSCC!!');
 document.ossocregform.gscc[0].focus(); 
  return (false);
 }  	   
 if (document.ossocregform.qualifications.value=='')
 {
  window.alert('Please enter your qualifications!!');
  document.ossocregform.qualifications.focus();
  return (false);
 }
 if ((document.ossocregform.sw_last_3_years[0].checked==false)&&(document.ossocregform.sw_last_3_years[1].checked==false))
 {
  window.alert('Please say whether you have Social Work experience in the last 3 years!!');
 document.ossocregform.sw_last_3_years[0].focus(); 
  return (false);
 } 
 return (true);
}
function checkuqs()
{
 if (document.uqsocregform.name_title.options[document.uqsocregform.name_title.selectedIndex].value=='')
 {
  window.alert('Please enter your title!!');
 document.uqsocregform.name_title.focus();
  return (false);
 }
 if (document.uqsocregform.firstname.value=='')
 {
  window.alert('Please enter your first name(s)!!');
  document.uqsocregform.firstname.focus();
  return (false);
 }
 if (document.uqsocregform.surname.value=='')
 {
  window.alert('Please enter your surname!!');
  document.uqsocregform.surname.focus();
  return (false);
 }  
 if ((document.uqsocregform.telephone.value=='')&&(document.uqsocregform.mobile.value==''))
 {
  window.alert('Please enter either your telephone number or your mobile number!!');
  document.uqsocregform.telephone.focus();
  return (false);
 }
 if (document.uqsocregform.email.value=='')
 {
  window.alert('Please enter your email address!!');
  document.uqsocregform.email.focus();
  return (false);
 } 
 if ((document.uqsocregform.address1.value=='')&&(document.uqsocregform.address2.value==''))
 {
  window.alert('Please enter your full address!!');
  document.uqsocregform.address1.focus();
  return (false);
 }
 if (document.uqsocregform.town.value=='')
 {
  window.alert('Please enter your Town!!');
  document.uqsocregform.town.focus();
  return (false);
 } 
  if (document.uqsocregform.county.options[document.uqsocregform.county.selectedIndex].value=='')
 {
  window.alert('Please enter your county!!');
  document.uqsocregform.county.focus();
  return (false);
 }
 if (document.uqsocregform.county.options[document.uqsocregform.county.selectedIndex].value=='')
 {
  window.alert('Please enter your county!!');
  document.uqsocregform.county.focus();
  return (false);
 } 
 if (document.uqsocregform.postcode.value=='')
 {
  window.alert('Please enter your postcode!!');
  document.uqsocregform.postcode.focus();
  return (false);
 }  
 if ((document.uqsocregform.dobday.options[document.uqsocregform.dobday.selectedIndex].value=='')||(document.uqsocregform.dobmonth.options[document.uqsocregform.dobmonth.selectedIndex].value=='')||(document.uqsocregform.dobyear.options[document.uqsocregform.dobyear.selectedIndex].value==''))
 {
  window.alert('Please enter your Date of Birth!!');
  document.uqsocregform.dobday.focus();
  return (false);
 }
 if (document.uqsocregform.ni.value=='')
 {
  window.alert('Please enter your National Insurance Number!!');
  document.uqsocregform.ni.focus();
  return (false);
 } 
 if ((document.uqsocregform.transport[0].checked==false)&&(document.uqsocregform.transport[1].checked==false))
 {
  window.alert('Please say whether you have transport!!');
 document.uqsocregform.transport[0].focus(); 
  return (false);
 }
 if ((document.uqsocregform.gscc[0].checked==false)&&(document.uqsocregform.gscc[1].checked==false))
 {
  window.alert('Please say whether you are registered with the GSCC!!');
 document.uqsocregform.gscc[0].focus(); 
  return (false);
 } 
 if ((document.uqsocregform.sw_last_3_years[0].checked==false)&&(document.uqsocregform.sw_last_3_years[1].checked==false))
 {
  window.alert('Please say whether you have Social Work experience in the last 3 years!!');
 document.uqsocregform.sw_last_3_years[0].focus(); 
  return (false);
 }
 return (true);
}
function checkreg()
{
 if (document.regform.name_title.options[document.regform.name_title.selectedIndex].value=='')
 {
  window.alert('Please enter your title!!');
 document.regform.name_title.focus();
  return (false);
 }
 if (document.regform.firstname.value=='')
 {
  window.alert('Please enter your first name(s)!!');
  document.regform.firstname.focus();
  return (false);
 }
 if (document.regform.surname.value=='')
 {
  window.alert('Please enter your surname!!');
  document.regform.surname.focus();
  return (false);
 }
 if ((document.regform.telephone.value=='')&&(document.regform.mobile.value=='')&&(document.regform.email.value==''))
 {
  window.alert('Please enter your telephone number or your mobile number or your email address!!');
  document.regform.telephone.focus();
  return (false);
 }
 
 if ((document.regform.address1.value=='')&&(document.regform.address2.value==''))
 {
  window.alert('Please enter your full address!!');
  document.regform.address1.focus();
  return (false);
 }

  if (document.regform.town.value=='')
 {
  window.alert('Please enter your Town!!');
  document.regform.town.focus();
  return (false);
 }
 if (document.regform.county.options[document.regform.county.selectedIndex].value=='')
 {
  window.alert('Please enter your county!!');
  document.regform.county.focus();
  return (false);
 }
 if (document.regform.postcode.value=='')
 {
  window.alert('Please enter your postcode!!');
  document.regform.postcode.focus();
  return (false);
 }
	var thepostcode = document.regform.postcode.value;
	thepostcode = trimString(thepostcode);
	if (thepostcode.indexOf(' ') == -1)
	{
		window.alert('Postcodes must contain a space for example LS1 3BX');
 		document.regform.postcode.focus();
  		return (false);
	} 
 if (document.regform.qual_status.options[document.regform.qual_status.selectedIndex].value=='')
 {
  window.alert('Please tell us whether you are qualified, unqualified, or a student!!');
  document.regform.qual_status.focus();
  return (false);
 } 
 
   
   
 return (true);
}
function checkqs()
{
 if (document.qsocregform.name_title.options[document.qsocregform.name_title.selectedIndex].value=='')
 {
  window.alert('Please enter your title!!');
 document.qsocregform.name_title.focus();
  return (false);
 }
 if (document.qsocregform.firstname.value=='')
 {
  window.alert('Please enter your first name(s)!!');
  document.qsocregform.firstname.focus();
  return (false);
 }
 if (document.qsocregform.surname.value=='')
 {
  window.alert('Please enter your surname!!');
  document.qsocregform.surname.focus();
  return (false);
 }
 if ((document.qsocregform.telephone.value=='')&&(document.qsocregform.mobile.value==''))
 {
  window.alert('Please enter either your telephone number or your mobile number!!');
  document.qsocregform.telephone.focus();
  return (false);
 }
 if (document.qsocregform.email.value=='')
 {
  window.alert('Please enter your email address!!');
  document.qsocregform.email.focus();
  return (false);
 } 
 if ((document.qsocregform.address1.value=='')&&(document.qsocregform.address2.value==''))
 {
  window.alert('Please enter your full address!!');
  document.qsocregform.address1.focus();
  return (false);
 }

  if (document.qsocregform.town.value=='')
 {
  window.alert('Please enter your Town!!');
  document.qsocregform.town.focus();
  return (false);
 }
 if (document.qsocregform.county.options[document.qsocregform.county.selectedIndex].value=='')
 {
  window.alert('Please enter your county!!');
  document.qsocregform.county.focus();
  return (false);
 }
  if (document.qsocregform.qualyear.options[document.qsocregform.qualyear.selectedIndex].value=='')
 {
  window.alert('Please enter your qualification year!!');
  document.qsocregform.qualyear.focus();
  return (false);
 } 
 if (document.qsocregform.postcode.value=='')
 {
  window.alert('Please enter your postcode!!');
  document.qsocregform.postcode.focus();
  return (false);
 }
	var thepostcode = document.qsocregform.postcode.value;
	thepostcode = trimString(thepostcode);
	if (thepostcode.indexOf(' ') == -1)
	{
		window.alert('Postcodes must contain a space for example LS1 3BX');
 		document.qsocregform.postcode.focus();
  		return (false);
	}   
 if ((document.qsocregform.dobday.options[document.qsocregform.dobday.selectedIndex].value=='')||(document.qsocregform.dobmonth.options[document.qsocregform.dobmonth.selectedIndex].value=='')||(document.qsocregform.dobyear.options[document.qsocregform.dobyear.selectedIndex].value==''))
 {
  window.alert('Please enter your Date of Birth!!');
  document.qsocregform.dobday.focus();
  return (false);
 }
 if (document.qsocregform.ni.value=='')
 {
  window.alert('Please enter your National Insurance Number!!');
  document.qsocregform.ni.focus();
  return (false);
 } 
 if ((document.qsocregform.transport[0].checked==false)&&(document.qsocregform.transport[1].checked==false))
 {
  window.alert('Please say whether you have transport!!');
 document.qsocregform.transport[0].focus(); 
  return (false);
 }
 if ((document.qsocregform.gscc[0].checked==false)&&(document.qsocregform.gscc[1].checked==false))
 {
  window.alert('Please say whether you are registered with the GSCC!!');
 document.qsocregform.gscc[0].focus(); 
  return (false);
 } 
   
 if (document.qsocregform.qualifications.options[document.qsocregform.qualifications.selectedIndex].value=='')
 {
  window.alert('Please enter your qualifications!!');
  document.qsocregform.qualifications.focus();
  return (false);
 }
 if ((document.qsocregform.sw_last_3_years[0].checked==false)&&(document.qsocregform.sw_last_3_years[1].checked==false))
 {
  window.alert('Please say whether you have Social Work experience in the last 3 years!!');
 document.qsocregform.sw_last_3_years[0].focus(); 
  return (false);
 } 
 return (true);
}
function checksch()
{
 if (document.schregform.schoolname.value=='')
 {
  window.alert('Please enter the school name!!');
  document.schregform.schoolname.focus();
  return (false);
 }
 if (document.schregform.address1.value=='')
 {
  window.alert('Please enter the full address of your school!!');
  document.schregform.address1.focus();
  return (false);
 }
 if (document.schregform.address2.value=='')
 {
  window.alert('Please enter the full address of your school!!');
  document.schregform.address2.focus();
  return (false);
 }
 if (document.schregform.county.options[document.schregform.county.selectedIndex].value=='')
 {
  window.alert('Please enter the county in which your school is located!!');
  document.schregform.county.focus();
  return (false);
 } 
 if (document.schregform.postcode.value=='')
 {
  window.alert('Please enter the postcode of your school!!');
  document.schregform.postcode.focus();
  return (false);
 }
 if (document.schregform.email.value=='')
 {
  window.alert('Please enter the email address of your school!!');
  document.schregform.email.focus();
  return (false);
 }
 if (document.schregform.telephone.value=='')
 {
  window.alert('Please enter the telephone number of your school!!');
  document.schregform.telephone.focus();
  return (false);
 }
 if (document.schregform.schooltype.options[document.schregform.schooltype.selectedIndex].value=='')
 {
  window.alert('Please select your school type!!');
  document.schregform.schooltype.focus();
  return (false);
 }      	
 if (document.schregform.name_title.options[document.schregform.name_title.selectedIndex].value=='')
 {
  window.alert('Please enter a title for the contact!!');
 document.schregform.name_title.focus();
  return (false);
 }
 if (document.schregform.firstname.value=='')
 {
  window.alert('Please enter a contact first name(s)!!');
  document.schregform.firstname.focus();
  return (false);
 }
 if (document.schregform.surname.value=='')
 {
  window.alert('Please enter a contact surname!!');
  document.schregform.surname.focus();
  return (false);
 }    
 return (true);
}
function checknn()
{
 if (document.nnregform.name_title.options[document.nnregform.name_title.selectedIndex].value=='')
 {
  window.alert('Please enter your title!!');
 document.nnregform.name_title.focus();
  return (false);
 }
 if (document.nnregform.firstname.value=='')
 {
  window.alert('Please enter your first name(s)!!');
  document.nnregform.firstname.focus();
  return (false);
 }
 if (document.nnregform.surname.value=='')
 {
  window.alert('Please enter your surname!!');
  document.nnregform.surname.focus();
  return (false);
 }  
 if (document.nnregform.telephone.value=='')
 {
  window.alert('Please enter your telephone number!!');
  document.nnregform.telephone.focus();
  return (false);
 }
 if (document.nnregform.email.value=='')
 {
  window.alert('Please enter your email address!!');
  document.nnregform.email.focus();
  return (false);
 } 
 if (document.nnregform.address1.value=='')
 {
  window.alert('Please enter your full address!!');
  document.nnregform.address1.focus();
  return (false);
 }
 if (document.nnregform.address2.value=='')
 {
  window.alert('Please enter your full address!!');
  document.nnregform.address2.focus();
  return (false);
 }
 if (document.nnregform.county.options[document.nnregform.county.selectedIndex].value=='')
 {
  window.alert('Please enter your county!!');
  document.nnregform.county.focus();
  return (false);
 } 
 if (document.nnregform.postcode.value=='')
 {
  window.alert('Please enter your postcode!!');
  document.nnregform.postcode.focus();
  return (false);
 }  
 if ((document.nnregform.dobday.options[document.nnregform.dobday.selectedIndex].value=='')||(document.nnregform.dobmonth.options[document.nnregform.dobmonth.selectedIndex].value=='')||(document.nnregform.dobyear.options[document.nnregform.dobyear.selectedIndex].value==''))
 {
  window.alert('Please enter your Date of Birth!!');
  document.nnregform.dobday.focus();
  return (false);
 }
 
 if ((document.nnregform.transport[0].checked==false)&&(document.nnregform.transport[1].checked==false))
 {
  window.alert('Please say whether you have transport!!');
 document.nnregform.transport[0].focus(); 
  return (false);
 }
 if (document.nnregform.workreq.options[document.nnregform.workreq.selectedIndex].value=='')
 {
  window.alert('Please state the work you require!!');
  document.nnregform.workreq.focus();
  return (false);
 }   
 return (true); 
}
function checkost()
{
 if (document.ostregform.name_title.options[document.ostregform.name_title.selectedIndex].value=='')
 {
  window.alert('Please enter your title!!');
 document.ostregform.name_title.focus();
  return (false);
 }
 if (document.ostregform.firstname.value=='')
 {
  window.alert('Please enter your first name(s)!!');
  document.ostregform.firstname.focus();
  return (false);
 }
 if (document.ostregform.surname.value=='')
 {
  window.alert('Please enter your surname!!');
  document.ostregform.surname.focus();
  return (false);
 }  
 if (document.ostregform.telephone.value=='')
 {
  window.alert('Please enter your telephone number!!');
  document.ostregform.telephone.focus();
  return (false);
 }
 if (document.ostregform.email.value=='')
 {
  window.alert('Please enter your email address!!');
  document.ostregform.email.focus();
  return (false);
 } 
 if (document.ostregform.address1.value=='')
 {
  window.alert('Please enter your full address!!');
  document.ostregform.address1.focus();
  return (false);
 }
 if (document.ostregform.address2.value=='')
 {
  window.alert('Please enter your full address!!');
  document.ostregform.address2.focus();
  return (false);
 }
 if (document.ostregform.county.options[document.ostregform.county.selectedIndex].value=='')
 {
  window.alert('Please enter your county!!');
  document.ostregform.county.focus();
  return (false);
 } 
 if (document.ostregform.postcode.value=='')
 {
  window.alert('Please enter your postcode!!');
  document.ostregform.postcode.focus();
  return (false);
 }  
 if ((document.ostregform.dobday.options[document.ostregform.dobday.selectedIndex].value=='')||(document.ostregform.dobmonth.options[document.ostregform.dobmonth.selectedIndex].value=='')||(document.ostregform.dobyear.options[document.ostregform.dobyear.selectedIndex].value==''))
 {
  window.alert('Please enter your Date of Birth!!');
  document.ostregform.dobday.focus();
  return (false);
 }
 
 if ((document.ostregform.transport[0].checked==false)&&(document.ostregform.transport[1].checked==false))
 {
  window.alert('Please say whether you have transport!!');
 document.ostregform.transport[0].focus(); 
  return (false);
 }
 if (document.ostregform.nationality.options[document.ostregform.nationality.selectedIndex].value=='')
 {
  window.alert('Please enter your Nationality!!');
  document.ostregform.nationality.focus();
  return (false);
 }
 if ((document.ostregform.permit[0].checked==false)&&(document.ostregform.permit[1].checked==false))
 {
  window.alert('Please say whether you need a work permit!!');
 document.ostregform.permit[0].focus(); 
  return (false);
 } 	   
 if (document.ostregform.qualifications.value=='')
 {
  window.alert('Please enter your qualifications!!');
  document.ostregform.qualifications.focus();
  return (false);
 }
 
 if ((document.ostregform.taught_last_3_years[0].checked==false)&&(document.ostregform.taught_last_3_years[1].checked==false))
 {
  window.alert('Please say whether you have taught in the last 3 years!!');
 document.ostregform.taught_last_3_years[0].focus(); 
  return (false);
 }
 if ((document.ostregform.primaryey.checked==false)&&(document.ostregform.primaryks1.checked==false)&&(document.ostregform.primaryks2.checked==false)&&(document.ostregform.primarysn.checked==false)&&(document.ostregform.secondarysn.checked==false))
 
 { 
 	if (document.ostregform.subject1.value=='')
 	{
  	window.alert('Please Please state whether your preferred Job Category is Primary or Secondary. If you havent checked a category in Primary, then you must, either check Special Needs in Secondary or, specify at least one Subject!!');
  	document.ostregform.subject1.focus();
  	return (false);
 	}
 	if ((document.ostregform.s1ks3.checked==false)&&(document.ostregform.s1gcse.checked==false)&&(document.ostregform.s1alevel.checked==false))
 	{
	 	window.alert('Please enter a teaching level for Subject 1!!');
  		document.ostregform.s1ks3.focus();
  	  	return (false);
 	} 	
 } 
 return (true); 
}

function checkukt()
{
 if (document.uktregform.name_title.options[document.uktregform.name_title.selectedIndex].value=='')
 {
  window.alert('Please enter your title!!');
 document.uktregform.name_title.focus();
  return (false);
 }
 if (document.uktregform.firstname.value=='')
 {
  window.alert('Please enter your first name(s)!!');
  document.uktregform.firstname.focus();
  return (false);
 }
 if (document.uktregform.surname.value=='')
 {
  window.alert('Please enter your surname!!');
  document.uktregform.surname.focus();
  return (false);
 }  
 if (document.uktregform.telephone.value=='')
 {
  window.alert('Please enter your telephone number!!');
  document.uktregform.telephone.focus();
  return (false);
 }
 if (document.uktregform.email.value=='')
 {
  window.alert('Please enter your email address!!');
  document.uktregform.email.focus();
  return (false);
 } 
 if (document.uktregform.address1.value=='')
 {
  window.alert('Please enter your full address!!');
  document.uktregform.address1.focus();
  return (false);
 }
 if (document.uktregform.address2.value=='')
 {
  window.alert('Please enter your full address!!');
  document.uktregform.address2.focus();
  return (false);
 }
 if (document.uktregform.county.options[document.uktregform.county.selectedIndex].value=='')
 {
  window.alert('Please enter your county!!');
  document.uktregform.county.focus();
  return (false);
 } 
 if (document.uktregform.postcode.value=='')
 {
  window.alert('Please enter your postcode!!');
  document.uktregform.postcode.focus();
  return (false);
 }  
 if ((document.uktregform.dobday.options[document.uktregform.dobday.selectedIndex].value=='')||(document.uktregform.dobmonth.options[document.uktregform.dobmonth.selectedIndex].value=='')||(document.uktregform.dobyear.options[document.uktregform.dobyear.selectedIndex].value==''))
 {
  window.alert('Please enter your Date of Birth!!');
  document.uktregform.dobday.focus();
  return (false);
 }
 if (document.uktregform.ni.value=='')
 {
  window.alert('Please enter your National Insurance Number!!');
  document.uktregform.ni.focus();
  return (false);
 } 
 if ((document.uktregform.transport[0].checked==false)&&(document.uktregform.transport[1].checked==false))
 {
  window.alert('Please say whether you have transport!!');
 document.uktregform.transport[0].focus(); 
  return (false);
 }  
 if (document.uktregform.qualifications.options[document.uktregform.qualifications.selectedIndex].value=='')
 {
  window.alert('Please enter your qualifications!!');
  document.uktregform.qualifications.focus();
  return (false);
 } 
 if ((document.uktregform.taught_last_3_years[0].checked==false)&&(document.uktregform.taught_last_3_years[1].checked==false))
 {
  window.alert('Please say whether you have taught in the last 3 years!!');
 document.uktregform.taught_last_3_years[0].focus(); 
  return (false);
 }
 if ((document.uktregform.primaryey.checked==false)&&(document.uktregform.primaryks1.checked==false)&&(document.uktregform.primaryks2.checked==false)&&(document.uktregform.primarysn.checked==false)&&(document.uktregform.secondarysn.checked==false))
 
 { 
 	if (document.uktregform.subject1.value=='')
 	{
  	window.alert('Please Please state whether your preferred Job Category is Primary or Secondary. If you havent checked a category in Primary, then you must, either check Special Needs in Secondary or, specify at least one Subject!!');
  	document.uktregform.subject1.focus();
  	return (false);
 	}
 	if ((document.uktregform.s1ks3.checked==false)&&(document.uktregform.s1gcse.checked==false)&&(document.uktregform.s1alevel.checked==false))
 	{
	 	window.alert('Please enter a teaching level for Subject 1!!');
  		document.uktregform.s1ks3.focus();
  	  	return (false);
 	} 	
 } 
 return (true);
}

function qsdocsdatecheck()
{
	var startmonth = document.qsdocsuploadform.qsdocstartmonth.options[document.qsdocsuploadform.qsdocstartmonth.selectedIndex].value;
	var startyear = document.qsdocsuploadform.qsdocstartyear.options[document.qsdocsuploadform.qsdocstartyear.selectedIndex].value;
	var endmonth = document.qsdocsuploadform.qsdocendmonth.options[document.qsdocsuploadform.qsdocendmonth.selectedIndex].value;
	var endyear = document.qsdocsuploadform.qsdocendyear.options[document.qsdocsuploadform.qsdocendyear.selectedIndex].value;
	
	if(startmonth == "01")
	{
		startmonth = "Jan";
	}
	else if(startmonth == "02")
	{
		startmonth = "Feb";
	}
	else if(startmonth == "03")
	{
		startmonth = "Mar";
	}
	else if(startmonth == "04")
	{
		startmonth = "Apr";
	}
	else if(startmonth == "05")
	{
		startmonth = "May";
	}
	else if(startmonth == "06")
	{
		startmonth = "Jun";
	}
	else if(startmonth == "07")
	{
		startmonth = "Jul";
	}
	else if(startmonth == "08")
	{
		startmonth = "Aug";
	}
	else if(startmonth == "09")
	{
		startmonth = "Sep";
	}
	else if(startmonth == "10")
	{
		startmonth = "Oct";
	}
	else if(startmonth == "11")
	{
		startmonth = "Nov";
	}
	else
	{
		startmonth = "Dec";
	}
	
	if(endmonth == "01")
	{
		endmonth = "Jan";
	}
	else if(endmonth == "02")
	{
		endmonth = "Feb";
	}
	else if(endmonth == "03")
	{
		endmonth = "Mar";
	}
	else if(endmonth == "04")
	{
		endmonth = "Apr";
	}
	else if(endmonth == "05")
	{
		endmonth = "May";
	}
	else if(endmonth == "06")
	{
		endmonth = "Jun";
	}
	else if(endmonth == "07")
	{
		endmonth = "Jul";
	}
	else if(endmonth == "08")
	{
		endmonth = "Aug";
	}
	else if(endmonth == "09")
	{
		endmonth = "Sep";
	}
	else if(endmonth == "10")
	{
		endmonth = "Oct";
	}
	else if(endmonth == "11")
	{
		endmonth = "Nov";
	}
	else
	{
		endmonth = "Dec";
	}
	var startdate = startmonth + ' 1, ' + startyear;
	var enddate = endmonth + ' 1, ' + endyear;
	var startsecs=Date.parse(startdate);
	var endsecs=Date.parse(enddate);
	var myresult;
	if (startsecs > endsecs)
	{
		return (true);
	}
	else
	{
		return (false);
	}
									
}

function qsdocseditdatecheck()
{
	var startmonth = document.qsdocseditform.qsdocstartmonth.options[document.qsdocseditform.qsdocstartmonth.selectedIndex].value;
	var startyear = document.qsdocseditform.qsdocstartyear.options[document.qsdocseditform.qsdocstartyear.selectedIndex].value;
	var endmonth = document.qsdocseditform.qsdocendmonth.options[document.qsdocseditform.qsdocendmonth.selectedIndex].value;
	var endyear = document.qsdocseditform.qsdocendyear.options[document.qsdocseditform.qsdocendyear.selectedIndex].value;
	
	if(startmonth == "01")
	{
		startmonth = "Jan";
	}
	else if(startmonth == "02")
	{
		startmonth = "Feb";
	}
	else if(startmonth == "03")
	{
		startmonth = "Mar";
	}
	else if(startmonth == "04")
	{
		startmonth = "Apr";
	}
	else if(startmonth == "05")
	{
		startmonth = "May";
	}
	else if(startmonth == "06")
	{
		startmonth = "Jun";
	}
	else if(startmonth == "07")
	{
		startmonth = "Jul";
	}
	else if(startmonth == "08")
	{
		startmonth = "Aug";
	}
	else if(startmonth == "09")
	{
		startmonth = "Sep";
	}
	else if(startmonth == "10")
	{
		startmonth = "Oct";
	}
	else if(startmonth == "11")
	{
		startmonth = "Nov";
	}
	else
	{
		startmonth = "Dec";
	}
	
	if(endmonth == "01")
	{
		endmonth = "Jan";
	}
	else if(endmonth == "02")
	{
		endmonth = "Feb";
	}
	else if(endmonth == "03")
	{
		endmonth = "Mar";
	}
	else if(endmonth == "04")
	{
		endmonth = "Apr";
	}
	else if(endmonth == "05")
	{
		endmonth = "May";
	}
	else if(endmonth == "06")
	{
		endmonth = "Jun";
	}
	else if(endmonth == "07")
	{
		endmonth = "Jul";
	}
	else if(endmonth == "08")
	{
		endmonth = "Aug";
	}
	else if(endmonth == "09")
	{
		endmonth = "Sep";
	}
	else if(endmonth == "10")
	{
		endmonth = "Oct";
	}
	else if(endmonth == "11")
	{
		endmonth = "Nov";
	}
	else
	{
		endmonth = "Dec";
	}
	var startdate = startmonth + ' 1, ' + startyear;
	var enddate = endmonth + ' 1, ' + endyear;
	var startsecs=Date.parse(startdate);
	var endsecs=Date.parse(enddate);
	var myresult;
	if (startsecs > endsecs)
	{
		return (true);
	}
	else
	{
		return (false);
	}
									
}
function qsdocscheck()
{	
	var thefilename = document.qsdocsuploadform.myfile.value;
	thefilename = trimString(thefilename);
	if(thefilename != '')
	{
		if (thefilename.indexOf("'") != -1)
		{
			window.alert('Filenames cannot contain apostrophes. Please remove the apostrophes from the filename and try again');
 			document.qsdocsuploadform.myfile.focus();
  			return (false);
		}
		if (thefilename.indexOf('"') != -1)
		{
			window.alert('Filenames cannot contain quotation marks. Please remove the quotation marks from the filename and try again');
 			document.qsdocsuploadform.myfile.focus();
  			return (false);
		}
		if (thefilename.indexOf('@') != -1)
		{
			window.alert('Filenames cannot contain the @ character. Please remove the @ character from the filename and try again');
 			document.qsdocsuploadform.myfile.focus();
  			return (false);
		}
	}
	else
	{
  		window.alert('You havent selected a file to upload!!');
  		document.qsdocsuploadform.myfile.focus();
  		return (false);		
	}
 	if (document.qsdocsuploadform.qsdoctype.options[document.qsdocsuploadform.qsdoctype.selectedIndex].value=='')
 	{
  		window.alert('Please select a document type!!');
  		document.qsdocsuploadform.qsdoctype.focus();
  		return (false);
 	}
 	if (document.qsdocsuploadform.qsdoctype.options[document.qsdocsuploadform.qsdoctype.selectedIndex].value=='Reference')
 	{
	 	if (document.qsdocsuploadform.qsdocstartmonth.options[document.qsdocsuploadform.qsdocstartmonth.selectedIndex].value=='')
	 	{
  		window.alert('References must have a start month!!');
  		document.qsdocsuploadform.qsdocstartmonth.focus();
  		return (false);
		}	 	
	 	if (document.qsdocsuploadform.qsdocstartyear.options[document.qsdocsuploadform.qsdocstartyear.selectedIndex].value=='')
	 	{
  		window.alert('References must have a start year!!');
  		document.qsdocsuploadform.qsdocstartyear.focus();
  		return (false);
		}
	 	if (document.qsdocsuploadform.qsdocendmonth.options[document.qsdocsuploadform.qsdocendmonth.selectedIndex].value=='')
	 	{
  		window.alert('References must have an end month!!');
  		document.qsdocsuploadform.qsdocendmonth.focus();
  		return (false);
		}	 	
	 	if (document.qsdocsuploadform.qsdocendyear.options[document.qsdocsuploadform.qsdocendyear.selectedIndex].value=='')
	 	{
  		window.alert('References must have an end year!!');
  		document.qsdocsuploadform.qsdocendyear.focus();
  		return (false);
		}
		var mydocdatecheck = qsdocsdatecheck();
	 	if (mydocdatecheck)
	 	{
  		window.alert('Your start date is later than your end date!!');
  		document.qsdocsuploadform.qsdocstartmonth.focus();
  		return (false);
		}

				
								
 	}
 	 		
 	return (true);
}

function qsdocseditcheck()
{	
 	if (document.qsdocseditform.qsdoctype.options[document.qsdocseditform.qsdoctype.selectedIndex].value=='')
 	{
  		window.alert('Please select a document type!!');
  		document.qsdocseditform.qsdoctype.focus();
  		return (false);
 	}
 	if (document.qsdocseditform.qsdoctype.options[document.qsdocseditform.qsdoctype.selectedIndex].value=='Reference')
 	{
	 	if (document.qsdocseditform.qsdocstartmonth.options[document.qsdocseditform.qsdocstartmonth.selectedIndex].value=='')
	 	{
  		window.alert('References must have a start month!!');
  		document.qsdocseditform.qsdocstartmonth.focus();
  		return (false);
		}	 	
	 	if (document.qsdocseditform.qsdocstartyear.options[document.qsdocseditform.qsdocstartyear.selectedIndex].value=='')
	 	{
  		window.alert('References must have a start year!!');
  		document.qsdocseditform.qsdocstartyear.focus();
  		return (false);
		}
	 	if (document.qsdocseditform.qsdocendmonth.options[document.qsdocseditform.qsdocendmonth.selectedIndex].value=='')
	 	{
  		window.alert('References must have an end month!!');
  		document.qsdocseditform.qsdocendmonth.focus();
  		return (false);
		}	 	
	 	if (document.qsdocseditform.qsdocendyear.options[document.qsdocseditform.qsdocendyear.selectedIndex].value=='')
	 	{
  		window.alert('References must have an end year!!');
  		document.qsdocseditform.qsdocendyear.focus();
  		return (false);
		}
		var mydocdatecheck = qsdocseditdatecheck();
	 	if (mydocdatecheck)
	 	{
  		window.alert('Your start date is later than your end date!!');
  		document.qsdocseditform.qsdocstartmonth.focus();
  		return (false);
		}

				
								
 	}
 	 		
 	return (true);
}
var qstextsubmitted = false;
function doqstextSubmit() {
	if (! qstextsubmitted) {
		qstextsubmitted = true;
		ProgressImg = document.getElementById('inprogress_img');
		document.getElementById("textsworking").style.visibility = "visible";
		setTimeout("ProgressImg.src = ProgressImg.src",100);
		return true;
		}
	else {
		return false;
		}
	}

function startqsdocUpload(){
      document.getElementById('f1_upload_process').style.visibility = 'visible';
      document.getElementById('f1_upload_form').style.visibility = 'hidden';
      return true;
}
function submitfile()
{
	var yeaornay = qsdocscheck();
	if (yeaornay)
	{
		startqsdocUpload();
		return true;
	}
	else
	{
		return false;
	}
}
function stopqsdocsUpload(success, docrefnum, userid){
      var result = '';
      if (success == 1){
         result = '<span class="msg">The document was uploaded successfully! You may now upload another document.<\/span><br/><br/>';
      }
      else if (success == 2){
         result = '<span class="emsg">A document with this name already exists. You must delete the existing document in order to upload a new version. Or you must rename the document before you can upload it<\/span><br/><br/>';
      }
      else if (success == 3){
         result = '<span class="emsg">Your file was too large. Maximum filesize is 150Kb.<\/span><br/><br/>';
      }            
      else {
         result = '<span class="emsg">There was an error during file upload!<\/span><br/><br/>';
      }
      document.getElementById('f1_upload_process').style.visibility = 'hidden';
      document.getElementById('f1_upload_form').innerHTML = result + '<TABLE><TR><TD class=form width=100>Document Type<\/TD><TD width=175><SELECT size=1 name=qsdoctype><OPTION value = "" selected >Select<\/OPTION><OPTION value = "CRB">CRB<\/OPTION>                              	<OPTION value = "CV or Profile">CV or Profile</OPTION><OPTION value = "Eligibility to Work">Eligibility to Work<\/OPTION><OPTION value = "Proof of NI">Proof of NI<\/OPTION><OPTION value = "Proof of Address">Proof of Address<\/OPTION><OPTION value = "Qualification">Qualification<\/OPTION><OPTION value = "GSCC">GSCC<\/OPTION><OPTION value = "Confidentiality Agreement">Confidentiality Agreement<\/OPTION><OPTION value = "Reference">Reference<\/OPTION><OPTION value = "Other Validation Document">Other Validation Document<\/OPTION><OPTION value = "Proof of Identity">Proof of Identity<\/OPTION><\/SELECT><\/TD><\/TR><TR><TD height=10><\/TD><\/TR><TR><TD class=form width=100>Start Date<\/TD><TD width=175><SELECT size=1 name=qsdocstartmonth><OPTION value = "" selected >Month<\/OPTION><OPTION value = "01">01<\/OPTION><OPTION value = "02">02<\/OPTION><OPTION value = "03">03<\/OPTION><OPTION value = "04">04<\/OPTION><OPTION value = "05">05<\/OPTION><OPTION value = "06">06<\/OPTION><OPTION value = "07">07<\/OPTION><OPTION value = "08">08<\/OPTION><OPTION value = "09">09<\/OPTION><OPTION value = "10">10<\/OPTION><OPTION value = "11">11<\/OPTION><OPTION value = "12">12<\/OPTION><\/SELECT><SELECT size=1 name=qsdocstartyear><OPTION value = "" selected >Year<\/OPTION><OPTION value = "pre 1995">pre 1995<\/OPTION><OPTION value = "1995">1995<\/OPTION><OPTION value = "1996">1996<\/OPTION><OPTION value = "1997">1997<\/OPTION><OPTION value = "1998">1998<\/OPTION><OPTION value = "1999">1999<\/OPTION><OPTION value = "2000">2000<\/OPTION><OPTION value = "2001">2001<\/OPTION><OPTION value = "2002">2002<\/OPTION><OPTION value = "2003">2003<\/OPTION><OPTION value = "2004">2004<\/OPTION><OPTION value = "2005">2005<\/OPTION><OPTION value = "2006">2006<\/OPTION><OPTION value = "2007">2007<\/OPTION><OPTION value = "2008">2008<\/OPTION><OPTION value = "2009">2009<\/OPTION><OPTION value = "2010">2010<\/OPTION><OPTION value = "2011">2011<\/OPTION><OPTION value = "2012">2012<\/OPTION><OPTION value = "2013">2013<\/OPTION><OPTION value = "2014">2014<\/OPTION><OPTION value = "2015">2015<\/OPTION><OPTION value = "2016">2016<\/OPTION><OPTION value = "2017">2017<\/OPTION><OPTION value = "2018">2018<\/OPTION><OPTION value = "2019">2019<\/OPTION><OPTION value = "2020">2020<\/OPTION><\/SELECT><\/TD><\/TR><TR><TD height=10><\/TD><\/TR><TR><TD class=form width=100>End Date<\/TD><TD width=175><SELECT size=1 name=qsdocendmonth><OPTION value = "" selected >Month<\/OPTION><OPTION value = "01">01<\/OPTION><OPTION value = "02">02<\/OPTION><OPTION value = "03">03<\/OPTION><OPTION value = "04">04<\/OPTION><OPTION value = "05">05<\/OPTION><OPTION value = "06">06<\/OPTION><OPTION value = "07">07<\/OPTION><OPTION value = "08">08<\/OPTION><OPTION value = "09">09<\/OPTION><OPTION value = "10">10<\/OPTION><OPTION value = "11">11<\/OPTION><OPTION value = "12">12<\/OPTION><\/SELECT><SELECT size=1 name=qsdocendyear><OPTION value = "" selected >Year<\/OPTION><OPTION value = "pre 1995">pre 1995<\/OPTION><OPTION value = "1995">1995<\/OPTION><OPTION value = "1996">1996<\/OPTION><OPTION value = "1997">1997<\/OPTION><OPTION value = "1998">1998<\/OPTION><OPTION value = "1999">1999<\/OPTION><OPTION value = "2000">2000<\/OPTION><OPTION value = "2001">2001<\/OPTION><OPTION value = "2002">2002<\/OPTION><OPTION value = "2003">2003<\/OPTION><OPTION value = "2004">2004<\/OPTION><OPTION value = "2005">2005<\/OPTION><OPTION value = "2006">2006<\/OPTION><OPTION value = "2007">2007<\/OPTION><OPTION value = "2008">2008<\/OPTION><OPTION value = "2009">2009<\/OPTION><OPTION value = "2010">2010<\/OPTION><OPTION value = "2011">2011<\/OPTION><OPTION value = "2012">2012<\/OPTION><OPTION value = "2013">2013<\/OPTION><OPTION value = "2014">2014<\/OPTION><OPTION value = "2015">2015<\/OPTION><OPTION value = "2016">2016<\/OPTION><OPTION value = "2017">2017<\/OPTION><OPTION value = "2018">2018<\/OPTION><OPTION value = "2019">2019<\/OPTION><OPTION value = "2020">2020<\/OPTION><\/SELECT><\/TD><\/TR><TR><TD height=10><\/TD><\/TR><TR><TD  class = form colspan = 3><center><b>Description<\/b><\/center><\/TD><\/TR><TR><TD colspan = 3 align = "center"><textarea name="qsdocdescription" cols="40" rows="5"><\/textarea><\/TD><\/TR><TR><TD height=10><\/TD><\/TR><\/TABLE><label>File: <input name="myfile" type="file" size="30" /><\/label><label><input type="submit" name="submitBtn" class="sbtn" value="Upload" /><\/label>';
      document.getElementById('f1_upload_form').style.visibility = 'visible';      
      return true;   
}

function check2()
{
 if ((document.friend.name_from.value=='')||(document.friend.email_from.value==''))
 {
  window.alert('Please enter your name and email address!!');
  return (false);
 }
 if ((document.friend.name_to.value=='')||(document.friend.email_to.value==''))
 {
  window.alert('Please enter your friends name and email address!!');
  return (false);
 }
 return (true);
}

function AllowTabCharacter()
{
	if (event != null)
	{
		if (event.srcElement)
		{
			if (event.srcElement.value)
			{
				if (event.keyCode == 9)
				{  // tab character
					if (document.selection != null)
					{
						document.selection.createRange().text = '\t';
						event.returnValue = false;
					}
					else
					{
						event.srcElement.value += '\t';
						return false;
					}
				}
			}
		}
	}
}

<!--
// bbCode control by
// subBlue design
// www.subBlue.com

// Startup variables
var imageTag = false;
var theSelection = false;

// Check for Browser & Platform for PC & IE specific bits
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var clientVer = parseInt(navigator.appVersion); // Get browser version

var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav  = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
                && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
                && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));

var is_win   = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac    = (clientPC.indexOf("mac")!=-1);


// Helpline messages
b_help = "{L_BBCODE_B_HELP}";
i_help = "{L_BBCODE_I_HELP}";
u_help = "{L_BBCODE_U_HELP}";
q_help = "{L_BBCODE_Q_HELP}";
c_help = "{L_BBCODE_C_HELP}";
l_help = "{L_BBCODE_L_HELP}";
o_help = "{L_BBCODE_O_HELP}";
p_help = "{L_BBCODE_P_HELP}";
w_help = "{L_BBCODE_W_HELP}";
a_help = "{L_BBCODE_A_HELP}";
s_help = "{L_BBCODE_S_HELP}";
f_help = "{L_BBCODE_F_HELP}";

// Define the bbCode tags
bbcode = new Array();
bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[bullet]','[/bullet]','[p]','[/p]','[blank]','','[img]','[/img]','[url]','[/url]');
imageTag = false;

// Shows the help messages in the helpline window
function helpline(help) {
	document.post.helpbox.value = eval(help + "_help");
}


// Replacement for arrayname.length property
function getarraysize(thearray) {
	for (i = 0; i < thearray.length; i++) {
		if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null))
			return i;
		}
	return thearray.length;
}

// Replacement for arrayname.push(value) not implemented in IE until version 5.5
// Appends element to the array
function arraypush(thearray,value) {
	thearray[ getarraysize(thearray) ] = value;
}

// Replacement for arrayname.pop() not implemented in IE until version 5.5
// Removes and returns the last element of an array
function arraypop(thearray) {
	thearraysize = getarraysize(thearray);
	retval = thearray[thearraysize - 1];
	delete thearray[thearraysize - 1];
	return retval;
}


function checkForm() {

	formErrors = false;    

	if (document.post.message.value.length < 2) {
		formErrors = "{L_EMPTY_MESSAGE}";
	}

	if (formErrors) {
		alert(formErrors);
		return false;
	} else {
		bbstyle(-1);
		//formObj.preview.disabled = true;
		//formObj.submit.disabled = true;
		return true;
	}
}


function emoticon(text) {
	text = ' ' + text + ' ';
	if (document.post.message.createTextRange && document.post.message.caretPos) {
		var caretPos = document.post.message.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
		document.post.message.focus();
	} else {
	document.post.message.value  += text;
	document.post.message.focus();
	}
}

function bbfontstyle(bbopen, bbclose) {
	if ((clientVer >= 4) && is_ie && is_win) {
		theSelection = document.selection.createRange().text;
		if (!theSelection) {
			document.post.message.value += bbopen + bbclose;
			document.post.message.focus();
			return;
		}
		document.selection.createRange().text = bbopen + theSelection + bbclose;
		document.post.message.focus();
		return;
	} else {
		document.post.message.value += bbopen + bbclose;
		document.post.message.focus();
		return;
	}
	storeCaret(document.post.message);
}


function bbstyle(bbnumber) {

	donotinsert = false;
	theSelection = false;
	bblast = 0;

	if (bbnumber == -1) { // Close all open tags & default button names
		while (bbcode[0]) {
			butnumber = arraypop(bbcode) - 1;
			document.post.message.value += bbtags[butnumber + 1];
			buttext = eval('document.post.addbbcode' + butnumber + '.value');
			eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
		}
		imageTag = false; // All tags are closed including image tags :D
		document.post.message.focus();
		return;
	}

	if ((clientVer >= 4) && is_ie && is_win)
		theSelection = document.selection.createRange().text; // Get text selection
		
	if (theSelection) {
		// Add tags around selection
		document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
		document.post.message.focus();
		theSelection = '';
		return;
	}
	
	// Find last occurance of an open tag the same as the one just clicked
	for (i = 0; i < bbcode.length; i++) {
		if (bbcode[i] == bbnumber+1) {
			bblast = i;
			donotinsert = true;
		}
	}

	if (donotinsert) {		// Close all open tags up to the one just clicked & default button names
		while (bbcode[bblast]) {
				butnumber = arraypop(bbcode) - 1;
				document.post.message.value += bbtags[butnumber + 1];
				buttext = eval('document.post.addbbcode' + butnumber + '.value');
				eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
				imageTag = false;
			}
			document.post.message.focus();
			return;
	} else { // Open tags
	
		if (imageTag && (bbnumber != 14)) {		// Close image tag before adding another
			document.post.message.value += bbtags[15];
			lastValue = arraypop(bbcode) - 1;	// Remove the close image tag from the list
			document.post.addbbcode14.value = "Img";	// Return button back to normal state
			imageTag = false;
		}
		
		// Open tag
		document.post.message.value += bbtags[bbnumber];
		if ((bbnumber == 14) && (imageTag == false)) imageTag = 1; // Check to stop additional tags after an unclosed image tag
		arraypush(bbcode,bbnumber+1);
		eval('document.post.addbbcode'+bbnumber+'.value += "*"');
		document.post.message.focus();
		return;
	}
	storeCaret(document.post.message);
}
function bbstyle1(bbnumber) {

	donotinsert = false;
	theSelection = false;
	bblast = 0;

	if (bbnumber == -1) { // Close all open tags & default button names
		while (bbcode[0]) {
			butnumber = arraypop(bbcode) - 1;
			document.post.message1.value += bbtags[butnumber + 1];
			buttext = eval('document.post.addbbcode' + butnumber + '.value');
			eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
		}
		imageTag = false; // All tags are closed including image tags :D
		document.post.message1.focus();
		return;
	}

	if ((clientVer >= 4) && is_ie && is_win)
		theSelection = document.selection.createRange().text; // Get text selection
		
	if (theSelection) {
		// Add tags around selection
		document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
		document.post.message1.focus();
		theSelection = '';
		return;
	}
	
	// Find last occurance of an open tag the same as the one just clicked
	for (i = 0; i < bbcode.length; i++) {
		if (bbcode[i] == bbnumber+1) {
			bblast = i;
			donotinsert = true;
		}
	}

	if (donotinsert) {		// Close all open tags up to the one just clicked & default button names
		while (bbcode[bblast]) {
				butnumber = arraypop(bbcode) - 1;
				document.post.message1.value += bbtags[butnumber + 1];
				buttext = eval('document.post.addbbcode' + butnumber + '.value');
				eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
				imageTag = false;
			}
			document.post.message1.focus();
			return;
	} else { // Open tags
	
		if (imageTag && (bbnumber != 14)) {		// Close image tag before adding another
			document.post.message1.value += bbtags[15];
			lastValue = arraypop(bbcode) - 1;	// Remove the close image tag from the list
			document.post.addbbcode14.value = "Img";	// Return button back to normal state
			imageTag = false;
		}
		
		// Open tag
		document.post.message1.value += bbtags[bbnumber];
		if ((bbnumber == 14) && (imageTag == false)) imageTag = 1; // Check to stop additional tags after an unclosed image tag
		arraypush(bbcode,bbnumber+1);
		eval('document.post.addbbcode'+bbnumber+'.value += "*"');
		document.post.message1.focus();
		return;
	}
	storeCaret(document.post.message1);
}


// Insert at Claret position. Code from
// http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
function storeCaret(textEl) {
	if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
	
}


//-->
