var count=0;
var max=-1;
var showtries=1;
function ost(){var a;
if(max==-1){a="неограничено"
}else{a=(max-count)
}document.getElementById("tries").innerHTML="Осталось выбора: "+a+"."
}function dropFile(a){if(document.getElementById){if(count==0){return
}count--;
while(a.tagName!="TR"){a=a.parentNode
}a.parentNode.removeChild(a);
if(showtries){ost()
}}}function addFile(b){if(count>=max&&max!=-1){alert("Максимально "+(max+1)+" вложений");
return
}if(document.getElementById){count++;
while(b.tagName!="TR"){b=b.parentNode
}var a=b.parentNode.insertBefore(b.cloneNode(true),b.nextSibling);
if(showtries){ost()
}}}var ns6=document.getElementById&&!document.all;
function restrictinput(maxlength,e,placeholder){if(window.event&&event.srcElement.value.length>=maxlength){return false
}else{if(e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){var pressedkey=/[a-zA-Z0-9\.\,\/]/;
if(pressedkey.test(String.fromCharCode(e.which))){e.stopPropagation()
}}}}function countlimit(maxlength,e,placeholder){var theform=eval(placeholder);
var lengthleft=maxlength-theform.value.length;
var placeholderobj=document.all?document.all[placeholder]:document.getElementById(placeholder);
if(window.event||e.target&&e.target==eval(placeholder)){if(lengthleft<0){theform.value=theform.value.substring(0,maxlength)
}placeholderobj.innerHTML=lengthleft
}}function displaylimit(thename,theid,thelimit){var chr_max=thelimit;
var theform=theid!=""?document.getElementById(theid):thename;
var limit_text="<b>MAX символов: "+chr_max+'. Осталось: <span id="'+theform.toString()+'">'+thelimit+"</span>.</b>";
if(document.all||ns6){document.write(limit_text)
}if(document.all){eval(theform).onkeypress=function(){return restrictinput(thelimit,event,theform)
};
eval(theform).onkeyup=function(){countlimit(thelimit,event,theform)
}
}else{if(ns6){document.body.addEventListener("keypress",function(event){restrictinput(thelimit,event,theform)
},true);
document.body.addEventListener("keyup",function(event){countlimit(thelimit,event,theform)
},true)
}}}var _travel_idDiv;
function ajax_update_travel_content(d,a,f,b,e,c){_travel_idDiv=$(d);
if($$("a.list_selected").first()){$$("a.list_selected").first().removeClassName("list_selected")
}if(f=="tab"){$("tabSelected").id="";
a.id="tabSelected"
}else{if(f=="link"){a.className="list_selected"
}else{if(f=="eternal"){if(c!=null){article=$("article"+c);
if(article){article.className="list_selected"
}}_travel_idDiv.scrollTo()
}}}if(_travel_idDiv&&b){new Ajax.Updater({success:d},b,{method:"get",evalScripts:true,onFailure:update_travel_content_error,onLoading:update_travel_content_load,parameters:e})
}}function update_travel_content_error(){_travel_idDiv.update("Произошла ошибка при обновлении информации.")
}function update_travel_content_load(){_travel_idDiv.update('<img src="'+otz_images_url+'/ajax-loader.gif" width="16" height="16" /> Загрузка данных ...')
}var t_type=0;
function blink_title_new_pm(){var d="У вас новое сообщение!";
var c="*****************";
if(t_type==0){document.title=d;
t_type=1
}else{document.title=c;
t_type=0
}setTimeout("blink_title_new_pm()",800)
}function update_notice_menu(){if($("new_personal_message").empty()){new Ajax.Updater({success:"new_personal_message"},otz_script_url,{method:"get",evalScripts:true,parameters:{action:"ajax_html",sa:"check_pm",enable_js:"1"}});
setTimeout("update_notice_menu()",30*1000)
}}var _update_div_obj;
function update_div_content(a,b){if(a!==null&&b!==null){_update_div_obj=$(b);
new Ajax.Updater({success:b},a,{method:"get",evalScripts:true,onFailure:_update_div_error,onLoading:_update_div_load})
}}function _update_div_error(){if(_update_div_obj!==null){_update_div_obj.update("Ошибка при загрузки данных.")
}}function _update_div_load(){if(_update_div_obj!==null){_update_div_obj.update('<img src="'+otz_images_url+'/ajax-loader.gif" width="16" height="16" /> Загрузка данных ...')
}}function strtotime(g,b){var e,f,k,j="",d="";
j=g;
j=j.replace(/\s{2,}|^\s|\s$/g," ");
j=j.replace(/[\t\r\n]/g,"");
if(j=="now"){return(new Date()).getTime()
}else{if(!isNaN(d=Date.parse(j))){return d/1000
}else{if(b){b=new Date(b)
}else{b=new Date()
}}}j=j.toLowerCase();
var a=function(i){var o=(i[2]&&i[2]=="ago");
var n=(n=i[0]=="last"?-1:1)*(o?-1:1);
switch(i[0]){case"last":case"next":switch(i[1].substring(0,3)){case"yea":b.setFullYear(b.getFullYear()+n);
break;
case"mon":b.setMonth(b.getMonth()+n);
break;
case"wee":b.setDate(b.getDate()+(n*7));
break;
case"day":b.setDate(b.getDate()+n);
break;
case"hou":b.setHours(b.getHours()+n);
break;
case"min":b.setMinutes(b.getMinutes()+n);
break;
case"sec":b.setSeconds(b.getSeconds()+n);
break;
default:var l;
if(typeof(l=__is_day[i[1].substring(0,3)])!="undefined"){var p=l-b.getDay();
if(p==0){p=7*n
}else{if(p>0){if(i[0]=="last"){p-=7
}}else{if(i[0]=="next"){p+=7
}}}b.setDate(b.getDate()+p)
}}break;
default:if(/\d+/.test(i[0])){n*=parseInt(i[0]);
switch(i[1].substring(0,3)){case"yea":b.setFullYear(b.getFullYear()+n);
break;
case"mon":b.setMonth(b.getMonth()+n);
break;
case"wee":b.setDate(b.getDate()+(n*7));
break;
case"day":b.setDate(b.getDate()+n);
break;
case"hou":b.setHours(b.getHours()+n);
break;
case"min":b.setMinutes(b.getMinutes()+n);
break;
case"sec":b.setSeconds(b.getSeconds()+n);
break
}}else{return false
}break
}return true
};
var c={day:{sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6},mon:{jan:0,feb:1,mar:2,apr:3,may:4,jun:5,jul:6,aug:7,sep:8,oct:9,nov:10,dec:11}};
f=j.match(/^(\d{2,4}-\d{2}-\d{2})(\s\d{1,2}:\d{1,2}(:\d{1,2})?)?$/);
if(f!=null){if(!f[2]){f[2]="00:00:00"
}else{if(!f[3]){f[2]+=":00"
}}k=f[1].split(/-/g);
for(e in c.mon){if(c.mon[e]==k[1]-1){k[1]=e
}}return strtotime(k[2]+" "+k[1]+" "+k[0]+" "+f[2])
}var h="([+-]?\\d+\\s(years?|months?|weeks?|days?|hours?|min|minutes?|sec|seconds?|sun.?|sunday|mon.?|monday|tue.?|tuesday|wed.?|wednesday|thu.?|thursday|fri.?|friday|sat.?|saturday)|(last|next)\\s(years?|months?|weeks?|days?|hours?|min|minutes?|sec|seconds?|sun.?|sunday|mon.?|monday|tue.?|tuesday|wed.?|wednesday|thu.?|thursday|fri.?|friday|sat.?|saturday))(\\sago)?";
f=j.match(new RegExp(h,"g"));
if(f==null){return false
}for(e in f){if(!a(f[e].split(" "))){return false
}}return(b)
};