function textareaCurLineNum(obj)
{
 var rowHeight = obj.clientHeight/obj.rows;
 var curHeight = obj.createTextRange().boundingHeight;

 return parseInt(curHeight/rowHeight)+(obj.value!=''?1:0);
}


function gen_nh_zakaz_price(){
	 count_ankor=document.getElementById("zapros");
	 rowHeight = count_ankor.clientHeight/count_ankor.rows;
 	 curHeight = count_ankor.createTextRange().boundingHeight;

 	 count_ankor= parseInt(curHeight/rowHeight)+(count_ankor.value!=''?1:0);
 
	 count_comment = document.getElementById("count_comment").value;
	 comment_price = document.getElementById("comment_price").value;
	 only_tic = document.getElementById("only_tic").value;
	 
	 tarif = document.getElementById("tarif").value;
	 tic_proc=30;
	 
	 //comment_price=5;
	 
	 if(tarif == '0') tarif_coef=1;
	 if(tarif == '1') tarif_coef=0.333;
	 if(tarif == '2') tarif_coef=0.666;
	 if(tarif == '3') tarif_coef=1.333;
	 if(tarif == '4') tarif_coef=0.5;
	  
         zakaz_price=(count_comment*3*count_ankor).toFixed(0);
         if(only_tic == '1') zakaz_price=parseInt(zakaz_price)+parseInt((zakaz_price/100*tic_proc).toFixed(0));
  
	 document.getElementById("zakaz_price").value=zakaz_price;
}





function gen_zakaz_price(){
	 count_comment = document.getElementById("count_comment").value;
	 comment_price = document.getElementById("comment_price").value;
	 only_tic = document.getElementById("only_tic").value;
	 
	 tarif = document.getElementById("tarif").value;
	 tic_proc=30;
	 
	 //comment_price=5;
	 
	 if(tarif == '0') tarif_coef=1;
	 if(tarif == '1') tarif_coef=0.333;
	 if(tarif == '2') tarif_coef=0.666;
	 if(tarif == '3') tarif_coef=1.333;
	 if(tarif == '4') tarif_coef=0.5;
	  
         zakaz_price=(count_comment*comment_price*tarif_coef).toFixed(0);
         if(only_tic == '1') zakaz_price=parseInt(zakaz_price)+parseInt((zakaz_price/100*tic_proc).toFixed(0));
  
	 document.getElementById("zakaz_price").value=zakaz_price;
}



function gen_article_price(){
	 count_article = document.getElementById("count_article").value;
	 u_article_price = document.getElementById("u_article_price").value;
	  
	 document.getElementById("article_price").value=(count_article*u_article_price).toFixed(0);
}




function enterSearch(){
	/*		
	var str = String("/vacancy/search");
	//str = str + String(search_form.select.value) ;
	res = document.getElementById("search_type");
	//alert(search_form.select.value);	exit;
	search_form.action = "/"+ String(res) +"/search";
	alert(search_form.action);
	
	*/
	
	var str = String("/vacancy/search");
	//str = str + String(form1.select.value) ;
	res = document.getElementById("search_type");
	//alert(res.value);
	//exit;
	//alert(document.getElementById("search_form_id").action);
	document.getElementById("search_form_id").action= "/"+ String(res.value) +"/search";
	//alert(document.getElementById("search_form_id").action);

	
}
		
		function go(v){
  if(v == 0){
    alert("Выберите рубрику второго уровня");
  }

}
 dom = (document.getElementById)? true : false;
  isOpera = (window.opera)? true : false;
isOpera7 = (isOpera && document.readyState)? true : false;
  function  showLogin(islogin) {
	if( isOpera &&  !isOpera7 ) {
		return true;
	} else if (dom) {
		document.getElementById('login-form').style.display = "block";
                if(islogin){
		    document.forms['login'].passwd.focus();
                }
                else{
		    document.forms['login'].login.focus();
                }
		return false;
	}
	return true;
}

function hideLogin() {
	document.getElementById('login-form').style.display = "none";
	return false;
}

  function  showReg(islogin) {
	if( isOpera &&  !isOpera7 ) {
		return true;
	} else if (dom) {
		document.getElementById('reg-form').style.display = "block";
		return false;
	}
	return true;
}

function hideReg() {
	document.getElementById('reg-form').style.display = "none";
	return false;
}
