
<!--

var ilayer = 0 ;

var gotlayers = 0;

var ClickButton=0;

var Hits=0;

NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1 : 0;

if (NS) {
	gotlayers = 1;
}
if (IE) {
	gotlayers = 1;
}

function popUp(on)
{
   var lLay ;
   
   if (IE) {
      lLay = document.all['popCal'] ;
   } else {
      lLay = document.layers['FormLayer'].document.layers['popCal'] ;
   }
	
   if (gotlayers) {
	if (on) {
		moveLayers() ;
		if (IE) {
			lLay.style.visibility = "visible";
		} else {
			lLay.visibility = "show";
		}
	} else {
		if (IE) {
			lLay.style.visibility = "hidden";
		} else {
			lLay.visibility = "hide";
		}
	}
   }
}

function SeeDate(i)
{
  var thedoc ;

  if (NS) 
	thedoc = document.layers['FormLayer'].document.SetStatus;
  else
  	thedoc = document.SetStatus ;
  
  
  if (ilayer == 1) 
  	thedoc.Returning.value = i;
  
  if (ilayer == 2) 
  	thedoc.Returning.value = i;
  
  HideDate();
  
  return;
}


function ShowDate(i)
{
  if (ilayer > 0) {
	  HideDate() ;
  }
  ClickButton=1;
  ilayer = i ;

  popUp(true);

  return;
}


function moveLayers()
{
   var lLay, x, y  ;

   x = 300 ;
   y = 200;
   if (IE) {
      lLay = document.all['popCal'] ;
   } else {
      lLay = document.layers['FormLayer'].document.layers['popCal'] ;
   }

   if (gotlayers) {
	if (NS) {
		lLay.left = x;
		lLay.top = y;
	} else {
		lLay.style.pixelLeft = x;
		lLay.style.pixelTop = y;
	}
   }
}

function HideDate()
{
  popUp(false) ;

  return;
}


//*****************Validation Information

function emailvalidation(entered, alertbox)
{
// E-mail-Validation 
//alert(entered.value);
apos=entered.value.indexOf("@");
dotpos=entered.value.lastIndexOf(".");
lastpos=entered.value.length-1;
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
{if (alertbox) {alert(alertbox); entered.focus();} return false;}
else {return true;}
}

function passwordvalidation(entered, second, alertbox)
{
if (entered.value==null || entered.value=="")
	{alert("Password cannot be blank"); return false;}
else 
	{if (entered.value == second.value) {return true;}
	else {entered.focus(); alert(alertbox); return false;}
	}
}

function valuevalidation(entered, min, max, alertbox, datatype)
{
// Value-Validation
with (entered)
{
checkvalue=parseFloat(value);
if (datatype)
  {smalldatatype=datatype.toLowerCase();
   if (smalldatatype.charAt(0)=="i") {checkvalue=parseInt(value)};
  }
if ((parseFloat(min)==min && checkvalue<min) || (parseFloat(max)==max && checkvalue>max) || value!=checkvalue)
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}

function digitvalidation(entered, min, max, alertbox, datatype)
{
// Digit-Validation
with (entered)
{
checkvalue=parseFloat(value);
if (datatype)
  {smalldatatype=datatype.toLowerCase();
   if (smalldatatype.charAt(0)=="i") {checkvalue=parseInt(value); if (value.indexOf(".")!=-1) {checkvalue=checkvalue+1}};
  }
if ((parseFloat(min)==min && value.length<min) || (parseFloat(max)==max && value.length>max) || value!=checkvalue)
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}

function emptyvalidation(entered, alertbox)
{
// Emptyfield-Validation
with (entered)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}

function formvalidation(thisform, skippassword)
{
with (thisform)
{
	if (emptyvalidation(EMail,"The EMail Address cannot be blank")==false) {EMail.focus(); return false;};
	if (emptyvalidation(FirstName,"The First Name cannot be blank")==false) {FirstName.focus(); return false;};
	if (emptyvalidation(LastName,"The Last Name cannot be blank")==false) {LastName.focus(); return false;};
	if (emailvalidation(EMail,"Must enter a valid E-mail address")==false) {EMail.focus(); return false;};
	if (skippassword!=true)
	{
	if (emptyvalidation(UserName,"The UserName cannot be blank")==false) {UserName.focus(); return false;};
	if (emptyvalidation(Password,"The password cannot be blank")==false) {Password.focus(); return false;};
	if (passwordvalidation(Password,thisform.PasswordConfirm,"Sorry, Passwords must match")==false) {Password.focus(); return false;};
	}
//if (valuevalidation(Value,0,5,"Value MUST be in the range 0-5")==false) {Value.focus(); return false;};
//if (digitvalidation(Digits,3,4,"You MUST enter 3 or 4 integer digits","I")==false) {Digits.focus(); return false;};
}
}
// -->

function urlencode(strText) 
	{
    var isObj;
	var trimReg;
	
    if( typeof(strText) == "string" )
		{
		if( strText != null )
			{
			trimReg = /(^\s+)|(\s+$)/g;
			strText = strText.replace( trimReg, '');
			
			for(i=32;i<256;i++) 
				{
				strText = strText.replace(String.fromCharCode(i),escape(String.fromCharCode(i)));
                }
			}
		}
		return strText;
	}

function trimAll(strValue) 
	{
	while (strValue.substring(0,1) == ' ')
		{
		strValue = strValue.substring(1, strValue.length);
		}
	while (strValue.substring(strValue.length-1, strValue.length) == ' ')
		{
		strValue = strValue.substring(0,strValue.length-1);
		}
	return strValue;
	}
