Function.prototype._extends=function(superClass)
{var Inheritance=function(){};Inheritance.prototype=superClass.prototype;this.prototype=new Inheritance();this.prototype.constructor=this;this.superClass=superClass;}
var rate_index=0;var rates=new Array();var script_url='/ajax.php';var miracle_request_sent=false;var needed_widget_ajax_params=new Object();needed_widget_ajax_params[0]="user_rate";needed_widget_ajax_params[1]="user_id";needed_widget_ajax_params[2]="object_id";needed_widget_ajax_params[3]="object_type_id";needed_widget_ajax_params[4]="user_rate_anonymous";needed_widget_ajax_params[5]="consumed_date";needed_widget_ajax_params[6]="user_not_interests";needed_widget_ajax_params[7]="user_interests";needed_widget_ajax_params[8]="user_rate";needed_widget_ajax_params[9]="user_old_rate";needed_widget_ajax_params[10]="user_rate_expected";needed_widget_ajax_params[11]="code";needed_widget_ajax_params[12]="content_id";needed_widget_ajax_params[13]="user_important";needed_widget_ajax_params[14]="flush_cookie";needed_widget_ajax_params[15]="user_id_other";needed_widget_ajax_params[16]="calc_express_recommends";needed_widget_ajax_params[17]="recommend_min_rates_amount";needed_widget_ajax_params[18]="object_to_calc_recommends";needed_widget_ajax_params[19]="func";needed_widget_ajax_params[20]="action";needed_widget_ajax_params[21]="rate_index";needed_widget_ajax_params[22]="spawner_rate_index";needed_widget_ajax_params[23]="object_owner_id";needed_widget_ajax_params[24]="year";needed_widget_ajax_params[25]="enable_nominations";needed_widget_ajax_params[26]="is_recommend_page";var StandartTemplate=function(rate_index)
{this.loaded_params=new Array();this.new_params=new Array();this.drawed=false;this.show_user_rate_digits=false;var drawed_stars=new Array();drawed_stars[0]=false;this.drawed_stars=drawed_stars;var rate_remove_drawed=new Array();rate_remove_drawed[0]=false;this.rate_remove_drawed=rate_remove_drawed;this.structure=new Array()
this.drawed_elements=new Array();var rate_names=new Array();this.total_marks=10;rate_names[0]='Сбросить оценку';rate_names[1]='хуже не бывает';rate_names[2]='очень плохо';rate_names[3]='плохо';rate_names[4]='ниже среднего';rate_names[5]='средне';rate_names[6]='выше среднего';rate_names[7]='нормально';rate_names[8]='хорошо';rate_names[9]='отлично';rate_names[10]='лучше не бывает';var months_nominative=new Array();var months_genitive=new Array();var months_locative=new Array();months_nominative['01']='январь';months_nominative['02']='февраль';months_nominative['03']='март';months_nominative['04']='апрель';months_nominative['05']='май';months_nominative['06']='июнь';months_nominative['07']='июль';months_nominative['08']='август';months_nominative['09']='сентябрь';months_nominative['10']='октябрь';months_nominative['11']='ноябрь';months_nominative['12']='декабрь';months_genitive['01']='январе';months_genitive['02']='феврале';months_genitive['03']='марте';months_genitive['04']='апреле';months_genitive['05']='мае';months_genitive['06']='июне';months_genitive['07']='июле';months_genitive['08']='августе';months_genitive['09']='сентябре';months_genitive['10']='октябре';months_genitive['11']='ноябре';months_genitive['12']='декабре';months_locative['00']='-';months_locative['01']='января';months_locative['02']='февраля';months_locative['03']='марта';months_locative['04']='апреля';months_locative['05']='мая';months_locative['06']='июня';months_locative['07']='июля';months_locative['08']='августа';months_locative['09']='сентября';months_locative['10']='октября';months_locative['11']='ноября';months_locative['12']='декабря';this.months_nominative=months_nominative;this.months_genitive=months_genitive;this.months_locative=months_locative;this.rate_names=rate_names;this.opinion_written=false;this.rate_block_id='rate_block_'+rate_index;this.user_rate_rate_id='user_rate_rate_'+rate_index;this.user_rate_interstenig_id='user_rate_interstenig_id_'+rate_index;this.user_rate_stars_id='user_rate_stars_'+rate_index;this.rate_remove_id='rate_remove_'+rate_index;this.main_rate_stars_block='main_rate_stars_block_'+rate_index;this.user_rate_expected_block='user_rate_expected_block_'+rate_index;this.user_rate_expected_id='user_rate_expected_'+rate_index;this.user_refferents_amount_id='user_refferents_amount_'+rate_index;this.rate_average_block_id='rate_average_block_'+rate_index;this.rate_average_id='rate_average_'+rate_index;this.rates_amount_id='rates_amount_'+rate_index;this.rate_get_exact_id='rate_get_exact_'+rate_index;this.user_recommend_id='user_recommend_'+rate_index;this.consumed_year_id='consumed_year_'+rate_index;this.links_block_id='links_block_'+rate_index;this.loaded_image_id='loaded_image_'+rate_index;this.consumed_date_id='consumed_date_'+rate_index;this.consumed_calendar_id='consumed_calendar_'+rate_index;this.guess_author_id='guess_author_'+rate_index;this.user_interesting_id='user_interesting_'+rate_index;this.user_not_interesting_id='user_not_interesting_'+rate_index;this.user_important_id='user_important_'+rate_index;this.user_multirate_id='user_multirate_'+rate_index;this.user_rate_anonymous_id='user_rate_anonymous_'+rate_index;this.user_action_date_id='user_action_date_'+rate_index;this.interesting_count_id='interesting_count_id_'+rate_index;this.user_rate_expected_block_stars="user_rate_expected_block_stars_"+rate_index;this.rate_other_block_stars='rate_other_block_stars_'+rate_index;this.user_rate_block_id="user_rate_block_"+rate_index;this.user_rate_digits_id="user_rate_digits_"+rate_index;this.rate_average_block_digits="rate_average_block_digits_"+rate_index;this.rate_change_id="rate_change_"+rate_index;this.expect_feedback_id="expect_feedback_"+rate_index;this.read_date_other_id="read_date_other_"+rate_index;this.rate_other_value_id="rate_other_value_"+rate_index;this.alias_other_id='alias_other_id_'+rate_index;this.distinct_other_id='distinct_other_id_'+rate_index;this.opinion_block_id='opinion_block_'+rate_index;this.passion_id="passion_"+rate_index;this.funny_id="funny_"+rate_index;this.rate_layer_id="rate_layer_"+rate_index;this.interest_layer_id="interest_layer_"+rate_index;this.interest_options_id="interest_options_"+rate_index;this.img_date_remove_id="img_date_remove_"+rate_index;this.img_multirate_close_id="img_multirate_close_"+rate_index;this.img_consumed_calendar_id="img_consumed_calendar_"+rate_index;this.rates_amount_none_id='rates_amount_none_id_'+rate_index;this.links_block_container_id="links_block_container_id_"+rate_index;this.tr_new_year_id="tr_new_year_"+rate_index;this.tr_average_block_id="tr_average_block_"+rate_index;this.tr_average_stars_id="tr_average_stars_"+rate_index;this.tr_expected_block_id="tr_expected_block"+rate_index;this.tr_expected_stars_id="tr_expected_stars_"+rate_index;this.rate_layer_stars_id="rate_layer_stars_"+rate_index;this.tr_user_rate_block_id="tr_user_rate_block_"+rate_index;this.tr_links_block_id="tr_links_block_"+rate_index;this.tr_opinion_block_id="tr_opinion_block_"+rate_index;this.tr_nominations_block_id="tr_nominations_block_"+rate_index;this.div_nominations_block_id="div_nominations_block_"+rate_index;this.user_refferents_amount_cross_id='user_refferents_amount_cross_id_'+rate_index;this.img_star_user=HOST_BASE+'img/wr_s_orfull.gif';this.img_star_none=HOST_BASE+'img/wr_s_gra.gif';this.img_star_user_hover=HOST_BASE+"img/star_user_hover_1.gif";this.img_rate_null=HOST_BASE+"img/rate_null.gif";this.img_progress_point=HOST_BASE+"img/progress_point.gif";this.img_wr_user_rate_expected_half=HOST_BASE+'img/wr_s_grehalf.gif';this.img_wr_user_rate_expected_full=HOST_BASE+'img/wr_s_grefull.gif';this.img_wr_other_rate_expected_full=HOST_BASE+'img/wr_s_redfull.gif';this.img_wr_null=HOST_BASE+'img/wr_s_gra.gif';this.img_wr_rate_average_half=HOST_BASE+'img/wr_s_ohalf.gif';this.img_wr_rate_average_full=HOST_BASE+'img/wr_s_ofull.gif';this.img_star_user_none=HOST_BASE+'img/wr_user_none.gif';this.img_star_user_nomination=HOST_BASE+'img/wr_s_orfull.gif';this.img_star_user_nomination_none=HOST_BASE+'img/wr_user_none.gif';this.img_rate_null_nomination=HOST_BASE+"img/rate_null.gif";this.img_multirate_close=HOST_BASE+"img/wr_remove_icon.png";this.img_date_remove=HOST_BASE+"img/wr_remove_icon.png";this.img_consumed_calendar=HOST_BASE+"img/rl_calendar.gif";this.img_user_interesting=HOST_BASE+"img/rl_btn_heart.gif";this.img_user_interesting_hover=HOST_BASE+"img/rl_btn_heart_hover.gif";this.img_user_interesting_a=HOST_BASE+"img/rl_btn_heart_a.gif";this.img_user_not_interesting=HOST_BASE+"img/rl_btn_cross.gif";this.img_user_not_interesting_hover=HOST_BASE+"img/rl_btn_cross_hover.gif";this.img_user_not_interesting_a=HOST_BASE+"img/rl_btn_cross_a.gif";this.img_il_buy=HOST_BASE+"img/ir_buy.gif";this.img_il_bazaar=HOST_BASE+"img/ir_bazaar.gif";this.img_il_cinema=HOST_BASE+"img/ir_cinema.gif";this.img_il_tv=HOST_BASE+"img/ir_tv.gif";}
StandartTemplate.prototype.reDrawStructure=function()
{if ( ((this.structure["user_rate"]<=0))&&!( this.drawed_elements['links_block']&2 ))
{$("div#"+this.links_block_id ).html('<div class="user_interesting" id="'+this.user_interesting_id+'"></div>');if (this.loaded_params['show_not_recommend_link']==1)
$("div#"+this.links_block_id ).append('<div class="user_interesting" id="'+this.user_not_interesting_id+'"></div>');if ( this.structure["user_interests"]==undefined )
this.drawControl("user_interests", this.loaded_params["user_interests"]);if ( this.structure["user_not_interests"]==undefined )
this.drawControl("user_not_interests", this.loaded_params["user_not_interests"]);this.drawed_elements['interestets_block']=1;this.drawed_elements['links_block']=2;}
else if ( this.structure["user_rate"]>0&&this.structure["user_rate"]!=undefined&&!( this.drawed_elements['links_block']&4 ) )
{if (this.rate.params['disable_block_opinion']){$("div#"+this.links_block_id ).html('<div  class="rgrey pb2" id="'+this.user_rate_anonymous_id+'"></div>');this.drawControl('user_rate_anonymous', 0);}else{var formatted_date=this.rate.getFormattedConsumeDate();var user_important=this.rate.params["user_important"];var statuses='<div style="display:none;" id="'+this.links_block_id+'_status_date">'+
this.dictonary["current_consumed_year"][2]+' '+formatted_date+'</div>'+'<div style="display:none;" id="'+this.links_block_id+'_status_important"><span class="ryellow">&laquo;Знаковое&raquo;</span></div>';$("#"+this.links_block_id ).html(statuses);if (formatted_date)
$("#"+this.links_block_id+"_status_date").show();if ( parseInt(user_important)>0 )
$("#"+this.links_block_id+"_status_important").show();}
this.drawed_elements['interestets_block']=0;this.drawed_elements['links_block']+=4;}
for ( var i in this.structure )
this.drawControl( i, this.structure[i]);}
StandartTemplate.prototype.hoverStars=function()
{img_star_hover=this.img_star_user_hover;if (this.rate.params['user_rate']==0)
$("#"+this.user_rate_stars_id+" > img.rate_image").each
(
function( index )
{this.src=img_star_hover;}
)}
StandartTemplate.prototype.rewriteStars=function( count, type, starId )
{img_star_none=this.img_star_user_none;img_star_user=this.img_star_user;rate_names=this.rate_names;var rate_null=this.img_rate_null;var add_class=isset(this.additional_star_class)?this.additional_star_class:'';var rateFunction='setRate';var extraId='';if (starId>0){rateFunction='setNominationRate';extraId='_'+starId;img_star_none=this.img_star_user_nomination_none;img_star_user=this.img_star_user_nomination;rate_null=this.img_rate_null_nomination;add_class='';}
$("#"+this.user_rate_stars_id+extraId+" > img.rate_image").each
(
function( index )
{if ( index<count&&this.src!=img_star_user)
this.src=img_star_user;else if ( index>=count&&this.src!=img_star_none)
this.src=img_star_none;}
)
if ( count>0&&!this.rate_remove_drawed[starId]&&type=='static')
{$("#"+this.rate_remove_id+extraId ).html('&nbsp;<img class="rate_image '+add_class+'" onclick="javascript:rates['+this.rate.rate_index+'].'+rateFunction+'(0, '+starId+')" title="сбросить оценку" src="'+rate_null+'" />');this.rate_remove_drawed[starId]=true;}
else if ( count==0&&type=='static')
{$("#"+this.rate_remove_id+extraId ).html('');$("#"+this.rate_change_id).hide();this.rate_remove_drawed[starId]=false;}
if (this.show_user_rate_digits&&!starId){if (count>0)
$("#"+this.user_rate_digits_id).html('<span class="red">'+count+'</span>').show();else
$("#"+this.user_rate_digits_id).hide();}}
StandartTemplate.prototype.requestInProgress=function()
{$("#"+this.loaded_image_id ).show();$("#"+this.rate_remove_id ).hide();}
StandartTemplate.prototype.requestCompleted=function()
{$("#"+this.loaded_image_id ).hide();$("#"+this.rate_remove_id ).show();}
StandartTemplate.prototype.drawUserImportant=function(val)
{var degree=new Array("обычное","знаковое");var degreeCap=new Array("Обычное","Знаковое");if ( parseInt(val)>0 )
{$("#"+this.user_important_id ).html('<span class="ryellow">&laquo;'+
degreeCap[val]+'&raquo;</span> <span class="rgrey">(<a class="rgrey" href="#" onclick="javascript:rates['+this.rate.rate_index+'].setImportant(0);return false;">снять</a>)</span>');$("#"+this.user_rate_interstenig_id).html('<img src="'+HOST_BASE+'img/u_important.gif" width="10" height="10" alt="" />');$("div#"+this.links_block_id+"_status_important").show();}
else
{var html='';for (var i=1;i<=1;i++)
html+=' <a class="rgrey" href="#" style="margin-right:10px;"'+' onclick="javascript:rates['+this.rate.rate_index+'].setImportant('+i+');return false;">'+'отметить как &laquo;'+degree[i]+'&raquo;</a>';$("#"+this.user_important_id ).html(html);$("#"+this.user_rate_interstenig_id).html('');$("div#"+this.links_block_id+"_status_important").hide();}}
StandartTemplate.prototype.drawDate=function()
{if (this.rate.params["entity"]=='person'||!isset(this.dictonary.current_consumed_year[2]))
return;var now=(new Date()).getTime()/1000;var yesterday=new Date(strtotime('-1 day',now) * 1000);var recently=new Date();var long_time_ago=new Date();var dates={now:['сегодня',this.rate.current_year,this.rate.current_month,this.rate.current_day,undefined],
yesterday:['вчера',yesterday.getFullYear(),(yesterday.getMonth()+1),yesterday.getDate(),undefined],
recently:['недавно',recently.getFullYear(),(recently.getMonth()+1),recently.getDate(),'1'],
long_time_ago:['давно',long_time_ago.getFullYear(),(long_time_ago.getMonth()+1),long_time_ago.getDate(),'2'],
long_long_ago:['очень давно',long_time_ago.getFullYear(),(long_time_ago.getMonth()+1),long_time_ago.getDate(),'3']};var html='<span style="font-size:1.1em;font-weight:bold;">';html+=this.dictonary.current_consumed_year[2]+'</span>';var currentDate='';var i=0;html+='<div>';for (var key in dates){currentDate=dates[key];html+='<input type="radio"';if (this.rate.compareConsumedDate(currentDate))
html+=' checked="checked"';if (key=='now')
html+=' style="margin-left:0;"';html+=' name="dateSelector_'+this.rate.rate_index+'" value="'+key+'" id="dateSelector'+i+'_'+this.rate.rate_index+'">';html+='<label for="dateSelector'+(i++)+'_'+this.rate.rate_index+'">'+currentDate[0]+'</label>';}
html+='<div style="margin:5px 0 0 0px;" id="'+this.img_consumed_calendar_id+'"><img class="remove_date" style="margin-left:0;" src="'+this.img_consumed_calendar+'" alt="календарь" title="календарь"><span class="calendar">календарь</span></div>';html+='</div>';$("#"+this.user_action_date_id ).hide();$("#"+this.consumed_date_id ).html(html);$("#"+this.consumed_date_id ).show();var closure=this;$("#"+this.rate_layer_id+" input:radio").unbind("click");$("#"+this.rate_layer_id+" input:radio").click(function (){currentDate=dates[this.value];if (closure.rate.compareConsumedDate(currentDate))
return;closure.drawed_elements['static_date']=0;closure.rate.setDay(currentDate[1],currentDate[2],currentDate[3],currentDate[4]);$("#"+closure.consumed_date_id ).hide();$("#"+closure.user_action_date_id ).show();});$("#"+this.img_consumed_calendar_id).unbind("click");$("#"+this.img_consumed_calendar_id).click(function (){closure.drawConsumedCalendar();$("#"+closure.rate_layer_id+" input:radio").removeAttr("checked");});}
StandartTemplate.prototype.drawConsumedCalendar=function(){var html='<span style="font-size:1.1em;font-weight:bold;">';var year=(parseInt(this.rate.current_consumed_year)>0)?this.rate.current_consumed_year:this.rate.current_year;var month=(parseInt(this.rate.current_consumed_month)>0)?this.rate.current_consumed_month:this.rate.current_month;var day=(parseInt(this.rate.current_consumed_day)>0)?this.rate.current_consumed_day:this.rate.current_day;html+=this.dictonary.current_consumed_year[2]+'</span>';html+=this.drawDay(day,month,year);html+='<select id="inputMonth_'+this.rate.rate_index+'">';for (var i=0;i<=12;i++){var key=((i<10)?'0':'')+i;html+='<option value="'+key+'" ';if (parseInt(key,10)==parseInt(month,10))
html+='selected="selected"';html+='>'+this.months_locative[key]+'</option>';}
html+='</select>';html+='<input id="inputYear_'+this.rate.rate_index+'" type="text" maxlength="4" value="'+year+'" class="input_year">г.';html+='<input type="button" id="inputOk_'+this.rate.rate_index+'" class="rate_opinion_button date_ok" value=""/>';html+='<p id="inputError_'+this.rate.rate_index+'" style="color:red;display:none;"></p>';$("#"+this.consumed_date_id ).hide();$("#"+this.consumed_calendar_id ).html(html);$("#"+this.consumed_calendar_id ).show();var closure=this;$("#inputMonth_"+this.rate.rate_index).unbind("change");$("#inputMonth_"+this.rate.rate_index).change(function (){var sel_month=$(this).val();if (parseInt(sel_month,10)>0){var sel_day=$("#inputDay_"+closure.rate.rate_index).val();var sel_year=$("#inputYear_"+closure.rate.rate_index).val();$("#inputDay_"+closure.rate.rate_index).removeAttr("disabled");$("#inputDay_"+closure.rate.rate_index).replaceWith(closure.drawDay(sel_day,sel_month,sel_year));}else{$("#inputDay_"+closure.rate.rate_index).replaceWith(closure.drawDay(0,0,sel_year));$("#inputDay_"+closure.rate.rate_index).attr("disabled","disabled");}});$("#inputYear_"+this.rate.rate_index).unbind("click");$("#inputYear_"+this.rate.rate_index).click(function (){$("#inputError_"+closure.rate.rate_index).hide();});$("#inputOk_"+this.rate.rate_index).unbind("click");$("#inputOk_"+this.rate.rate_index).click(function (){var sel_day=$("#inputDay_"+closure.rate.rate_index).val();var sel_year=$("#inputYear_"+closure.rate.rate_index).val();var sel_month=$("#inputMonth_"+closure.rate.rate_index).val();var pattern=/^\d{4,4}$/;if (!pattern.test(sel_year)||parseInt(sel_year)==0){$("#inputError_"+closure.rate.rate_index).html('Год указан неверно!').show();return;}
var nowTime=new Date();var pastTime=new Date(1950,0,1);var releaseTime=new Date(parseInt(closure.rate.params.year),0,1);var userTime=new Date(parseInt(sel_year), ((parseInt(sel_month)>0)?(parseInt(sel_month) - 1):parseInt(sel_month)), ((parseInt(sel_day)>0)?parseInt(sel_day):1) ,0,0,0);if (userTime.getTime()>nowTime.getTime()){$("#inputError_"+closure.rate.rate_index).html('Дата из будущего не может быть указана.').show();return;}
if (userTime.getTime()<pastTime.getTime()){$("#inputError_"+closure.rate.rate_index).html('Нельзя указать дату ранее 1950 года.').show();return;}
if (parseInt(closure.rate.params.year)>0&&userTime.getTime()<releaseTime.getTime()){$("#inputError_"+closure.rate.rate_index).html('Нельзя указать дату ранее года выпуска '+closure.dictonary.elements[2]+'.').show();return;}
if (parseInt(sel_month)==0)
sel_day=0;closure.drawed_elements['static_date']=0;closure.rate.setDay(sel_year,sel_month,parseInt(sel_day));$("#"+closure.consumed_calendar_id ).hide();$("#"+closure.user_action_date_id ).show();});}
StandartTemplate.prototype.drawDay=function(day,month,year){var html='';var days=29;var curMonth=parseInt(month,10) - 1;var tempDate=new Date(parseInt(year),curMonth,days);for(var i=days;i<=32;i++){tempDate.setDate(i);if (tempDate.getMonth()!=curMonth){days=i - 1;i=33;}}
html+='<select id="inputDay_'+this.rate.rate_index+'">';for(var i=0;i<=days;i++){html+='<option value="'+i+'" ';if (i==parseInt(day))
html+='selected="selected"';html+='>'+( i==0?'-':i)+'</option>';}
html+='</select>';return html;}
StandartTemplate.prototype.hideConsumedDate=function()
{$("#"+this.consumed_date_id ).hide();}
var Rate=function(params, template, rate_index, dictonary)
{this.dictonary=dictonary;this.template=template;this.template.dictonary=dictonary;this.date=new Date();this.current_year=this.date.getFullYear();this.current_month=this.date.getMonth()+1;this.current_day=this.date.getDate();this.start_year=1980;this.creation_year=params['year'];this.params=params;this.ajax_params=new Object();for (var i in params)
this.ajax_params[i]=this.params[i];if (this.params['user_read_date']!=undefined )
this.setConsumedDate(this.params['user_read_date']);this.ajax_params.rate_index=rate_index;this.ajax_params.action='Rate';this.request_already_sent=0;this.rate_index=rate_index;this.rate_block_id='rate_block_'+this.rate_index;}
Rate.prototype.flushForm=function(id)
{if (this.params.user_author===undefined||this.params.user_author==='')
$("#"+id).attr('value','');}
Rate.prototype.restoreForm=function(id,value)
{var user_author=$("#"+id).attr('value');user_author=$.trim(user_author);user_author=user_author.toLowerCase();this.params.user_author=user_author;if (user_author=='')
{$("#"+id).attr('value',value);return;}
var author=$.trim($("#poemAuthor"+this.params.object_id).val());author=author.toLowerCase();var guess_result=0;var t=0;var q=author.split(' ');var len=q.length;for (var name_parts in q )
{if (name_parts!='in_array'&&t<len&&$.trim(q[name_parts])==$.trim(user_author))
guess_result=1;t++;}
if (author==user_author)
guess_result=1;this.params.guess_result=guess_result;this.ajax_params.guess_result=guess_result;}
Rate.prototype.setConsumedDate=function(dt)
{if (dt==0)
dt='0000-00-00';t=dt.split("-");this.current_consumed_year=t[0];this.params['current_consumed_year']=t[0];this.current_consumed_month=t[1];this.params['current_consumed_month']=t[1];st=t[2].split(":");this.current_consumed_day=st[0];this.params['current_consumed_day']=st[0];if (st[1]!=undefined){this.current_consumed_symbolic=st[1];this.params['current_consumed_symbolic']=st[1];}else{this.current_consumed_symbolic=0;this.params['current_consumed_symbolic']=0;}}
Rate.prototype.hideConsumedDate=function()
{if (this.params['user_read_date']!=undefined )
this.setConsumedDate(this.params['user_read_date']);this.template.hideConsumedDate();}
Rate.prototype.drawYear=function()
{this.template.drawYear();}
Rate.prototype.drawDate=function()
{this.template.drawDate();}
Rate.prototype.drawMonth=function( year )
{if (year!=this.current_consumed_year)
{this.current_consumed_year=year;this.current_consumed_month='00';this.current_consumed_day='00';}
this.template.drawMonth();}
Rate.prototype.drawDay=function(month)
{if (month!=this.current_consumed_month)
{this.current_consumed_month=month;this.current_consumed_day='00';}
this.set_day=1;this.set_month=(parseInt(this.current_consumed_month, 10)==0)?0:parseInt(this.current_consumed_month, 10) - 1;this.set_year=parseInt(this.current_consumed_year, 10);this.set_date=new Date(this.set_year, this.set_month, this.set_day);this.template.drawDay();}
Rate.prototype.rewriteStars=function( count, type, starId )
{this.template.rewriteStars( count, type, starId );}
Rate.prototype.showWidget=function()
{this.template.showWidget();}
Rate.prototype.hoverStars=function()
{this.template.hoverStars();}
Rate.prototype.restoreStars=function( type, starId )
{t=0;var user_rate=(starId>0)?this.params["nomination_rates"][starId]:this.params.user_rate;for (var i=1;i<=this.template.total_marks;i++)
{if (this.template.rate_names[i]==undefined||user_rate<i)
continue;t++;}
if (window.event)
{if ($(event.toElement).attr("class")!="rate_image")
this.template.rewriteStars( t, type, starId );}
else
this.template.rewriteStars( t, type, starId );}
Rate.prototype.drawControls=function()
{var param_to_send;for (var i in this.params)
if ( this.template.loaded_params[i]==undefined )
this.template.loaded_params[i]=this.params[i];else
this.template.new_params[i]=this.params[i];for ( i in this.template.loaded_params )
if ( this.template.loaded_params[i]!=this.template.new_params[i])
{param_to_send=(this.template.new_params[i])?this.template.new_params[i]:this.template.loaded_params[i];this.template.loaded_params[i]=param_to_send;this.template.structure[i]=param_to_send;}
else
delete this.template.structure[i];this.template.drawControls( this );this.template.reDrawStructure();this.template.doSomeSpecial();if (!this.template.new_params )
this.template.loaded_params=this.template.new_params;this.template.new_params=new Array();}
Rate.prototype.handleResponse=function( response )
{answer=response.split(":::");params=new Array();for ( var i in answer )
{if (i!=='in_array')
{t=answer[i].split("==");params[t[0]]=t[1];}}
params["rate_index"]=parseInt( params["rate_index"]);obj_id=rates[params["rate_index"]].params["object_id"];rates[params["rate_index"]].template.afterRequest();for (var s in rates)
if (s!=='in_array'&&obj_id==rates[s].params['object_id'])
{params["rate_index"]=s;rates[s].hlr(params);}
if ((isset(params['spawner_rate_index'])&&params['user_rate_expected_loader']>0 ))
{rates[params["spawner_rate_index"]].params.new_expect=1;rates[params["spawner_rate_index"]].getDirectExpect()};}
Rate.prototype.hlr=function( params )
{for (i in params)
{if ( i=="user_rate")
{rates[params["rate_index"]].params["user_old_rate"]=rates[params["rate_index"]].params["user_rate"];rates[params["rate_index"]].ajax_params["user_old_rate"]=rates[params["rate_index"]].ajax_params["user_rate"];}
rates[params["rate_index"]].params[i]=params[i];rates[params["rate_index"]].ajax_params[i]=params[i];}
if ( params["user_id"]==0)
guestCallback(params);if (rates[params["rate_index"]].params['user_read_date']!=undefined )
rates[params["rate_index"]].setConsumedDate(rates[params["rate_index"]].params['user_read_date']);rates[params["rate_index"]].drawControls();rates[params["rate_index"]].request_already_sent=0;rates[params["rate_index"]].template.requestCompleted();}
Rate.prototype.setNominationRate=function(value,nomination_id)
{if (value!=this.params['nomination_rates'][nomination_id]&&this.request_already_sent==0)
{this.request_already_sent=1;var oParams=new Object;oParams.action='Nomination';oParams.step='setRate';oParams.object_id=this.params["object_id"];oParams.nomination_id=nomination_id;oParams.rate=value;oParams.rate_index=this.rate_index;$.post(script_url, oParams, this.responseNominationRate,"json");}}
Rate.prototype.responseNominationRate=function(response)
{var closure=rates[response.rate_index];closure.request_already_sent=0;if (response.success){closure.params["nomination_rates"][response.nomination_id]=response.rate;closure.restoreStars('dynamic',response.nomination_id);if (!closure.template.rate_remove_drawed[response.nomination_id]&&response.rate>0)
{closure.template.rate_remove_drawed[response.nomination_id]=true;$("#"+closure.template.rate_remove_id+'_'+response.nomination_id).html('&nbsp;<img class="rate_image" title="сбросить оценку" onclick="javascript:rates['+response.rate_index+'].template.setNominationRate(0,'+response.nomination_id+')" src="'+closure.template.img_rate_null_nomination+'" />');}else if (response.rate>0){$("#"+closure.template.rate_remove_id+'_'+response.nomination_id).show();}else{$("#"+closure.template.rate_remove_id+'_'+response.nomination_id).hide();}}}
Rate.prototype.setRate=function(value)
{if (value!=this.params['user_rate'])
{this.ajax_params.func='setRate';this.ajax_params.user_rate=value;this.ajax_params.user_rate_anonymous=this.params["user_rate_anonymous"];this.ajax_params.user_important=this.params["user_important"];var closure=this.template;if (value==0&&this.params['enable_nominations']==1){var empty_cell='<tr style="display:none" id="'+this.template.tr_nominations_block_id+'"><td colspan="3"></td></tr>';$("tr[id^='"+this.template.tr_nominations_block_id+"']").replaceWith(empty_cell);$("#"+this.template.div_nominations_block_id ).hide();$("#"+this.template.user_multirate_id+" a").unbind("click");$("#"+this.template.user_multirate_id+" a").click(function (){closure.getNominations();return false;});this.params['nomination_rates']=undefined;}
this.sendRequest();}
if (isset(this.params['after_save_rate']))
eval(this.params['after_save_rate']+'('+value+')');}
Rate.prototype.sendRequest=function()
{if (this.request_already_sent==0&&(!miracle_request_sent||isset(this.params.new_expect)))
{for (var s in rates)
{if (s!=='in_array'&&this.params["object_id"]==rates[s].params['object_id'])
{if (parseInt(this.ajax_params.user_rate)==0&&this.ajax_params.func=='setRate')
rates[s].template.drawed_elements['links_block']=0;rates[s].template.requestInProgress();rates[s].request_already_sent=1;}}
this.template.requestInProgress();this.request_already_sent=1;real_params=new Object();for (i in needed_widget_ajax_params)
{if (isset(this.ajax_params[needed_widget_ajax_params[i]]))
real_params[needed_widget_ajax_params[i]]=this.ajax_params[needed_widget_ajax_params[i]];}
this.template.beforeRequest();$.post( script_url, real_params, rates[this.rate_index].handleResponse);}}
Rate.prototype.getExtendedDirectExpect=function()
{this.ajax_params.func='getExtendedDirectExpect';this.sendRequest();}
Rate.prototype.getDirectExpect=function()
{if (this.params['user_id'])
{this.ajax_params.func='getDirectExpect';this.sendRequest();}else{var linkParams='';if (isset(this.params['entity'])){linkParams='?object_id='+this.params['object_id'];if (this.params['entity']=='element'){linkParams+='&content_id='+this.params['content_id']+'&element_id='+this.params['element_id'];}
if (this.params['entity']=='person'){linkParams+='&person_id='+this.params['person_id'];}
if (this.params['entity']=='collection'){linkParams+='&collection_id='+this.params['collection_id']+'&content_id='+this.params['content_id'];}}
location.href=addParamSeparator(this.params['link_registration']+linkParams)
+'redirect='+encodeURIComponent(window.location);}}
Rate.prototype.setDay=function(year,month,day)
{this.ajax_params.func='setConsumedDate';this.ajax_params.consumed_date=year+'-'+month+'-'+day;if (isset(arguments[3])){this.ajax_params.consumed_date+=':'+arguments[3];this.current_consumed_symbolic=arguments[3];}
this.current_consumed_day=day;this.current_consumed_month=month;this.current_consumed_year=year;this.sendRequest();}
Rate.prototype.getUserRate=function()
{return this.params['user_rate'];}
Rate.prototype.setInterest=function(interest)
{this.ajax_params.func='setInterest';this.ajax_params.user_interests=interest;this.sendRequest();}
Rate.prototype.setNotInterest=function(interest)
{this.ajax_params.func='setNotInterest';this.ajax_params.user_not_interests=interest;this.sendRequest();}
Rate.prototype.setAnonymity=function(anonymity)
{this.ajax_params.func='setAnonymity';this.ajax_params.user_rate_anonymous=anonymity;this.sendRequest();}
Rate.prototype.setImportant=function(important)
{this.ajax_params.func='setImportant';this.ajax_params.user_important=important;this.sendRequest();}
Rate.prototype.sendExpectFeedback=function()
{this.ajax_params.func='sendExpectFeedback';this.sendRequest();}
Rate.prototype.sendUserSpecialObject=function(code)
{this.ajax_params.func='sendUserSpecialObject';this.ajax_params.code=code;this.sendRequest();}
Rate.prototype.compareConsumedDate=function(currentDate)
{var cd4=(currentDate[4]==undefined)?0:currentDate[4];return (currentDate[1]==this.current_consumed_year&&currentDate[2]==parseInt(this.current_consumed_month,10)&&currentDate[3]==parseInt(this.current_consumed_day,10)&&cd4==this.current_consumed_symbolic );}
Rate.prototype.getFormattedConsumeDate=function()
{var formattedDate='';switch (true)
{case (this.params['current_consumed_symbolic']>0):var symbolic_id=this.params['current_consumed_symbolic'];formattedDate=this.template.dictonary["current_consumed_symbolic"][symbolic_id];break;case (this.params['current_consumed_day']>0):formattedDate=parseFloat(this.params['current_consumed_day'])+' '+
this.template.months_locative[this.params['current_consumed_month']]+' '+this.params['current_consumed_year']+' года';break;case (this.params['current_consumed_month']>0):formattedDate=' в '+this.template.months_genitive[this.params['current_consumed_month']]+' '
+this.params['current_consumed_year']+' года';break;case (this.params['current_consumed_year']>0):formattedDate=' в '+this.params['current_consumed_year']+' году';break;}
return formattedDate;}
function drawRateControls(params)
{params=prepareParams(params);++rate_index;if (params['user_sex']!=undefined)
user_sex=params['user_sex'];else
user_sex=0;if (params['sex_other']!=undefined)
sex_other=params['sex_other'];else
sex_other=0;switch( params['object_type_id'])
{case 1:case 2:case 48:case 53:case 54:if (!InicializedDictionaries['BooksDictonary'])
{BooksDictonary._extends(StandartDictonary);InicializedDictionaries['BooksDictonary']=true;}
var dict=new BooksDictonary(user_sex, sex_other);break;case 50:if (!InicializedDictionaries['BooksDictonary']||!InicializedDictionaries['LectureDictonary'])
{BooksDictonary._extends(StandartDictonary);LectureDictonary._extends(BooksDictonary);InicializedDictionaries['BooksDictonary']=true;InicializedDictionaries['LectureDictonary']=true;}
var dict=new LectureDictonary(user_sex, sex_other);break;case 43:if (!InicializedDictionaries['BooksDictonary']||!InicializedDictionaries['PoemsDictonary'])
{BooksDictonary._extends(StandartDictonary);PoemsDictonary._extends(BooksDictonary);InicializedDictionaries['BooksDictonary']=true;InicializedDictionaries['PoemsDictonary']=true;}
var dict=new PoemsDictonary(user_sex, sex_other);break;case 68:if (!InicializedDictionaries['BooksDictonary']||!InicializedDictionaries['PeriodicalDictonary'])
{BooksDictonary._extends(StandartDictonary);PeriodicalDictonary._extends(BooksDictonary);InicializedDictionaries['BooksDictonary']=true;InicializedDictionaries['PeriodicalDictonary']=true;}
var dict=new PeriodicalDictonary(user_sex, sex_other);break;case 45:case 22:case 18:if (!InicializedDictionaries['MusicDictonary'])
{MusicDictonary._extends(StandartDictonary);InicializedDictionaries['MusicDictonary']=true;}
var dict=new MusicDictonary(user_sex, sex_other);break;case 46:if (!InicializedDictionaries['VinoDictonary'])
{VinoDictonary._extends(StandartDictonary);InicializedDictionaries['VinoDictonary']=true;}
var dict=new VinoDictonary(user_sex, sex_other);break;case 10:if (!InicializedDictionaries['GamesDictonary'])
{GamesDictonary._extends(StandartDictonary);InicializedDictionaries['GamesDictonary']=true;}
var dict=new GamesDictonary(user_sex, sex_other);break;case 8:if (!InicializedDictionaries['SceneDictonary'])
{SceneDictonary._extends(StandartDictonary);InicializedDictionaries['SceneDictonary']=true;}
var dict=new SceneDictonary(user_sex, sex_other);break;case 26:if (!InicializedDictionaries['ArchiDictonary'])
{ArchiDictonary._extends(StandartDictonary);InicializedDictionaries['ArchiDictonary']=true;}
var dict=new ArchiDictonary(user_sex, sex_other);break;case 12:if (!InicializedDictionaries['MusicDictonary']||!InicializedDictionaries['RadioDictonary'])
{MusicDictonary._extends(StandartDictonary);RadioDictonary._extends(MusicDictonary);InicializedDictionaries['MusicDictonary']=true;InicializedDictionaries['RadioDictonary']=true;}
var dict=new RadioDictonary(user_sex, sex_other);break;case 23:if (!InicializedDictionaries['SitesDictonary'])
{SitesDictonary._extends(StandartDictonary);InicializedDictionaries['SitesDictonary']=true;}
var dict=new SitesDictonary(user_sex, sex_other);break;case 16:if (!InicializedDictionaries['TVDictonary'])
{TVDictonary._extends(StandartDictonary);InicializedDictionaries['TVDictonary']=true;}
var dict=new TVDictonary(user_sex, sex_other);break;case 33:if (!InicializedDictionaries['IntDictonary'])
{IntDictonary._extends(StandartDictonary)
InicializedDictionaries['IntDictonary']=true;}
var dict=new IntDictonary(user_sex);break;case 71:if (!InicializedDictionaries['BrandsDictonary'])
{BrandsDictonary._extends(StandartDictonary);InicializedDictionaries['BrandsDictonary']=true;}
var dict=new BrandsDictonary(user_sex);break;case 62:if (!InicializedDictionaries['ParfumDictonary'])
{ParfumDictonary._extends(StandartDictonary);InicializedDictionaries['ParfumDictonary']=true;}
var dict=new ParfumDictonary(user_sex, sex_other);break;case 64:if (!InicializedDictionaries['ParfumDictonary']||!InicializedDictionaries['ParfumBrandsDictonary'])
{ParfumDictonary._extends(StandartDictonary);ParfumBrandsDictonary._extends(ParfumDictonary);InicializedDictionaries['ParfumDictonary']=true;InicializedDictionaries['ParfumBrandsDictonary']=true;}
var dict=new ParfumBrandsDictonary(user_sex, sex_other);break;case 73:if (!InicializedDictionaries['ProductDictonary'])
{ProductDictonary._extends(StandartDictonary)
InicializedDictionaries['ProductDictonary']=true;}
var dict=new ProductDictonary(user_sex, sex_other);break;case 94:if (!InicializedDictionaries['TrashDictonary'])
{TrashDictonary._extends(StandartDictonary);InicializedDictionaries['TrashDictonary']=true;}
var dict=new TrashDictonary(user_sex, sex_other);break;case 107:if (!InicializedDictionaries['PhotoDictonary'])
{PhotoDictonary._extends(StandartDictonary);InicializedDictionaries['PhotoDictonary']=true;}
var dict=new PhotoDictonary(user_sex, sex_other);break;case 40:case 97:case 103:case 101:case 105:if (!InicializedDictionaries['SimpleDictonary'])
{SimpleDictonary._extends(StandartDictonary);InicializedDictionaries['SimpleDictonary']=true;}
var dict=new SimpleDictonary(user_sex, sex_other);break;case 108:if (!InicializedDictionaries['GiftsDictonary'])
{GiftsDictonary._extends(StandartDictonary);InicializedDictionaries['GiftsDictonary']=true;}
var dict=new GiftsDictonary(user_sex, sex_other);break;case 111:case 112:case 113:case 118:if (!InicializedDictionaries['TravelDictonary'])
{TravelDictonary._extends(StandartDictonary);InicializedDictionaries['TravelDictonary']=true;}
var dict=new TravelDictonary(user_sex, sex_other);break;case 115:if (!InicializedDictionaries['BlogDictonary'])
{BlogDictonary._extends(StandartDictonary);InicializedDictionaries['BlogDictonary']=true;}
var dict=new BlogDictonary(user_sex, sex_other);break;case 116:if (!InicializedDictionaries['MobileDictonary'])
{MobileDictonary._extends(StandartDictonary);InicializedDictionaries['MobileDictonary']=true;}
var dict=new MobileDictonary(user_sex, sex_other);break;default:var dict=new StandartDictonary(user_sex, sex_other);break;}
if (params['object_type_id']==33&&params['layout']=='Joined')
params['layout']='IntIntersectionTemplate';switch( params['layout'])
{case'Standart2':var tpl=new Standart2Template(rate_index);break;case'Home2':if (!InicializedTemplates['Home2Template'])
{Home2Template._extends(Standart2Template);incializeTemplate('Home2Template');InicializedTemplates['Home2Template']=true;}
var tpl=new Home2Template(rate_index);break;case'Joined':if (!InicializedTemplates['JoinedTemplate'])
{JoinedTemplate._extends(Standart2Template);incializeTemplate('JoinedTemplate');InicializedTemplates['JoinedTemplate']=true;}
var tpl=new JoinedTemplate(rate_index);break;case'ExpectedAndAverage':if (!InicializedTemplates['ExpectedAndAverageTemplate'])
{ExpectedAndAverageTemplate._extends(Standart2Template);dict.user_not_interests='Не рекомендовать';incializeTemplate('ExpectedAndAverageTemplate');InicializedTemplates['ExpectedAndAverageTemplate']=true;}
var tpl=new ExpectedAndAverageTemplate(rate_index);break;case'ExpectedOrAverage':if (!InicializedTemplates['ExpectedOrAverageTemplate'])
{ExpectedOrAverageTemplate._extends(Standart2Template);incializeTemplate('ExpectedOrAverageTemplate');InicializedTemplates['ExpectedOrAverageTemplate']=true;}
var tpl=new ExpectedOrAverageTemplate(rate_index);break;case'EvaluateRate':if (!InicializedTemplates['EvaluateRateTemplate'])
{EvaluateRateTemplate._extends(Standart2Template);incializeTemplate('EvaluateRateTemplate');InicializedTemplates['EvaluateRateTemplate']=true;}
var tpl=new EvaluateRateTemplate(rate_index);break;case'EvaluateIntRate':if (!InicializedTemplates['EvaluateIntRateTemplate'])
{EvaluateIntRateTemplate._extends(Standart2Template);incializeTemplate('EvaluateIntRateTemplate');InicializedTemplates['EvaluateIntRateTemplate']=true;}
var tpl=new EvaluateIntRateTemplate(rate_index);break;case'Person':if (!InicializedTemplates['PersonTemplate'])
{PersonTemplate._extends(Standart2Template);incializeTemplate('PersonTemplate');InicializedTemplates['PersonTemplate']=true;}
var tpl=new PersonTemplate(rate_index);break;case'Products':if (!InicializedTemplates['ProductTemplate'])
{ProductTemplate._extends(Standart2Template);incializeTemplate('ProductTemplate');InicializedTemplates['ProductTemplate']=true;}
var tpl=new ProductTemplate(rate_index);break;case'Poem':if (!InicializedTemplates['PoemTemplate'])
{PoemTemplate._extends(Standart2Template);incializeTemplate('PoemTemplate');InicializedTemplates['PoemTemplate']=true;}
var tpl=new PoemTemplate(rate_index);break;case'IntTemplate':if (!InicializedTemplates['IntTemplate'])
{IntTemplate._extends(Standart2Template);incializeTemplate('IntTemplate');InicializedTemplates['IntTemplate']=true;}
var tpl=new IntTemplate(rate_index);break;case'IntIntersectionTemplate':if (!InicializedTemplates['IntTemplate']||!InicializedTemplates['IntIntersectionTemplate'])
{IntTemplate._extends(Standart2Template);incializeTemplate('IntTemplate');IntIntersectionTemplate._extends(IntTemplate);incializeTemplate('IntIntersectionTemplate');InicializedTemplates['IntTemplate']=true;InicializedTemplates['IntIntersectionTemplate']=true;}
var tpl=new IntIntersectionTemplate(rate_index);break;case"TV":if (!InicializedTemplates['TVTemplate'])
{TVTemplate._extends(Standart2Template);incializeTemplate('TVTemplate');InicializedTemplates['TVTemplate']=true;}
var tpl=new TVTemplate(rate_index);break;case"PrintTV":case"Print":if (!InicializedTemplates['PrintTemplate'])
{PrintTemplate._extends(Standart2Template)
incializeTemplate('PrintTemplate');InicializedTemplates['PrintTemplate']=true;}
var tpl=new PrintTemplate(rate_index);break;case"Photo":if (!InicializedTemplates['PhotoTemplate'])
{PhotoTemplate._extends(Standart2Template);incializeTemplate('PhotoTemplate');InicializedTemplates['PhotoTemplate']=true;}
var tpl=new PhotoTemplate(rate_index);break;case"MyRate":if (!InicializedTemplates['MyRateTemplate'])
{MyRateTemplate._extends(Standart2Template);incializeTemplate('MyRateTemplate');InicializedTemplates['MyRateTemplate']=true;}
var tpl=new MyRateTemplate(rate_index);break;case"Travel":if (!InicializedTemplates['TravelTemplate'])
{TravelTemplate._extends(Standart2Template);incializeTemplate('TravelTemplate');InicializedTemplates['TravelTemplate']=true;}
var tpl=new TravelTemplate(rate_index);break;case"TravelEvaluate":if (!InicializedTemplates['EvaluateTravelTemplate'])
{EvaluateTravelTemplate._extends(Standart2Template);incializeTemplate('EvaluateTravelTemplate');InicializedTemplates['EvaluateTravelTemplate']=true;}
var tpl=new EvaluateTravelTemplate(rate_index);break;case"RatingRate":if (!InicializedTemplates['RatingRateTemplate'])
{RatingRateTemplate._extends(Standart2Template);incializeTemplate('RatingRateTemplate');InicializedTemplates['RatingRateTemplate']=true;}
var tpl=new RatingRateTemplate(rate_index);break;case"CompactRatingRate":if (!InicializedTemplates['CompactRatingRateTemplate'])
{CompactRatingRateTemplate._extends(Standart2Template);incializeTemplate('CompactRatingRateTemplate');InicializedTemplates['CompactRatingRateTemplate']=true;}
var tpl=new CompactRatingRateTemplate(rate_index);break;case"EntityTemplate":if (!InicializedTemplates['EntityTemplate'])
{EntityTemplate._extends(Standart2Template);incializeTemplate('EntityTemplate');InicializedTemplates['EntityTemplate']=true;}
var tpl=new EntityTemplate(rate_index);break;case"StringIntersection":if (!InicializedTemplates['StringIntersectionTemplate'])
{StringIntersectionTemplate._extends(Standart2Template);incializeTemplate('StringIntersectionTemplate');InicializedTemplates['StringIntersectionTemplate']=true;}
var tpl=new StringIntersectionTemplate(rate_index);break;}
params["rate_index"]=rate_index;rates[rate_index]=new Rate( params, tpl, rate_index, dict );rates[rate_index].drawControls();}
function prepareParams(params)
{if (params["user_id"]==undefined)
params["user_id"]=0;if (params["year"]==undefined)
params["year"]=0;if (params["user_rate"]==undefined)
params["user_rate"]=0;if (params["rates_amount"]==undefined&&!params["user_rate_expected"])
{params["rates_amount"]=0;params["user_rate_no_expect"]=1;}
if (params["expand_widget"]==undefined)
params["expand_widget"]=0;if (params["rate_average"]==undefined)
params["rate_average"]=0;if (params["rate_variance"]==undefined)
params["rate_variance"]=0;if (params["user_read_date"]==undefined||params["user_read_date"]==0)
params["user_read_date"]='0000-00-00';if (params["user_rate_anonymous"]==undefined)
params["user_rate_anonymous"]=0;if (params["user_rate_expected"]==undefined)
params["user_rate_expected"]=0;if (params["user_refferents_amount"]==undefined)
params["user_refferents_amount"]=0;if (params["cross_object_type_id"]==undefined)
params["cross_object_type_id"]=0;if (params["cross_object_type_name"]==undefined)
params["cross_object_type_name"]='';if (params["use_document_write"]==undefined)
params["use_document_write"]=1;if (params["opinions_enabled"]==undefined)
params["opinions_enabled"]=1;if (params['show_not_recommend_link']==undefined||params['show_not_recommend_link']==0)
params['show_not_recommend_link']=1;else
params['show_not_recommend_link']=0;if (params['no_display_name']==undefined)
params['no_display_name']=0;else
params['no_display_name']=1;if (params['loader_object_id']!=undefined)
params['object_to_calc_recommends']=params['loader_object_id'];if (params["smart_widget"]==undefined)
params["smart_widget"]=0;if (params["miracle_tooltip"]==undefined||params["rates_amount"]<10||params["object_type_id"]==33||params["object_type_id"]==12||params["object_type_id"]==73||params["object_type_id"]==40||params["object_type_id"]==97||params["object_type_id"]==101||params["object_type_id"]==103||params["object_type_id"]==105
)
params["miracle_tooltip"]=0;if (params["widget_id"]==undefined)
params["widget_id"]='';if (params["flush_cookie"]==undefined||params["flush_cookie"]!=0)
params["flush_cookie"]=1;else
params["flush_cookie"]=0;if (params["layout"]==undefined)
params["layout"]='Standart2';if (params["dictionary"]==undefined)
params["dictionary"]='Standart';if (params["hide_expect_rate"]==undefined)
params["hide_expect_rate"]=0;if (params["hide_rates_link"]==undefined)
params["hide_rates_link"]=0;if (params["replace_registration_element"]==undefined)
params["replace_registration_element"]=0;params["recommend_min_rates_amount"]=RECOMMEND_MIN_RATES_AMOUNT;if (params["object_type_id"]==33||params["object_type_id"]==115||params["object_type_id"]==94||params["object_type_id"]==107||params["object_type_id"]==64||params["object_type_id"]==118||params['layout']=='Photo'||params['layout']=='Home2'||params['layout']=='ExpectedOrAverage'||params['layout']=='RatingRate'||params['layout']=='EvaluateRate'||params['layout']=='MyRate'||params['layout']=='CompactRatingRate'
)
params["disable_block_opinion"]=true;if ((isset(params['hide_user_interests'])&&params['hide_user_interests']==0)||params["object_type_id"]==115||params['layout']=='Travel'||params['layout']=='Photo')
params['hide_user_interests']=true;else
params['hide_user_interests']=false;if (params['layout']=='IntTemplate')
params['show_not_recommend_link']=0;return params;}
function replaceEvaluateElement(content_id, rate_id, miracle_oid)
{var params=new Object;params.action='EvaluateElement';params.content_id=content_id;params.miracle_oid=miracle_oid;if (isset(arguments[3])){params.entity=arguments[3];}else{params.entity='element';}
$('#'+rate_id).parents('.evaluateElementCell')
.html('<span class="elementCellProgress"><img src="'+HOST_BASE+'img/progress.gif" align="absmiddle" /> Загрузка...</span>')
.load(script_url, params);}
var refresh_evaluate_block=false;function refreshEvaluateRates(content_id, page)
{if (!refresh_evaluate_block)
{refresh_evaluate_block=true;$('#evaluateRatesProcess').show();if (content_id==undefined)
content_id=0;var params=new Object;params.action='EvaluateRates';params.content_id=content_id;params.page=page;if (isset(arguments[2])){params.entity=arguments[2];}else{params.entity='element';}
$('#evaluateRates').load(script_url, params, function(){refresh_evaluate_block=false;});}}
$(function(){$(".magicstar").bind("mouseenter mouseleave",function(e){var id=$(this).attr("id");var ids=id.split("_");if (e.type=='mouseenter')
rates[ids[1]].rewriteStars(ids[3],'dynamic',ids[2]);else
rates[ids[1]].restoreStars('dynamic',ids[2]);});});