array_color_length=2;
	colors_= new Array(array_color_length);
	colors_[0] = "red";
	colors_[1] = "white";
	var next_ = 0;
	
	function changeLinkColor()
	{
		document.getElementById("inbox_link").style.color = colors_[next_];
			
		next_++;
		if(next_>array_color_length-1) next_=0;
		window.setTimeout("changeLinkColor()",300);
	}

 var ptn_empty=/^\s*$/;
 var ptn_positiv_digit=/^\s*(\d+)\s*$/;

 function check_empty(field, name)
 {
    if (!field.value || ptn_empty.test(field.value))
    {
        error = "The field '"+name+"' is empty. Fill it, please.";
        alert(error); field.focus(); field.select();
        return false;
    }
    return true;
 }

 function check(field, pattern, name)
 {
    if (field.value && pattern.test(field.value) == false)
    {
        error = "The field '"+name+"' is incorrect. Change it, please.";
        alert(error); field.focus(); field.select();
        return false;
    }
    return true;
 }

 function check_login()
 {
    res = check_empty(data_login.login, 'Login') && check_empty(data_login.pass, 'Password');
    return res;
 }

 function check_qsearch()
 {
    res = check_empty(data_search.from, 'FROM')
	&& check_empty(data_search.to, 'TO')
	&& check(data_search.from, ptn_positiv_digit, 'FROM')
	&& check(data_search.to, ptn_positiv_digit, 'TO');
    return res;
 }
 