function IsNum(val)
{
   if ( (val == "") || (parseInt(val, 10) != val) )
   {
      return false;
   }
   else
   {
      return true;
   }
}

function IsEmpty(val)
{
   if (val == "")
   {
      return true;
   }
   else
   {
      return false;
   }
}

function IsDate(yy, mm, dd)
{
   var result = true;

   if ( (dd == "") || (parseInt(dd, 10) != dd) || (parseInt(dd, 10) < 1) || (parseInt(dd, 10) > 31) )
   {
      result = false;
   }

   if ( (mm == "") || (parseInt(mm, 10) != mm) || (parseInt(mm, 10) < 1) || (parseInt(mm, 10) > 12) )
   {
      result = false;
   }

   if ( (yy == "") || (parseInt(yy, 10) != yy) || (parseInt(yy, 10) < 0) )
   {
      result = false;
   }
   
   var date = new Date((parseInt(yy, 10)),(parseInt(mm, 10)-1),parseInt(dd, 10));
   if ( (date.getDate() != parseInt(dd, 10)%100) ||
        (date.getMonth() != (parseInt(mm, 10)-1)) ||
        (date.getFullYear() != parseInt(yy, 10)) ||
		(date.getFullYear() >= 10000))
   {
      result = false;
   }

   return result;
}

function IsTime(hh, mm)
{
   if ( (hh == "") || (parseInt(hh, 10) != hh) || (parseInt(hh, 10) < 0) || (parseInt(hh, 10) > 23) ||
        (mm == "") || (parseInt(mm, 10) != mm) || (parseInt(mm, 10) < 0) || (parseInt(mm, 10) > 59) )
   {
      return false;
   }
   else
   {
      return true;
   }
}

function selectedOptionValue(selectElement)
{
    //
    // this function returns the selected value of an option
    // box. Useful for netscape browser
    // the input parameter is the option element
    //
	return selectElement.options[selectElement.selectedIndex].value;
}

function isExpired(ef_y, ef_m, ef_d, exp_y, exp_m, exp_d)
{	
	var ef_date = new Date((parseInt(ef_y, 10)),(parseInt(ef_m, 10)-1),parseInt(ef_d, 10));
	var exp_date = new Date((parseInt(exp_y, 10)),(parseInt(exp_m, 10)-1),parseInt(exp_d, 10));	

	if (ef_date.getTime() >= exp_date.getTime())
		return true;
	else
		return false;
}

function isPositiveNum(num)
{
	if (parseInt(num, 10) != num)
		return false;
	else if (num < 0)
		return false;
	
	return true;
}

function isPositiveFloatNum(num)
{
	if (parseFloat(num, 10) != num)
		return false;
	else if (num < 0)
		return false;
	
	return true;
}

