<!--
function trim(str) {
	return str.replace(/^\s*/,'').replace(/\s*$/,'');
}


// Функция установки значения cookie.
function setCookie(name, value, path, expires, domain, secure) {
        var curCookie = name + "=" + escape(value) +
                ((expires) ? "; expires=" + expires.toGMTString() : "") +
                ((path) ? "; path=" + path : "; path=/") +
                ((domain) ? "; domain=" + domain : "") +
                ((secure) ? "; secure" : "");
        document.cookie = curCookie;
}

// Функция чтения значения cookie.
function getCookie(name) {
        var prefix = name + "=";
        var cookieStartIndex = document.cookie.indexOf(prefix);
        if(cookieStartIndex == -1) return null;
        var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length);
        if(cookieEndIndex == -1) cookieEndIndex = document.cookie.length;
        return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

// Функция удаления значения cookie
function delCookie(name, path, domain) {
        if(getCookie(name)) {
                document.cookie = name + "=" + 
                ((path) ? "; path=" + path : "; path=/") +
                ((domain) ? "; domain=" + domain : "") +
                "; expires=Thu, 01-Jan-70 00:00:01 GMT";
        }
}

// Устанавливает Cookie сложной структуры.
function setCookieEx(name, value, path, expires, domain, secure)
{
  value=Serialize(value);
alert(value);
  return setCookie(name, value, path, expires, domain, secure);
}

// Читает Cookie сложной структуры.
function getCookieEx(name)
{
  var v=getCookie(name);
  return Unserialize(v);
}

// -->

//проверка валидности даты (c) anidim
function isValidDate(year, month, day)
{
//	var dt = new Date(y, m-1, d);
//	return ((y == dt.getYear()) && ((m-1) == dt.getMonth()) && (d == dt.getDate()));

	var result = false;
	mydate = new Date( year, month, day );
	if((day==mydate.getDate())&&(month==mydate.getMonth())&&(year==mydate.getFullYear())&&(year>1753))
		 result = true;
		 
	//check for past date
	if (result)
	{
		var curdate = new Date(Date.getFullYear(), Date.getMonth(), Date.getDate());
		if (curdate > mydate) 
			result = false;
	}
		 
	return result;	
}