function setDataType(cValue)
  {
    // THIS FUNCTION CONVERTS DATES AND NUMBERS FOR PROPER ARRAY
    // SORTING WHEN IN THE SORT FUNCTION
    var isDate = new Date(cValue);
    if (isDate == "NaN")
      {
        if (isNaN(cValue))
          {
            // THE VALUE IS A STRING, MAKE ALL CHARACTERS IN
            // STRING UPPER CASE TO ASSURE PROPER A-Z SORT
            cValue = cValue.toUpperCase();
            return cValue;
          }
        else
          {
            // VALUE IS A NUMBER, TO PREVENT STRING SORTING OF A NUMBER
            // ADD AN ADDITIONAL DIGIT THAT IS THE + TO THE LENGTH OF
            // THE NUMBER WHEN IT IS A STRING
            var myNum;
            myNum = String.fromCharCode(48 + cValue.length) + cValue;
            return myNum;
          }
        }
  else
      {
        // VALUE TO SORT IS A DATE, REMOVE ALL OF THE PUNCTUATION AND
        // AND RETURN THE STRING NUMBER
        //BUG - STRING AND NOT NUMERICAL SORT .....
        // ( 1 - 10 - 11 - 2 - 3 - 4 - 41 - 5  etc.)
        var myDate = new String();
        myDate = isDate.getFullYear() + " " ;
        myDate = myDate + isDate.getMonth() + " ";
        myDate = myDate + isDate.getDate(); + " ";
        myDate = myDate + isDate.getHours(); + " ";
        myDate = myDate + isDate.getMinutes(); + " ";
        myDate = myDate + isDate.getSeconds();
        //myDate = String.fromCharCode(48 + myDate.length) + myDate;
        return myDate ;
      }
  }
function sortTable(col, tableToSort)
{
  window.status="Sorting...";
  var iCurCell = col + tableToSort.cols;
  var totalRows = tableToSort.rows.length;
  var bSort = 0;
  var colArray = new Array();
  var oldIndex = new Array();
  var indexArray = new Array();
  var bArray = new Array();
  var newRow;
  var newCell;
  var i;
  var c;
  var j;
  // ** POPULATE THE ARRAY colArray WITH CONTENTS OF THE COLUMN SELECTED
  for (a=0; a<tableToSort.cols; a++)
  {
  tableToSort.rows(0).cells(a).style.fontWeight=400;
  }
  tableToSort.rows(0).cells(col).style.fontWeight=700;
  for (i=1; i < tableToSort.rows.length; i++)
  {
    colArray[i - 1] = setDataType(tableToSort.cells(iCurCell).innerText);
    iCurCell = iCurCell + tableToSort.cols;
  }
  // ** COPY ARRAY FOR COMPARISON AFTER SORT
  for (i=0; i < colArray.length; i++)
  {
    bArray[i] = colArray[i];
  }
    // ** SORT THE COLUMN ITEMS
  colArray.sort();
   // reverse in is an integer
  if (isNaN(colArray[0])){}
  else
  {
  colArray=colArray.reverse();
  }
  for (i=0; i < colArray.length; i++)
  { // LOOP THROUGH THE NEW SORTED ARRAY
    indexArray[i] = (i+1);
    for(j=0; j < bArray.length; j++)
    { // LOOP THROUGH THE OLD ARRAY
      if (colArray[i] == bArray[j])
      {  // WHEN THE ITEM IN THE OLD AND NEW MATCH, PLACE THE
    // CURRENT ROW NUMBER IN THE PROPER POSITION IN THE
      // NEW ORDER ARRAY SO ROWS CAN BE MOVED ....
      // MAKE SURE CURRENT ROW NUMBER IS NOT ALREADY IN THE
      // NEW ORDER ARRAY
        for (c=0; c<i; c++)
        {
          if ( oldIndex[c] == (j+1) )
          {
            bSort = 1;
          }
        }
        if (bSort == 0)
        {
          oldIndex[i] = (j+1);
        }
        bSort = 0;
      }
    }
  }
  // ** SORTING COMPLETE, ADD NEW ROWS TO BASE OF TABLE ....
  for (i=0; i<oldIndex.length; i++)
    {
      newRow = tableToSort.insertRow();
      if (i%2 == 0) {newRow.className="col5";}
      else {newRow.className="col4";}
   
      for (c=0; c<tableToSort.cols; c++)
        {
          newCell = newRow.insertCell();
          
          newCell.innerHTML = tableToSort.rows(oldIndex[i]).cells(c).innerHTML;
        }
      }
  //MOVE NEW ROWS TO TOP OF TABLE ....
  for (i=1; i<totalRows; i++)
    {
      tableToSort.moveRow((tableToSort.rows.length -1),1);
    }
  //DELETE THE OLD ROWS FROM THE BOTTOM OF THE TABLE ....
  for (i=1; i<totalRows; i++)
    {
      tableToSort.deleteRow();
    }
   window.status="";
  }
function guestbook()
{
window.open("../guestbook.asp",'joke',"height=350,width=450,top=100,left=125,status=YES,scrollbars=1,toolbar=no,menubar=no,location=no");
}
function feedback()
{
window.open("../feedback.asp",'joke',"height=220,width=310,top=100,left=150,status=YES,scrollbars=1,toolbar=no,menubar=no,location=no");
}
function isEmail(str) {
  // are regular expressions supported?
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) 
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(str) && r2.test(str));
}
function login1()
{
if (document.form1.email.value=="")
	{
	alert("Please enter your email address.");
	form1.email.focus();
	return false;
	}
if (! isEmail(document.form1.email.value))
	{
	alert("Invalid email !!");
	form1.email.focus();
	return false;
	}
if (document.form1.password1.value=="")
	{
	alert("Please enter your password.");
	form1.password1.focus();
	return false;
	}
return true;
}
function user1()
{
if (document.form3.P_name.value=="")
	{
	alert("Please enter your name.");
	form3.P_name.focus();
	return false;
	}
if (document.form3.email.value=="")
	{
	alert("Please enter your email.");
	form3.email.focus();
	return false;
	}
if (! isEmail(document.form3.email.value))
	{
	alert("Invalid email !!");
	form3.email.focus();
	return false;
	}
if (document.form3.password1.value=="")
	{
	alert("Please enter your password.");
	form3.password1.focus();
	return false;
	}
if (document.form3.password1.value!=document.form3.password2.value)
	{
	alert("Passwords entered do not match");
	form3.password1.focus();
	return false;
	}
if (document.form3.password1.value.length<5)
	{
	alert("Your password should be at least 5 characters long.");
	form3.password1.focus();
	return false;
	}
return true;
}
function show_forgot()
{
if (document.all["forgot"].style.display == "inline")
	{
	document.all["forgot"].style.display = "none";
	}
else
	{
	document.all["forgot"].style.display = "inline";
	}
}
function forget()
{
if (document.form2.email.value=="")
	{
	alert("Please enter your email.");
	form2.email.focus();
	return false;
	}
if (! isEmail(document.form2.email.value))
	{
	alert("Invalid email !!");
	form2.email.focus();
	return false;
	}
return true
}