function toFloat(numb)
{
  numb1 = String(numb);
 if(LCID!=1033)
 {
	 numb1 = numb1.replace('.','');
	 numb1 = numb1.replace(',','.');	 
 }
 else
 	numb1 = numb1.replace(',','');
 	return Number(numb1);
}

function toCurrency(numb)
{
 if(LCID!=1033)
 {
	 var numb2 = String(numb);
	 var numb1 ='';
	 for(i=0; i < numb2.length; i++)
	 {
	  if (numb2.charAt(i) == '.') 
	     { numb1 += ',';}
	  
	  else 
	     {numb1 += numb2.charAt(i);}
	  
	 }
	 return numb1;
 }
 else
 	return numb;
}

function isInt(numstr)
{
	var isValid = true;
	if (numstr+'' == "undefined" || numstr+'' == "null" || numstr+'' == '')	
		return false;
	numstr += '';	
	for (i = 0; i < numstr.length; i++)
		{
    		if (!((numstr.charAt(i) >= "0") && (numstr.charAt(i) <= "9")))
			{
       			isValid = false;
       			break;
			}
      	}
   	return isValid;
}

function isDate(dateStr)
{
var datePat = /^(\d{1,2})(.)(\d{1,2})\2(\d{4})$/; // dots as delimiters

var matchArray = dateStr.match(datePat); // is the format ok?
if (matchArray == null)
	{
	alert('Datum ist nicht in einem gültigen Format.')
	return false;
	}
day = matchArray[1]; // parse date into variables
month= matchArray[3];
year = matchArray[4];
if (month < 1 || month > 12) // check month range
	{ 
	alert('Monat muß zwischen 1 und 12 sein.');
	return false;
	}
if (day < 1 || day > 31)
	{
	alert('Tag muß zwischen 1 und 31 sein.');
	return false;
	}
if ((month==4 || month==6 || month==9 || month==11) && day==31)
	{
	alert('Monat '+month+' hat nicht 31 Tage.')
	return false
	}
if (month == 2) // check for february 29th
	{
		var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
		if (day>29 || (day==29 && !isleap))
		{
			alert('Februar ' + year + ' hat nicht ' + day + ' Tage.');
		return false;
	   }
	}
return true;  // date is valid
}

function isEmail(emailAdress)
{
      i   = emailAdress.indexOf('@');
      j   = emailAdress.indexOf('.',i);
      k   = emailAdress.indexOf(',');
      kk  = emailAdress.indexOf(' ');
      jj  = emailAdress.lastIndexOf('.')+1;
      len = emailAdress.length;
      if ((i>0) && (j>(i+1)) && (k==-1) && (kk==-1) && (len-jj >=2) && (len-jj<=5)) return true
      else return false;
}

function isFloat(numb)
{
 
	 if(LCID!=1033)
	 	{
	  	numb2 = numb.replace('.','');
	  	numb2 = Number(numb2.replace(',','.'));
		}
	 else
	  numb2 = Number(numb.replace(',',''));
	 
	 return !isNaN(parseFloat(numb2));
}

function checkDateSelectBox(theForm, postfix)
 {
  var tyear  = eval('theForm.Year_' + postfix);
  var tmonth = eval('theForm.Month_' + postfix);
  var tday   = eval('theForm.Day_' + postfix);
  XDate = new Date(tyear.options[tyear.selectedIndex].value, 
  				   tmonth.options[tmonth.selectedIndex].value-1, 
				   tday.options[tday.selectedIndex].value);
  if(XDate.getDate()!= tday.options[tday.selectedIndex].value)
	 {
	  alert('Ungültiges Datum!!!'); 
	  return false;
	  }
   return true;
 }
 
function compareDateSelectBox(theForm, postfix1, postfix2)
 {
	var year1 	= eval('theForm.Year_' + postfix1);
	var year2 	= eval('theForm.Year_' + postfix2);
	var month1 	= eval('theForm.Month_' + postfix1);
	var month2 	= eval('theForm.Month_' + postfix2);
	var day1 	= eval('theForm.Day_' + postfix1);
	var day2 	= eval('theForm.Day_' + postfix2);
	if (Number(year1.options[year1.selectedIndex].value) < Number(year2.options[year2.selectedIndex].value)) return true;
	if (Number(year1.options[year1.selectedIndex].value) > Number(year2.options[year2.selectedIndex].value))
		{
		alert("Anfangsdatum ist grösser als Enddatum !!!");
		return false;
		}
	if (Number(month1.options[month1.selectedIndex].value) < Number(month2.options[month2.selectedIndex].value)) return true;		
	if (Number(month1.options[month1.selectedIndex].value) > Number(month2.options[month2.selectedIndex].value))
		{
		alert("Anfangsdatum ist grösser als Enddatum !!!");
		return false;
		}
	if (Number(day1.options[day1.selectedIndex].value) <= Number(day2.options[day2.selectedIndex].value)) 
		return true
	else
		{
		alert("Anfangsdatum ist grösser als Enddatum !!!");
		return false;
		}
 }