function LmOver(elem, clr)
{elem.style.backgroundImage = "url('images/button_image_click.gif')";
elem.style.cursor = 'hand'}

function LmOut(elem, clr)
{elem.style.backgroundImage = "url('images/button_image.gif')";}

function LmDown(elem, clr)
{elem.style.backgroundImage = "url('images/button_image_click.gif')";}

function LmUp(path)
{doSubmit('index.asp','goto_Login');}

function sLmOver(elem, clr)
{elem.style.backgroundImage = "url('images/s_button_image_click.gif')";
elem.style.cursor = 'hand'}

function sLmOut(elem, clr)
{elem.style.backgroundImage = "url('images/s_button_image.gif')";}

function sLmDown(elem, clr)
{elem.style.backgroundImage = "url('images/s_button_image_click.gif')";}

function sLmUp(path)
{doSubmit('index.asp','goto_Login');}

function vsLmOver(elem, clr)
{elem.style.backgroundImage = "url('images/vs_button_image_click.gif')"; 
elem.style.cursor = 'hand'}

function vsLmOut(elem, clr)
{elem.style.backgroundImage = "url('images/vs_button_image.gif')";}

function vsLmDown(elem, clr)
{elem.style.backgroundImage = "url('images/vs_button_image_click.gif')";}

function vsLmUp(path)
{doSubmit('index.asp','goto_Login');}

function openHelpWindow(theURL,winName,features)
	{
	window.open(theURL,winName,features);
	}
function posHelp(e,strHTML)
{
if (e != '') 
	{
	helpContent.innerHTML=strHTML;
	helpContent.style.left=e.clientX;
	helpContent.style.top=e.clientY;
	helpContent.style.visibility='visible';
	}
}
function hideHelp()
{
	helpContent.innerHTML="";
	helpContent.style.left=0;
	helpContent.style.top=0;
	helpContent.style.visibility='hidden';			
}
function doSubmit(strLocation,strNextAction)
{
document.form1.txtAction.value=strNextAction
document.form1.action=strLocation;
document.form1.submit();
}
//********************************************************************************
//Purpose  : Checks and restricts length of a text area
//********************************************************************************/
//use -  return onkeyup="checkLength(this, 10);" on text area. This restricts to
//length of 10 chars

function checkLength(oTextBox,iLength)
{
var intMaxChar = iLength;
var strText = oTextBox.value;

if(strText.length>intMaxChar)
	{
	alert('You have exceeded the maximum allowed ' + intMaxChar + ' characters');
	oTextBox.value = strText.substring(0,intMaxChar);
	}
}

//Validation
function checkfornull(oField)
{
if (oField.value!='')
	{return false;}
else
	{return true;}
}

function getRadioValue (radioButtonOrGroup) 
{
  var value = null;
  if (radioButtonOrGroup.length) 
  { // group 
    for (var b = 0; b < radioButtonOrGroup.length; b++)
      if (radioButtonOrGroup[b].checked)
        value = radioButtonOrGroup[b].value;
        
  }
  else if (radioButtonOrGroup.checked)
    value = radioButtonOrGroup.value;
  return value;
}

function isCheckChecked(oField)
{
for(var i=0;i<oField.length;i++)
	{
	if (oField[i].checked==true)
		{return true;}
	}
}

/********************************************************************************
Function : Trim
Purpose  : Remove leading and trailing spaces from a string
********************************************************************************/
function Trim(strValue){
	return LTrim(RTrim(strValue));
}

/********************************************************************************
Purpose  : Remove leading spaces from a string
********************************************************************************/
function LTrim(strValue){
	var rgExp = /^  */;
	return strValue.replace(rgExp, "");
}

/********************************************************************************
Purpose  : Remove trailing spaces from a string
********************************************************************************/
function RTrim(strValue){
	var rgExp = /  *$/;
	return strValue.replace(rgExp, "");
}

/********************************************************************************
Purpose  : UK Date Validation
********************************************************************************/
function y2k(number) { return (number < 1000) ? number + 1900 : number; }

var reason = '';

function isValidDate (myDate,sep) {
// checks if date passed is in valid dd/mm/yyyy format

    if (myDate.length == 10) {
        if (myDate.substring(2,3) == sep && myDate.substring(5,6) == sep) {
            var date  = myDate.substring(0,2);
            var month = myDate.substring(3,5);
            var year  = myDate.substring(6,10);

            var test = new Date(year,month-1,date);
            var now = new Date();
            if(test<now) {
				return false;
				}

            if (year == y2k(test.getYear()) && (month-1 == test.getMonth()) && (date == test.getDate())) {
                reason = '';
                return true;
            }
            else {
                reason = 'valid format but an invalid date';
                return false;
            }
        }
        else {
            reason = 'invalid spearators';
            return false;
        }
    }
    else {
        reason = 'invalid length';
        return false;
    }
}




