var old_str = '';
function ajax_search()
{
	if (window.timeout) {
		clearTimeout(timeout);
	}
	object = { 
			func: function() {
			poiskObj = document.getElementById('poisk');
			if(old_str!=poiskObj.value) {
				old_str = poiskObj.value;
				jsAjaxUtil.InsertDataToNode('/include/res_search.php?q='+encodeURI(poiskObj.value), 'resSearch', true);
				$(document).bind('mousedown', checkMouse);
			}
		}
	}
	timeout = setTimeout( function() {object.func.call(this) } , 500); 
}
 
function hide_results()
 {
	document.getElementById('resSearch').style.display='none';

 }   
 
 
function show_results()
 {
	document.getElementById('resSearch').style.display='block'; 
 }
 
 
 
var login_complite = false;
var pass_complite =  false;
 
 
function check_login(login)
 {
	if(login.length>=3) {
		login_complite = true;
		document.getElementById('login_text').style.color='#000000';
	}
	else
	 {
 		login_complite = false;
		document.getElementById('login_text').style.color='#FF0000';	
	 }
	 active_reg_button();
 }
 
function check_pass(password)
 {
	if(password.length>=6) {
		pass_complite = true;	
		document.getElementById('pass_text').style.color='#000000';			
	}
	else {
		pass_complite = false;
		document.getElementById('pass_text').style.color='#FF0000';			
	}
	active_reg_button();
 }
 
 
function active_reg_button()
 {

	if(login_complite && pass_complite)
	 document.getElementById('reg_submit').disabled = false;
	//else 	 document.getElementById('reg_submit').disabled = true;

 }
 
 
 
 function check_star(star_id)
  {	
  //alert(star_id);
		for(i=1; i<=5; i++) 
		 {
			document.getElementById('star'+i).className='staroff';
		 }  
		for(i=1; i<=star_id; i++) 
		 {
			document.getElementById('star'+i).className='staron';
		 }
		 
		 document.getElementById('star_value').value=star_id;
		 return false;
  
  }
  
  
  
 function show_reg() 
	{
		var a = document.getElementById('dop_reg_table');
		if(a.style.display=='none')
		 a.style.display='block';
		else a.style.display='none';
		return false;

	} 
