<!--

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
//*****************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 nothing"); 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)
{
with (thisform)
{
if (Password.value!=null && Password.value!="")
{
	if (passwordvalidation(Password,thisform.PasswordConfirm,"Sorry, Passwords must match")==false) {thisform.Password.focus(); return false;};
	if (emailvalidation(EMail,"Invalid E-mail address")==false) {EMail.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;};
//if (emptyvalidation(Whatever,"The textfield is empty")==false) {Whatever.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 clickButton(e, buttonid){ 
      var bt = document.getElementById(buttonid); 
      if (typeof bt == 'object'){ 
            if(navigator.appName.indexOf("Netscape")>(-1)){ 
                  if (e.keyCode == 13){ 
                        bt.click(); 
                        return false; 
                  } 
            } 
            if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)){ 
                  if (event.keyCode == 13){ 
                        bt.click(); 
                        return false; 
                  } 
            } 
      } 
}


function checkUncheckAll(newvalue,field)
{
	if (newvalue==true)
	{
		if(field.length == undefined) {
			field.checked = true ;
		}
		else {
			// SelectItems.chkGroupSelect.value='on';
			for (i = 0; i < field.length; i++)
				field[i].checked = true ;
		}			
	}
	else
	{
		if(field.length == undefined) {
			field.checked = false ;
		}
		else {
			// SelectItems.chkGroupSelect.value='off';
			for (i = 0; i < field.length; i++)
				field[i].checked = false ;
		}
	}
}


function checkIsNumeric(evt, blnDecimalAllowed)
{
	var charCode = (evt.which) ? evt.which : event.keyCode
	
	if (blnDecimalAllowed == true && charCode == 46)
		{
		return true;
		}
	else if (charCode > 31 && (charCode < 48 || charCode > 57))
		{
		return false;
		}
	else
		{
		return true;
		}
}


function checkIsAlphaNumeric(evt)
{
	var charCode = (evt.which) ? evt.which : event.keyCode
	//alert(charCode);
	//		CHECKING "0" to "9"						CHECKING "A" to "Z"							CHECKING "a" to "z"
	if ((charCode < 48 || charCode > 57) && (charCode < 65 || charCode > 90) && (charCode < 97 || charCode > 122))
		{
		return false;
		}
	
	return true;
} 


function checkIsValidHexColor(evt)
{
	var charCode = (evt.which) ? evt.which : event.keyCode
	//alert(charCode);
	//		CHECKING "0" to "9"						CHECKING "A" to "F"							CHECKING "a" to "f"
	if ((charCode < 48 || charCode > 57) && (charCode < 65 || charCode > 70) && (charCode < 97 || charCode > 102))
		{
		return false;
		}
	
	return true;
} 
