function StrToInt(s) {
	nRet=0;
	nSep=-1;
	s=s.replace(" ", "");
	for(i=0;i<s.length;i++){
		ch=s.charAt(i);
		if (i==0&&ch=="-") continue;
		if (ch=='.'||ch==','){
			if (nSep<0) nSep=0;
			else return null;
			continue;
		}
		if (ch>='0'&&ch<='9') {
			nRet=nRet*10+(s.charCodeAt(i) - 48);
			if (nSep>=0) nSep++;
		} else return null;
	}
	for(;nSep>0;nSep--) nRet/=10;
	if (s.charAt(0)=='-') nRet=-nRet;
	return nRet;                     
}

function BadEmailMsg(s){
	return '"'+s+'"'+ " не похоже на адрес электронной почты.";
}

function isEmail(s) {
	i=s.indexOf('@',1);
	if (i >= 0) {
		i=s.indexOf('.', i + 2);
		return (i >=0) && (s.length - i > 2);
	} else return false;
}

function isEmpty(ctl) {
    if (ctl!=null){
    	s = ctl.value;
		s=s.replace(" ", "");
		return (s == "");
    }
    else
		return true;
}

function ValidateForm(sMsg, ctl) {
	if (ctl!=null) ctl.focus();
	if (sMsg!="")	 {
		alert(sMsg);
		return false;
	}
	return true;
}