Dic={yandex_map:"Яндекс.Карта",sites_item_empty:"Место для моего сайта",transition_posts_group_button_subscribe:"подписка",sitese_manager_join_failure:"Ошибка сервера.\nНе удалось присоединиться к сайту.",sitese_manager_joined_limit:"Не удалось присоединиться к сайту.\nВы достигли лимита.\nУдалите ненужные свои сайты и попробуйте снова.",sitese_manager_leave_failure:"Ошибка сервера.\nНе удалось покинуть группу.",email:"Email",sitese_manager_subscribe_failure:"Ошибка сервера.\nНе удалось подписаться к сайту.",confirm_postimage_deletion:"Удалить картинку темы по умолчанию?",sites_manager_unsubcribe_confirmation:"Вы действительно хотите отписаться?",sites_manager_unsubcribe_confirm_yes:"Да",sitese_manager_unsubscribe_failure:"Ошибка сервера.\nНе удалось отписаться от сайта.",sitese_manager_upload_failure:"Ошибка сервера.\nНе удалось подгрузить сайты.",loadingMarkers:"загрузка меток на карте...",turn_on_js:"Для работы карты необходимо включить JavaScript",comment_button:"Добавить",transition_posts_group_button_join_success:"Добавлен в Мои",transition_posts_group_button_left_text:"удалить",transition_posts_group_button_join_text:"В мои",loading:"загрузка...",write_button:"отправить",searchResults:"поиск по «%d»",hide_search_results:"показать всё остальное…",no_address_found:"адрес не найден",confirm_group_left:"Вы уверены, что больше не хотите быть участником сайта?",searching:"поиск...",my_house_link_obj2geo_type_person_house_work:"Я здесь работаю",photos_house:"Фото: %d",you_are_already_connected:"[твой друг]",this_is_my_house:"сделать моим домом",my_house_link:"Я здесь...",street_other:"другая улица",text_for_action_type_invite_or_join_rejected:"Отказано",map:"карта",hybrid:"гибрид",satellite:"спутник",create_blog_of_house_button:"Создать блог",confirm_photo_deletion:"Удалить фото?",firstname:"Имя",nothingFound:"совпадений не найдено",blog_house:"Блог: %d",there_are_network_problems:"Проблемы со связью",house_choose:"выберите дом",street_choose:"выберите улицу",house_other:"другой дом",my_house_link_obj2geo_type_person_house_other:"Я здесь  просто так",my_house_link_obj2geo_type_person_house_study:"Я здесь учусь",my_house_link_obj2geo_type_person_house_live:"Я здесь живу",people_house:"Люди: %d",map_zoomer_country:"Страна",map_zoomer_rayon:"Район",map_zoomer_street:"Улица",map_zoomer_house:"Дом",error_setting_geostatus:"ошибка",map_zoomer_city:"Город",add_place_balloon_button:"Да, я здесь!",street_text_tooltip:"напишите через запятую свой район, улицу и т.п.",status_usage_tooltip:"Ваш геостатус. Для других пользователей Вы сейчас здесь.",click_this_to_enable_button:"Передача данных на сервер. Если висит долго, то щёлкните по этой надписи.",city_text_tooltip:"напишите через запятую свой край, область, район, село и т.п.",ao_choose:"выберите АО",rating_tooltip:"Рейтинг",comment_reply:"Ответить на комментарий",city_choose:"выберите город",region_choose:"выберите регион",rayon_choose:"выберите район",baloon_loading:"загрузка...",country_choose:"выберите страну",updating_geostatus:"сохранение…",add_point_balloon_button:"здесь!",parent_whole_world:"где-то на нашей планете",loading_group_invite:"отправка приглашения",discounts_old:"прошедшие акции",notice_marker_text:"Это наш дом!",photo_is_uploading:"фото загружается...",click_to_restore_saved_text:"Нажмите, чтобы восстановить сохраненный текст",groups_item_people_map_fullscreen_add_on_map_tooltip:"Добавьте себя на эту карту!\nПеретащите булавку в нужную точку.",new_album_name:"Название нового альбома",photo_edit:"редактировать",photo_being_uploaded:"фото загружается...",photo_has_no_album:"Без альбома",press_enter_to_save:"нажмите «Enter», чтобы сохранить",share_photo:"поделиться фото",text_for_action_type_share_photo:"Посмотри на фотографию «%s»",confirm_delete_album_cover:"Действительно удалить фото на обложке?",share_photo_baloon:"отправить",photo_crop_button:"кадрировать",confirm_place_deletion:"Удалить адрес?",site_is_being_maintained:"Сайт сейчас обновляется, подождите минуту, пожалуйста",delete_photo_tag:"удалить метку",preventing_doublepost:"Передача данных на сервер...",error_sending_photo_to_email:"При отправке фотографии на адрес %s произошла ошибка: сервер не отвечает или отвечает некорректно. Приносим наши извинения и просим сообщить в службу поддержки.",groups_admin_save_changes_failure:"Ошибка сервера.\nСохранение не выполнено.",invite_sent:"отправлено",groups_admin_cancel_changes_failure:"Ошибка сервера.\nОтмена изменений не выполнена.",groups_admin_save_changes_success:"Изменения успешно сохранены",discounts_till_days:"дн.",first_time:"первый раз",second_time:"второй раз",third_time:"третий раз",group_comon_save_showing_twitter_signals_failure:"save showing signals is failure",list:"список",map_create_route:"маршрут",error_edge_photo_delete_is_not_confirmed:"Удалить фото?",mapchat_user_direction_to_the_south:"на юг",group_comon_stock_work_interval_d:"д",mapchat_new_messages:"новое!",mapchat_message_submit:"Сказать",send_shortcut:"Ctrl+Enter",chat_create_marker_title:"Напишите первое сообщение",share_button:"отправить",place_not_shared:"не отправлено",place_marker_address_label:"Адрес",error_sending_place_to_email:"При отправке места на адрес %s произошла ошибка: сервер не отвечает или отвечает некорректно. Приносим наши извинения и просим обратиться в службу поддержки с описанием обстоятельств, приведших к этой проблеме.",loading_share_place:"отправка...",place_shared:"отправлено",share_place_baloon:"отправить",chat_marker_people_counter_empty:"Здесь пока никого",chat_marker_people_counter:"Сейчас в этом чате: %d",place_marker_name_label:"Название",floater_form_loading:"отправка...",floater_form_error:"сообщение не отправлено",error_fill_in_required_fields:"Пожалуйста, заполните все обязательные поля",discounts_till_days_one:"день",mapchat_user_direction_to_the_south_east:"на юго-восток",error_custom_url_is_html_image_expected:"укажите адрес самой картинки, а не страницы с картинкой",mapchat_user_direction_to_the_north_west:"на северо-запад",mapchat_user_direction_to_the_west:"на запад",mapchat_user_direction_to_the_north:"на север",mapchat_user_direction_to_the_east:"на восток",mapchat_user_direction_to_the_north_east:"на северо-восток",write:"написать",chat_address_banned:"Анонимные сообщения с вашего адреса запрещены модератором",confirm_application_delete:"Вы уверены, что хотите удалить это приложение?",my_chats_no_items:"пока нет ни одного чата",mapchat_user_direction_to_the_south_west:"на юго-запад",error_invalid_format_koth_text_too_long:"Слишком длинный текст сообщения",shortcut_for_submit:"(ctrl+enter)",text_for_action_type_join_request_message:"Давай дружить?",join_group:"присоединиться к сайту",discounts_till_days_many:"дней",floater_form_submitted:"сообщение отправлено",floater_form_exception:"при отправке сообщения произошла непредвиденная ошибка",discounts_till_days_several:"дня",widget_settings:"настроить",close_block:"закрыть",form_data_sent:"Данные сохранены!",form_post_failure:"При отправке произошла непредвиденная ошибка",discounts_actual:"текущие акции",text_for_action_type_invite_group_accepted:"Приглашение на сайт «%s» принято.",empty_value:"-",do_you_want_send_join_request:"Предложить пользователю",waiting_invite_offer_accept:"Ожидание ответа на предложение о дружбе",do_you_want_to_accept_invitation:"Принимаете ли Вы предложение о дружбе?",group_comon_more_link:"ещё...",domain_free:"Бесплатный",blogpost_notify_statstics_show_all:"развернуть все записи",urls_add_address_likes:"Похожие адреса:",urls_popular:"популярный",urls_bar_add:"Вы выбрали:",urls_alt_cred:"кр./мес.",blogpost_notify_statstics_hide_all:"свернуть все записи",text_for_action_type_invite_group:"Приглашение на сайт «%s»",default_value:"Значение по умолчанию",navigation_search:"Поиск",trading_system_still_working:"Ещё работает...",close_preview:"закрыть",input_list_cancel_delete:"отменить удаление",group_comon_hide_link:"скрыть",search_span_people:"Люди",invite_free_is_done:"На сегодня у Вас не осталось\nбесплатных приглашений",group_rating_reason_update_type_13:"приглашение друзей",confirm_application_cancel:"Были произведены изменения, Вы уверены, что хотите отменить эти изменения?",confirm_delete_video_js:"Вы действительно хотите удалить данное видео?",trading_system_failure:"Ошибка торговой системы",messages_delete_confirm:"Вы действительно хотите удалить\nвсю переписку с этим пользователем?",app_list_publish_alert_text:"Приложение будет отправлено на просмотр нашим модераторам, после чего оно будет добавлено в общий каталог приложений.",delete_failure:"Ошибка сервера.\nУдаление выполнено не было.",photo_has_been_deleted:"Фото удалено.",btn_left_group:"Вы уверены, что больше не хотите быть участником данного сайта?",groups_user_unlink_alert:"Вы точно хотите раздружиться с данным пользователем?",comment_has_been_undeleted:"Комментарий был восстановлен",error_required_missed:"обязательное поле пропущено",blog_post_has_been_deleted_as_spam:"Тема помечена как спам и удалена.",comment_has_been_deleted_as_spam:"Комментарий помечен как спам и удалён",photo_has_been_deleted_as_spam:"Фото помечено как спам и удалено.",video_has_been_deleted_as_spam:"Видео помечено как спам и удалено.",video_has_been_deleted:"Видео удалено.",profile_sites_more_link:"eщё",miniwizard_failure:"Ошибка сервера.\nДанные не были сохранены.",miniwizard_succes:"Данные успешно сохранены",form_data_error:"Ошибки в полях ввода",video_paused_reset_failure:"Ошибка сервера.\nНе удалось отменить досмотр видео.",theme_selector_ie_warning:"Данный дизайн содержит элементы нестандартного оформления, которые не поддерживается Вашим браузером.\nПожалуйста, воспользуйтесь любым другим из популярных.",video_like_reset_failure:"Ошибка сервера.\nНе удалось отметить видео как не понравившееся.",videoroom_created:"приглашение отправлено",video_upload_torrent_metric_kb:"кБ",video_upload_torrent_metric_gb:"ГБ",video_upload_torrent_metric_b:"Б",video_upload_torrent_metric_mb:"МБ",audio_copy_failure:"Ошибка сервера.\nНе удалось скопировать аудиофайл.",messages_complaint_confirm:"Вы уверены, что хотите сообщить о спаме\nи удалить эту переписку?",rnd_popular_post_and:"и",invite_accept_button:"принять",invite_this_person_button:"подружиться",text_for_action_type_join_request_link:"Давай дружить?",delete_app_msg_server_error:"Ошибка сервера. Сообщение не удалено.",invite_reject_button:"отказать",lastname:"Фамилия",blogpost_notify_statstics_not_complete:"Статистика еще не готова",blogpost_notify_statstics_sent_of:"из",text_for_action_type_invite_or_join_accepted:"Предложение принято",blogpost_notify_statstics_unknown:"неизвестно",group_comon_stock_selector_empty_text:"Извините, ничего не найдено",modal_close_window:"закрыть",profile_sites_hide_more_link:"скрыть",group_confirm_delete_order:"Вы действительно хотите удалить заявку?",order_settings_hover:"Свернуть",rnd_popular_post_firends:"Ваши друзья",order_settings:"Развернуть",order_close:"Закрыть",rnd_popular_post_rate:"оценили тему:",group_comon_navigation_search_default_value:"ПОИСК",group_rating_reason_update_type_4:"вход на сайт",group_rating_reason_update_type_5:"размещение темы в блоге",group_rating_reason_update_type_6:"загрузку видео",group_rating_reason_update_type_7:"загрузку аудио",group_rating_reason_update_type_8:"комментарий",group_rating_reason_update_type_9:"голосование",group_updated_rating_text:"к Вашему рейтингу за",group_rating_reason_update_type_3:"размещение фотографии",title_groups_item_activity:"Активность",group_rating_reason_update_type_2_1:"твит",email_normalized:"email_normalized",export_to_twitter_com:"export_to_twitter_com",twitter_com_id:"twitter_com_id",group_comon_instrumeny_is_not_available:"(не доступно)",group_comon_suggest_failure:"При поиске инструмента произошла ошибка сервера",mark_as_favorite:"Отметить как любимый",unmark_as_favorite:"Нажмите, чтобы удалить вопрос из списка Ваших любимых",operation_type_short:"Sell (Short)",rnd_popular_post_close_title:"Закрыть",order_condition_type_active:"Активная",order_condition_type_condition_lastup:"LastUp",group_comon_resolve_failure:"Server error. Couldn't resolve an instrument.",order_condition_type_condition_lastdown:"LastDown",group_comon_glass_th_price:"Цена",group_comon_glass_th_sell:"Продажа",group_comon_glass_th_buy:"Покупка",blog_post_has_been_deleted:"Тема удалена.",invite_import_toggle_all_checkboxes:"убрать/поставить все галочки",group_rating_reason_update_type_11:"создание заявки",group_comon_order_gold_currency:"Унций",comon_order_bought:"bought",comon_order_sold:"sold",order_accept:"принята",buy:"купить",group_comon_stock_work_interval_s:"с",group_comon_stock_work_interval_m:"м",group_comon_stock_work_interval_in:"Биржа открыта. Закроется через",group_comon_stock_work_interval_more:"Биржа закрыта. Откроется через",group_comon_stock_work_interval_less:"Биржа откроется через",order_closed:"закрыта",comment_has_been_deleted:"Комментарий удалён.",group_rating_reason_update_type_2_3:"сигнал",group_rating_reason_update_type_2_2:"твит с twitter.com",group_rating_reason_update_type_1:"сообщение",group_rating_reason_update_type_12:"импортированные email'ы",input_list_move_up:"переместить вверх",input_list_move_down:"переместить вниз",input_list_delete:"удалить",captcha_russian_letters_only:"только кириллица",fast_deleting_block_author_confirm:"Вы уверены, что хотите заблокировать данного пользователя?\nДействие невозможно отменить. Пользователь будет внесён в черный список сайта, а весь его контент через некоторое время заблокирован.",fast_deleting_author_has_been_blocked:"Автор заблокирован.",group_comon_stock_work_interval_h:"ч",groups_item_edit_button_install_anywhere:"Разместить на всех страницах",groups_item_need_settings_cmt:'Для корректной работы всплывающих уведомлений <a href="http://naplatforme.ru/_/pomosch#other_2nd_level_domain">необходимо настроить</a> доменное имя "cmt".',action_links_like:"Нравится",foreign_like_buttons_text:"Поделитесь с друзьями",groups_item_edit_button_install_on_contexts:"Разместить виджет на страницах",confirm_no:"Нет",confirm_yes:"Да",confirm_join_popup_header:"Вы хотите присоединиться к сайту «%s»?",confirm_join_popup_checker_text:"Присылать уведомления об интересных темах",confirm_join_popup_by_invitor_header:"%s приглашает Вас на сайт «%s»",confirm_join_text:"Принять приглашение:",word:function(c){var a=Object.isArray(c)?c[0]:c,d=null;if(this[a]){d=this[a]}else{return(window.DEBUG_MODE?("???"+c+"???"):"")}return Object.isArray(c)?d.vsprintf(c.slice(1)):d}};var Prototype={Version:"1.7",Browser:(function(){var c=navigator.userAgent;var a=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!a,Opera:a,WebKit:c.indexOf("AppleWebKit/")>-1,Gecko:c.indexOf("Gecko")>-1&&c.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile/.test(c)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var a=window.Element||window.HTMLElement;return !!(a&&a.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var d=document.createElement("div"),c=document.createElement("form"),a=false;if(d.__proto__&&(d.__proto__!==c.__proto__)){a=true}d=c=null;return a})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Abstract={};var Try={these:function(){var d;for(var c=0,f=arguments.length;c<f;c++){var a=arguments[c];try{d=a();break}catch(h){}}return d}};var Class=(function(){var e=(function(){for(var f in {toString:1}){if(f==="toString"){return false}}return true})();function a(){}function c(){var k=null,j=$A(arguments);if(Object.isFunction(j[0])){k=j.shift()}function f(){this.initialize.apply(this,arguments)}Object.extend(f,Class.Methods);f.superclass=k;f.subclasses=[];if(k){a.prototype=k.prototype;f.prototype=new a;k.subclasses.push(f)}for(var h=0,l=j.length;h<l;h++){f.addMethods(j[h])}if(!f.prototype.initialize){f.prototype.initialize=Prototype.emptyFunction}f.prototype.constructor=f;return f}function d(n){var j=this.superclass&&this.superclass.prototype,h=Object.keys(n);if(e){if(n.toString!=Object.prototype.toString){h.push("toString")}if(n.valueOf!=Object.prototype.valueOf){h.push("valueOf")}}for(var f=0,k=h.length;f<k;f++){var m=h[f],l=n[m];if(j&&Object.isFunction(l)&&l.argumentNames()[0]=="$super"){var o=l;l=(function(p){return function(){return j[p].apply(this,arguments)}})(m).wrap(o);l.valueOf=o.valueOf.bind(o);l.toString=o.toString.bind(o)}this.prototype[m]=l}return this}return{create:c,Methods:{addMethods:d}}})();(function(){var G=Object.prototype.toString,F="Null",s="Undefined",z="Boolean",h="Number",w="String",L="Object",x="[object Function]",C="[object Boolean]",j="[object Number]",o="[object String]",k="[object Array]",B="[object Date]",l=window.JSON&&typeof JSON.stringify==="function"&&JSON.stringify(0)==="0"&&typeof JSON.stringify(Prototype.K)==="undefined";function n(N){switch(N){case null:return F;case (void 0):return s}var M=typeof N;switch(M){case"boolean":return z;case"number":return h;case"string":return w}return L}function D(M,O){for(var N in O){M[N]=O[N]}return M}function K(M){try{if(d(M)){return"undefined"}if(M===null){return"null"}return M.inspect?M.inspect():String(M)}catch(N){if(N instanceof RangeError){return"..."}throw N}}function H(M){return J("",{"":M},[])}function J(V,S,T){var U=S[V],R=typeof U;if(n(U)===L&&typeof U.toJSON==="function"){U=U.toJSON(V)}var O=G.call(U);switch(O){case j:case C:case o:U=U.valueOf()}switch(U){case null:return"null";case true:return"true";case false:return"false"}R=typeof U;switch(R){case"string":return U.inspect(true);case"number":return isFinite(U)?String(U):"null";case"object":for(var N=0,M=T.length;N<M;N++){if(T[N]===U){throw new TypeError()}}T.push(U);var Q=[];if(O===k){for(var N=0,M=U.length;N<M;N++){var P=J(N,U,T);Q.push(typeof P==="undefined"?"null":P)}Q="["+Q.join(",")+"]"}else{var W=Object.keys(U);for(var N=0,M=W.length;N<M;N++){var V=W[N],P=J(V,U,T);if(typeof P!=="undefined"){Q.push(V.inspect(true)+":"+P)}}Q="{"+Q.join(",")+"}"}T.pop();return Q}}function A(M){return JSON.stringify(M)}function m(M){return $H(M).toQueryString()}function t(M){return M&&M.toHTML?M.toHTML():String.interpret(M)}function v(M){if(n(M)!==L){throw new TypeError()}var N=[];for(var O in M){if(M.hasOwnProperty(O)){N.push(O)}}return N}function e(M){var N=[];for(var O in M){N.push(M[O])}return N}function E(M){return D({},M)}function y(M){return !!(M&&M.nodeType==1)}function p(M){return G.call(M)===k}var c=(typeof Array.isArray=="function")&&Array.isArray([])&&!Array.isArray({});if(c){p=Array.isArray}function f(M){return M instanceof Hash}function a(M){return G.call(M)===x}function q(M){return G.call(M)===o}function u(M){return G.call(M)===j}function I(M){return G.call(M)===B}function d(M){return typeof M==="undefined"}D(Object,{extend:D,inspect:K,toJSON:l?A:H,toQueryString:m,toHTML:t,keys:Object.keys||v,values:e,clone:E,isElement:y,isArray:p,isHash:f,isFunction:a,isString:q,isNumber:u,isDate:I,isUndefined:d})})();Object.extend(Function.prototype,(function(){var n=Array.prototype.slice;function e(s,o){var q=s.length,p=o.length;while(p--){s[q+p]=o[p]}return s}function l(p,o){p=n.call(p,0);return e(p,o)}function j(){var o=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return o.length==1&&!o[0]?[]:o}function k(q){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var o=this,p=n.call(arguments,1);return function(){var s=l(p,arguments);return o.apply(q,s)}}function h(q){var o=this,p=n.call(arguments,1);return function(t){var s=e([t||window.event],p);return o.apply(q,s)}}function m(){if(!arguments.length){return this}var o=this,p=n.call(arguments,0);return function(){var q=l(p,arguments);return o.apply(this,q)}}function f(q){var o=this,p=n.call(arguments,1);q=q*1000;return window.setTimeout(function(){return o.apply(o,p)},q)}function a(){var o=e([0.01],arguments);return this.delay.apply(this,o)}function d(p){var o=this;return function(){var q=e([o.bind(this)],arguments);return p.apply(this,q)}}function c(){if(this._methodized){return this._methodized}var o=this;return this._methodized=function(){var p=e([this],arguments);return o.apply(null,p)}}return{argumentNames:j,bind:k,bindAsEventListener:h,curry:m,delay:f,defer:a,wrap:d,methodize:c}})());(function(d){function c(){return this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+"Z"}function a(){return this.toISOString()}if(!d.toISOString){d.toISOString=c}if(!d.toJSON){d.toJSON=a}})(Date.prototype);RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(c,a){this.callback=c;this.frequency=a;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},execute:function(){this.callback(this)},stop:function(){if(!this.timer){return}clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();this.currentlyExecuting=false}catch(a){this.currentlyExecuting=false;throw a}}}});Object.extend(String,{interpret:function(a){return a==null?"":String(a)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,(function(){var NATIVE_JSON_PARSE_SUPPORT=window.JSON&&typeof JSON.parse==="function"&&JSON.parse('{"test": true}').test&&false;function prepareReplacement(replacement){if(Object.isFunction(replacement)){return replacement}var template=new Template(replacement);return function(match){return template.evaluate(match)}}function gsub(pattern,replacement){var result="",source=this,match;replacement=prepareReplacement(replacement);if(Object.isString(pattern)){pattern=RegExp.escape(pattern)}if(!(pattern.length||pattern.source)){replacement=replacement("");return replacement+source.split("").join(replacement)+replacement}while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length)}else{result+=source,source=""}}return result}function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0){return match[0]}return replacement(match)})}function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this)}function truncate(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?"...":truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this)}function strip(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"")}function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,"img"),matchOne=new RegExp(Prototype.ScriptFragment,"im");return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||["",""])[1]})}function evalScripts(){return this.extractScripts().map(function(script){return eval(script)})}function escapeHTML(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function unescapeHTML(){return this.stripTags().replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match){return{}}return match[1].split(separator||"&").inject({},function(hash,pair){if((pair=pair.split("="))[0]){var key=decodeURIComponent(pair.shift()),value=pair.length>1?pair.join("="):pair[0];if(value!=undefined){value=decodeURIComponent(value)}if(key in hash){if(!Object.isArray(hash[key])){hash[key]=[hash[key]]}hash[key].push(value)}else{hash[key]=value}}return hash})}function toArray(){return this.split("")}function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function times(count){return count<1?"":new Array(count+1).join(this)}function camelize(){return this.replace(/-+(.)?/g,function(match,chr){return chr?chr.toUpperCase():""})}function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function underscore(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase()}function dasherize(){return this.replace(/_/g,"-")}function inspect(useDoubleQuotes){var escapedString=this.replace(/[\x00-\x1f\\]/g,function(character){if(character in String.specialChar){return String.specialChar[character]}return"\\u00"+character.charCodeAt().toPaddedString(2,16)});if(useDoubleQuotes){return'"'+escapedString.replace(/"/g,'\\"')+'"'}return"'"+escapedString.replace(/'/g,"\\'")+"'"}function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,"$1")}function isJSON(){var str=this;if(str.blank()){return false}str=str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@");str=str.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");str=str.replace(/(?:^|:|,)(?:\s*\[)+/g,"");return(/^[\],:{}\s]*$/).test(str)}function evalJSON(sanitize){var json=this.unfilterJSON(),cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;if(cx.test(json)){json=json.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function parseJSON(){var json=this.unfilterJSON();return JSON.parse(json)}function include(pattern){return this.indexOf(pattern)>-1}function startsWith(pattern){return this.lastIndexOf(pattern,0)===0}function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.indexOf(pattern,d)===d}function empty(){return this==""}function blank(){return/^\s*$/.test(this)}function interpolate(object,pattern){return new Template(this,pattern).evaluate(object)}return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim||strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:NATIVE_JSON_PARSE_SUPPORT?parseJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate}})());var Template=Class.create({initialize:function(a,c){this.template=a.toString();this.pattern=c||Template.Pattern},evaluate:function(a){if(a&&Object.isFunction(a.toTemplateReplacements)){a=a.toTemplateReplacements()}return this.template.gsub(this.pattern,function(e){if(a==null){return(e[1]+"")}var h=e[1]||"";if(h=="\\"){return e[2]}var c=a,j=e[3],f=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;e=f.exec(j);if(e==null){return h}while(e!=null){var d=e[1].startsWith("[")?e[2].replace(/\\\\]/g,"]"):e[1];c=c[d];if(null==c||""==e[3]){break}j=j.substring("["==e[3]?e[1].length:e[0].length);e=f.exec(j)}return h+String.interpret(c)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function d(C,B){var A=0;try{this._each(function(E){C.call(B,E,A++)})}catch(D){if(D!=$break){throw D}}return this}function v(D,C,B){var A=-D,E=[],F=this.toArray();if(D<1){return F}while((A+=D)<F.length){E.push(F.slice(A,A+D))}return E.collect(C,B)}function c(C,B){C=C||Prototype.K;var A=true;this.each(function(E,D){A=A&&!!C.call(B,E,D);if(!A){throw $break}});return A}function l(C,B){C=C||Prototype.K;var A=false;this.each(function(E,D){if(A=!!C.call(B,E,D)){throw $break}});return A}function m(C,B){C=C||Prototype.K;var A=[];this.each(function(E,D){A.push(C.call(B,E,D))});return A}function x(C,B){var A;this.each(function(E,D){if(C.call(B,E,D)){A=E;throw $break}});return A}function k(C,B){var A=[];this.each(function(E,D){if(C.call(B,E,D)){A.push(E)}});return A}function j(D,C,B){C=C||Prototype.K;var A=[];if(Object.isString(D)){D=new RegExp(RegExp.escape(D))}this.each(function(F,E){if(D.match(F)){A.push(C.call(B,F,E))}});return A}function a(A){if(Object.isFunction(this.indexOf)){if(this.indexOf(A)!=-1){return true}}var B=false;this.each(function(C){if(C==A){B=true;throw $break}});return B}function u(B,A){A=Object.isUndefined(A)?null:A;return this.eachSlice(B,function(C){while(C.length<B){C.push(A)}return C})}function o(A,C,B){this.each(function(E,D){A=C.call(B,A,E,D)});return A}function z(B){var A=$A(arguments).slice(1);return this.map(function(C){return C[B].apply(C,A)})}function t(C,B){C=C||Prototype.K;var A;this.each(function(E,D){E=C.call(B,E,D);if(A==null||E>=A){A=E}});return A}function q(C,B){C=C||Prototype.K;var A;this.each(function(E,D){E=C.call(B,E,D);if(A==null||E<A){A=E}});return A}function f(D,B){D=D||Prototype.K;var C=[],A=[];this.each(function(F,E){(D.call(B,F,E)?C:A).push(F)});return[C,A]}function h(B){var A=[];this.each(function(C){A.push(C[B])});return A}function e(C,B){var A=[];this.each(function(E,D){if(!C.call(B,E,D)){A.push(E)}});return A}function p(B,A){return this.map(function(D,C){return{value:D,criteria:B.call(A,D,C)}}).sort(function(F,E){var D=F.criteria,C=E.criteria;return D<C?-1:D>C?1:0}).pluck("value")}function s(){return this.map()}function w(){var B=Prototype.K,A=$A(arguments);if(Object.isFunction(A.last())){B=A.pop()}var C=[this].concat(A).map($A);return this.map(function(E,D){return B(C.pluck(D))})}function n(){return this.toArray().length}function y(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:d,eachSlice:v,all:c,every:c,any:l,some:l,collect:m,map:m,detect:x,findAll:k,select:k,filter:k,grep:j,include:a,member:a,inGroupsOf:u,inject:o,invoke:z,max:t,min:q,partition:f,pluck:h,reject:e,sortBy:p,toArray:s,entries:s,zip:w,size:n,inspect:y,find:x}})();function $A(d){if(!d){return[]}if("toArray" in Object(d)){return d.toArray()}var c=d.length||0,a=new Array(c);while(c--){a[c]=d[c]}return a}function $w(a){if(!Object.isString(a)){return[]}a=a.strip();return a?a.split(/\s+/):[]}Array.from=$A;(function(){var v=Array.prototype,p=v.slice,s=v.forEach;function c(A,z){for(var y=0,B=this.length>>>0;y<B;y++){if(y in this){A.call(z,this[y],y,this)}}}if(!s){s=c}function o(){this.length=0;return this}function e(){return this[0]}function j(){return this[this.length-1]}function l(){return this.select(function(y){return y!=null})}function x(){return this.inject([],function(z,y){if(Object.isArray(y)){return z.concat(y.flatten())}z.push(y);return z})}function k(){var y=p.call(arguments,0);return this.select(function(z){return !y.include(z)})}function h(y){return(y===false?this.toArray():this)._reverse()}function n(y){return this.inject([],function(B,A,z){if(0==z||(y?B.last()!=A:!B.include(A))){B.push(A)}return B})}function t(y){return this.uniq().findAll(function(z){return y.detect(function(A){return z===A})})}function u(){return p.call(this,0)}function m(){return this.length}function w(){return"["+this.map(Object.inspect).join(", ")+"]"}function a(A,y){y||(y=0);var z=this.length;if(y<0){y=z+y}for(;y<z;y++){if(this[y]===A){return y}}return -1}function q(z,y){y=isNaN(y)?this.length:(y<0?this.length+y:y)+1;var A=this.slice(0,y).reverse().indexOf(z);return(A<0)?A:y-A-1}function d(){var D=p.call(this,0),B;for(var z=0,A=arguments.length;z<A;z++){B=arguments[z];if(Object.isArray(B)&&!("callee" in B)){for(var y=0,C=B.length;y<C;y++){D.push(B[y])}}else{D.push(B)}}return D}Object.extend(v,Enumerable);if(!v._reverse){v._reverse=v.reverse}Object.extend(v,{_each:s,clear:o,first:e,last:j,compact:l,flatten:x,without:k,reverse:h,uniq:n,intersect:t,clone:u,toArray:u,size:m,inspect:w});var f=(function(){return[].concat(arguments)[0][0]!==1})(1,2);if(f){v.concat=d}if(!v.indexOf){v.indexOf=a}if(!v.lastIndexOf){v.lastIndexOf=q}})();function $H(a){return new Hash(a)}var Hash=Class.create(Enumerable,(function(){function f(t){this._object=Object.isHash(t)?t.toObject():Object.clone(t)}function h(u){for(var t in this._object){var v=this._object[t],w=[t,v];w.key=t;w.value=v;u(w)}}function m(t,u){return this._object[t]=u}function d(t){if(this._object[t]!==Object.prototype[t]){return this._object[t]}}function p(t){var u=this._object[t];delete this._object[t];return u}function s(){return Object.clone(this._object)}function q(){return this.pluck("key")}function o(){return this.pluck("value")}function j(u){var t=this.detect(function(v){return v.value===u});return t&&t.key}function l(t){return this.clone().update(t)}function e(t){return new Hash(t).inject(this,function(u,v){u.set(v.key,v.value);return u})}function c(t,u){if(Object.isUndefined(u)){return t}return t+"="+encodeURIComponent(String.interpret(u))}function a(){return this.inject([],function(x,A){var w=encodeURIComponent(A.key),u=A.value;if(u&&typeof u=="object"){if(Object.isArray(u)){var z=[];for(var v=0,t=u.length,y;v<t;v++){y=u[v];z.push(c(w,y))}return x.concat(z)}}else{x.push(c(w,u))}return x}).join("&")}function n(){return"#<Hash:{"+this.map(function(t){return t.map(Object.inspect).join(": ")}).join(", ")+"}>"}function k(){return new Hash(this)}return{initialize:f,_each:h,set:m,get:d,unset:p,toObject:s,toTemplateReplacements:s,keys:q,values:o,index:j,merge:l,update:e,toQueryString:a,inspect:n,toJSON:s,clone:k}})());Hash.from=$H;Object.extend(Number.prototype,(function(){function e(){return this.toPaddedString(2,16)}function c(){return this+1}function k(m,l){$R(0,this,true).each(m,l);return this}function j(n,m){var l=this.toString(m||10);return"0".times(n-l.length)+l}function a(){return Math.abs(this)}function d(){return Math.round(this)}function f(){return Math.ceil(this)}function h(){return Math.floor(this)}return{toColorPart:e,succ:c,times:k,toPaddedString:j,abs:a,round:d,ceil:f,floor:h}})());function $R(d,a,c){return new ObjectRange(d,a,c)}var ObjectRange=Class.create(Enumerable,(function(){function c(h,e,f){this.start=h;this.end=e;this.exclusive=f}function d(e){var f=this.start;while(this.include(f)){e(f);f=f.succ()}}function a(e){if(e<this.start){return false}if(this.exclusive){return e<this.end}return e<=this.end}return{initialize:c,_each:d,include:a}})());var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(a){this.responders._each(a)},register:function(a){if(!this.include(a)){this.responders.push(a)}},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(e,c,d,a){this.each(function(f){if(Object.isFunction(f[e])){try{f[e].apply(f,[c,d,a])}catch(h){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(a){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,a||{});this.options.method=this.options.method.toLowerCase();if(Object.isHash(this.options.parameters)){this.options.parameters=this.options.parameters.toObject()}}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,c,a){$super(a);this.transport=Ajax.getTransport();this.request(c)},request:function(c){this.url=c;this.method=this.options.method;var f=Object.isString(this.options.parameters)?this.options.parameters:Object.toQueryString(this.options.parameters);if(!["get","post"].include(this.method)){f+=(f?"&":"")+"_method="+this.method;this.method="post"}if(f&&this.method==="get"){this.url+=(this.url.include("?")?"&":"?")+f}this.parameters=f.toQueryParams();try{var a=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(a)}Ajax.Responders.dispatch("onCreate",this,a);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||f):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(d){this.dispatchException(d)}},onStateChange:function(){var a=this.transport.readyState;if(a>1&&!((a==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var f={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){f["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){f.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var d=this.options.requestHeaders;if(Object.isFunction(d.push)){for(var c=0,e=d.length;c<e;c+=2){f[d[c]]=d[c+1]}}else{$H(d).each(function(h){f[h.key]=h.value})}}for(var a in f){this.transport.setRequestHeader(a,f[a])}},success:function(){var a=this.getStatus();return !a||(a>=200&&a<300)||a==304},getStatus:function(){try{if(this.transport.status===1223){return 204}return this.transport.status||0}catch(a){return 0}},respondToReadyState:function(a){var d=Ajax.Request.Events[a],c=new Ajax.Response(this);if(d=="Complete"){try{this._complete=true;(this.options["on"+c.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(c,c.headerJSON)}catch(f){this.dispatchException(f)}var h=c.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&h&&h.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+d]||Prototype.emptyFunction)(c,c.headerJSON);Ajax.Responders.dispatch("on"+d,this,c,c.headerJSON)}catch(f){this.dispatchException(f)}if(d=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},isSameOrigin:function(){var a=this.url.match(/^\s*https?:\/\/[^\/]*/);return !a||(a[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))},getHeader:function(a){try{return this.transport.getResponseHeader(a)||null}catch(c){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(a){(this.options.onException||Prototype.emptyFunction)(this,a);Ajax.Responders.dispatch("onException",this,a)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(d){this.request=d;var e=this.transport=d.transport,a=this.readyState=e.readyState;if((a>2&&!Prototype.Browser.IE)||a==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(e.responseText);this.headerJSON=this._getHeaderJSON()}if(a==4){var c=e.responseXML;this.responseXML=Object.isUndefined(c)?null:c;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(a){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(a){return null}},getResponseHeader:function(a){return this.transport.getResponseHeader(a)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var a=this.getHeader("X-JSON");if(!a){return null}a=decodeURIComponent(escape(a));try{return a.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(c){this.request.dispatchException(c)}},_getResponseJSON:function(){var a=this.request.options;if(!a.evalJSON||(a.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(a.sanitizeJSON||!this.request.isSameOrigin())}catch(c){this.request.dispatchException(c)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,a,d,c){this.container={success:(a.success||a),failure:(a.failure||(a.success?null:a))};c=Object.clone(c);var e=c.onComplete;c.onComplete=(function(f,h){this.updateContent(f.responseText);if(Object.isFunction(e)){e(f,h)}}).bind(this);$super(d,c)},updateContent:function(e){var d=this.container[this.success()?"success":"failure"],a=this.options;if(!a.evalScripts){e=e.stripScripts()}if(d=$(d)){if(a.insertion){if(Object.isString(a.insertion)){var c={};c[a.insertion]=e;d.insert(c)}else{a.insertion(d,e)}}else{d.update(e)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,a,d,c){$super(c);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=a;this.url=d;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},updateComplete:function(a){if(this.options.decay){this.decay=(a.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=a.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(c){if(arguments.length>1){for(var a=0,e=[],d=arguments.length;a<d;a++){e.push($(arguments[a]))}return e}if(Object.isString(c)){c=document.getElementById(c)}return Element.extend(c)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(h,a){var d=[];var f=document.evaluate(h,$(a)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var c=0,e=f.snapshotLength;c<e;c++){d.push(Element.extend(f.snapshotItem(c)))}return d}}if(!Node){var Node={}}if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}(function(d){function e(h,f){if(h==="select"){return false}if("type" in f){return false}return true}var c=(function(){try{var f=document.createElement('<input name="x">');return f.tagName.toLowerCase()==="input"&&f.name==="x"}catch(h){return false}})();var a=d.Element;d.Element=function(j,h){h=h||{};j=j.toLowerCase();var f=Element.cache;if(c&&h.name){j="<"+j+' name="'+h.name+'">';delete h.name;return Element.writeAttribute(document.createElement(j),h)}if(!f[j]){f[j]=Element.extend(document.createElement(j))}var k=e(j,h)?f[j].cloneNode(false):document.createElement(j);return Element.writeAttribute(k,h)};Object.extend(d.Element,a||{});if(a){d.Element.prototype=a.prototype}})(this);Element.idCounter=1;Element.cache={};Element._purgeElement=function(c){var a=c._prototypeUID;if(a){Element.stopObserving(c);c._prototypeUID=void 0;delete Element.Storage[a]}};Element.Methods={visible:function(a){return $(a).style.display!="none"},toggle:function(a){a=$(a);Element[Element.visible(a)?"hide":"show"](a);return a},hide:function(a){a=$(a);a.style.display="none";return a},show:function(a){a=$(a);a.style.display="";return a},remove:function(a){a=$(a);a.parentNode.removeChild(a);return a},update:(function(){var e=(function(){var j=document.createElement("select"),k=true;j.innerHTML='<option value="test">test</option>';if(j.options&&j.options[0]){k=j.options[0].nodeName.toUpperCase()!=="OPTION"}j=null;return k})();var c=(function(){try{var j=document.createElement("table");if(j&&j.tBodies){j.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var l=typeof j.tBodies[0]=="undefined";j=null;return l}}catch(k){return true}})();var a=(function(){try{var j=document.createElement("div");j.innerHTML="<link>";var l=(j.childNodes.length===0);j=null;return l}catch(k){return true}})();var d=e||c||a;var h=(function(){var j=document.createElement("script"),l=false;try{j.appendChild(document.createTextNode(""));l=!j.firstChild||j.firstChild&&j.firstChild.nodeType!==3}catch(k){l=true}j=null;return l})();function f(n,o){n=$(n);var j=Element._purgeElement;var p=n.getElementsByTagName("*"),m=p.length;while(m--){j(p[m])}if(o&&o.toElement){o=o.toElement()}if(Object.isElement(o)){return n.update().insert(o)}o=Object.toHTML(o);var l=n.tagName.toUpperCase();if(l==="SCRIPT"&&h){n.text=o;return n}if(d){if(l in Element._insertionTranslations.tags){while(n.firstChild){n.removeChild(n.firstChild)}Element._getContentFromAnonymousElement(l,o.stripScripts()).each(function(q){n.appendChild(q)})}else{if(a&&Object.isString(o)&&o.indexOf("<link")>-1){while(n.firstChild){n.removeChild(n.firstChild)}var k=Element._getContentFromAnonymousElement(l,o.stripScripts(),true);k.each(function(q){n.appendChild(q)})}else{n.innerHTML=o.stripScripts()}}}else{n.innerHTML=o.stripScripts()}o.evalScripts.bind(o).defer();return n}return f})(),replace:function(c,d){c=$(c);if(d&&d.toElement){d=d.toElement()}else{if(!Object.isElement(d)){d=Object.toHTML(d);var a=c.ownerDocument.createRange();a.selectNode(c);d.evalScripts.bind(d).defer();d=a.createContextualFragment(d.stripScripts())}}c.parentNode.replaceChild(d,c);return c},insert:function(d,f){d=$(d);if(Object.isString(f)||Object.isNumber(f)||Object.isElement(f)||(f&&(f.toElement||f.toHTML))){f={bottom:f}}var e,h,c,j;for(var a in f){e=f[a];a=a.toLowerCase();h=Element._insertionTranslations[a];if(e&&e.toElement){e=e.toElement()}if(Object.isElement(e)){h(d,e);continue}e=Object.toHTML(e);c=((a=="before"||a=="after")?d.parentNode:d).tagName.toUpperCase();j=Element._getContentFromAnonymousElement(c,e.stripScripts());if(a=="top"||a=="after"){j.reverse()}j.each(h.curry(d));e.evalScripts.bind(e).defer()}return d},wrap:function(c,d,a){c=$(c);if(Object.isElement(d)){$(d).writeAttribute(a||{})}else{if(Object.isString(d)){d=new Element(d,a)}else{d=new Element("div",d)}}if(c.parentNode){c.parentNode.replaceChild(d,c)}d.appendChild(c);return d},inspect:function(c){c=$(c);var a="<"+c.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(h){var f=h.first(),d=h.last(),e=(c[f]||"").toString();if(e){a+=" "+d+"="+e.inspect(true)}});return a+">"},recursivelyCollect:function(a,d,e){a=$(a);e=e||-1;var c=[];while(a=a[d]){if(a.nodeType==1){c.push(Element.extend(a))}if(c.length==e){break}}return c},ancestors:function(a){return Element.recursivelyCollect(a,"parentNode")},descendants:function(a){return Element.select(a,"*")},firstDescendant:function(a){a=$(a).firstChild;while(a&&a.nodeType!=1){a=a.nextSibling}return $(a)},immediateDescendants:function(c){var a=[],d=$(c).firstChild;while(d){if(d.nodeType===1){a.push(Element.extend(d))}d=d.nextSibling}return a},previousSiblings:function(a,c){return Element.recursivelyCollect(a,"previousSibling")},nextSiblings:function(a){return Element.recursivelyCollect(a,"nextSibling")},siblings:function(a){a=$(a);return Element.previousSiblings(a).reverse().concat(Element.nextSiblings(a))},match:function(c,a){c=$(c);if(Object.isString(a)){return Prototype.Selector.match(c,a)}return a.match(c)},up:function(c,e,a){c=$(c);if(arguments.length==1){return $(c.parentNode)}var d=Element.ancestors(c);return Object.isNumber(e)?d[e]:Prototype.Selector.find(d,e,a)},down:function(c,d,a){c=$(c);if(arguments.length==1){return Element.firstDescendant(c)}return Object.isNumber(d)?Element.descendants(c)[d]:Element.select(c,d)[a||0]},previous:function(c,d,a){c=$(c);if(Object.isNumber(d)){a=d,d=false}if(!Object.isNumber(a)){a=0}if(d){return Prototype.Selector.find(c.previousSiblings(),d,a)}else{return c.recursivelyCollect("previousSibling",a+1)[a]}},next:function(c,e,a){c=$(c);if(Object.isNumber(e)){a=e,e=false}if(!Object.isNumber(a)){a=0}if(e){return Prototype.Selector.find(c.nextSiblings(),e,a)}else{var d=Object.isNumber(a)?a+1:1;return c.recursivelyCollect("nextSibling",a+1)[a]}},select:function(a){a=$(a);var c=Array.prototype.slice.call(arguments,1).join(", ");return Prototype.Selector.select(c,a)},adjacent:function(a){a=$(a);var c=Array.prototype.slice.call(arguments,1).join(", ");return Prototype.Selector.select(c,a.parentNode).without(a)},identify:function(a){a=$(a);var c=Element.readAttribute(a,"id");if(c){return c}do{c="anonymous_element_"+Element.idCounter++}while($(c));Element.writeAttribute(a,"id",c);return c},readAttribute:function(d,a){d=$(d);if(Prototype.Browser.IE){var c=Element._attributeTranslations.read;if(c.values[a]){return c.values[a](d,a)}if(c.names[a]){a=c.names[a]}if(a.include(":")){return(!d.attributes||!d.attributes[a])?null:d.attributes[a].value}}return d.getAttribute(a)},writeAttribute:function(f,d,h){f=$(f);var c={},e=Element._attributeTranslations.write;if(typeof d=="object"){c=d}else{c[d]=Object.isUndefined(h)?true:h}for(var a in c){d=e.names[a]||a;h=c[a];if(e.values[a]){d=e.values[a](f,h)}if(h===false||h===null){f.removeAttribute(d)}else{if(h===true){f.setAttribute(d,d)}else{f.setAttribute(d,h)}}}return f},getHeight:function(a){return Element.getDimensions(a).height},getWidth:function(a){return Element.getDimensions(a).width},classNames:function(a){return new Element.ClassNames(a)},hasClassName:function(a,c){if(!(a=$(a))){return}var d=a.className;return(d.length>0&&(d==c||new RegExp("(^|\\s)"+c+"(\\s|$)").test(d)))},addClassName:function(a,c){if(!(a=$(a))){return}if(!Element.hasClassName(a,c)){a.className+=(a.className?" ":"")+c}return a},removeClassName:function(a,c){if(!(a=$(a))){return}a.className=a.className.replace(new RegExp("(^|\\s+)"+c+"(\\s+|$)")," ").strip();return a},toggleClassName:function(a,c){if(!(a=$(a))){return}return Element[Element.hasClassName(a,c)?"removeClassName":"addClassName"](a,c)},cleanWhitespace:function(c){c=$(c);var d=c.firstChild;while(d){var a=d.nextSibling;if(d.nodeType==3&&!/\S/.test(d.nodeValue)){c.removeChild(d)}d=a}return c},empty:function(a){return $(a).innerHTML.blank()},descendantOf:function(c,a){c=$(c),a=$(a);if(c.compareDocumentPosition){return(c.compareDocumentPosition(a)&8)===8}if(a.contains){return a.contains(c)&&a!==c}while(c=c.parentNode){if(c==a){return true}}return false},scrollTo:function(a){a=$(a);var c=Element.cumulativeOffset(a);window.scrollTo(c[0],c[1]);return a},getStyle:function(c,d){c=$(c);d=d=="float"?"cssFloat":d.camelize();var e=c.style[d];if(!e||e=="auto"){var a=document.defaultView.getComputedStyle(c,null);e=a?a[d]:null}if(d=="opacity"){return e?parseFloat(e):1}return e=="auto"?null:e},getOpacity:function(a){return $(a).getStyle("opacity")},setStyle:function(c,d){c=$(c);var f=c.style,a;if(Object.isString(d)){c.style.cssText+=";"+d;return d.include("opacity")?c.setOpacity(d.match(/opacity:\s*(\d?\.?\d*)/)[1]):c}for(var e in d){if(e=="opacity"){c.setOpacity(d[e])}else{f[(e=="float"||e=="cssFloat")?(Object.isUndefined(f.styleFloat)?"cssFloat":"styleFloat"):e]=d[e]}}return c},setOpacity:function(a,c){a=$(a);a.style.opacity=(c==1||c==="")?"":(c<0.00001)?0:c;return a},makePositioned:function(a){a=$(a);var c=Element.getStyle(a,"position");if(c=="static"||!c){a._madePositioned=true;a.style.position="relative";if(Prototype.Browser.Opera){a.style.top=0;a.style.left=0}}return a},undoPositioned:function(a){a=$(a);if(a._madePositioned){a._madePositioned=undefined;a.style.position=a.style.top=a.style.left=a.style.bottom=a.style.right=""}return a},makeClipping:function(a){a=$(a);if(a._overflow){return a}a._overflow=Element.getStyle(a,"overflow")||"auto";if(a._overflow!=="hidden"){a.style.overflow="hidden"}return a},undoClipping:function(a){a=$(a);if(!a._overflow){return a}a.style.overflow=a._overflow=="auto"?"":a._overflow;a._overflow=null;return a},clonePosition:function(c,e){var a=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});e=$(e);var f=Element.viewportOffset(e),h=[0,0],d=null;c=$(c);if(Element.getStyle(c,"position")=="absolute"){d=Element.getOffsetParent(c);h=Element.viewportOffset(d)}if(d==document.body){h[0]-=document.body.offsetLeft;h[1]-=document.body.offsetTop}if(a.setLeft){c.style.left=(f[0]-h[0]+a.offsetLeft)+"px"}if(a.setTop){c.style.top=(f[1]-h[1]+a.offsetTop)+"px"}if(a.setWidth){c.style.width=e.offsetWidth+"px"}if(a.setHeight){c.style.height=e.offsetHeight+"px"}return c}};Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(e,c,d){switch(d){case"height":case"width":if(!Element.visible(c)){return null}var f=parseInt(e(c,d),10);if(f!==c["offset"+d.capitalize()]){return f+"px"}var a;if(d==="height"){a=["border-top-width","padding-top","padding-bottom","border-bottom-width"]}else{a=["border-left-width","padding-left","padding-right","border-right-width"]}return a.inject(f,function(h,j){var k=e(c,j);return k===null?h:h-parseInt(k,10)})+"px";default:return e(c,d)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(d,a,c){if(c==="title"){return a.title}return d(a,c)})}else{if(Prototype.Browser.IE){Element.Methods.getStyle=function(a,c){a=$(a);c=(c=="float"||c=="cssFloat")?"styleFloat":c.camelize();var d=a.style[c];if(!d&&a.currentStyle){d=a.currentStyle[c]}if(c=="opacity"){if(d=(a.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(d[1]){return parseFloat(d[1])/100}}return 1}if(d=="auto"){if((c=="width"||c=="height")&&(a.getStyle("display")!="none")){return a["offset"+c.capitalize()]+"px"}return null}return d};Element.Methods.setOpacity=function(c,f){function h(j){return j.replace(/alpha\([^\)]*\)/gi,"")}c=$(c);var a=c.currentStyle;if((a&&!a.hasLayout)||(!a&&c.style.zoom=="normal")){c.style.zoom=1}var e=c.getStyle("filter"),d=c.style;if(f==1||f===""){(e=h(e))?d.filter=e:d.removeAttribute("filter");return c}else{if(f<0.00001){f=0}}d.filter=h(e)+"alpha(opacity="+(f*100)+")";return c};Element._attributeTranslations=(function(){var c="className",a="for",d=document.createElement("div");d.setAttribute(c,"x");if(d.className!=="x"){d.setAttribute("class","x");if(d.className==="x"){c="class"}}d=null;d=document.createElement("label");d.setAttribute(a,"x");if(d.htmlFor!=="x"){d.setAttribute("htmlFor","x");if(d.htmlFor==="x"){a="htmlFor"}}d=null;return{read:{names:{"class":c,className:c,"for":a,htmlFor:a},values:{_getAttr:function(e,f){return e.getAttribute(f)},_getAttr2:function(e,f){return e.getAttribute(f,2)},_getAttrNode:function(e,h){var f=e.getAttributeNode(h);return f?f.value:""},_getEv:(function(){var e=document.createElement("div"),j;e.onclick=Prototype.emptyFunction;var h=e.getAttribute("onclick");if(String(h).indexOf("{")>-1){j=function(f,k){k=f.getAttribute(k);if(!k){return null}k=k.toString();k=k.split("{")[1];k=k.split("}")[0];return k.strip()}}else{if(h===""){j=function(f,k){k=f.getAttribute(k);if(!k){return null}return k.strip()}}}e=null;return j})(),_flag:function(e,f){return $(e).hasAttribute(f)?f:null},style:function(e){return e.style.cssText.toLowerCase()},title:function(e){return e.title}}}}})();Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(a,c){a.checked=!!c},style:function(a,c){a.style.cssText=c?c:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(a){Element._attributeTranslations.write.names[a.toLowerCase()]=a;Element._attributeTranslations.has[a.toLowerCase()]=a});(function(a){Object.extend(a,{href:a._getAttr2,src:a._getAttr2,type:a._getAttr,action:a._getAttrNode,disabled:a._flag,checked:a._flag,readonly:a._flag,multiple:a._flag,onload:a._getEv,onunload:a._getEv,onclick:a._getEv,ondblclick:a._getEv,onmousedown:a._getEv,onmouseup:a._getEv,onmouseover:a._getEv,onmousemove:a._getEv,onmouseout:a._getEv,onfocus:a._getEv,onblur:a._getEv,onkeypress:a._getEv,onkeydown:a._getEv,onkeyup:a._getEv,onsubmit:a._getEv,onreset:a._getEv,onselect:a._getEv,onchange:a._getEv})})(Element._attributeTranslations.read.values);if(Prototype.BrowserFeatures.ElementExtensions){(function(){function a(f){var c=f.getElementsByTagName("*"),e=[];for(var d=0,h;h=c[d];d++){if(h.tagName!=="!"){e.push(h)}}return e}Element.Methods.down=function(d,e,c){d=$(d);if(arguments.length==1){return d.firstDescendant()}return Object.isNumber(e)?a(d)[e]:Element.select(d,e)[c||0]}})()}}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(a,c){a=$(a);a.style.opacity=(c==1)?0.999999:(c==="")?"":(c<0.00001)?0:c;return a}}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(a,c){a=$(a);a.style.opacity=(c==1||c==="")?"":(c<0.00001)?0:c;if(c==1){if(a.tagName.toUpperCase()=="IMG"&&a.width){a.width++;a.width--}else{try{var f=document.createTextNode(" ");a.appendChild(f);a.removeChild(f)}catch(d){}}}return a}}}}}if("outerHTML" in document.documentElement){Element.Methods.replace=function(d,f){d=$(d);if(f&&f.toElement){f=f.toElement()}if(Object.isElement(f)){d.parentNode.replaceChild(f,d);return d}f=Object.toHTML(f);var e=d.parentNode,c=e.tagName.toUpperCase();if(Element._insertionTranslations.tags[c]){var h=d.next(),a=Element._getContentFromAnonymousElement(c,f.stripScripts());e.removeChild(d);if(h){a.each(function(j){e.insertBefore(j,h)})}else{a.each(function(j){e.appendChild(j)})}}else{d.outerHTML=f.stripScripts()}f.evalScripts.bind(f).defer();return d}}Element._returnOffset=function(c,d){var a=[c,d];a.left=c;a.top=d;return a};Element._getContentFromAnonymousElement=function(f,e,h){var j=new Element("div"),d=Element._insertionTranslations.tags[f];var a=false;if(d){a=true}else{if(h){a=true;d=["","",0]}}if(a){j.innerHTML="&nbsp;"+d[0]+e+d[1];j.removeChild(j.firstChild);for(var c=d[2];c--;){j=j.firstChild}}else{j.innerHTML=e}return $A(j.childNodes)};Element._insertionTranslations={before:function(a,c){a.parentNode.insertBefore(c,a)},top:function(a,c){a.insertBefore(c,a.firstChild)},bottom:function(a,c){a.appendChild(c)},after:function(a,c){a.parentNode.insertBefore(c,a.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};(function(){var a=Element._insertionTranslations.tags;Object.extend(a,{THEAD:a.TBODY,TFOOT:a.TBODY,TH:a.TD})})();Element.Methods.Simulated={hasAttribute:function(a,d){d=Element._attributeTranslations.has[d]||d;var c=$(a).getAttributeNode(d);return !!(c&&c.specified)}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);(function(a){if(!Prototype.BrowserFeatures.ElementExtensions&&a.__proto__){window.HTMLElement={};window.HTMLElement.prototype=a.__proto__;Prototype.BrowserFeatures.ElementExtensions=true}a=null})(document.createElement("div"));Element.extend=(function(){function d(j){if(typeof window.Element!="undefined"){var l=window.Element.prototype;if(l){var n="_"+(Math.random()+"").slice(2),k=document.createElement(j);l[n]="x";var m=(k[n]!=="x");delete l[n];k=null;return m}}return false}function c(k,j){for(var m in j){var l=j[m];if(Object.isFunction(l)&&!(m in k)){k[m]=l.methodize()}}}var e=d("object");if(Prototype.BrowserFeatures.SpecificElementExtensions){if(e){return function(k){if(k&&typeof k._extendedByPrototype=="undefined"){var j=k.tagName;if(j&&(/^(?:object|applet|embed)$/i.test(j))){c(k,Element.Methods);c(k,Element.Methods.Simulated);c(k,Element.Methods.ByTag[j.toUpperCase()])}}return k}}return Prototype.K}var a={},f=Element.Methods.ByTag;var h=Object.extend(function(l){if(!l||typeof l._extendedByPrototype!="undefined"||l.nodeType!=1||l==window){return l}var j=Object.clone(a),k=l.tagName.toUpperCase();if(f[k]){Object.extend(j,f[k])}c(l,j);l._extendedByPrototype=Prototype.emptyFunction;return l},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(a,Element.Methods);Object.extend(a,Element.Methods.Simulated)}}});h.refresh();return h})();if(document.documentElement.hasAttribute){Element.hasAttribute=function(a,c){return a.hasAttribute(c)}}else{Element.hasAttribute=Element.Methods.Simulated.hasAttribute}Element.addMethods=function(d){var l=Prototype.BrowserFeatures,e=Element.Methods.ByTag;if(!d){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(Element.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods),BUTTON:Object.clone(Form.Element.Methods)})}if(arguments.length==2){var c=d;d=arguments[1]}if(!c){Object.extend(Element.Methods,d||{})}else{if(Object.isArray(c)){c.each(j)}else{j(c)}}function j(n){n=n.toUpperCase();if(!Element.Methods.ByTag[n]){Element.Methods.ByTag[n]={}}Object.extend(Element.Methods.ByTag[n],d)}function a(p,o,n){n=n||false;for(var s in p){var q=p[s];if(!Object.isFunction(q)){continue}if(!n||!(s in o)){o[s]=q.methodize()}}}function f(q){var n;var p={OPTGROUP:"OptGroup",TEXTAREA:"TextArea",P:"Paragraph",FIELDSET:"FieldSet",UL:"UList",OL:"OList",DL:"DList",DIR:"Directory",H1:"Heading",H2:"Heading",H3:"Heading",H4:"Heading",H5:"Heading",H6:"Heading",Q:"Quote",INS:"Mod",DEL:"Mod",A:"Anchor",IMG:"Image",CAPTION:"TableCaption",COL:"TableCol",COLGROUP:"TableCol",THEAD:"TableSection",TFOOT:"TableSection",TBODY:"TableSection",TR:"TableRow",TH:"TableCell",TD:"TableCell",FRAMESET:"FrameSet",IFRAME:"IFrame"};if(p[q]){n="HTML"+p[q]+"Element"}if(window[n]){return window[n]}n="HTML"+q+"Element";if(window[n]){return window[n]}n="HTML"+q.capitalize()+"Element";if(window[n]){return window[n]}var o=document.createElement(q),s=o.__proto__||o.constructor.prototype;o=null;return s}var k=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(l.ElementExtensions){a(Element.Methods,k);a(Element.Methods.Simulated,k,true)}if(l.SpecificElementExtensions){for(var m in Element.Methods.ByTag){var h=f(m);if(Object.isUndefined(h)){continue}a(e[m],h.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){return{width:this.getWidth(),height:this.getHeight()}},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};(function(c){var j=Prototype.Browser,f=document,d,e={};function a(){if(j.WebKit&&!f.evaluate){return document}if(j.Opera&&window.parseFloat(window.opera.version())<9.5){return document.body}return document.documentElement}function h(k){if(!d){d=a()}e[k]="client"+k;c["get"+k]=function(){return d[e[k]]};return c["get"+k]()}c.getWidth=h.curry("Width");c.getHeight=h.curry("Height")})(document.viewport);Element.Storage={UID:1};Element.addMethods({getStorage:function(c){if(!(c=$(c))){return}var a;if(c===window){a=0}else{if(typeof c._prototypeUID==="undefined"){c._prototypeUID=Element.Storage.UID++}a=c._prototypeUID}if(!Element.Storage[a]){Element.Storage[a]=$H()}return Element.Storage[a]},store:function(c,a,d){if(!(c=$(c))){return}if(arguments.length===2){Element.getStorage(c).update(a)}else{Element.getStorage(c).set(a,d)}return c},retrieve:function(d,c,a){if(!(d=$(d))){return}var f=Element.getStorage(d),e=f.get(c);if(Object.isUndefined(e)){f.set(c,a);e=a}return e},clone:function(d,a){if(!(d=$(d))){return}var f=d.cloneNode(a);f._prototypeUID=void 0;if(a){var e=Element.select(f,"*"),c=e.length;while(c--){e[c]._prototypeUID=void 0}}return Element.extend(f)},purge:function(d){if(!(d=$(d))){return}var a=Element._purgeElement;a(d);var e=d.getElementsByTagName("*"),c=e.length;while(c--){a(e[c])}return null}});(function(){function k(z){var y=z.match(/^(\d+)%?$/i);if(!y){return null}return(Number(y[1])/100)}function s(J,K,z){var C=null;if(Object.isElement(J)){C=J;J=C.getStyle(K)}if(J===null){return null}if((/^(?:-)?\d+(\.\d+)?(px)?$/i).test(J)){return window.parseFloat(J)}var E=J.include("%"),A=(z===document.viewport);if(/\d/.test(J)&&C&&C.runtimeStyle&&!(E&&A)){var y=C.style.left,I=C.runtimeStyle.left;C.runtimeStyle.left=C.currentStyle.left;C.style.left=J||0;J=C.style.pixelLeft;C.style.left=y;C.runtimeStyle.left=I;return J}if(C&&E){z=z||C.parentNode;var B=k(J);var F=null;var D=C.getStyle("position");var H=K.include("left")||K.include("right")||K.include("width");var G=K.include("top")||K.include("bottom")||K.include("height");if(z===document.viewport){if(H){F=document.viewport.getWidth()}else{if(G){F=document.viewport.getHeight()}}}else{if(H){F=$(z).measure("width")}else{if(G){F=$(z).measure("height")}}}return(F===null)?0:F*B}return 0}function j(y){if(Object.isString(y)&&y.endsWith("px")){return y}return y+"px"}function m(z){var y=z;while(z&&z.parentNode){var A=z.getStyle("display");if(A==="none"){return false}z=$(z.parentNode)}return true}var e=Prototype.K;if("currentStyle" in document.documentElement){e=function(y){if(!y.currentStyle.hasLayout){y.style.zoom=1}return y}}function h(y){if(y.include("border")){y=y+"-width"}return y.camelize()}Element.Layout=Class.create(Hash,{initialize:function($super,z,y){$super();this.element=$(z);Element.Layout.PROPERTIES.each(function(A){this._set(A,null)},this);if(y){this._preComputing=true;this._begin();Element.Layout.PROPERTIES.each(this._compute,this);this._end();this._preComputing=false}},_set:function(z,y){return Hash.prototype.set.call(this,z,y)},set:function(z,y){throw"Properties of Element.Layout are read-only."},get:function($super,z){var y=$super(z);return y===null?this._compute(z):y},_begin:function(){if(this._prepared){return}var C=this.element;if(m(C)){this._prepared=true;return}var E={position:C.style.position||"",width:C.style.width||"",visibility:C.style.visibility||"",display:C.style.display||""};C.store("prototype_original_styles",E);var F=C.getStyle("position"),y=C.getStyle("width");if(y==="0px"||y===null){C.style.display="block";y=C.getStyle("width")}var z=(F==="fixed")?document.viewport:C.parentNode;C.setStyle({position:"absolute",visibility:"hidden",display:"block"});var A=C.getStyle("width");var B;if(y&&(A===y)){B=s(C,"width",z)}else{if(F==="absolute"||F==="fixed"){B=s(C,"width",z)}else{var G=C.parentNode,D=$(G).getLayout();B=D.get("width")-this.get("margin-left")-this.get("border-left")-this.get("padding-left")-this.get("padding-right")-this.get("border-right")-this.get("margin-right")}}C.setStyle({width:B+"px"});this._prepared=true},_end:function(){var z=this.element;var y=z.retrieve("prototype_original_styles");z.store("prototype_original_styles",null);z.setStyle(y);this._prepared=false},_compute:function(z){var y=Element.Layout.COMPUTATIONS;if(!(z in y)){throw"Property not found."}return this._set(z,y[z].call(this,this.element))},toObject:function(){var y=$A(arguments);var z=(y.length===0)?Element.Layout.PROPERTIES:y.join(" ").split(" ");var A={};z.each(function(B){if(!Element.Layout.PROPERTIES.include(B)){return}var C=this.get(B);if(C!=null){A[B]=C}},this);return A},toHash:function(){var y=this.toObject.apply(this,arguments);return new Hash(y)},toCSS:function(){var y=$A(arguments);var A=(y.length===0)?Element.Layout.PROPERTIES:y.join(" ").split(" ");var z={};A.each(function(B){if(!Element.Layout.PROPERTIES.include(B)){return}if(Element.Layout.COMPOSITE_PROPERTIES.include(B)){return}var C=this.get(B);if(C!=null){z[h(B)]=C+"px"}},this);return z},inspect:function(){return"#<Element.Layout>"}});Object.extend(Element.Layout,{PROPERTIES:$w("height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height"),COMPOSITE_PROPERTIES:$w("padding-box-width padding-box-height margin-box-width margin-box-height border-box-width border-box-height"),COMPUTATIONS:{height:function(A){if(!this._preComputing){this._begin()}var y=this.get("border-box-height");if(y<=0){if(!this._preComputing){this._end()}return 0}var B=this.get("border-top"),z=this.get("border-bottom");var D=this.get("padding-top"),C=this.get("padding-bottom");if(!this._preComputing){this._end()}return y-B-z-D-C},width:function(A){if(!this._preComputing){this._begin()}var z=this.get("border-box-width");if(z<=0){if(!this._preComputing){this._end()}return 0}var D=this.get("border-left"),y=this.get("border-right");var B=this.get("padding-left"),C=this.get("padding-right");if(!this._preComputing){this._end()}return z-D-y-B-C},"padding-box-height":function(z){var y=this.get("height"),B=this.get("padding-top"),A=this.get("padding-bottom");return y+B+A},"padding-box-width":function(y){var z=this.get("width"),A=this.get("padding-left"),B=this.get("padding-right");return z+A+B},"border-box-height":function(z){if(!this._preComputing){this._begin()}var y=z.offsetHeight;if(!this._preComputing){this._end()}return y},"border-box-width":function(y){if(!this._preComputing){this._begin()}var z=y.offsetWidth;if(!this._preComputing){this._end()}return z},"margin-box-height":function(z){var y=this.get("border-box-height"),A=this.get("margin-top"),B=this.get("margin-bottom");if(y<=0){return 0}return y+A+B},"margin-box-width":function(A){var z=this.get("border-box-width"),B=this.get("margin-left"),y=this.get("margin-right");if(z<=0){return 0}return z+B+y},top:function(y){var z=y.positionedOffset();return z.top},bottom:function(y){var B=y.positionedOffset(),z=y.getOffsetParent(),A=z.measure("height");var C=this.get("border-box-height");return A-C-B.top},left:function(y){var z=y.positionedOffset();return z.left},right:function(A){var C=A.positionedOffset(),B=A.getOffsetParent(),y=B.measure("width");var z=this.get("border-box-width");return y-z-C.left},"padding-top":function(y){return s(y,"paddingTop")},"padding-bottom":function(y){return s(y,"paddingBottom")},"padding-left":function(y){return s(y,"paddingLeft")},"padding-right":function(y){return s(y,"paddingRight")},"border-top":function(y){return s(y,"borderTopWidth")},"border-bottom":function(y){return s(y,"borderBottomWidth")},"border-left":function(y){return s(y,"borderLeftWidth")},"border-right":function(y){return s(y,"borderRightWidth")},"margin-top":function(y){return s(y,"marginTop")},"margin-bottom":function(y){return s(y,"marginBottom")},"margin-left":function(y){return s(y,"marginLeft")},"margin-right":function(y){return s(y,"marginRight")}}});if("getBoundingClientRect" in document.documentElement){Object.extend(Element.Layout.COMPUTATIONS,{right:function(z){var A=e(z.getOffsetParent());var B=z.getBoundingClientRect(),y=A.getBoundingClientRect();return(y.right-B.right).round()},bottom:function(z){var A=e(z.getOffsetParent());var B=z.getBoundingClientRect(),y=A.getBoundingClientRect();return(y.bottom-B.bottom).round()}})}Element.Offset=Class.create({initialize:function(z,y){this.left=z.round();this.top=y.round();this[0]=this.left;this[1]=this.top},relativeTo:function(y){return new Element.Offset(this.left-y.left,this.top-y.top)},inspect:function(){return"#<Element.Offset left: #{left} top: #{top}>".interpolate(this)},toString:function(){return"[#{left}, #{top}]".interpolate(this)},toArray:function(){return[this.left,this.top]}});function v(z,y){return new Element.Layout(z,y)}function c(y,z){return $(y).getLayout().get(z)}function q(z){z=$(z);var D=Element.getStyle(z,"display");if(D&&D!=="none"){return{width:z.offsetWidth,height:z.offsetHeight}}var A=z.style;var y={visibility:A.visibility,position:A.position,display:A.display};var C={visibility:"hidden",display:"block"};if(y.position!=="fixed"){C.position="absolute"}Element.setStyle(z,C);var B={width:z.offsetWidth,height:z.offsetHeight};Element.setStyle(z,y);return B}function o(y){y=$(y);if(f(y)||d(y)||p(y)||n(y)){return $(document.body)}var z=(Element.getStyle(y,"display")==="inline");if(!z&&y.offsetParent){return $(y.offsetParent)}while((y=y.parentNode)&&y!==document.body){if(Element.getStyle(y,"position")!=="static"){return n(y)?$(document.body):$(y)}}return $(document.body)}function x(z){z=$(z);var y=0,A=0;if(z.parentNode){do{y+=z.offsetTop||0;A+=z.offsetLeft||0;z=z.offsetParent}while(z)}return new Element.Offset(A,y)}function t(z){z=$(z);var A=z.getLayout();var y=0,C=0;do{y+=z.offsetTop||0;C+=z.offsetLeft||0;z=z.offsetParent;if(z){if(p(z)){break}var B=Element.getStyle(z,"position");if(B!=="static"){break}}}while(z);C-=A.get("margin-top");y-=A.get("margin-left");return new Element.Offset(C,y)}function a(z){var y=0,A=0;do{y+=z.scrollTop||0;A+=z.scrollLeft||0;z=z.parentNode}while(z);return new Element.Offset(A,y)}function w(C){z=$(z);var y=0,B=0,A=document.body;var z=C;do{y+=z.offsetTop||0;B+=z.offsetLeft||0;if(z.offsetParent==A&&Element.getStyle(z,"position")=="absolute"){break}}while(z=z.offsetParent);z=C;do{if(z!=A){y-=z.scrollTop||0;B-=z.scrollLeft||0}}while(z=z.parentNode);return new Element.Offset(B,y)}function u(y){y=$(y);if(Element.getStyle(y,"position")==="absolute"){return y}var C=o(y);var B=y.viewportOffset(),z=C.viewportOffset();var D=B.relativeTo(z);var A=y.getLayout();y.store("prototype_absolutize_original_styles",{left:y.getStyle("left"),top:y.getStyle("top"),width:y.getStyle("width"),height:y.getStyle("height")});y.setStyle({position:"absolute",top:D.top+"px",left:D.left+"px",width:A.get("width")+"px",height:A.get("height")+"px"});return y}function l(z){z=$(z);if(Element.getStyle(z,"position")==="relative"){return z}var y=z.retrieve("prototype_absolutize_original_styles");if(y){z.setStyle(y)}return z}if(Prototype.Browser.IE){o=o.wrap(function(A,z){z=$(z);if(f(z)||d(z)||p(z)||n(z)){return $(document.body)}var y=z.getStyle("position");if(y!=="static"){return A(z)}z.setStyle({position:"relative"});var B=A(z);z.setStyle({position:y});return B});t=t.wrap(function(B,z){z=$(z);if(!z.parentNode){return new Element.Offset(0,0)}var y=z.getStyle("position");if(y!=="static"){return B(z)}var A=z.getOffsetParent();if(A&&A.getStyle("position")==="fixed"){e(A)}z.setStyle({position:"relative"});var C=B(z);z.setStyle({position:y});return C})}else{if(Prototype.Browser.Webkit){x=function(z){z=$(z);var y=0,A=0;do{y+=z.offsetTop||0;A+=z.offsetLeft||0;if(z.offsetParent==document.body){if(Element.getStyle(z,"position")=="absolute"){break}}z=z.offsetParent}while(z);return new Element.Offset(A,y)}}}Element.addMethods({getLayout:v,measure:c,getDimensions:q,getOffsetParent:o,cumulativeOffset:x,positionedOffset:t,cumulativeScrollOffset:a,viewportOffset:w,absolutize:u,relativize:l});function p(y){return y.nodeName.toUpperCase()==="BODY"}function n(y){return y.nodeName.toUpperCase()==="HTML"}function f(y){return y.nodeType===Node.DOCUMENT_NODE}function d(y){return y!==document.body&&!Element.descendantOf(y,document.body)}if("getBoundingClientRect" in document.documentElement){Element.addMethods({viewportOffset:function(y){y=$(y);if(d(y)){return new Element.Offset(0,0)}var z=y.getBoundingClientRect(),A=document.documentElement;return new Element.Offset(z.left-A.clientLeft,z.top-A.clientTop)}})}})();window.$$=function(){var a=$A(arguments).join(", ");return Prototype.Selector.select(a,document)};Prototype.Selector=(function(){function a(){throw new Error('Method "Prototype.Selector.select" must be defined.')}function d(){throw new Error('Method "Prototype.Selector.match" must be defined.')}function e(n,o,k){k=k||0;var j=Prototype.Selector.match,m=n.length,h=0,l;for(l=0;l<m;l++){if(j(n[l],o)&&k==h++){return Element.extend(n[l])}}}function f(k){for(var h=0,j=k.length;h<j;h++){Element.extend(k[h])}return k}var c=Prototype.K;return{select:a,match:d,find:e,extendElements:(Element.extend===c)?c:f,extendElement:Element.extend}})();Prototype._original_property=window.Sizzle;
/*
 * Sizzle CSS Selector Engine - v1.0
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var u=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,m=0,f=Object.prototype.toString,s=false,l=true;[0,0].sort(function(){l=false;return 0});var c=function(I,y,F,A){F=F||[];var e=y=y||document;if(y.nodeType!==1&&y.nodeType!==9){return[]}if(!I||typeof I!=="string"){return F}var G=[],H,D,M,L,E,x,w=true,B=t(y),K=I;while((u.exec(""),H=u.exec(K))!==null){K=H[3];G.push(H[1]);if(H[2]){x=H[3];break}}if(G.length>1&&n.exec(I)){if(G.length===2&&h.relative[G[0]]){D=j(G[0]+G[1],y)}else{D=h.relative[G[0]]?[y]:c(G.shift(),y);while(G.length){I=G.shift();if(h.relative[I]){I+=G.shift()}D=j(I,D)}}}else{if(!A&&G.length>1&&y.nodeType===9&&!B&&h.match.ID.test(G[0])&&!h.match.ID.test(G[G.length-1])){var N=c.find(G.shift(),y,B);y=N.expr?c.filter(N.expr,N.set)[0]:N.set[0]}if(y){var N=A?{expr:G.pop(),set:a(A)}:c.find(G.pop(),G.length===1&&(G[0]==="~"||G[0]==="+")&&y.parentNode?y.parentNode:y,B);D=N.expr?c.filter(N.expr,N.set):N.set;if(G.length>0){M=a(D)}else{w=false}while(G.length){var z=G.pop(),C=z;if(!h.relative[z]){z=""}else{C=G.pop()}if(C==null){C=y}h.relative[z](M,C,B)}}else{M=G=[]}}if(!M){M=D}if(!M){throw"Syntax error, unrecognized expression: "+(z||I)}if(f.call(M)==="[object Array]"){if(!w){F.push.apply(F,M)}else{if(y&&y.nodeType===1){for(var J=0;M[J]!=null;J++){if(M[J]&&(M[J]===true||M[J].nodeType===1&&k(y,M[J]))){F.push(D[J])}}}else{for(var J=0;M[J]!=null;J++){if(M[J]&&M[J].nodeType===1){F.push(D[J])}}}}}else{a(M,F)}if(x){c(x,e,F,A);c.uniqueSort(F)}return F};c.uniqueSort=function(w){if(d){s=l;w.sort(d);if(s){for(var e=1;e<w.length;e++){if(w[e]===w[e-1]){w.splice(e--,1)}}}}return w};c.matches=function(e,w){return c(e,null,null,w)};c.find=function(C,e,D){var B,z;if(!C){return[]}for(var y=0,x=h.order.length;y<x;y++){var A=h.order[y],z;if((z=h.leftMatch[A].exec(C))){var w=z[1];z.splice(1,1);if(w.substr(w.length-1)!=="\\"){z[1]=(z[1]||"").replace(/\\/g,"");B=h.find[A](z,e,D);if(B!=null){C=C.replace(h.match[A],"");break}}}}if(!B){B=e.getElementsByTagName("*")}return{set:B,expr:C}};c.filter=function(F,E,I,y){var x=F,K=[],C=E,A,e,B=E&&E[0]&&t(E[0]);while(F&&E.length){for(var D in h.filter){if((A=h.match[D].exec(F))!=null){var w=h.filter[D],J,H;e=false;if(C==K){K=[]}if(h.preFilter[D]){A=h.preFilter[D](A,C,I,K,y,B);if(!A){e=J=true}else{if(A===true){continue}}}if(A){for(var z=0;(H=C[z])!=null;z++){if(H){J=w(H,A,z,C);var G=y^!!J;if(I&&J!=null){if(G){e=true}else{C[z]=false}}else{if(G){K.push(H);e=true}}}}}if(J!==undefined){if(!I){C=K}F=F.replace(h.match[D],"");if(!e){return[]}break}}}if(F==x){if(e==null){throw"Syntax error, unrecognized expression: "+F}else{break}}x=F}return C};var h=c.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")}},relative:{"+":function(C,e,B){var z=typeof e==="string",D=z&&!/\W/.test(e),A=z&&!D;if(D&&!B){e=e.toUpperCase()}for(var y=0,x=C.length,w;y<x;y++){if((w=C[y])){while((w=w.previousSibling)&&w.nodeType!==1){}C[y]=A||w&&w.nodeName===e?w||false:w===e}}if(A){c.filter(e,C,true)}},">":function(B,w,C){var z=typeof w==="string";if(z&&!/\W/.test(w)){w=C?w:w.toUpperCase();for(var x=0,e=B.length;x<e;x++){var A=B[x];if(A){var y=A.parentNode;B[x]=y.nodeName===w?y:false}}}else{for(var x=0,e=B.length;x<e;x++){var A=B[x];if(A){B[x]=z?A.parentNode:A.parentNode===w}}if(z){c.filter(w,B,true)}}},"":function(y,w,A){var x=m++,e=v;if(!/\W/.test(w)){var z=w=A?w:w.toUpperCase();e=q}e("parentNode",w,x,y,z,A)},"~":function(y,w,A){var x=m++,e=v;if(typeof w==="string"&&!/\W/.test(w)){var z=w=A?w:w.toUpperCase();e=q}e("previousSibling",w,x,y,z,A)}},find:{ID:function(w,x,y){if(typeof x.getElementById!=="undefined"&&!y){var e=x.getElementById(w[1]);return e?[e]:[]}},NAME:function(x,A,B){if(typeof A.getElementsByName!=="undefined"){var w=[],z=A.getElementsByName(x[1]);for(var y=0,e=z.length;y<e;y++){if(z[y].getAttribute("name")===x[1]){w.push(z[y])}}return w.length===0?null:w}},TAG:function(e,w){return w.getElementsByTagName(e[1])}},preFilter:{CLASS:function(y,w,x,e,B,C){y=" "+y[1].replace(/\\/g,"")+" ";if(C){return y}for(var z=0,A;(A=w[z])!=null;z++){if(A){if(B^(A.className&&(" "+A.className+" ").indexOf(y)>=0)){if(!x){e.push(A)}}else{if(x){w[z]=false}}}}return false},ID:function(e){return e[1].replace(/\\/g,"")},TAG:function(w,e){for(var x=0;e[x]===false;x++){}return e[x]&&t(e[x])?w[1]:w[1].toUpperCase()},CHILD:function(e){if(e[1]=="nth"){var w=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]=="even"&&"2n"||e[2]=="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(w[1]+(w[2]||1))-0;e[3]=w[3]-0}e[0]=m++;return e},ATTR:function(z,w,x,e,A,B){var y=z[1].replace(/\\/g,"");if(!B&&h.attrMap[y]){z[1]=h.attrMap[y]}if(z[2]==="~="){z[4]=" "+z[4]+" "}return z},PSEUDO:function(z,w,x,e,A){if(z[1]==="not"){if((u.exec(z[3])||"").length>1||/^\w/.test(z[3])){z[3]=c(z[3],null,null,w)}else{var y=c.filter(z[3],w,x,true^A);if(!x){e.push.apply(e,y)}return false}}else{if(h.match.POS.test(z[0])||h.match.CHILD.test(z[0])){return true}}return z},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){e.parentNode.selectedIndex;return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(x,w,e){return !!c(e[3],x).length},header:function(e){return/h\d/i.test(e.nodeName)},text:function(e){return"text"===e.type},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toUpperCase()==="BUTTON"},input:function(e){return/input|select|textarea|button/i.test(e.nodeName)}},setFilters:{first:function(w,e){return e===0},last:function(x,w,e,y){return w===y.length-1},even:function(w,e){return e%2===0},odd:function(w,e){return e%2===1},lt:function(x,w,e){return w<e[3]-0},gt:function(x,w,e){return w>e[3]-0},nth:function(x,w,e){return e[3]-0==w},eq:function(x,w,e){return e[3]-0==w}},filter:{PSEUDO:function(B,x,y,C){var w=x[1],z=h.filters[w];if(z){return z(B,y,x,C)}else{if(w==="contains"){return(B.textContent||B.innerText||"").indexOf(x[3])>=0}else{if(w==="not"){var A=x[3];for(var y=0,e=A.length;y<e;y++){if(A[y]===B){return false}}return true}}}},CHILD:function(e,y){var B=y[1],w=e;switch(B){case"only":case"first":while((w=w.previousSibling)){if(w.nodeType===1){return false}}if(B=="first"){return true}w=e;case"last":while((w=w.nextSibling)){if(w.nodeType===1){return false}}return true;case"nth":var x=y[2],E=y[3];if(x==1&&E==0){return true}var A=y[0],D=e.parentNode;if(D&&(D.sizcache!==A||!e.nodeIndex)){var z=0;for(w=D.firstChild;w;w=w.nextSibling){if(w.nodeType===1){w.nodeIndex=++z}}D.sizcache=A}var C=e.nodeIndex-E;if(x==0){return C==0}else{return(C%x==0&&C/x>=0)}}},ID:function(w,e){return w.nodeType===1&&w.getAttribute("id")===e},TAG:function(w,e){return(e==="*"&&w.nodeType===1)||w.nodeName===e},CLASS:function(w,e){return(" "+(w.className||w.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(A,y){var x=y[1],e=h.attrHandle[x]?h.attrHandle[x](A):A[x]!=null?A[x]:A.getAttribute(x),B=e+"",z=y[2],w=y[4];return e==null?z==="!=":z==="="?B===w:z==="*="?B.indexOf(w)>=0:z==="~="?(" "+B+" ").indexOf(w)>=0:!w?B&&e!==false:z==="!="?B!=w:z==="^="?B.indexOf(w)===0:z==="$="?B.substr(B.length-w.length)===w:z==="|="?B===w||B.substr(0,w.length+1)===w+"-":false},POS:function(z,w,x,A){var e=w[2],y=h.setFilters[e];if(y){return y(z,x,w,A)}}}};var n=h.match.POS;for(var p in h.match){h.match[p]=new RegExp(h.match[p].source+/(?![^\[]*\])(?![^\(]*\))/.source);h.leftMatch[p]=new RegExp(/(^(?:.|\r|\n)*?)/.source+h.match[p].source)}var a=function(w,e){w=Array.prototype.slice.call(w,0);if(e){e.push.apply(e,w);return e}return w};try{Array.prototype.slice.call(document.documentElement.childNodes,0)}catch(o){a=function(z,y){var w=y||[];if(f.call(z)==="[object Array]"){Array.prototype.push.apply(w,z)}else{if(typeof z.length==="number"){for(var x=0,e=z.length;x<e;x++){w.push(z[x])}}else{for(var x=0;z[x];x++){w.push(z[x])}}}return w}}var d;if(document.documentElement.compareDocumentPosition){d=function(w,e){if(!w.compareDocumentPosition||!e.compareDocumentPosition){if(w==e){s=true}return 0}var x=w.compareDocumentPosition(e)&4?-1:w===e?0:1;if(x===0){s=true}return x}}else{if("sourceIndex" in document.documentElement){d=function(w,e){if(!w.sourceIndex||!e.sourceIndex){if(w==e){s=true}return 0}var x=w.sourceIndex-e.sourceIndex;if(x===0){s=true}return x}}else{if(document.createRange){d=function(y,w){if(!y.ownerDocument||!w.ownerDocument){if(y==w){s=true}return 0}var x=y.ownerDocument.createRange(),e=w.ownerDocument.createRange();x.setStart(y,0);x.setEnd(y,0);e.setStart(w,0);e.setEnd(w,0);var z=x.compareBoundaryPoints(Range.START_TO_END,e);if(z===0){s=true}return z}}}}(function(){var w=document.createElement("div"),x="script"+(new Date).getTime();w.innerHTML="<a name='"+x+"'/>";var e=document.documentElement;e.insertBefore(w,e.firstChild);if(!!document.getElementById(x)){h.find.ID=function(z,A,B){if(typeof A.getElementById!=="undefined"&&!B){var y=A.getElementById(z[1]);return y?y.id===z[1]||typeof y.getAttributeNode!=="undefined"&&y.getAttributeNode("id").nodeValue===z[1]?[y]:undefined:[]}};h.filter.ID=function(A,y){var z=typeof A.getAttributeNode!=="undefined"&&A.getAttributeNode("id");return A.nodeType===1&&z&&z.nodeValue===y}}e.removeChild(w);e=w=null})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){h.find.TAG=function(w,A){var z=A.getElementsByTagName(w[1]);if(w[1]==="*"){var y=[];for(var x=0;z[x];x++){if(z[x].nodeType===1){y.push(z[x])}}z=y}return z}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){h.attrHandle.href=function(w){return w.getAttribute("href",2)}}e=null})();if(document.querySelectorAll){(function(){var e=c,x=document.createElement("div");x.innerHTML="<p class='TEST'></p>";if(x.querySelectorAll&&x.querySelectorAll(".TEST").length===0){return}c=function(B,A,y,z){A=A||document;if(!z&&A.nodeType===9&&!t(A)){try{return a(A.querySelectorAll(B),y)}catch(C){}}return e(B,A,y,z)};for(var w in e){c[w]=e[w]}x=null})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var e=document.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}h.order.splice(1,0,"CLASS");h.find.CLASS=function(w,x,y){if(typeof x.getElementsByClassName!=="undefined"&&!y){return x.getElementsByClassName(w[1])}};e=null})()}function q(w,B,A,F,C,E){var D=w=="previousSibling"&&!E;for(var y=0,x=F.length;y<x;y++){var e=F[y];if(e){if(D&&e.nodeType===1){e.sizcache=A;e.sizset=y}e=e[w];var z=false;while(e){if(e.sizcache===A){z=F[e.sizset];break}if(e.nodeType===1&&!E){e.sizcache=A;e.sizset=y}if(e.nodeName===B){z=e;break}e=e[w]}F[y]=z}}}function v(w,B,A,F,C,E){var D=w=="previousSibling"&&!E;for(var y=0,x=F.length;y<x;y++){var e=F[y];if(e){if(D&&e.nodeType===1){e.sizcache=A;e.sizset=y}e=e[w];var z=false;while(e){if(e.sizcache===A){z=F[e.sizset];break}if(e.nodeType===1){if(!E){e.sizcache=A;e.sizset=y}if(typeof B!=="string"){if(e===B){z=true;break}}else{if(c.filter(B,[e]).length>0){z=e;break}}}e=e[w]}F[y]=z}}}var k=document.compareDocumentPosition?function(w,e){return w.compareDocumentPosition(e)&16}:function(w,e){return w!==e&&(w.contains?w.contains(e):true)};var t=function(e){return e.nodeType===9&&e.documentElement.nodeName!=="HTML"||!!e.ownerDocument&&e.ownerDocument.documentElement.nodeName!=="HTML"};var j=function(e,C){var y=[],z="",A,x=C.nodeType?[C]:C;while((A=h.match.PSEUDO.exec(e))){z+=A[0];e=e.replace(h.match.PSEUDO,"")}e=h.relative[e]?e+"*":e;for(var B=0,w=x.length;B<w;B++){c(e,x[B],y)}return c.filter(z,y)};window.Sizzle=c})();(function(d){var e=Prototype.Selector.extendElements;function a(f,h){return e(d(f,h||document))}function c(h,f){return d.matches(f,[h]).length==1}Prototype.Selector.engine=d;Prototype.Selector.select=a;Prototype.Selector.match=c})(Sizzle);window.Sizzle=Prototype._original_property;delete Prototype._original_property;var Form={reset:function(a){a=$(a);a.reset();return a},serializeElements:function(k,e){if(typeof e!="object"){e={hash:!!e}}else{if(Object.isUndefined(e.hash)){e.hash=true}}var f,j,a=false,h=e.submit,c,d;if(e.hash){d={};c=function(l,m,n){if(m in l){if(!Object.isArray(l[m])){l[m]=[l[m]]}l[m].push(n)}else{l[m]=n}return l}}else{d="";c=function(l,m,n){return l+(l?"&":"")+encodeURIComponent(m)+"="+encodeURIComponent(n)}}return k.inject(d,function(l,m){if(!m.disabled&&m.name){f=m.name;j=$(m).getValue();if(j!=null&&m.type!="file"&&(m.type!="submit"||(!a&&h!==false&&(!h||f==h)&&(a=true)))){l=c(l,f,j)}}return l})}};Form.Methods={serialize:function(c,a){return Form.serializeElements(Form.getElements(c),a)},getElements:function(f){var h=$(f).getElementsByTagName("*"),e,a=[],d=Form.Element.Serializers;for(var c=0;e=h[c];c++){a.push(e)}return a.inject([],function(j,k){if(d[k.tagName.toLowerCase()]){j.push(Element.extend(k))}return j})},getInputs:function(j,d,e){j=$(j);var a=j.getElementsByTagName("input");if(!d&&!e){return $A(a).map(Element.extend)}for(var f=0,k=[],h=a.length;f<h;f++){var c=a[f];if((d&&c.type!=d)||(e&&c.name!=e)){continue}k.push(Element.extend(c))}return k},disable:function(a){a=$(a);Form.getElements(a).invoke("disable");return a},enable:function(a){a=$(a);Form.getElements(a).invoke("enable");return a},findFirstElement:function(c){var d=$(c).getElements().findAll(function(e){return"hidden"!=e.type&&!e.disabled});var a=d.findAll(function(e){return e.hasAttribute("tabIndex")&&e.tabIndex>=0}).sortBy(function(e){return e.tabIndex}).first();return a?a:d.find(function(e){return/^(?:input|select|textarea)$/i.test(e.tagName)})},focusFirstElement:function(c){c=$(c);var a=c.findFirstElement();if(a){a.activate()}return c},request:function(c,a){c=$(c),a=Object.clone(a||{});var e=a.parameters,d=c.readAttribute("action")||"";if(d.blank()){d=window.location.href}a.parameters=c.serialize(true);if(e){if(Object.isString(e)){e=e.toQueryParams()}Object.extend(a.parameters,e)}if(c.hasAttribute("method")&&!a.method){a.method=c.method}return new Ajax.Request(d,a)}};Form.Element={focus:function(a){$(a).focus();return a},select:function(a){$(a).select();return a}};Form.Element.Methods={serialize:function(a){a=$(a);if(!a.disabled&&a.name){var c=a.getValue();if(c!=undefined){var d={};d[a.name]=c;return Object.toQueryString(d)}}return""},getValue:function(a){a=$(a);var c=a.tagName.toLowerCase();return Form.Element.Serializers[c](a)},setValue:function(a,c){a=$(a);var d=a.tagName.toLowerCase();Form.Element.Serializers[d](a,c);return a},clear:function(a){$(a).value="";return a},present:function(a){return $(a).value!=""},activate:function(a){a=$(a);try{a.focus();if(a.select&&(a.tagName.toLowerCase()!="input"||!(/^(?:button|reset|submit)$/i.test(a.type)))){a.select()}}catch(c){}return a},disable:function(a){a=$(a);a.disabled=true;return a},enable:function(a){a=$(a);a.disabled=false;return a}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers=(function(){function c(k,l){switch(k.type.toLowerCase()){case"checkbox":case"radio":return h(k,l);default:return f(k,l)}}function h(k,l){if(Object.isUndefined(l)){return k.checked?k.value:null}else{k.checked=!!l}}function f(k,l){if(Object.isUndefined(l)){return k.value}else{k.value=l}}function a(m,p){if(Object.isUndefined(p)){return(m.type==="select-one"?d:e)(m)}var l,n,q=!Object.isArray(p);for(var k=0,o=m.length;k<o;k++){l=m.options[k];n=this.optionValue(l);if(q){if(n==p){l.selected=true;return}}else{l.selected=p.include(n)}}}function d(l){var k=l.selectedIndex;return k>=0?j(l.options[k]):null}function e(n){var k,o=n.length;if(!o){return null}for(var m=0,k=[];m<o;m++){var l=n.options[m];if(l.selected){k.push(j(l))}}return k}function j(k){return Element.hasAttribute(k,"value")?k.value:k.text}return{input:c,inputSelector:h,textarea:f,select:a,selectOne:d,selectMany:e,optionValue:j,button:f}})();Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,a,c,d){$super(d,c);this.element=$(a);this.lastValue=this.getValue()},execute:function(){var a=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(a)?this.lastValue!=a:String(this.lastValue)!=String(a)){this.callback(this.element,a);this.lastValue=a}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=Class.create({initialize:function(a,c){this.element=$(a);this.callback=c;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var a=this.getValue();if(this.lastValue!=a){this.callback(this.element,a);this.lastValue=a}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(a){if(a.type){switch(a.type.toLowerCase()){case"checkbox":case"radio":Event.observe(a,"click",this.onElementEvent.bind(this));break;default:Event.observe(a,"change",this.onElementEvent.bind(this));break}}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});(function(){var G={KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{}};var h=document.documentElement;var H="onmouseenter" in h&&"onmouseleave" in h;var a=function(I){return false};if(window.attachEvent){if(window.addEventListener){a=function(I){return !(I instanceof window.Event)}}else{a=function(I){return true}}}var v;function E(J,I){return J.which?(J.which===I+1):(J.button===I)}var s={0:1,1:4,2:2};function C(J,I){return(I==0&&J.button==0)||(J.button===s[I])}function F(J,I){switch(I){case 0:return J.which==1&&!J.metaKey;case 1:return J.which==2||(J.which==1&&J.metaKey);case 2:return J.which==3;default:return false}}if(window.attachEvent){if(!window.addEventListener){v=C}else{v=function(J,I){return a(J)?C(J,I):E(J,I)}}}else{if(Prototype.Browser.WebKit){v=F}else{v=E}}function z(I){return v(I,0)}function x(I){return v(I,1)}function q(I){return v(I,2)}function e(K){K=G.extend(K);var J=K.target,I=K.type,L=K.currentTarget;if(L&&L.tagName){if(I==="load"||I==="error"||(I==="click"&&L.tagName.toLowerCase()==="input"&&L.type==="radio")){J=L}}if(J.nodeType==Node.TEXT_NODE){J=J.parentNode}return Element.extend(J)}function t(J,K){var I=G.element(J);if(!K){return I}while(I){if(Object.isElement(I)&&Prototype.Selector.match(I,K)){return Element.extend(I)}I=I.parentNode}}function w(I){return{x:d(I),y:c(I)}}function d(K){var J=document.documentElement,I=document.body||{scrollLeft:0};return K.pageX||(K.clientX+(J.scrollLeft||I.scrollLeft)-(J.clientLeft||0))}function c(K){var J=document.documentElement,I=document.body||{scrollTop:0};return K.pageY||(K.clientY+(J.scrollTop||I.scrollTop)-(J.clientTop||0))}function u(I){G.extend(I);I.preventDefault();I.stopPropagation();I.stopped=true}G.Methods={isLeftClick:z,isMiddleClick:x,isRightClick:q,element:e,findElement:t,pointer:w,pointerX:d,pointerY:c,stop:u};var B=Object.keys(G.Methods).inject({},function(I,J){I[J]=G.Methods[J].methodize();return I});if(window.attachEvent){function l(J){var I;switch(J.type){case"mouseover":case"mouseenter":I=J.fromElement;break;case"mouseout":case"mouseleave":I=J.toElement;break;default:return null}return Element.extend(I)}var y={stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}};G.extend=function(J,I){if(!J){return false}if(!a(J)){return J}if(J._extendedByPrototype){return J}J._extendedByPrototype=Prototype.emptyFunction;var K=G.pointer(J);Object.extend(J,{target:J.srcElement||I,relatedTarget:l(J),pageX:K.x,pageY:K.y});Object.extend(J,B);Object.extend(J,y);return J}}else{G.extend=Prototype.K}if(window.addEventListener){G.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(G.prototype,B)}function p(M,L,N){var K=Element.retrieve(M,"prototype_event_registry");if(Object.isUndefined(K)){f.push(M);K=Element.retrieve(M,"prototype_event_registry",$H())}var I=K.get(L);if(Object.isUndefined(I)){I=[];K.set(L,I)}if(I.pluck("handler").include(N)){return false}var J;if(L.include(":")){J=function(O){if(Object.isUndefined(O.eventName)){return false}if(O.eventName!==L){return false}G.extend(O,M);N.call(M,O)}}else{if(!H&&(L==="mouseenter"||L==="mouseleave")){if(L==="mouseenter"||L==="mouseleave"){J=function(P){G.extend(P,M);var O=P.relatedTarget;while(O&&O!==M){try{O=O.parentNode}catch(Q){O=M}}if(O===M){return}N.call(M,P)}}}else{J=function(O){G.extend(O,M);N.call(M,O)}}}J.handler=N;I.push(J);return J}function k(){for(var I=0,J=f.length;I<J;I++){G.stopObserving(f[I]);f[I]=null}}var f=[];if(Prototype.Browser.IE){window.attachEvent("onunload",k)}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)}var o=Prototype.K,j={mouseenter:"mouseover",mouseleave:"mouseout"};if(!H){o=function(I){return(j[I]||I)}}function A(L,K,M){L=$(L);var J=p(L,K,M);if(!J){return L}if(K.include(":")){if(L.addEventListener){L.addEventListener("dataavailable",J,false)}else{L.attachEvent("ondataavailable",J);L.attachEvent("onlosecapture",J)}}else{var I=o(K);if(L.addEventListener){L.addEventListener(I,J,false)}else{L.attachEvent("on"+I,J)}}return L}function n(O,L,P){O=$(O);var K=Element.retrieve(O,"prototype_event_registry");if(!K){return O}if(!L){K.each(function(R){var Q=R.key;n(O,Q)});return O}var M=K.get(L);if(!M){return O}if(!P){M.each(function(Q){n(O,L,Q.handler)});return O}var N=M.length,J;while(N--){if(M[N].handler===P){J=M[N];break}}if(!J){return O}if(L.include(":")){if(O.removeEventListener){O.removeEventListener("dataavailable",J,false)}else{O.detachEvent("ondataavailable",J);O.detachEvent("onlosecapture",J)}}else{var I=o(L);if(O.removeEventListener){O.removeEventListener(I,J,false)}else{O.detachEvent("on"+I,J)}}K.set(L,M.without(J));return O}function D(L,K,J,I){L=$(L);if(Object.isUndefined(I)){I=true}if(L==document&&document.createEvent&&!L.dispatchEvent){L=document.documentElement}var M;if(document.createEvent){M=document.createEvent("HTMLEvents");M.initEvent("dataavailable",I,true)}else{M=document.createEventObject();M.eventType=I?"ondataavailable":"onlosecapture"}M.eventName=K;M.memo=J||{};if(document.createEvent){L.dispatchEvent(M)}else{L.fireEvent(M.eventType,M)}return G.extend(M)}G.Handler=Class.create({initialize:function(K,J,I,L){this.element=$(K);this.eventName=J;this.selector=I;this.callback=L;this.handler=this.handleEvent.bind(this)},start:function(){G.observe(this.element,this.eventName,this.handler);return this},stop:function(){G.stopObserving(this.element,this.eventName,this.handler);return this},handleEvent:function(J){var I=G.findElement(J,this.selector);if(I){this.callback.call(this.element,J,I)}}});function m(K,J,I,L){K=$(K);if(Object.isFunction(I)&&Object.isUndefined(L)){L=I,I=null}return new G.Handler(K,J,I,L).start()}Object.extend(G,G.Methods);Object.extend(G,{fire:D,observe:A,stopObserving:n,on:m});Element.addMethods({fire:D,observe:A,stopObserving:n,on:m});Object.extend(document,{fire:D.methodize(),observe:A.methodize(),stopObserving:n.methodize(),on:m.methodize(),loaded:false});if(window.Event){Object.extend(window.Event,G)}else{window.Event=G}})();(function(){var e;function a(){if(document.loaded){return}if(e){window.clearTimeout(e)}document.loaded=true;document.fire("dom:loaded")}function d(){if(document.readyState==="complete"){document.stopObserving("readystatechange",d);a()}}function c(){try{document.documentElement.doScroll("left")}catch(f){e=c.defer();return}a()}if(document.addEventListener){document.addEventListener("DOMContentLoaded",a,false)}else{document.observe("readystatechange",d);if(window==top){e=c.defer()}}Event.observe(window,"load",a)})();Element.addMethods();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(a,c){return Element.insert(a,{before:c})},Top:function(a,c){return Element.insert(a,{top:c})},Bottom:function(a,c){return Element.insert(a,{bottom:c})},After:function(a,c){return Element.insert(a,{after:c})}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(c,a,d){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(c,a,d)}this.xcomp=a;this.ycomp=d;this.offset=Element.cumulativeOffset(c);return(d>=this.offset[1]&&d<this.offset[1]+c.offsetHeight&&a>=this.offset[0]&&a<this.offset[0]+c.offsetWidth)},withinIncludingScrolloffsets:function(c,a,e){var d=Element.cumulativeScrollOffset(c);this.xcomp=a+d[0]-this.deltaX;this.ycomp=e+d[1]-this.deltaY;this.offset=Element.cumulativeOffset(c);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+c.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+c.offsetWidth)},overlap:function(c,a){if(!c){return 0}if(c=="vertical"){return((this.offset[1]+a.offsetHeight)-this.ycomp)/a.offsetHeight}if(c=="horizontal"){return((this.offset[0]+a.offsetWidth)-this.xcomp)/a.offsetWidth}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(a){Position.prepare();return Element.absolutize(a)},relativize:function(a){Position.prepare();return Element.relativize(a)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(c,d,a){a=a||{};return Element.clonePosition(d,c,a)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(c){function a(d){return d.blank()?null:"[contains(concat(' ', @class, ' '), ' "+d+" ')]"}c.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(d,f){f=f.toString().strip();var e=/\s/.test(f)?$w(f).map(a).join(""):a(f);return e?document._getElementsByXPath(".//*"+e,d):[]}:function(f,h){h=h.toString().strip();var j=[],k=(/\s/.test(h)?$w(h):null);if(!k&&!h){return j}var d=$(f).getElementsByTagName("*");h=" "+h+" ";for(var e=0,m,l;m=d[e];e++){if(m.className&&(l=" "+m.className+" ")&&(l.include(h)||(k&&k.all(function(n){return !n.toString().blank()&&l.include(" "+n+" ")})))){j.push(Element.extend(m))}}return j};return function(e,d){return $(d||document.body).getElementsByClassName(e)}}(Element.Methods)}Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(a){this.element=$(a)},_each:function(a){this.element.className.split(/\s+/).select(function(c){return c.length>0})._each(a)},set:function(a){this.element.className=a},add:function(a){if(this.include(a)){return}this.set($A(this).concat(a).join(" "))},remove:function(a){if(!this.include(a)){return}this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);(function(){window.Selector=Class.create({initialize:function(a){this.expression=a.strip()},findElements:function(a){return Prototype.Selector.select(this.expression,a)},match:function(a){return Prototype.Selector.match(a,this.expression)},toString:function(){return this.expression},inspect:function(){return"#<Selector: "+this.expression+">"}});Object.extend(Selector,{matchElements:function(h,j){var a=Prototype.Selector.match,e=[];for(var d=0,f=h.length;d<f;d++){var c=h[d];if(a(c,j)){e.push(Element.extend(c))}}return e},findElement:function(h,j,c){c=c||0;var a=0,e;for(var d=0,f=h.length;d<f;d++){e=h[d];if(Prototype.Selector.match(e,j)&&c===a++){return Element.extend(e)}}},findChildElements:function(c,d){var a=d.toArray().join(", ");return Prototype.Selector.select(a,c||document)}})})();var Cookie={set:function(e,h,c,f){var a="";if(c!=undefined){var j=new Date();j.setTime(j.getTime()+(86400000*parseFloat(c)));a="; expires="+j.toGMTString()}return(document.cookie=escape(e)+"="+escape(h||"")+"; path=/"+a+(f?"; domain="+f:""))},get:function(a){var c=document.cookie.match(new RegExp("(^|;)\\s*"+escape(a)+"=([^;\\s]*)"));return(c?unescape(c[2]):null)},erase:function(a){var c=Cookie.get(a)||true;Cookie.set(a,"",-1);return c},accept:function(){if(typeof navigator.cookieEnabled=="boolean"){return navigator.cookieEnabled}Cookie.set("_test","1");return(Cookie.erase("_test")==="1")}};var Builder={NODEMAP:{AREA:"map",CAPTION:"table",COL:"table",COLGROUP:"table",LEGEND:"fieldset",OPTGROUP:"select",OPTION:"select",PARAM:"object",TBODY:"table",TD:"table",TFOOT:"table",TH:"table",THEAD:"table",TR:"table"},node:function(a){a=a.toUpperCase();var j=this.NODEMAP[a]||"div";var c=document.createElement(j);try{c.innerHTML="<"+a+"></"+a+">"}catch(h){}var f=c.firstChild||null;if(f&&(f.tagName.toUpperCase()!=a)){f=f.getElementsByTagName(a)[0]}if(!f){f=document.createElement(a)}if(!f){return}if(arguments[1]){if(this._isStringOrNumber(arguments[1])||(arguments[1] instanceof Array)||arguments[1].tagName){this._children(f,arguments[1])}else{var d=this._attributes(arguments[1]);if(d.length){try{c.innerHTML="<"+a+" "+d+"></"+a+">"}catch(h){}f=c.firstChild||null;if(!f){f=document.createElement(a);for(attr in arguments[1]){f[attr=="class"?"className":attr]=arguments[1][attr]}}if(f.tagName.toUpperCase()!=a){f=c.getElementsByTagName(a)[0]}}}}if(arguments[2]){this._children(f,arguments[2])}return $(f)},_text:function(a){return document.createTextNode(a)},ATTR_MAP:{className:"class",htmlFor:"for"},_attributes:function(a){var c=[];for(attribute in a){if(a[attribute]!==undefined){c.push((attribute in this.ATTR_MAP?this.ATTR_MAP[attribute]:attribute)+'="'+a[attribute].toString().escapeHTML().gsub(/"/,"&quot;")+'"')}}return c.join(" ")},_children:function(c,a){if(a.tagName){c.appendChild(a);return}if(typeof a=="object"){a.flatten().each(function(d){if(typeof d=="object"){c.appendChild(d)}else{if(Builder._isStringOrNumber(d)){c.appendChild(Builder._text(d))}}})}else{if(Builder._isStringOrNumber(a)){c.appendChild(Builder._text(a))}}},_isStringOrNumber:function(a){return(typeof a=="string"||typeof a=="number")},build:function(c){var a=this.node("div");$(a).update(c.strip());return a.down()},dump:function(c){if(typeof c!="object"&&typeof c!="function"){c=window}var a=("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);a.each(function(d){c[d]=function(){return Builder.node.apply(Builder,[d].concat($A(arguments)))}})}};var Autocompleter={};Autocompleter.Base=function(){};Autocompleter.Base.prototype={baseInitialize:function(c,d,a){this.element=$(c);this.update=$(d);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;if(this.setOptions){this.setOptions(a)}else{this.options=a||{}}this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||0.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(e,f){if(!f.style.position||f.style.position=="absolute"){f.style.position="absolute";Position.clone(e,f,{setHeight:false,offsetTop:e.offsetHeight})}Effect.Appear(f,{duration:0.15})};this.options.onHide=this.options.onHide||function(e,f){new Effect.Fade(f,{duration:0.15})};if(typeof(this.options.tokens)=="string"){this.options.tokens=new Array(this.options.tokens)}this.observer=null;this.element.setAttribute("autocomplete","off");Element.hide(this.update);Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this));Event.observe(this.element,"keypress",this.onKeyPress.bindAsEventListener(this))},show:function(){if(Element.getStyle(this.update,"display")=="none"){this.options.onShow(this.element,this.update)}if(!this.iefix&&(navigator.appVersion.indexOf("MSIE")>0)&&(navigator.userAgent.indexOf("Opera")<0)&&(Element.getStyle(this.update,"position")=="absolute")){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.update.id+"_iefix")}if(this.iefix){setTimeout(this.fixIEOverlapping.bind(this),50)}},fixIEOverlapping:function(){Position.clone(this.update,this.iefix,{setTop:(!this.update.style.height)});this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix)},hide:function(){this.stopIndicator();if(Element.getStyle(this.update,"display")!="none"){this.options.onHide(this.element,this.update)}if(this.iefix){Element.hide(this.iefix)}},startIndicator:function(){if(this.options.indicator){Element.show(this.options.indicator)}},stopIndicator:function(){if(this.options.indicator){Element.hide(this.options.indicator)}},onKeyPress:function(a){if(this.active){switch(a.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(a);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(a);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();if(navigator.appVersion.indexOf("AppleWebKit")>0){Event.stop(a)}return;case Event.KEY_DOWN:this.markNext();this.render();if(navigator.appVersion.indexOf("AppleWebKit")>0){Event.stop(a)}return}}else{if(a.keyCode==Event.KEY_TAB||a.keyCode==Event.KEY_RETURN||(navigator.appVersion.indexOf("AppleWebKit")>0&&a.keyCode==0)){return}}this.changed=true;this.hasFocus=true;if(this.observer){clearTimeout(this.observer)}this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000)},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices()},onHover:function(c){var a=Event.findElement(c,"LI");if(this.index!=a.autocompleteIndex){this.index=a.autocompleteIndex;this.render()}Event.stop(c)},onClick:function(c){var a=Event.findElement(c,"LI");this.index=a.autocompleteIndex;this.selectEntry();this.hide()},onBlur:function(a){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false},render:function(){if(this.entryCount>0){for(var a=0;a<this.entryCount;a++){this.index==a?Element.addClassName(this.getEntry(a),"selected"):Element.removeClassName(this.getEntry(a),"selected")}if(this.hasFocus){this.show();this.active=true}}else{this.active=false;this.hide()}},markPrevious:function(){if(this.index>0){this.index--}else{this.index=this.entryCount-1}this.getEntry(this.index).scrollIntoView(true)},markNext:function(){if(this.index<this.entryCount-1){this.index++}else{this.index=0}this.getEntry(this.index).scrollIntoView(false)},getEntry:function(a){return this.update.firstChild.childNodes[a]},getCurrentEntry:function(){return this.getEntry(this.index)},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry())},updateElement:function(h){if(this.options.updateElement){this.options.updateElement(h);return}var d="";if(this.options.select){var a=document.getElementsByClassName(this.options.select,h)||[];if(a.length>0){d=Element.collectTextNodes(a[0],this.options.select)}}else{d=Element.collectTextNodesIgnoreClass(h,"informal")}var f=this.findLastToken();if(f!=-1){var e=this.element.value.substr(0,f+1);var c=this.element.value.substr(f+1).match(/^\s+/);if(c){e+=c[0]}this.element.value=e+d}else{this.element.value=d}this.element.focus();if(this.options.afterUpdateElement){this.options.afterUpdateElement(this.element,h)}},updateChoices:function(d){if(!this.changed&&this.hasFocus){this.update.innerHTML=d;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;for(var a=0;a<this.entryCount;a++){var c=this.getEntry(a);c.autocompleteIndex=a;this.addObservers(c)}}else{this.entryCount=0}this.stopIndicator();this.index=0;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();this.hide()}else{this.render()}}},addObservers:function(a){Event.observe(a,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(a,"click",this.onClick.bindAsEventListener(this))},onObserverEvent:function(){this.changed=false;if(this.getToken().length>=this.options.minChars){this.startIndicator();this.getUpdatedChoices()}else{this.active=false;this.hide()}},getToken:function(){var c=this.findLastToken();if(c!=-1){var a=this.element.value.substr(c+1).replace(/^\s+/,"").replace(/\s+$/,"")}else{var a=this.element.value}return/\n/.test(a)?"":a},findLastToken:function(){var d=-1;for(var c=0;c<this.options.tokens.length;c++){var a=this.element.value.lastIndexOf(this.options.tokens[c]);if(a>d){d=a}}return d}};Ajax.Autocompleter=Class.create();Object.extend(Object.extend(Ajax.Autocompleter.prototype,Autocompleter.Base.prototype),{initialize:function(d,e,c,a){this.baseInitialize(d,e,a);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=c},getUpdatedChoices:function(){entry=encodeURIComponent(this.options.paramName)+"="+encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,entry):entry;if(this.options.defaultParams){this.options.parameters+="&"+this.options.defaultParams}new Ajax.Request(this.url,this.options)},onComplete:function(a){this.updateChoices(a.responseText)}});Autocompleter.Local=Class.create();Autocompleter.Local.prototype=Object.extend(new Autocompleter.Base(),{initialize:function(c,e,d,a){this.baseInitialize(c,e,a);this.options.array=d},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this))},setOptions:function(a){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(c){var e=[];var d=[];var k=c.getToken();var j=0;for(var f=0;f<c.options.array.length&&e.length<c.options.choices;f++){var h=c.options.array[f];var l=c.options.ignoreCase?h.toLowerCase().indexOf(k.toLowerCase()):h.indexOf(k);while(l!=-1){if(l==0&&h.length!=k.length){e.push("<li><strong>"+h.substr(0,k.length)+"</strong>"+h.substr(k.length)+"</li>");break}else{if(k.length>=c.options.partialChars&&c.options.partialSearch&&l!=-1){if(c.options.fullSearch||/\s/.test(h.substr(l-1,1))){d.push("<li>"+h.substr(0,l)+"<strong>"+h.substr(l,k.length)+"</strong>"+h.substr(l+k.length)+"</li>");break}}}l=c.options.ignoreCase?h.toLowerCase().indexOf(k.toLowerCase(),l+1):h.indexOf(k,l+1)}}if(d.length){e=e.concat(d.slice(0,c.options.choices-e.length))}return"<ul>"+e.join("")+"</ul>"}},a||{})}});Field.scrollFreeActivate=function(a){setTimeout(function(){Field.activate(a)},1)};Ajax.InPlaceEditor=Class.create();Ajax.InPlaceEditor.defaultHighlightColor="#FFFF99";Ajax.InPlaceEditor.prototype={initialize:function(d,c,a){this.url=c;this.element=$(d);this.options=Object.extend({paramName:"value",okButton:true,okText:"ok",cancelLink:true,cancelText:"cancel",savingText:"Saving...",clickToEditText:"Click to edit",okText:"ok",rows:1,onComplete:function(f,e){new Effect.Highlight(e,{startcolor:this.options.highlightcolor})},onFailure:function(e){alert("Error communicating with the server: "+e.responseText.stripTags())},callback:function(e){return Form.serialize(e)},handleLineBreaks:true,loadingText:"Loading...",savingClassName:"inplaceeditor-saving",loadingClassName:"inplaceeditor-loading",formClassName:"inplaceeditor-form",highlightcolor:Ajax.InPlaceEditor.defaultHighlightColor,highlightendcolor:"#FFFFFF",externalControl:null,submitOnBlur:false,ajaxOptions:{},evalScripts:false},a||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+"-inplaceeditor";if($(this.options.formId)){this.options.formId=null}}if(this.options.externalControl){this.options.externalControl=$(this.options.externalControl)}this.originalBackground=Element.getStyle(this.element,"background-color");if(!this.originalBackground){this.originalBackground="transparent"}this.element.title=this.options.clickToEditText;this.onclickListener=this.enterEditMode.bindAsEventListener(this);this.mouseoverListener=this.enterHover.bindAsEventListener(this);this.mouseoutListener=this.leaveHover.bindAsEventListener(this);Event.observe(this.element,"click",this.onclickListener);Event.observe(this.element,"mouseover",this.mouseoverListener);Event.observe(this.element,"mouseout",this.mouseoutListener);if(this.options.externalControl){Event.observe(this.options.externalControl,"click",this.onclickListener);Event.observe(this.options.externalControl,"mouseover",this.mouseoverListener);Event.observe(this.options.externalControl,"mouseout",this.mouseoutListener)}},enterEditMode:function(a){if(this.saving){return}if(this.editing){return}this.editing=true;this.onEnterEditMode();if(this.options.externalControl){Element.hide(this.options.externalControl)}Element.hide(this.element);this.createForm();this.element.parentNode.insertBefore(this.form,this.element);if(!this.options.loadTextURL){Field.scrollFreeActivate(this.editField)}if(a){Event.stop(a)}return false},createForm:function(){this.form=document.createElement("form");this.form.id=this.options.formId;Element.addClassName(this.form,this.options.formClassName);this.form.onsubmit=this.onSubmit.bind(this);this.createEditField();if(this.options.textarea){var a=document.createElement("br");this.form.appendChild(a)}if(this.options.okButton){okButton=document.createElement("input");okButton.type="submit";okButton.value=this.options.okText;okButton.className="editor_ok_button";this.form.appendChild(okButton)}if(this.options.cancelLink){cancelLink=document.createElement("a");cancelLink.href="#";cancelLink.appendChild(document.createTextNode(this.options.cancelText));cancelLink.onclick=this.onclickCancel.bind(this);cancelLink.className="editor_cancel";this.form.appendChild(cancelLink)}},hasHTMLLineBreaks:function(a){if(!this.options.handleLineBreaks){return false}return a.match(/<br/i)||a.match(/<p>/i)},convertHTMLLineBreaks:function(c){var a=this.options.handleLineBreaks?"\n":"";return c.replace(/<br>/gi,a).replace(/<br\/>/gi,a).replace(/<\/p>/gi,a).replace(/<p>/gi,"")},createEditField:function(){var f;if(this.options.loadTextURL){f=this.options.loadingText}else{f=this.getText()}var d=this;if(this.options.rows==1&&!this.hasHTMLLineBreaks(f)){this.options.textarea=false;var a=document.createElement("input");a.obj=this;a.type="text";a.name=this.options.paramName;a.value=f;a.style.backgroundColor=this.options.highlightcolor;a.className="editor_field";var c=this.options.size||this.options.cols||0;if(c!=0){a.size=c}if(this.options.submitOnBlur){a.onblur=this.onSubmit.bind(this)}this.editField=a}else{this.options.textarea=true;var e=document.createElement("textarea");e.obj=this;e.name=this.options.paramName;e.value=this.convertHTMLLineBreaks(f);e.rows=this.options.rows;e.cols=this.options.cols||40;e.className="editor_field";if(this.options.submitOnBlur){e.onblur=this.onSubmit.bind(this)}this.editField=e}if(this.options.loadTextURL){this.loadExternalText()}this.form.appendChild(this.editField)},getText:function(){return this.element.innerHTML},loadExternalText:function(){Element.addClassName(this.form,this.options.loadingClassName);this.editField.disabled=true;new Ajax.Request(this.options.loadTextURL,Object.extend({asynchronous:true,onComplete:this.onLoadedExternalText.bind(this)},this.options.ajaxOptions))},onLoadedExternalText:function(a){Element.removeClassName(this.form,this.options.loadingClassName);this.editField.disabled=false;this.editField.value=a.responseText.stripTags();Field.scrollFreeActivate(this.editField)},onclickCancel:function(){this.onComplete();this.leaveEditMode();return false},onFailure:function(a){this.options.onFailure(a);if(this.oldInnerHTML){this.element.innerHTML=this.oldInnerHTML;this.oldInnerHTML=null}return false},onSubmit:function(){var a=this.form;var c=this.editField.value;this.onLoading();if(this.options.evalScripts){new Ajax.Request(this.url,Object.extend({parameters:this.options.callback(a,c),onComplete:this.onComplete.bind(this),onFailure:this.onFailure.bind(this),asynchronous:true,evalScripts:true},this.options.ajaxOptions))}else{new Ajax.Updater({success:this.element,failure:null},this.url,Object.extend({parameters:this.options.callback(a,c),onComplete:this.onComplete.bind(this),onFailure:this.onFailure.bind(this)},this.options.ajaxOptions))}if(arguments.length>1){Event.stop(arguments[0])}return false},onLoading:function(){this.saving=true;this.removeForm();this.leaveHover();this.showSaving()},showSaving:function(){this.oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;Element.addClassName(this.element,this.options.savingClassName);this.element.style.backgroundColor=this.originalBackground;Element.show(this.element)},removeForm:function(){if(this.form){if(this.form.parentNode){Element.remove(this.form)}this.form=null}},enterHover:function(){if(this.saving){return}this.element.style.backgroundColor=this.options.highlightcolor;if(this.effect){this.effect.cancel()}Element.addClassName(this.element,this.options.hoverClassName)},leaveHover:function(){if(this.options.backgroundColor){this.element.style.backgroundColor=this.oldBackground}Element.removeClassName(this.element,this.options.hoverClassName);if(this.saving){return}this.effect=new Effect.Highlight(this.element,{startcolor:this.options.highlightcolor,endcolor:this.options.highlightendcolor,restorecolor:this.originalBackground})},leaveEditMode:function(){Element.removeClassName(this.element,this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this.originalBackground;Element.show(this.element);if(this.options.externalControl){Element.show(this.options.externalControl)}this.editing=false;this.saving=false;this.oldInnerHTML=null;this.onLeaveEditMode()},onComplete:function(a){this.leaveEditMode();this.options.onComplete.bind(this)(a,this.element)},onEnterEditMode:function(){},onLeaveEditMode:function(){},dispose:function(){if(this.oldInnerHTML){this.element.innerHTML=this.oldInnerHTML}this.leaveEditMode();Event.stopObserving(this.element,"click",this.onclickListener);Event.stopObserving(this.element,"mouseover",this.mouseoverListener);Event.stopObserving(this.element,"mouseout",this.mouseoutListener);if(this.options.externalControl){Event.stopObserving(this.options.externalControl,"click",this.onclickListener);Event.stopObserving(this.options.externalControl,"mouseover",this.mouseoverListener);Event.stopObserving(this.options.externalControl,"mouseout",this.mouseoutListener)}}};Ajax.InPlaceCollectionEditor=Class.create();Object.extend(Ajax.InPlaceCollectionEditor.prototype,Ajax.InPlaceEditor.prototype);Object.extend(Ajax.InPlaceCollectionEditor.prototype,{createEditField:function(){if(!this.cached_selectTag){var a=document.createElement("select");var d=this.options.collection||[];var c;d.each(function(h,f){c=document.createElement("option");c.value=(h instanceof Array)?h[0]:h;if((typeof this.options.value=="undefined")&&((h instanceof Array)?this.element.innerHTML==h[1]:h==c.value)){c.selected=true}if(this.options.value==c.value){c.selected=true}c.appendChild(document.createTextNode((h instanceof Array)?h[1]:h));a.appendChild(c)}.bind(this));this.cached_selectTag=a}this.editField=this.cached_selectTag;if(this.options.loadTextURL){this.loadExternalText()}this.form.appendChild(this.editField);this.options.callback=function(e,f){return"value="+encodeURIComponent(f)}}});Form.Element.DelayedObserver=Class.create();Form.Element.DelayedObserver.prototype={initialize:function(c,a,d){this.delay=a||0.5;this.element=$(c);this.callback=d;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,"keyup",this.delayedListener.bindAsEventListener(this))},delayedListener:function(a){if(this.lastValue==$F(this.element)){return}if(this.timer){clearTimeout(this.timer)}this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000);this.lastValue=$F(this.element)},onTimerEvent:function(){this.timer=null;this.callback(this.element,$F(this.element))}};function scrollToSmoother(c){c=c||30;var a;var e=0;var d=window.scrollTo;window.scrollTo=function(o,n,m){var h=document.viewport.getScrollOffsets();var k=o-h.left;var f=n-h.top;var l=k*2/c;var j=f*2/c;if(k<c&&f<c){d(o,n);return}if(a){clearInterval(a)}e=0;a=setInterval(function(){if(e==c){clearInterval(a);if(m){window.location.hash=m}return}e++;var s=Math.abs(e-c/2);var q=(e<(c/2)?-1:1)*s/c*(c-s);var p=h.left+k/2+q*l;var t=h.top+f/2+q*j;d(parseInt(p),parseInt(t))},10)}}Timer={times:{},pending:{},start:function(a,c){a=a||"default";c=c||new Date();if(this.pending[a]){return}this.pending[a]=c},stop:function(a,c){a=a||"default";c=c||new Date();if(!this.pending[a]){return}this.times[a]=(this.times[a]||0)+(c-this.pending[a]);delete this.pending[a]},set:function(a,d,c){this.start(a,d);this.stop(a,c)},log:function(a){if(a){this.print(this.times[a],a);return}for(var a in this.times){this.print(this.times[a],a)}},print:function(d,a){var c=d+" ms - "+a;(function(){if(window.console){if(d>=10){window.console.warn&&window.console.warn(c)}if(!window.console.warn&&!window.console.info){window.console.log&&window.console.log(c)}}else{if(window.opera){window.opera.postError&&window.opera.postError(c)}}}).defer()}};Sound={tracks:{},_enabled:true,template:new Template('<embed style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>'),enable:function(){Sound._enabled=true},disable:function(){Sound._enabled=false},play:function(c){if(!Sound._enabled){return}var a=Object.extend({track:"global",url:c,replace:false},arguments[1]||{});if(a.replace&&this.tracks[a.track]){$R(0,this.tracks[a.track].id).each(function(e){var d=$("sound_"+a.track+"_"+e);d.Stop&&d.Stop();d.remove()});this.tracks[a.track]=null}if(!this.tracks[a.track]){this.tracks[a.track]={id:0}}else{this.tracks[a.track].id++}a.id=this.tracks[a.track].id;$$("body")[0].insert(Prototype.Browser.IE?new Element("bgsound",{id:"sound_"+a.track+"_"+a.id,src:a.url,loop:1,autostart:true}):Sound.template.evaluate(a))}};if(Prototype.Browser.Gecko&&navigator.userAgent.indexOf("Win")>0){if(navigator.plugins&&$A(navigator.plugins).detect(function(a){return a.name.indexOf("QuickTime")!=-1})){Sound.template=new Template('<object id="sound_#{track}_#{id}" width="0" height="0" type="audio/mpeg" data="#{url}"/>')}else{Sound.play=function(){}}}Event.observe=Event.observe.wrap(function(e,c,a,d){$A(Object.isArray(a)?a:[a]).each(function(f){e(c,f,d)});return c});Element.addMethods({observe:Event.observe});Object.extend(document,{observe:Element.Methods.observe.methodize()});Event.isCtrlEnter=function(a){return a.ctrlKey&&(a.keyCode==Event.KEY_RETURN||(a.keyCode==10&&(Prototype.Browser.WebKit||Prototype.Browser.IE)))};Event.SCROLL=(Prototype.Browser.IE||Prototype.Browser.Opera||Prototype.Browser.WebKit)?"mousewheel":"DOMMouseScroll";Function.prototype.getDelayedHandlers=function(c){c=c||{};var e=("over" in c)?c.over:400;var f=("out" in c)?c.out:200;var d={timeouts:{},handlers:{}};var a=this;d.handlers.over=function(){if(d.timeouts.out){clearTimeout(d.timeouts.out);d.timeouts.out=null}d.timeouts.over=a.delay(e/1000,true,d)};d.handlers.out=function(){if(d.timeouts.over){clearTimeout(d.timeouts.over);d.timeouts.over=null}d.timeouts.out=a.delay(f/1000,false,d)};return d};Object.extend(Element.Methods,{hover:function(a,c){a=$(a);var d=(c instanceof Function)?c:function(f){a[f?"addClassName":"removeClassName"](c)};c=(c instanceof Function)?"hover":(c||"hover");var e=Prototype.Browser.IE?["mouseenter","mouseleave"]:["mouseover","mouseout"];return a.observe(e[0],d.curry(true)).observe(e[1],d.curry(false))},delayedHover:function(d,e,c){d=$(d);var a=e.bind(d).getDelayedHandlers(c);var f=Prototype.Browser.IE?["mouseenter","mouseleave"]:["mouseover","mouseout"];d.observe(f[0],a.handlers.over);d.observe(f[1],a.handlers.out);return a},fitViewport:function(k){k=$(k);var e=k.getWidth();var d=k.getHeight();var l=k.viewportOffset();var m=l[0];var j=l[1];var c=document.viewport.getWidth()-20;var a=document.viewport.getHeight()-20;var h=0,f=0;if(m+e>c){h=(c-(m+e))}if(j+d>a){f=(a-(j+d))}if(!h&&!f){return k}k.style.top=parseInt(k.style.top)+f+"px";k.style.left=parseInt(k.style.left)+h+"px";return k},preventDocumentScroll:function(a){document.observe("mouse:wheel",function(c){if(!c.element().descendantOf(a)){return}if((c.memo.delta>0&&a.scrollTop==0)||(c.memo.delta<0&&a.scrollTop+a.getHeight()+5>a.scrollHeight)){Event.stop(c)}});return a},hideOnOuterClick:function(c,a,f,e){c=$(c);a=$(a);if(!c){return}document.observe("click",function d(h){var j=h.element();if(a&&(j==a||j.descendantOf(a))){return}if(j.descendantOf(c)){return}e||document.stopObserving("click",d);f?f():c.hide()});return c},replaceClassNameWith:function(c,a,d){c=$(c);c.className=c.className.replace(new RegExp("\\b("+a+"|"+d+")\\b","ig"),"")+" "+d;return c},nextSiblingsUntil:function(d,a){var f=d.nextSiblings();var e=[];var c=false;f.each(function(h){if(h.match(a)){c=true}if(c){return}e.push(h)});if(!e.first()){return null}else{return e}},createElementGroup:function(a,e){var d=false;if(a.elementGroup){d=true}else{a.elementGroup=[]}if(!e){return}if(e instanceof Array){$(e).each(function(f){f=$(f);if(!f){return}a.elementGroup.push(f)})}else{var c=$(e);if(c){a.elementGroup.push(c)}}if(d){return}a.hide=a.hide.wrap(function(f){a.elementGroup.each(function(h){h.hide()});return f.call()});a.show=a.show.wrap(function(f){a.elementGroup.each(function(h){h.show()});return f.call()});a.writeAttribute=a.writeAttribute.wrap(function(h){var f=arguments[1];var j=arguments[2];a.elementGroup.each(function(k){k.writeAttribute(f,j)});return h.curry(f,j).call()})}});Element.collectTextNodesIgnoreClass=function(a,c){return $A($(a).childNodes).collect(function(d){return(d.nodeType==3?d.nodeValue:((d.hasChildNodes()&&!Element.hasClassName(d,c))?Element.collectTextNodesIgnoreClass(d,c):""))}).flatten().join("")};Object.extend(Form.Methods,{asyncSubmit:function(d,c){c=c||{};var e={};var f=$(d).getElements();f.each(function(h){switch(h.type){case"radio":if(h.checked){e[h.name]=h.value}break;case"checkbox":if(h.checked){e[h.name]=h.value}break;default:if(h.name){e[h.name]=h.value}}});var a={csrf:window.csrf,parameters:e};Object.extend(a,c);request=new Ajax.Request(d.action+(c.add2url||""),a)},requirementsMet:function(c){var d=$(c).getElements(),a=true;d.each(function(e){var h=e.up(".form_field");if(!h){return}var f=e.siblings().find(function(j){return j.hasClassName("errors_container")});if(!f){return}while(f.firstChild){f.removeChild(f.firstChild)}if(h.hasClassName("required")&&!h.hasClassName("requirementsMet")){a=false;f.update(Builder.node("p.error",Dic.word("error_required_missed")))}});return a}});Object.extend(Form.Element.Methods,{setDefaultValue:function(c,e,a){c=$(c);var d=function(){if(!c.value.length){c.value=e;a&&c.addClassName(a)}};d();c.observe("blur",d);c.observe("focus",function(){if(c.value==e){c.value="";a&&c.removeClassName(a)}});c.form&&$(c.form).observe("submit",function(){if(c.value==e){c.value="";a&&c.removeClassName(a)}});return c},makeRequired:function(j,e,d){j=$(j);var h=j.id&&j.id.indexOf("email")!=-1||j.className&&j.className.indexOf("email")!=-1,k=/^\w+([+\.-]?\w+)*@(((([a-z0-9]{2,})|([a-z0-9][-][a-z0-9]+))[\.][a-z0-9])|([a-z0-9]+[-]?))+[a-z0-9]+\.([a-z]{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$/i,c=j.up("div.required"),f=/radio/i.test(j.type);if(f){$A(document.getElementsByName(j.name)).each(function(l){l.checked&&c.addClassName("requirementsMet");l.observe(["change","keyup","mouseup","blur"],function(m){m.element().checked&&c.addClassName("requirementsMet")})});return}var a=function(){setTimeout(function(){var l=(j.hasClassName("hasDefaultAtFirst")?j.selectedIndex<1:j.value.blank())||(e?$F(j).length<e:false)||(d?$F(j).length>d:false)||(h?!k.test($F(j)):false);c[l?"removeClassName":"addClassName"]("requirementsMet")},10)};j.observe(["change","keyup","mouseup","blur"],a);a();return j},makeRequiredEqualTo:function(e,c,d){e=$(e);c=$(c);function a(){setTimeout(function(){d((!e.value.blank())&&(e.value==c.value),e,c)},10)}$A([e,c]).invoke("observe",["change","keyup","mouseup"],a);a();return e},disable:function(a,c){a=$(a);c=c||"disabled";a.disabled=true;a.addClassName(c);return a},enable:function(a,c){a=$(a);c=c||"disabled";a.disabled=false;a.removeClassName(c);return a},uploadFile:function(d,c,a){d=$(d);a=a||{};if(!d||!/input/i.test(d.nodeName)||!/file/i.test(d.type)){throw"Form.Element.uploadFile is for file inputs only"}if(d.form&&/^fileUploadIframe_/i.test(d.form.target)){throw"Form.Element.uploadFile is already running"}var j="fileUploadIframe_"+Math.floor(Math.random()*10000000);var e=Builder.node("iframe",{id:j,name:j,style:"display:none;"});document.body.appendChild(e);e.observe("load",function(l){if(e.readyState!=undefined&&e.readyState!="complete"){return}var k=e.contentDocument||e.contentWindow.document;if(/^\s*blank\s+page\s*$/i.test(k.firstChild.textContent||k.firstChild.outerText)){return}(a.onComplete||Prototype.K).curry(k,e).defer()});var h=!a.parameters?[]:$H(a.parameters).collect(function(k){return Builder.node("input",{type:"hidden",name:k.key,value:k.value})});var f=Builder.node("form",{action:c,target:j,method:"post",enctype:"multipart/form-data",encType:"multipart/form-data",encoding:"multipart/form-data"},h);d.parentNode.insertBefore(f,d);f.appendChild(d);f.submit();return function(){f.reset();f.parentNode.insertBefore(d,f);f.remove();e.remove()}}});Object.extend(String.prototype,{parseInt:parseInt.methodize(),parseFloat:parseFloat.methodize(),nbsp:(function(){var a=document.createElement("div");a.innerHTML="&nbsp;";return a.firstChild.nodeValue})(),add2url:function(c){var a=(this.length>0)?this:window.location.href;return a.replace(/#.*$/,"").replace(/$|(\/$)|(\/)?(?=\?)/,"/"+c+"/")},declension:function(a,d){if(a.length==2){a[2]=a[1]}d=d%100;var c=d%10;if((d>10&&d<20)||(c>4)||(c==0)){return a[2]}if(c==1){return a[0]}return a[1]},format:function(c){if(!(c instanceof Array)){c=[c]}if(!this.match(/%d/)){return this.replace(/$/,"("+c.join(", ")+")")}var a=0;return this.gsub(/%d\s*(\{(.*?)\|(.*?)(?:\|(.*?))?\})?/,function(d){return d[1]==undefined?""+c[a++]:""+c[a]+" "+String.prototype.declension(d.slice(2),c[a++])})},linkify:function(){var a=";/?:@&\\=\\+$,%#\\w\\.\\!~\\*'\\(\\)-";var d=a.replace(/\\\./,"").replace(",","");var c='([^\\w"/]|^)((?:https?://www\\.|https?://|www\\.)(?:(?!&quot;|&gt;|&lt;)['+a+"])+)(["+d+"])";return this.gsub(new RegExp(c,"i"),'#{1}<a href="#{2}#{3}" target="_blank">#{2}#{3}</a>')}});String.prototype.truncate=String.prototype.truncate.wrap(function(c,d,a){return c.call(this,d,a||"…")});Builder.node=Builder.node.wrap(function(d,e,c,a){if(!a&&c){if(Builder._isStringOrNumber(c)||c.tagName||(c instanceof Array)){a=c;c=undefined}}c=c||{};if(/#(\w+)/.test(e)){c.id=RegExp.$1;e=e.replace(/#\w+/,"")}if(/\.(.+)$/.test(e)){c.className=RegExp.$1;e=e.replace(/\..*$/,"")}return d.call(Builder,e,c,a)});HtmlBuilder={node:function(f,d,c){if(Object.isArray(d)||(!c&&Object.isString(d))){c=d;d=undefined}d=d||{};c=c||[];if(Object.isString(c)){c=[c]}if(/#(\w+)/.test(f)){d.id=RegExp.$1;f=f.replace(/#\w+/,"")}if(/\.(.+)$/.test(f)){d["class"]=RegExp.$1;f=f.replace(/\..*$/,"")}function e(h){return(""+h).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}var a=$H(d).collect(function(h){return h.key+'="'+e(h.value)+'"'}).join(" ");return $A(["img","br","input"]).indexOf(f)==-1?"<"+f+" "+a+">"+c.join("")+"</"+f+">":"<"+f+" "+a+" />"}};if(Prototype.Browser.Gecko&&!$("cabinet_bar")){function handler(a,d,c){return a(function(){d()},c)}if(window.setInterval.wrap){window.setInterval=window.setInterval.wrap(handler);window.setTimeout=window.setTimeout.wrap(handler)}}(function(){document.observe(["mousewheel","DOMMouseScroll"],function(d){var a;if(d.wheelDelta){a=d.wheelDelta/120}else{if(d.detail){a=-d.detail/3}}if(!a){return}if(d&&d.element&&d.element()){var c=d.element().fire("mouse:wheel",{delta:a});if(c.stopped){d.stop()}}})})();String.prototype.split=String.prototype.split.wrap(function(j,m,e){if(!(m instanceof RegExp)){return j.call(this,m,e)}if(e===undefined||+e<0){e=false}else{e=Math.floor(+e);if(!e){return[]}}var d=(m.global?"g":"")+(m.ignoreCase?"i":"")+(m.multiline?"m":""),k=new RegExp("^"+m.source+"$",d),c=[],a=0,f=0,h;if(!m.global){m=new RegExp(m.source,"g"+d)}while((!e||f++<=e)&&(h=m.exec(this))){var l=!h[0].length;if(l&&m.lastIndex>h.index){m.lastIndex=h.index}if(m.lastIndex>a){if(h.length>1){h[0].replace(k,function(){for(var n=1;n<arguments.length-2;n++){if(arguments[n]===undefined){h[n]=undefined}}})}c=c.concat(this.slice(a,h.index),(h.index===this.length?[]:h.slice(1)));a=m.lastIndex}if(l){m.lastIndex++}}return(a===this.length)?(m.test("")?c:c.concat("")):(e?c:c.concat(this.slice(a)))});function convertRGBToHex(c){var d=new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)","gi");var a=c.replace(d,"$1,$2,$3").split(",");if(a.length==3){r=parseInt(a[0]).toString(16);g=parseInt(a[1]).toString(16);b=parseInt(a[2]).toString(16);r=r.length==1?"0"+r:r;g=g.length==1?"0"+g:g;b=b.length==1?"0"+b:b;return"#"+r+g+b}return c}function getRandomInt(c,a){return Math.floor(Math.random()*(a-c+1))+c}Date.prototype.serverShift=function(){if(Date.shift){this.setHours(Date.shift+this.getUTCHours())}return this};Ajax.Responders.register({onCreate:function(a){a.timeoutId=window.setTimeout(function(){if(a.transport.readyState<1||a.transport.readyState>3){a.transport.abort();if(window.DEBUG_MODE&&!(a&&a.parameters&&a.parameters.background)){notify(Dic.word("there_are_network_problems"))}a.options.onFailure&&a.options.onFailure(a.transport,a.json)}},5000)},onComplete:function(c){window.clearTimeout(c.timeoutId);if((c.getHeader("X-Mirtesen")||"").match(/NeedAuth/i)){if(c.options.on403){c.options.on403(c.transport,c.json)}else{if((c.getHeader("X-Mirtesen-Background"))){return}else{window.location="/login/"}}}if(!(c.getHeader("Content-Type")||"").match(/text\/javascript/i)){return}var a;try{a=c.evalResponse().result}catch(d){}if(a&&a.exception){if(a.exception.type=="RedirectException"&&a.exception.url){window.location=a.exception.url}}},onException:function(c,a){window.clearTimeout(c.timeoutId);if(window.DEBUG_MODE&&window.console&&console.log){console.log(a)}if(window.DEBUG_MODE&&window.opera&&opera.postError){opera.postError(a)}if(a.name=="AppJsException"){if(a.type=="badAuth"){c.options.on403&&c.options.on403(c.transport,c.json);return}if(window.DEBUG_MODE&&(a.type=="badResult"||a.type=="badJson")){notify("Something BAD happened on server! Check console for details.")}}},on503:function(){notify(Dic.word("site_is_being_maintained"))}});Ajax.parseResult=function(f,c){var a;try{a=f.responseText.evalJSON()}catch(d){if(c){c()}throw new AppJsException({transport:f,exception:d},"badJson")}if(!a.result||!a.result.ok||a.result.auth){if(c){c()}throw new AppJsException({transport:f,parsed:a},(a.result&&a.result.auth)?"badAuth":"badResult")}return a.result};Form.Methods.request=Form.Methods.request.wrap(function(c,d,a){var f=d.getElements();a=a||{};a.onException=(a.onException||Prototype.emptyFunction).wrap(function(k,m,j){k(m,j);if(j.name!="AppJsException"||j.type!="badResult"||!j.data.parsed){throw j}var h=j.data.parsed.result;if(!h||!h.exception){throw j}if(h.exception.type=="CaptchaException"){showCaptchaLightbox(h.captchaImageLink);return}if(!/((Data(Mapper)?)|Auth)Exception/i.test(h.exception.type)){throw j}var l=h.errorMap;$H(l).each(function(s){var u=s.key;var t=s.value;var p=new RegExp("\\["+u+"\\]");var n=f.find(function(v){return(v.name.match(p)||v.name==u)});if(!n){throw j}var o=n.siblings().find(function(v){return v.hasClassName("errors_container")});if(!o){var q=n.up(".form_field");if(q){o=q.childElements().find(function(v){return v.hasClassName("errors_container")})}else{throw j}}$(n.parentNode).addClassName("error");$A(t).each(function(v){o.update().appendChild(Builder.node("p.error",v))})})});f.each(function(h){$(h.parentNode).removeClassName("error");var j=h.siblings().find(function(k){return k.hasClassName("errors_container")});if(!j){return}while(j.firstChild){j.removeChild(j.firstChild)}});var e=d.readAttribute("action");if(a.add2url&&!e.match(new RegExp(a.add2url))){d.action=e.add2url(a.add2url);setTimeout(function(){d.action=e},0)}return c.apply(this,[d,a])});(function(){function a(d,c){c=$(c);c.className=c.className.replace(/\b(jsBlock|jsInline|jsNone|hidden)\b/g,"");return d.call(this,c)}Element.Methods.show=Element.Methods.show.wrap(a);Element.Methods.hide=Element.Methods.hide.wrap(a);Element.Methods.toggle=Element.Methods.toggle.wrap(a)})();Element.addMethods();Element.addMethods("textarea",{fitText:function(c){if(c.hasClassName("unresizable")){return}if(!c.rows||c.rows<4){c.rows=4;c.style.height="auto"}if(Prototype.Browser.IE||Prototype.Browser.Gecko){var a=(c.scrollWidth>c.getWidth())?10:0;while(c.scrollHeight>c.getHeight()-a&&c.rows<100){c.rows++}}else{var f=8;var e=Math.ceil(c.getWidth()/f);var d=2;d=$A(c.value.split(/\n/)).inject(d,function(j,h){return j+1+Math.floor(h.length/e)});c.rows=Math.max(c.rows,d,4)}}});String.replaceSmiles=function(a){$A([["[:b:]","good3"],["[:q:]","negative"],["[:dance:]","dance5"],["[:drinks:]","drinks"],["[:sorry:]","sorry"],["[:boredom:]","boredom"],["[:clapping:]","clapping"],["[:whistling:]","whistle2"],["[:opcorn:]","popcorm1"],[":)","smile3"],["=)","smile3"],[":-)","smile3"],[":D","laugh1"],[":-D","laugh1"],[";)","derisive"],[";-)","derisive"],[":P","blum3"],[":p","blum3"],[":-P","blum3"],[":-p","blum3"],[":-*","air_kiss"],[":-[","blush2"],[":~-(","cry"],[":-(","sad"],["=-O","surprise"],["[:kissing:]","kiss"],["[:drool:]","drool"],["[:rofl:]","rofl"],["[:no:]","no"],["[:trampoline:]","trampoline"],["[:rtfm:]","rtfm"],["[:ranting:]","ranting"],["[:cowboy:]","cowboy"],["[:sleep:]","sleep"],["[:hi:]","hi"],["[:in_love:]","in_love"],["[:giverose:]","giverose"],["[:heart_eyes:]","heart_eyes"],["[:baby:]","baby"],["[:verysad:]","verysad"],["[:bonk:]","bonk"],["[:girl_blum:]","girl_blum2"],["[:curtsey:]","curtsey"],["[:girl_drink:]","girl_drink3"],["[:girl_devil:]","girl_devil"],["[:girl_sigh:]","girl_sigh"],["[:girl_cry:]","girl_cry2"],["[:girl_surprise:]","girl_surprise"],["[:girl_kiss:]","girl_kiss"],["[:diablo:]","diablo"],["[:music:]","music"],["[:beach:]","beach"],["[:new_russian:]","new_russian"],["[:dash:]","dash2"],["[:tease:]","tease"]]).each(function(d){var c=new RegExp(d[0].replace(/(?=[\[\]\(\)\*])/,"\\"),"g");a=a.replace(c,'<img alt="'+d[0]+'" src="/static/images/smiles/'+d[1]+'.gif" />')});return a};String.prototype.vsprintf=function(c){var a=0;return this.gsub(/%./,function(d){return c[a++]})};Prototype.Browser.IE6=Prototype.Browser.IE&&parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5))==6;Prototype.Browser.IE7=Prototype.Browser.IE&&parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5))==7;Number.prototype.formatSecondsPos=function(){switch(true){case this>=2*30*24*60*60:return Math.floor(this/(30*24*60*60))+" months";case this>=30*24*60*60:return"1 month";case this>=2*24*60*60:return Math.floor(this/(24*60*60))+" days";case this>=24*60*60:return"1 day";case this>=2*60*60:return Math.floor(this/(60*60))+" hours";case this>=60*60:return"1 hour";case this>=2*60:return Math.floor(this/60)+" minutes";case this>=60:return"1 minute";case this>=5:return Math.floor(this/5)*5+" seconds";default:return"5 seconds"}};Number.prototype.formatSecondsAgo=function(){return this.formatSecondsPos()+" ago"};Number.prototype.formatSecondsIn=function(){return"in "+this.formatSecondsPos()};var WCH_Constructor=function(){if(!(document.all&&document.getElementById&&!window.opera&&navigator.userAgent.toLowerCase().indexOf("mac")==-1)){this.Apply=function(){};this.Discard=function(){};return}var l=false;var f=false;var d=null;var e=true;var k=this;this.Apply=function(n,o,m){if(e){c()}if(l&&(oIframe=a(n,o,m))){oIframe.style.visibility="visible"}else{if(d!=null){d.style.visibility="hidden"}}};this.Discard=function(m,n){if(l&&(oIframe=a(m,n,false))){oIframe.style.visibility="hidden";oIframe=null}else{if(d!=null){d.style.visibility="visible"}}};function a(n,s,o){var m=j(n);var u=((oTmp=j(s))?oTmp:document.getElementsByTagName("body")[0]);if(!m||!u){return}var q=document.getElementById("WCHhider"+m.id);if(!q){var p=(f)?"filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);":"";var t=m.style.zIndex;if(t==""){t=m.currentStyle.zIndex}t=parseInt(t);if(isNaN(t)){return null}if(t<2){return null}t--;var v="WCHhider"+m.id;u.insertAdjacentHTML("afterBegin",'<iframe class="WCHiframe" src="javascript:false;" id="'+v+'" scroll="no" frameborder="0" style="position:absolute;visibility:hidden;'+p+"border:0;top:0;left;0;width:0;height:0;background-color:#ccc;z-index:"+t+';"></iframe>');q=document.getElementById(v);h(q,m)}else{if(o){h(q,m)}}return q}function h(n,m){n.style.width=m.offsetWidth+"px";n.style.height=m.offsetHeight+"px";n.style.left=m.offsetLeft+"px";n.style.top=m.offsetTop+"px"}function j(n){var m=null;switch(typeof(n)){case"object":m=n;break;case"string":m=document.getElementById(n);break}return m}function c(){l=(typeof(document.body.contentEditable)!="undefined");f=(typeof(document.compatMode)!="undefined");if(!l){if(document.styleSheets.length==0){document.createStyleSheet()}var m=document.styleSheets[0];m.addRule(".WCHhider","visibility:visible");d=m.rules(m.rules.length-1)}e=false}};var WCH=new WCH_Constructor();String.prototype.parseColor=function(){var a="#";if(this.slice(0,4)=="rgb("){var d=this.slice(4,this.length-1).split(",");var c=0;do{a+=parseInt(d[c]).toColorPart()}while(++c<3)}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var c=1;c<4;c++){a+=(this.charAt(c)+this.charAt(c)).toLowerCase()}}if(this.length==7){a=this.toLowerCase()}}}return(a.length==7?a:(arguments[0]||this))};Element.collectTextNodes=function(a){return $A($(a).childNodes).collect(function(c){return(c.nodeType==3?c.nodeValue:(c.hasChildNodes()?Element.collectTextNodes(c):""))}).flatten().join("")};Element.collectTextNodesIgnoreClass=function(a,c){return $A($(a).childNodes).collect(function(d){return(d.nodeType==3?d.nodeValue:((d.hasChildNodes()&&!Element.hasClassName(d,c))?Element.collectTextNodesIgnoreClass(d,c):""))}).flatten().join("")};Element.setContentZoom=function(a,c){a=$(a);a.setStyle({fontSize:(c/100)+"em"});if(Prototype.Browser.WebKit){window.scrollBy(0,0)}return a};Element.getInlineOpacity=function(a){return $(a).style.opacity||""};Element.forceRerendering=function(a){try{a=$(a);var d=document.createTextNode(" ");a.appendChild(d);a.removeChild(d)}catch(c){}};var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},Transitions:{linear:Prototype.K,sinoidal:function(a){return(-Math.cos(a*Math.PI)/2)+0.5},reverse:function(a){return 1-a},flicker:function(a){var a=((-Math.cos(a*Math.PI)/4)+0.75)+Math.random()/4;return a>1?1:a},wobble:function(a){return(-Math.cos(a*Math.PI*(9*a))/2)+0.5},pulse:function(c,a){return(-Math.cos((c*((a||5)-0.5)*2)*Math.PI)/2)+0.5},spring:function(a){return 1-(Math.cos(a*4.5*Math.PI)*Math.exp(-a*6))},none:function(a){return 0},full:function(a){return 1}},DefaultOptions:{duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(a){var c="position:relative";if(Prototype.Browser.IE){c+=";zoom:1"}a=$(a);$A(a.childNodes).each(function(d){if(d.nodeType==3){d.nodeValue.toArray().each(function(e){a.insertBefore(new Element("span",{style:c}).update(e==" "?String.fromCharCode(160):e),d)});Element.remove(d)}})},multiple:function(c,d){var f;if(((typeof c=="object")||Object.isFunction(c))&&(c.length)){f=c}else{f=$(c).childNodes}var a=Object.extend({speed:0.1,delay:0},arguments[2]||{});var e=a.delay;$A(f).each(function(j,h){new d(j,Object.extend(a,{delay:h*a.speed+e}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(c,d,a){c=$(c);d=(d||"appear").toLowerCase();return Effect[Effect.PAIRS[d][c.visible()?1:0]](c,Object.extend({queue:{position:"end",scope:(c.id||"global"),limit:1}},a||{}))}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null},_each:function(a){this.effects._each(a)},add:function(c){var d=new Date().getTime();var a=Object.isString(c.options.queue)?c.options.queue:c.options.queue.position;switch(a){case"front":this.effects.findAll(function(f){return f.state=="idle"}).each(function(f){f.startOn+=c.finishOn;f.finishOn+=c.finishOn});break;case"with-last":d=this.effects.pluck("startOn").max()||d;break;case"end":d=this.effects.pluck("finishOn").max()||d;break}c.startOn+=d;c.finishOn+=d;if(!c.options.queue.limit||(this.effects.length<c.options.queue.limit)){this.effects.push(c)}if(!this.interval){this.interval=setInterval(this.loop.bind(this),15)}},remove:function(a){this.effects=this.effects.reject(function(c){return c==a});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop:function(){var d=new Date().getTime();for(var c=0,a=this.effects.length;c<a;c++){this.effects[c]&&this.effects[c].loop(d)}}});Effect.Queues={instances:$H(),get:function(a){if(!Object.isString(a)){return a}return this.instances.get(a)||this.instances.set(a,new Effect.ScopedQueue())}};Effect.Queue=Effect.Queues.get("global");Effect.Base=Class.create({position:null,start:function(a){if(a&&a.transition===false){a.transition=Effect.Transitions.linear}this.options=Object.extend(Object.extend({},Effect.DefaultOptions),a||{});this.currentFrame=0;this.state="idle";this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;this.render=(function(){function c(e,d){if(e.options[d+"Internal"]){e.options[d+"Internal"](e)}if(e.options[d]){e.options[d](e)}}return function(d){if(this.state==="idle"){this.state="running";c(this,"beforeSetup");if(this.setup){this.setup()}c(this,"afterSetup")}if(this.state==="running"){d=(this.options.transition(d)*this.fromToDelta)+this.options.from;this.position=d;c(this,"beforeUpdate");if(this.update){this.update(d)}c(this,"afterUpdate")}}})();this.event("beforeStart");if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).add(this)}},loop:function(d){if(d>=this.startOn){if(d>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish()}this.event("afterFinish");return}var c=(d-this.startOn)/this.totalTime,a=(c*this.totalFrames).round();if(a>this.currentFrame){this.render(c);this.currentFrame=a}}},cancel:function(){if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).remove(this)}this.state="finished"},event:function(a){if(this.options[a+"Internal"]){this.options[a+"Internal"](this)}if(this.options[a]){this.options[a](this)}},inspect:function(){var a=$H();for(property in this){if(!Object.isFunction(this[property])){a.set(property,this[property])}}return"#<Effect:"+a.inspect()+",options:"+$H(this.options).inspect()+">"}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(a){this.effects=a||[];this.start(arguments[1])},update:function(a){this.effects.invoke("render",a)},finish:function(a){this.effects.each(function(c){c.render(1);c.cancel();c.event("beforeFinish");if(c.finish){c.finish(a)}c.event("afterFinish")})}});Effect.Tween=Class.create(Effect.Base,{initialize:function(d,h,f){d=Object.isString(d)?$(d):d;var c=$A(arguments),e=c.last(),a=c.length==5?c[3]:null;this.method=Object.isFunction(e)?e.bind(d):Object.isFunction(d[e])?d[e].bind(d):function(j){d[e]=j};this.start(Object.extend({from:h,to:f},a||{}))},update:function(a){this.method(a)}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}))},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(c){this.element=$(c);if(!this.element){throw (Effect._elementDoesNotExistError)}if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}var a=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(a)},update:function(a){this.element.setOpacity(a)}});Effect.Move=Class.create(Effect.Base,{initialize:function(c){this.element=$(c);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(a)},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle("left")||"0");this.originalTop=parseFloat(this.element.getStyle("top")||"0");if(this.options.mode=="absolute"){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop}},update:function(a){this.element.setStyle({left:(this.options.x*a+this.originalLeft).round()+"px",top:(this.options.y*a+this.originalTop).round()+"px"})}});Effect.MoveBy=function(c,a,d){return new Effect.Move(c,Object.extend({x:d,y:a},arguments[3]||{}))};Effect.Scale=Class.create(Effect.Base,{initialize:function(c,d){this.element=$(c);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:d},arguments[2]||{});this.start(a)},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(c){this.originalStyle[c]=this.element.style[c]}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var a=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(c){if(a.indexOf(c)>0){this.fontSize=parseFloat(a);this.fontSizeType=c}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=="box"){this.dims=[this.element.offsetHeight,this.element.offsetWidth]}if(/^content/.test(this.options.scaleMode)){this.dims=[this.element.scrollHeight,this.element.scrollWidth]}if(!this.dims){this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]}},update:function(a){var c=(this.options.scaleFrom/100)+(this.factor*a);if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*c+this.fontSizeType})}this.setDimensions(this.dims[0]*c,this.dims[1]*c)},finish:function(a){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle)}},setDimensions:function(a,f){var h={};if(this.options.scaleX){h.width=f.round()+"px"}if(this.options.scaleY){h.height=a.round()+"px"}if(this.options.scaleFromCenter){var e=(a-this.dims[0])/2;var c=(f-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){h.top=this.originalTop-e+"px"}if(this.options.scaleX){h.left=this.originalLeft-c+"px"}}else{if(this.options.scaleY){h.top=-e+"px"}if(this.options.scaleX){h.left=-c+"px"}}}this.element.setStyle(h)}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(c){this.element=$(c);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(a)},setup:function(){if(this.element.getStyle("display")=="none"){this.cancel();return}this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle("background-image");this.element.setStyle({backgroundImage:"none"})}if(!this.options.endcolor){this.options.endcolor=this.element.getStyle("background-color").parseColor("#ffffff")}if(!this.options.restorecolor){this.options.restorecolor=this.element.getStyle("background-color")}this._base=$R(0,2).map(function(a){return parseInt(this.options.startcolor.slice(a*2+1,a*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(a){return parseInt(this.options.endcolor.slice(a*2+1,a*2+3),16)-this._base[a]}.bind(this))},update:function(a){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(c,d,e){return c+((this._base[e]+(this._delta[e]*a)).round().toColorPart())}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=function(d){var c=arguments[1]||{},a=document.viewport.getScrollOffsets(),e=$(d).cumulativeOffset();if(c.offset){e[1]+=c.offset}return new Effect.Tween(null,a.top,e[1],c,function(f){scrollTo(a.left,f.round())})};Effect.Fade=function(d){d=$(d);var a=d.getInlineOpacity();var c=Object.extend({from:d.getOpacity()||1,to:0,afterFinishInternal:function(e){if(e.options.to!=0){return}e.element.hide().setStyle({opacity:a})}},arguments[1]||{});return new Effect.Opacity(d,c)};Effect.Appear=function(c){c=$(c);var a=Object.extend({from:(c.getStyle("display")=="none"?0:c.getOpacity()||0),to:1,afterFinishInternal:function(d){d.element.forceRerendering()},beforeSetup:function(d){d.element.setOpacity(d.options.from).show()}},arguments[1]||{});return new Effect.Opacity(c,a)};Effect.Puff=function(c){c=$(c);var a={opacity:c.getInlineOpacity(),position:c.getStyle("position"),top:c.style.top,left:c.style.left,width:c.style.width,height:c.style.height};return new Effect.Parallel([new Effect.Scale(c,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(c,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(d){Position.absolutize(d.effects[0].element)},afterFinishInternal:function(d){d.effects[0].element.hide().setStyle(a)}},arguments[1]||{}))};Effect.BlindUp=function(a){a=$(a);a.makeClipping();return new Effect.Scale(a,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(c){c.element.hide().undoClipping()}},arguments[1]||{}))};Effect.BlindDown=function(c){c=$(c);var a=c.getDimensions();return new Effect.Scale(c,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:a.height,originalWidth:a.width},restoreAfterFinish:true,afterSetup:function(d){d.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(d){d.element.undoClipping()}},arguments[1]||{}))};Effect.SwitchOff=function(c){c=$(c);var a=c.getInlineOpacity();return new Effect.Appear(c,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(d){new Effect.Scale(d.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(e){e.element.makePositioned().makeClipping()},afterFinishInternal:function(e){e.element.hide().undoClipping().undoPositioned().setStyle({opacity:a})}})}},arguments[1]||{}))};Effect.DropOut=function(c){c=$(c);var a={top:c.getStyle("top"),left:c.getStyle("left"),opacity:c.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(c,{x:0,y:100,sync:true}),new Effect.Opacity(c,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(d){d.effects[0].element.makePositioned()},afterFinishInternal:function(d){d.effects[0].element.hide().undoPositioned().setStyle(a)}},arguments[1]||{}))};Effect.Shake=function(e){e=$(e);var c=Object.extend({distance:20,duration:0.5},arguments[1]||{});var f=parseFloat(c.distance);var d=parseFloat(c.duration)/10;var a={top:e.getStyle("top"),left:e.getStyle("left")};return new Effect.Move(e,{x:f,y:0,duration:d,afterFinishInternal:function(h){new Effect.Move(h.element,{x:-f*2,y:0,duration:d*2,afterFinishInternal:function(j){new Effect.Move(j.element,{x:f*2,y:0,duration:d*2,afterFinishInternal:function(k){new Effect.Move(k.element,{x:-f*2,y:0,duration:d*2,afterFinishInternal:function(l){new Effect.Move(l.element,{x:f*2,y:0,duration:d*2,afterFinishInternal:function(m){new Effect.Move(m.element,{x:-f,y:0,duration:d,afterFinishInternal:function(n){n.element.undoPositioned().setStyle(a)}})}})}})}})}})}})};Effect.SlideDown=function(d){d=$(d).cleanWhitespace();var a=d.down().getStyle("bottom");var c=d.getDimensions();return new Effect.Scale(d,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:c.height,originalWidth:c.width},restoreAfterFinish:true,afterSetup:function(e){e.element.makePositioned();e.element.down().makePositioned();if(window.opera){e.element.setStyle({top:""})}e.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(e){e.element.down().setStyle({bottom:(e.dims[0]-e.element.clientHeight)+"px"})},afterFinishInternal:function(e){e.element.undoClipping().undoPositioned();e.element.down().undoPositioned().setStyle({bottom:a})}},arguments[1]||{}))};Effect.SlideUp=function(d){d=$(d).cleanWhitespace();var a=d.down().getStyle("bottom");var c=d.getDimensions();return new Effect.Scale(d,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,scaleMode:{originalHeight:c.height,originalWidth:c.width},restoreAfterFinish:true,afterSetup:function(e){e.element.makePositioned();e.element.down().makePositioned();if(window.opera){e.element.setStyle({top:""})}e.element.makeClipping().show()},afterUpdateInternal:function(e){e.element.down().setStyle({bottom:(e.dims[0]-e.element.clientHeight)+"px"})},afterFinishInternal:function(e){e.element.hide().undoClipping().undoPositioned();e.element.down().undoPositioned().setStyle({bottom:a})}},arguments[1]||{}))};Effect.Squish=function(a){return new Effect.Scale(a,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(c){c.element.makeClipping()},afterFinishInternal:function(c){c.element.hide().undoClipping()}})};Effect.Grow=function(d){d=$(d);var c=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var a={top:d.style.top,left:d.style.left,height:d.style.height,width:d.style.width,opacity:d.getInlineOpacity()};var j=d.getDimensions();var k,h;var f,e;switch(c.direction){case"top-left":k=h=f=e=0;break;case"top-right":k=j.width;h=e=0;f=-j.width;break;case"bottom-left":k=f=0;h=j.height;e=-j.height;break;case"bottom-right":k=j.width;h=j.height;f=-j.width;e=-j.height;break;case"center":k=j.width/2;h=j.height/2;f=-j.width/2;e=-j.height/2;break}return new Effect.Move(d,{x:k,y:h,duration:0.01,beforeSetup:function(l){l.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(l){new Effect.Parallel([new Effect.Opacity(l.element,{sync:true,to:1,from:0,transition:c.opacityTransition}),new Effect.Move(l.element,{x:f,y:e,sync:true,transition:c.moveTransition}),new Effect.Scale(l.element,100,{scaleMode:{originalHeight:j.height,originalWidth:j.width},sync:true,scaleFrom:window.opera?1:0,transition:c.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(m){m.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(m){m.effects[0].element.undoClipping().undoPositioned().setStyle(a)}},c))}})};Effect.Shrink=function(d){d=$(d);var c=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var a={top:d.style.top,left:d.style.left,height:d.style.height,width:d.style.width,opacity:d.getInlineOpacity()};var h=d.getDimensions();var f,e;switch(c.direction){case"top-left":f=e=0;break;case"top-right":f=h.width;e=0;break;case"bottom-left":f=0;e=h.height;break;case"bottom-right":f=h.width;e=h.height;break;case"center":f=h.width/2;e=h.height/2;break}return new Effect.Parallel([new Effect.Opacity(d,{sync:true,to:0,from:1,transition:c.opacityTransition}),new Effect.Scale(d,window.opera?1:0,{sync:true,transition:c.scaleTransition,restoreAfterFinish:true}),new Effect.Move(d,{x:f,y:e,sync:true,transition:c.moveTransition})],Object.extend({beforeStartInternal:function(j){j.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(j){j.effects[0].element.hide().undoClipping().undoPositioned().setStyle(a)}},c))};Effect.Pulsate=function(d){d=$(d);var c=arguments[1]||{},a=d.getInlineOpacity(),f=c.transition||Effect.Transitions.linear,e=function(h){return 1-f((-Math.cos((h*(c.pulses||5)*2)*Math.PI)/2)+0.5)};return new Effect.Opacity(d,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(h){h.element.setStyle({opacity:a})}},c),{transition:e}))};Effect.Fold=function(c){c=$(c);var a={top:c.style.top,left:c.style.left,width:c.style.width,height:c.style.height};c.makeClipping();return new Effect.Scale(c,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(d){new Effect.Scale(c,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(e){e.element.hide().undoClipping().setStyle(a)}})}},arguments[1]||{}))};Effect.Morph=Class.create(Effect.Base,{initialize:function(d){this.element=$(d);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(a.style)){this.style=$H(a.style)}else{if(a.style.include(":")){this.style=a.style.parseStyle()}else{this.element.addClassName(a.style);this.style=$H(this.element.getStyles());this.element.removeClassName(a.style);var c=this.element.getStyles();this.style=this.style.reject(function(e){return e.value==c[e.key]});a.afterFinishInternal=function(e){e.element.addClassName(e.options.style);e.transforms.each(function(f){e.element.style[f.style]=""})}}}this.start(a)},setup:function(){function a(c){if(!c||["rgba(0, 0, 0, 0)","transparent"].include(c)){c="#ffffff"}c=c.parseColor();return $R(0,2).map(function(d){return parseInt(c.slice(d*2+1,d*2+3),16)})}this.transforms=this.style.map(function(j){var h=j[0],f=j[1],e=null;if(f.parseColor("#zzzzzz")!="#zzzzzz"){f=f.parseColor();e="color"}else{if(h=="opacity"){f=parseFloat(f);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}}else{if(Element.CSS_LENGTH.test(f)){var d=f.match(/^([\+\-]?[0-9\.]+)(.*)$/);f=parseFloat(d[1]);e=(d.length==3)?d[2]:null}}}var c=this.element.getStyle(h);return{style:h.camelize(),originalValue:e=="color"?a(c):parseFloat(c||0),targetValue:e=="color"?a(f):f,unit:e}}.bind(this)).reject(function(c){return((c.originalValue==c.targetValue)||(c.unit!="color"&&(isNaN(c.originalValue)||isNaN(c.targetValue))))})},update:function(a){var e={},c,d=this.transforms.length;while(d--){e[(c=this.transforms[d]).style]=c.unit=="color"?"#"+(Math.round(c.originalValue[0]+(c.targetValue[0]-c.originalValue[0])*a)).toColorPart()+(Math.round(c.originalValue[1]+(c.targetValue[1]-c.originalValue[1])*a)).toColorPart()+(Math.round(c.originalValue[2]+(c.targetValue[2]-c.originalValue[2])*a)).toColorPart():(c.originalValue+(c.targetValue-c.originalValue)*a).toFixed(3)+(c.unit===null?"":c.unit)}this.element.setStyle(e,true)}});Effect.Transform=Class.create({initialize:function(a){this.tracks=[];this.options=arguments[1]||{};this.addTracks(a)},addTracks:function(a){a.each(function(c){c=$H(c);var d=c.values().first();this.tracks.push($H({ids:c.keys().first(),effect:Effect.Morph,options:{style:d}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(a){var e=a.get("ids"),d=a.get("effect"),c=a.get("options");var f=[$(e)||$$(e)].flatten();return f.map(function(h){return new d(h,Object.extend({sync:true},c))})}).flatten(),this.options)}});Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex");Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement("div");String.prototype.parseStyle=function(){var c,a=$H();if(Prototype.Browser.WebKit){c=new Element("div",{style:this}).style}else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';c=String.__parseStyleElement.childNodes[0].style}Element.CSS_PROPERTIES.each(function(d){if(c[d]){a.set(d,c[d])}});if(Prototype.Browser.IE&&this.include("opacity")){a.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1])}return a};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(c){var a=document.defaultView.getComputedStyle($(c),null);return Element.CSS_PROPERTIES.inject({},function(d,e){d[e]=a[e];return d})}}else{Element.getStyles=function(c){c=$(c);var a=c.currentStyle,d;d=Element.CSS_PROPERTIES.inject({},function(e,f){e[f]=a[f];return e});if(!d.opacity){d.opacity=c.getOpacity()}return d}}Effect.Methods={morph:function(a,c){a=$(a);new Effect.Morph(a,Object.extend({style:c},arguments[2]||{}));return a},visualEffect:function(d,f,c){d=$(d);var e=f.dasherize().camelize(),a=e.charAt(0).toUpperCase()+e.substring(1);new Effect[a](d,c);return d},highlight:function(c,a){c=$(c);new Effect.Highlight(c,a);return c}};$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(a){Effect.Methods[a]=function(d,c){d=$(d);Effect[a.charAt(0).toUpperCase()+a.substring(1)](d,c);return d}});$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(a){Effect.Methods[a]=Element[a]});Element.addMethods(Effect.Methods);if(typeof Effect=="undefined"){throw ("You must have the script.aculo.us library to use this accordion")}var Accordion=Class.create({initialize:function(d,a){if(!$(d)){throw ("Attempted to initalize accordion with id: "+d+" which was not found.")}this.accordion=$(d);this.options={toggleClass:"accordion-toggle",toggleActive:"accordion-toggle-active",contentClass:"accordion-content"};this.contents=this.accordion.select("div."+this.options.contentClass);this.isAnimating=false;this.maxHeight=0;this.current=a?this.contents[a-1]:this.contents[0];this.toExpand=null;this.checkMaxHeight();this.initialHide();this.attachInitialMaxHeight();var c=this.clickHandler.bindAsEventListener(this);this.accordion.observe("click",c)},expand:function(a){this.toExpand=a.next("div."+this.options.contentClass);if(this.current!=this.toExpand){this.toExpand.show();this.animate()}},checkMaxHeight:function(){for(var a=0;a<this.contents.length;a++){if(this.contents[a].getHeight()>this.maxHeight){this.maxHeight=this.contents[a].getHeight()}}},attachInitialMaxHeight:function(){this.current.previous("div."+this.options.toggleClass).addClassName(this.options.toggleActive);if(this.current.getHeight()!=this.maxHeight){this.current.setStyle({height:this.maxHeight+"px"})}},clickHandler:function(c){var a=c.element();if(a.hasClassName(this.options.toggleClass)&&!this.isAnimating){this.expand(a)}},initialHide:function(){for(var a=0;a<this.contents.length;a++){if(this.contents[a]!=this.current){this.contents[a].hide();this.contents[a].setStyle({height:0})}}},animate:function(){var d=new Array();var a={sync:true,scaleFrom:0,scaleContent:false,transition:Effect.Transitions.sinoidal,scaleMode:{originalHeight:this.maxHeight,originalWidth:this.accordion.getWidth()},scaleX:false,scaleY:true};d.push(new Effect.Scale(this.toExpand,100,a));a={sync:true,scaleContent:false,transition:Effect.Transitions.sinoidal,scaleX:false,scaleY:true};d.push(new Effect.Scale(this.current,0,a));var c=0.35;new Effect.Parallel(d,{duration:c,fps:35,queue:{position:"end",scope:"accordion"},beforeStart:function(){this.isAnimating=true;this.current.previous("div."+this.options.toggleClass).removeClassName(this.options.toggleActive);this.toExpand.previous("div."+this.options.toggleClass).addClassName(this.options.toggleActive)}.bind(this),afterFinish:function(){this.current.hide();this.toExpand.setStyle({height:this.maxHeight+"px"});this.current=this.toExpand;this.isAnimating=false;this.current.fire("accordion:expanded")}.bind(this)})}});function Dklab_Realplexor(c,d,a){var f="1.31";var e=document.location.host;if(!this.constructor._registry){this.constructor._registry={}}this.version=f;this._map={};this._realplexor=null;this._namespace=d;this._login=null;this._iframeId="mpl"+(new Date().getTime());this._iframeTag='<iframe id="'+this._iframeId+'" onload="Dklab_Realplexor._iframeLoaded(&quot;'+this._iframeId+'&quot;)" src="'+c+"?identifier=IFRAME&amp;HOST="+e+"&amp;version="+this.version+'" style="display: none; position:absolute; width:200px; height: 200px; left: -1000px;"></iframe>';this._iframeCreated=false;this._needExecute=false;this._executeTimer=null;this.constructor._registry[this._iframeId]=this;if(!c.match(/^\w+:\/\/([^/]+)/)){throw"Dklab_Realplexor constructor argument must be fully-qualified URL, "+c+" given."}var h=RegExp.$1;if(h!=e&&h.lastIndexOf("."+e)!=h.length-e.length-1){throw"Due to the standard XMLHttpRequest security policy, hostname in URL passed to Dklab_Realplexor ("+h+") must be equals to the current host ("+e+") or be its direct sub-domain."}if(a){document.write(this._iframeTag);this._iframeCreated=true}document.domain=e}Dklab_Realplexor._iframeLoaded=function(c){var a=this._registry[c];setTimeout(function(){var d=document.getElementById(c);a._realplexor=d.contentWindow.Dklab_Realplexor_Loader;if(a.needExecute){a.execute()}},50)};Dklab_Realplexor.prototype.logon=function(a){this._login=a};Dklab_Realplexor.prototype.setCursor=function(c,a){if(!this._map[c]){this._map[c]={cursor:null,callbacks:[]}}this._map[c].cursor=a;return this};Dklab_Realplexor.prototype.subscribe=function(e,d){if(!this._map[e]){this._map[e]={cursor:null,callbacks:[]}}var c=this._map[e].callbacks;for(var a=0;a<c.length;a++){if(c[a]===d){return this}}c.push(d);return this};Dklab_Realplexor.prototype.unsubscribe=function(e,d){if(!this._map[e]){return this}if(d==null){this._map[e].callbacks=[];return this}var c=this._map[e].callbacks;for(var a=0;a<c.length;a++){if(c[a]===d){c.splice(a,1);return this}}return this};Dklab_Realplexor.prototype.execute=function(){if(!this._iframeCreated){var c=document.createElement("DIV");c.innerHTML=this._iframeTag;document.body.appendChild(c);this._iframeCreated=true}if(this._executeTimer){clearTimeout(this._executeTimer);this._executeTimer=null}var a=this;if(!this._realplexor){this._executeTimer=setTimeout(function(){a.execute()},30);return}this._realplexor.execute(this._map,this.constructor._callAndReturnException,(this._login!=null?this._login+"_":"")+(this._namespace!=null?this._namespace:""))};Dklab_Realplexor._callAndReturnException=function(c,a){try{c.apply(null,a);return null}catch(d){return""+d}};window.location_clone=Object.clone(window.location);if((window.location.hash.length>0)&&document.body){document.body.className+=" hasHash"}if(document.lastChild&&document.lastChild.lastChild){document.lastChild.lastChild.id="jsBody"}function initCollapsibleTextareas(){document.observe("click",function(d){var e=d.findElement("textarea");if(!e||!e.hasClassName("collapsed")){return}var a=e.up("form").down(".smileys")||$("smileys");e.removeClassName("collapsed").observe("blur",function c(){canCollapseTextarea=true;window.setTimeout(function(){if(canCollapseTextarea&&e.value.blank()){e.addClassName("collapsed");a&&a.hide()}},170)});a&&a.show()})}function initModalWindows(a,d){var c=d||"modalWindow";window[c]=(function(u){var k,e,t,q=null,f=null,o=[],h=true;if(!u.elementIds){return}$(u.elementIds).each(function(w){var v=$(w);v&&o.push(v)});if(!o[0]){return}t=Builder.node("a.delete",Dic.word("modal_close_window"));k=Builder.node(u.containerNode||"div.modal_window",t).hide();e=Builder.node("div.modal_window_back",{style:"display: none;"});o[0].insert({before:k});k.insert({top:t}).insert({before:e});if(u.visibleNodes&&u.visibleNodes.each){u.visibleNodes.each(function(v){k.insert({top:Builder.node(v)})})}o.each(function(v){k.insert(v)});var p=function(){if(!f){return}if(h){if(u.onFirstShow instanceof Function){u.onFirstShow(f,k)}}k.setStyle({marginTop:document.viewport.getScrollOffsets()[1]+"px"});e.setStyle({height:$(document.body).parentNode.scrollHeight+"px"});if(u.onShow instanceof Function){u.onShow(f,k)}if(u.onResize instanceof Function){u.onResize(f,k)}e.show();k.show();f.show();if(h){if(u.afterFirstShow instanceof Function){u.afterFirstShow(f,k)}h=false}if(!$("uploading_block")||$("uploading_block").style.display=="none"){document.observe("click",n);document.observe("keydown",s)}};var m=function(v){v=v||{};if(v.id!=null){o.each(function(w){if(w.id==v.id){q=w}})}else{if(v.index!=null){q=o[v.index]}}q=q||f;if(f){j()}if(q){f=q;p()}};var j=function(v){document.stopObserving("click",n);document.stopObserving("keydown",s);if(v){document.fire("modalwindow:confirmed",v)}e.hide();k.hide();if(f){f.hide();document.fire("modalwindow:closed")}};var l=function(){h=true};function s(v){if(v.keyCode!=Event.KEY_ESC){return}j()}function n(v){if(!v.isLeftClick()){return}var w=v.element();if(v.findElement("div.mceListBoxMenu")||v.findElement("div.mceColorSplitMenu")||w.hasClassName("color_item")){return}if(w!=k&&!w.descendantOf(k)){j()}else{if(w.match("a.modal_window_confirm")){j({isConfirmed:true})}else{if(w.match("a.modal_window_cancel")){j({isConfirmed:false})}}}}t.observe("click",j);if(u.onResize instanceof Function){Event.observe(window,"resize",u.onResize.curry(f,k))}return{showWindow:m,hideAll:j,show:p,hide:j,reset:l}})(a)}function handleApplication(c,j,f){var e=$("app_settings_manage_"+c);if(!e){return}var l=$("app_vislvl_"+c),h=$("remote_iframe_"+j),a=$("app_settings_"+c),d=a.down("form");if(d){var k=$(d.save),m=k&&k.next()}e.observe("click",function(n){var o=n.findElement("a");if(!o){return}if(o.hasClassName("app_fullscreen")){window.location=o.down().href}if(o.hasClassName("app_sets")){a.toggle()}if(o.hasClassName("add_app")){e.hide();a.show()}if(o.hasClassName("app_make_visible")){l.down().next().click()}if(o.hasClassName("app_make_invisible")){l.down().next().next().click()}if(o.hasClassName("app_delete")){confirm(Dic.word("confirm_application_delete"))&&d.request({submit:d.getElements().last().name,add2url:"json",onSuccess:function(p){Ajax.parseResult(p);if(window.gadgets.container.isCanvas){window.location=f;return}a.up().next().remove();a.up().remove()}})}});if(!m){return}m.observe("click",function(n){n.stop();a.hide();e.show()});k.observe("click",function(n){if(d.serialize().match(/install/)){return}n.stop();d.request({add2url:"settings/json/set",onSuccess:function(p){var o=Ajax.parseResult(p);if(h){h.src=o.url}else{window.location=o.url}a.hide().previous().replaceClassNameWith("public|private",o.vislvl)}})})}(function(){var d={},a={height:650,width:600,resizable:"yes",scrollbars:"no",status:"no",menubar:"no",toolbar:"no",location:"yes",directories:"no",personalbar:"no"};document.observe("popout:clicked",c.curry({}));window.popout=function(f,e){$(f).observe("click",c.curry(e))};function c(f,h){var k=h.findElement("a");if(k){var e=k.className.match(/popout_name_(\w+)/)}if(k&&e){h.stop()}else{return}e=(e&&!Prototype.Browser.WebKit)?e[1]:"_blank";var j=(e!="_blank")&&d[e]&&!d[e].closed?d[e]:window.open(k.href,e,$H(Object.extend(Object.clone(a),f||{})).collect(function(l){return l.key+"="+l.value}).join(","));d[e]=j;j&&j.focus()}})();function subscribe2comments(a,h,f,e,c,k){var d=k||$("watch_form");if(!d||!d.submit){return}var j=$(d.submit);if(!j.observe){return}var l=d["comment[watch]"]||d.watch;j.observe("click",function(n){var m=l.value!="t";new Ajax.Request(a,{parameters:d.serialize(true),onComplete:function(){d.submit.enable()},onSuccess:function(q){try{var o=Ajax.parseResult(q)}catch(p){d.submit.hide();d.submit.next().show();alert(p.message);throw p}l.value=m?"t":"f";d.submit.className=m?"butt_watch":"butt_unwatch";d.submit.value=m?h:f;d.submit.previous().update(m?e:c);if($("comment_watch_hidden")){$("comment_watch_hidden").value=m?"f":"t"}}});d.submit.disable();n.stop();this.blur()})}function EffectHighlight(d,c){d=$(d);c=Object.extend({steps:30,duration:1,startColor:["ff","ff","99"],endColor:["ff","ff","ff"]},c||{});c.startColor=$R(0,2).collect(function(h){return parseInt(c.startColor[h],16)});c.endColor=$R(0,2).collect(function(h){return parseInt(c.endColor[h],16)});var f=0,e=d.style.backgroundImage;d.style.backgroundImage="none";function a(){if(++f>c.steps){d.style.backgroundImage=e;return}d.style.backgroundColor="#"+$R(0,2).collect(function(h){return(c.startColor[h]+(c.endColor[h]-c.startColor[h])*f/c.steps).round().toColorPart(16)}).join("");a.delay(c.duration/c.steps)}a.delay(c.duration/c.steps)}function codeBaloon(d,c,a){c=$(c);$(d)&&$(d).observe("click",function(){c.show()});$(a).observe("click",function(){this.select()}).previous().observe("click",function(){c.toggle()});c.hideOnOuterClick(d)}(function(){var e,c,f,d,a;window.objectShare=function(k,m,o,s){s=s||{};var j,q=q||Builder.node("textarea.unresizable",{cols:30,rows:2}),p=s.restrictEmail||false,h=s.restrictMessage||false;k=$(k);if(!k){return}if(typeof(a)=="undefined"){a=k.hasClassName("balloon")}e=e||Builder.node("div.friends").observe("click",function(t){var u=t.element();if(!u.match("input[type=submit]")||u.disabled){return}t.stop();u.form.action=m;u.form.request({parameters:{backurl:window.location.href,"invite[message]":q.value},onSuccess:function(){u.up("p").removeClassName("loading").addClassName("sent")},onFailure:function(){u.up("p").removeClassName("loading").addClassName("error")},add2url:"json"});u.disable().up("p").addClassName("loading");u.blur()});a&&e.preventDocumentScroll();c=c||Builder.node("div.share_block",[Builder.node("div.top",Builder.node("div",Builder.node("hr"))),Builder.node("div.content",[Builder.node("a.close").observe("click",function(t){c.hide();WCH.Discard(k,k.up())}),(!o.empty())?([Builder.node("p.text",[o,]),Builder.node("div.spacer_sm",Builder.node("hr"))]):([]),(!h)?[q,Builder.node("div.spacer_sm",Builder.node("hr"))]:([]),(!p)?([Builder.node("form.simple email_share",{action:m,method:"post",enctype:"multipart/form-data"},[Builder.node("input",{type:"hidden",name:"csrf",value:csrf}),Builder.node("input",{type:"hidden",name:"backurl",value:window.location.href}),Builder.node("input.object_share",{type:"submit",name:"submit_button",value:Dic.word("share_button")}).observe("click",n),Dic.word("email")+": ",Builder.node("span",Builder.node("input.email_input",{type:"text",name:"user[0][email]"}))]),Builder.node("div.spacer_sm",Builder.node("hr")),]):([]),e,Builder.node("div.spacer_sm",Builder.node("hr"))]),Builder.node("div.bottom",Builder.node("div",Builder.node("hr")))]);a&&c.hideOnOuterClick(null,function(){c.hide();WCH.Discard(k,k.up())});k.insert({top:c});WCH.Apply(k,k.up());f=f||c.firstChild.nextSibling.firstChild;if(d){c.show()}else{e.addClassName("loading");new Ajax.Request("/friends/json",{method:"get",onSuccess:function(u){var t=Ajax.parseResult(u);d=$A(t.friends);e.removeClassName("loading");l()}})}function l(){j=d.collect(function(t){return Builder.node("p",[Builder.node("form.simple",{method:"post",action:m},[Builder.node("input",{type:"hidden",name:"csrf",value:csrf}),Builder.node("input",{type:"hidden",name:"user[0][id]",value:t.id}),Builder.node("input.object_share",{type:"submit",value:Dic.word("share_button")})]),Builder.node("img",{src:t.photo_small}),Builder.node("span.name",t.name)])});j.each(function(t){e.appendChild(t)})}function n(u){u.stop();var v=this.form["user[0][email]"].value;if(v.empty()){return}this.form.request({parameters:{csrf:csrf,backurl:window.location.href,"invite[message]":q.value},onSuccess:function(x){var w=Ajax.parseResult(x);t&&t.removeClassName("loading").addClassName("sent")},onFailure:function(){t.removeClassName("loading").addClassName("error");alert(Dic.word("error_sending_photo_to_email").format(v))},onException:function(x,w){t.removeClassName("loading").addClassName("error");alert(w.message||$H(w.data.parsed.result.errorMap).values().first()||Dic.word("error_sending_photo_to_email").format(v))},add2url:"json"});var t=Builder.node("p.email loading",[Builder.node("form.simple",Builder.node("input.object_share",{type:"submit",value:Dic.word("share_button")}).disable()),v]);e.insert({top:t});this.form["user[0][email]"].value="";document.fire("form:submitted")}}})();(function(){var d,a;var c=document.title;window.titleTicker=function(e){if(d){clearTimeout(d)}a=0;d=setInterval(function(){document.title=(a==0)?e:(a==1?"* * * * * * * * * * * * *":c);a=++a%3},500);return d};titleTicker.stop=function(){clearTimeout(d);timout=undefined;document.title=c}})();window.domReady=window.domReady||{};window.domReady.runAll=function(){var e,a=[],c=Cookie.get("profiling")||window.DEBUG_MODE;window.DEBUG_MODE=c;function d(f){return Prototype.Browser.Gecko?f:$H(f).collect(function(h){return h.key+": "+h.value}).join(";\n")}if(window.console){if(console.error){e=function(f){console.error(d(f))}}else{if(console.log){e=function(f){console.log(d(f))}}}}else{if(window.opera&&opera.postError){e=function(f){opera.postError(d(f))}}else{e=function(f){a.push(f)}}}$A(window.domReady).each(function(f){try{var j="";if(c){var l=f.toString().replace(/\n/g,"\\n");var h=l.match(/function (\w+)/);j=h?h[1]:l}Timer.start(j);f();Timer.stop(j)}catch(k){e(k)}});if(c){(function(){Timer.log()}).defer()}if(a.length>0){throw a[0]}};function codeSelector(c,a){$(c).observe(["focus","click"],function(){$(c).select()});if(!a){$(c).select()}}function formSubmit(d){var a={},c=false;d=d||{};a.container=d.containerId?$(d.containerId):null;a.loadingText=d.loadingText||Dic.word("form_submit_loading_text");a.successText=d.successText||Dic.word("form_submit_success_text");a.errorText=d.errorText||Dic.word("form_submit_error_text");a.exceptionText=d.exceptionText||Dic.word("form_submit_exception_text");a.validatorFunction=d.validatorFunction||function(){return{ok:"true"}};(a.container?a.container:document).observe("click",function(h){if(!h.isLeftClick()){return}var j=h.element();if(!j.hasClassName("ajax_button")){return}h.stop();if(c){return}var f=$(j.form);a.replacedElement=d.replacedElement||f.parentNode;if(!a.replacedElement.replaceChild){a.replacedElement=$(a.replacedElement)}var m=Builder.node("span.loading_sm",a.loadingText),l=Builder.node("span.invite_sent submitted",a.successText),e=Builder.node("span.invite_not_sent not_submitted",a.errorText),k=a.replacedElement;f.replaceChild(m,k);if(a.validatorFunction(f).ok!="true"){m.parentNode.replaceChild(e,m);return}f.request({submit:j.name,onSuccess:function(p){try{var n=Ajax.parseResult(p)}catch(o){m.parentNode.replaceChild(k,m);throw o}m.parentNode.replaceChild(l,m)},add2url:"json"})})}function groupInvite(c,e,k,d,j,f){var h=false,a=false;document.observe("click",function(l){if(!l.isLeftClick()){return}var q=l.element();if(!q.hasClassName("invite_into_group")&&!q.hasClassName("ajax_button")){return}var v=$("free_invite_count"),w=$("cost_invite_count");if(v){var o=v.innerHTML;if(o>0){o--}v.innerHTML=o;if(!a&&o<1){a=true;if(!w){window.location.reload()}}}if(!v||v.innerHTML){if(w){var u=w.innerHTML;u--;w.innerHTML=u;if(u<1){return}}}l.stop();if(h){return}var m=$(q.form);var p=!!j;if(p){if(q.form["user[0][name]"].value==j){q.form["user[0][name]"].select();EffectHighlight(q.form["user[0][name]"]);return}if(q.form["user[0][lastname]"].value==f){q.form["user[0][lastname]"].value=""}}var n=Builder.node("span.message loading_sm",c),t=Builder.node("span.message invite_sent submitted",e),s=Builder.node("span.message invite_not_sent not_submitted",k);if(p){q.parentNode.replaceChild(n,q)}else{m.parentNode.replaceChild(n,m)}m.request({submit:q.name,onSuccess:function(y){var x=Ajax.parseResult(y);n.parentNode.replaceChild(t,n);if(videoroom){videoroom.onInvitationSent(x)}},onException:function(y,x){n.parentNode.replaceChild(s,n);(new Helper(x.message||d)).element(s).show(s);if(/QuotaException/.test(x.serverType)){s.up("table").addClassName("disabled");h=true}},add2url:"json"})})}function ajaxComments(a,e,h,f,k){a=$(a);if(!a){return}var c=$(a.form);var d;function j(){a.enable();DoublePost.hide();clearTimeout(d)}c.observe("submit",function(n){if(a.value.empty()){n.stop();if(a.hasClassName("no_empty_balloon")){a.focus()}else{var m=new Helper(Dic.word("error_required_missed"));m.show(c.submitButton);setTimeout(j,0);setTimeout(m.hide.bind(m),3000);return}}if(c.photo&&!/^\s*$/.test(c.photo.value)){return}n.stop();c.action=e||c.action||window.location.href.replace(/#.*/,"");c.request({onSuccess:function(t){var p=Ajax.parseResult(t,j),s=String.replaceSmiles(p.html);j();a.clear().focus();var o=$("originalComment");if(f){o.insert({after:s})}else{o.insert({before:s});(function(){var w=o.previous();if(k){EffectHighlight(w,{duration:2,endColor:[k.substr(0,2),k.substr(2,2),k.substr(4,2)]})}else{EffectHighlight(w,{duration:2})}var u=w.viewportOffset();var v=document.viewport.getDimensions();if(u.left>=0&&u.top>=0&&u.left+w.getWidth()<v.width&&u.top+w.getHeight()<v.height){return}w.scrollTo();(function(){window.location.hash=o.previous().down().name}).delay(0.5)}).defer();if(h){h()}}var q=$("status_block");if(q&&q.down("a.edit_link")&&o.next(".comment_block")&&o.next(".comment_block").down(".commentContents")){q.down(".text").update(o.next(".comment_block").down(".commentContents").innerHTML)}},onException:function(p,o){if(o.serverType!="QuotaException"&&o.serverType!="CaptchaException"){throw o}a.next().insert(Builder.node("p.error",o.message));a.up().addClassName("error")},onFailure:function(o){j()},add2url:"json"});document.fire("form:submitted");d=setTimeout(function(){a.disable()},500);$(c.submitButton).disable()});var l=$("upload_link");if(l){l.observe("click",function(m){if(!m.isLeftClick()){return}m.stop();l.hide();$("upload_block_the").show()})}}function ctrlEnter(){document.observe("keydown",function(d){if(!Event.isCtrlEnter(d)){return}var c=d.element();if(!/textarea/i.test(c.nodeName)){return}if(c.value.blank()){return}EffectHighlight(c,{duration:0.3});var a=c.form.submitButton;if(a){a.click();DoublePost.prevent(a)}else{c.form.submit()}})}function initDynamicReply(k,j,h,a){var d=$("commentForm"),f=$("originalComment"),c=$("comment_text");form_field=c.up("div.form_field");if(!d){return}if(!a){ajaxComments(c,k,function(){d.parentNode&&d.previous()&&d.previous().show();f.hide().parentNode.appendChild(d)},j,h)}var e=Builder.node("input",{type:"hidden",name:"comment[in_reply_to_id]",value:""});c.form.appendChild(e);document.observe("click",function(m){if(!m.isLeftClick()){return}var l=findLink(m);if(!l||!/commentReplyLink/i.test(l.name)){return}m.stop();d[j?"next":"previous"]().show();if(form_field&&form_field.hasClassName("collapsible_form")){if(form_field.hasClassName("relative_block")){return}form_field.removeClassName("collapsible_form");$("smileys")&&$("smileys").show();$("collapsible_form_btn")&&$("collapsible_form_btn").removeClassName("collapsible_form");$("upload_link")&&$("upload_link").show()}var n=j?{before:d.show()}:{after:d.show()};l.insert(n);l.hide();e.value=l.rel||"";c.focus()})}function kindaLightbox(e){var a=$(document.body),d=a.parentNode.scrollHeight,c=$("kindaLightbox");if(c){c.childNodes[1].firstChild.src=e}else{c=Builder.node("div#kindaLightbox",[Builder.node("div.back",{style:"height: "+d+"px"}),Builder.node("div.container",{style:"overflow: visible;"},[Builder.node("img",{src:e}),Builder.node("a.logout",Dic.word("close_preview"))])]).observe("click",function(f){if(!f.isLeftClick()){return}c.hide();c.childNodes[1].firstChild.src=""});a.appendChild(c)}if(document.documentElement.scrollTop||document.body.scrollTop){c.firstChild.nextSibling.style.top=(document.documentElement.scrollTop||document.body.scrollTop)+"px"}(function(){c.show()}).defer()}function tagsAutoComplete(a,e,c){c=c||{};var d={method:"get",minChars:3,tokens:(c.noTokens?null:[",","\n"]),afterUpdateElement:c.afterUpdateElement||(function(f){f.value+=", "}),updateElement:c.updateElement||null,callback:c.callback||null,onHide:function(f,h){h.hide()}};if(!c.positionUnder&&!c.pinnedBox){d.onShow=function(f,h){if(!h.style.position||h.style.position=="absolute"){h.style.position="absolute";h.clonePosition(f,{setHeight:false,setWidth:false,offsetLeft:f.offsetWidth})}h.show()}}else{if(c.pinnedBox){d.onShow=function(f,h){h.clonePosition(f,{setHeight:false,setWidth:false,offsetLeft:0,offsetTop:f.offsetHeight});h.show()}}}return new Ajax.Autocompleter($(a),$(e),"/tags/my/"+(c.objId||""),d)}function inviteEmailsMultiplier(d,m,h){var a=$("invite_form").getElements();a.findAll(function(n){return n.previous()&&/span/i.test(n.previous().nodeName)}).invoke("makeRequired");var e=a.findAll(function(n){return n.name.match(/^user\[\d+\]\[email\]/)});var c=0;e.each(function(o,n){n=o.name.match(/\d+/);if(n>c){c=n}});var j=e.length;var f=$("add_fields");function l(n){f.parentNode.parentNode.insertBefore(n,f.parentNode)}function k(p,o,q,n){return Builder.node("div.form_field "+(n?"":"required"),[Builder.node("label",{htmlFor:"user_"+o+"_"+q},p),(n?"":Builder.node("span",{className:(n?undefined:"req")},"*")),(h?Builder.node("br"):""),Builder.node("input",{id:"user_"+o+"_"+q,name:"user["+o+"]["+q+"]",type:"text",value:""})])}f.observe("click",function(p){if(!p.isLeftClick()){return}p.stop();f.blur();if(d&&j>=d){return}l(Builder.node("div.spacer",Builder.node("hr")));j++;c++;if(d&&j>=d){f.addClassName("disabled")}if(!m){var n=k(Dic.word("firstname"),c,"name");var q=k(Dic.word("lastname"),c,"lastname",true)}var o=k(Dic.word("email"),c,"email",m);if(h){l(Builder.node("div.invite_row",[n,q,o,Builder.node("div.wrap",Builder.node("hr"))]))}else{if(!m){l(n);l(q)}l(o)}if(!m){n.lastChild.makeRequired().focus();o.lastChild.makeRequired()}else{o.focus()}})}function confirm_deletion(d,c){var a=c||"confirm_deletion";window.delete_confirmers=window.delete_confirmers||[];if(window.delete_confirmers.indexOf(a)>=0){return}window.delete_confirmers.push(a);document.observe("click",function(f){if(!f.isLeftClick()){return}var h=f.findElement("[name]");if(!h){return}if(a instanceof RegExp){if(!a.test(h.name)){return}}else{if(a!=h.name){return}}if(h.form&&h.form.confirmed&&h.form.confirmed.value){return}if(confirm(h.id?Dic.word(h.id):d)){h.removeClassName("ignoreDouble");if(h.href){f.stop();if(h.href=="javascript:void(0)"){var e=h.up("form");if(e&&e.confirmed){e.confirmed.value=1;e.submit()}}else{window.location=h.href+(h.href.match(/\?/)?"&":"?")+"confirmed=1"}}else{if(h.form&&h.form.confirmed){h.form.confirmed.value=1}}}else{f.stop();h.addClassName("ignoreDouble")}})}function findLink(e){var a=3,c=/^a$/i,d=e.target;if(!d){return}while(--a>=0&&d.parentNode){if(c.test(d.nodeName)){return d}d=d.parentNode}}AppJsException=Class.create();AppJsException.prototype={initialize:function(c,a){this.name="AppJsException";this.data=c;this.type=a;try{this.message=c.parsed.result.exception.message;this.serverType=c.parsed.result.exception.type}catch(d){}}};var captchaLightboxInitialized=false;function showCaptchaLightbox(c){var a=$("captcha_lightbox");if(!a){return}if(!captchaLightboxInitialized){captchaLightboxInitialized=true;initModalWindows({elementIds:["captcha_lightbox"],onShow:function(e){if(e.id!="captcha_lightbox"){return}var d=a.down("img.captcha");var f=a.down("input.text");d.src=c;f.clear();a.down(".captcha_error").hide()},onFirstShow:function(e){var d=a.down("form");d.observe("submit",function(f){f.stop();d.request({method:"post",add2url:"json",onSuccess:function(j){try{Ajax.parseResult(j);window.modalWindow.hideAll()}catch(h){if($("captcha_img")){$("captcha_img").src+="&rnd="+Math.random()}$("user_captcha")&&$("user_captcha").focus();a.down(".captcha_error").show()}},onFailure:function(){if($("captcha_img")){$("captcha_img").src+="&rnd="+Math.random()}$("user_captcha")&&$("user_captcha").focus();a.down(".captcha_error").show()},onComplete:function(){d.enable()},onException:function(){d.enable()}})})}})}window.modalWindow.showWindow({id:"captcha_lightbox"})}(function(){$$("div.fast_deleting").each(function(a){a.observe("click",function(t){if(!t.isLeftClick()){return}var c=t.element();if(!c.hasClassName("delete_obj")&&!c.hasClassName("spam")&&!c.hasClassName("restore")&&!c.hasClassName("block_author")&&!c.hasClassName("accept")&&!c.hasClassName("cancel")){return}t.stop();var e=c.up("form"),f=e.up(),m=e.down("div"),u=m.down("span"),w=e.down("input.restore"),n=f.down("input.delete_obj"),q=f.down(".block_author"),s=f.down("input.accept"),p=f.down(".cancel"),v=f.down("input.spam"),k=e.down("input.restore_param"),l=e.down("input[name=postHandlerWidgetId]"),h=e.down("input[name=confirmed]"),x=e.down("input[name=objType]"),o=e.down("input[name=doublePostProtection]"),j=e.next("div.block_in"),d=j.previous(".edit_obj");if(c.hasClassName("block_author")){u.update(Dic.word("fast_deleting_block_author_confirm"));m.addClassName("blocking").style.display="block";q.hide();n.hide();v&&v.hide();d&&d.hide();f.hasClassName("item")&&f.addClassName("ignoreHover");Effect.BlindUp(j,{duration:0.2});return}else{if(c.hasClassName("cancel")){m.hide();n.show();v&&v.show();q.show();d&&d.show();f.hasClassName("item")&&f.addClassName("ignoreHover");Effect.BlindDown(j,{duration:0.2});return}}h.setValue("1");o.setValue("0");k&&k.setValue(c.hasClassName("restore")?"1":"0");if(!c.hasClassName("restore")){Effect.BlindUp(j,{duration:0.2});n.hide();v&&v.hide();q&&q.hide();s&&s.hide();p&&p.hide();d&&d.hide();f.hasClassName("item")&&f.addClassName("ignoreHover")}m.addClassName("loading").style.display="block";e.request({method:"post",add2url:(l?"":"json"),onSuccess:function(z){var y=Ajax.parseResult(z);if(y.ok){m.removeClassName("blocking");if(c.hasClassName("restore")){Effect.BlindDown(j,{duration:0.2});m.hide();n.show();v&&v.show();q&&q.show();s&&s.show();p&&p.show();d&&d.show();f.hasClassName("item")&&f.removeClassName("ignoreHover")}else{m.removeClassName("loading");if(c.hasClassName("delete_obj")){u.update(Dic.word(x.value+"_has_been_deleted"))}else{if(c.hasClassName("spam")){u.update(Dic.word(x.value+"_has_been_deleted_as_spam"))}else{if(c.hasClassName("accept")){u.update(Dic.word("fast_deleting_author_has_been_blocked"));return}}}}}else{alert(Dic.word("delete_failure"))}},onFailure:function(){alert(Dic.word("delete_failure"))}})})})})();function runEditFlashParams(){$$("object").each(function(a){a.style.position="relative";var c=a.down('param[name="wmode"]');if(c){c.writeAttribute("value","opaque")}else{a.insert('<param name="wmode" value="opaque">')}});$$("embed").each(function(d){d.writeAttribute("wmode","opaque");var a=d.up(),c=a.down('param[name="wmode"]');if(c){c.writeAttribute("value","opaque")}else{a.insert('<param name="wmode" value="opaque">')}})}window.domReady.push(function(){runEditFlashParams()});function setBanner(h,c,e){var c=$(c),e=$(e);if(!c||!e){return}e.appendChild(document.body.removeChild(c));var d=c.down("embed");if(d){if(h){var f=d.readAttribute("flashvars")+("&userName="+h);d.writeAttribute("flashvars",f)}d.writeAttribute("wmode","opaque")}var a=c.down("object");if(a){if(h){a.flashvars+=("&userName="+h)}a.wmode="opaque"}c.show()}function initNevadaFormCheck(){var c=170;function d(){if(!$("invite_field_username").hasClassName("requirementsMet")){$("invite_field_username").removeClassName("error");setTimeout(function(){$("invite_field_username").addClassName("error")},c)}}function e(){if(!$("invite_field_birthday").hasClassName("requirementsMet")){$("invite_field_birthday").removeClassName("error");setTimeout(function(){$("invite_field_birthday").addClassName("error");$("invite_field_birthday").down("small.hint").addClassName("error")},c)}}function f(){if(!$("invite_field_sex").hasClassName("requirementsMet")){$("invite_field_sex").removeClassName("error");setTimeout(function(){$("invite_field_sex").addClassName("error")},c)}}function a(){if(!$("invite_field_city").hasClassName("requirementsMet")){$("invite_field_city").removeClassName("error");setTimeout(function(){$("invite_field_city").addClassName("error")},c)}}$("user_lastname").observe("focus",function(h){d()});$("birthday").observe(["change","keyup","mouseup","blur"],function(l){if(l.findElement("select")){d();var m=false,n=this.up(".required");for(var k=0,j=$$("#birthday select"),h=j.length;k<h;k++){if(j[k].selectedIndex<1){m=true;break}}if(m){n.removeClassName("requirementsMet").addClassName("error")}else{n.removeClassName("error").addClassName("requirementsMet")}}});$("invite_field_sex").observe("change",function(h){if(h.findElement("input[type=radio]")){e();d()}});$("user_city")&&$("user_city").observe("change",function(h){e();d();f()});$("country")&&$("country").observe("change",function(h){e();d();f()});$("user_captcha")&&$("user_captcha").observe("focus",function(h){e();d();f();a()})}function initVideosHover(){$$("div.videos_list div.item").each(function(a){a.onmouseover=function(){this.addClassName("tr_hover");var c=this.className;add_class="truncated_level_";if(c.indexOf(add_class)!=-1){this.addClassName("tr_hover_level_"+c.substring(c.indexOf(add_class)+add_class.length,1))}};a.onmouseout=function(){this.removeClassName("tr_hover");var c=this.className;add_class="truncated_level_";if(c.indexOf(add_class)!=-1){this.removeClassName("tr_hover_level_"+c.substring(c.indexOf(add_class)+add_class.length,1))}}})}(function(){var a=$("video_item_url_code");if(!a){return}document.observe("click",function(c){if(!c.isLeftClick()){return}var d=c.element(),e=$("video_item_url_code_block");if(d==a){e.toggle()}else{if(d!=e&&d!=e.down(".head",0)&&d!=e.down(".head",1)&&d!=e.down("input.text_field",0)&&d!=e.down("input.text_field",1)){e.hide()}}});$("video_item_url_code_block").observe("click",function(c){if(!c.isLeftClick()){return}var d=c.element();if(d.hasClassName("text_field")){d.focus();d.select()}})}());function initTorrentFilesHadlers(m){var c=$$("#torrent_files input.checker"),j=c.length;function h(){for(var l=0;l<j-1;l++){if(!c[l].checked){return false}}return true}function e(){for(var l=0;l<j-1;l++){if(c[l].checked){return false}}return true}function n(){var o=0;for(var l=0;l<m.length;l++){if(c[l].checked){o+=m[l]}}var q=o,p=Dic.word("video_upload_torrent_metric_b");if(o>1000000000){p=Dic.word("video_upload_torrent_metric_gb");q=o/1024/1024/1024}else{if(o>1000000){p=Dic.word("video_upload_torrent_metric_mb");q=o/1024/1024}else{if(o>1000){p=Dic.word("video_upload_torrent_metric_kb");q=o/1024}}}$("over_size").update(q.toFixed(2));$("size_metric").update(p)}if(h()){c[j-1].checked=true}n();$("torrent_files").observe("click",function(o){if(!o.isLeftClick()){return}var p=o.element();if(p==c[j-1]){if(h()){for(var l=0;l<j-1;l++){c[l].checked=false}}else{for(var l=0;l<j-1;l++){c[l].checked=true}}if(e()){this.up("div").removeClassName("requirementsMet").addClassName("error")}else{this.up("div").removeClassName("error").addClassName("requirementsMet")}}else{if(p.hasClassName("checker")){c[j-1].checked=h();if(e()){this.up("div").removeClassName("requirementsMet").addClassName("error")}else{this.up("div").removeClassName("error").addClassName("requirementsMet")}}}n()});var k=$$("#torrent_files input.text_field");for(var f=0,d=k.length;f<d;f++){k[f].observe("keydown",function(l){if(l.keyCode==13){l.stop();if(!this.up().next().hasClassName("last")){this.up().next().down("input.text_field").focus()}}})}$("torrent_queue_submit")&&$("torrent_queue_submit").observe("click",function(l){if(!l.isLeftClick()){return}if(($("upload_torrent_form").hasClassName("separate_files")?false:!$("upload_torrent_file").up("div").hasClassName("requirementsMet"))||!$("torrent_files").up("div").hasClassName("requirementsMet")){l.stop();$("upload_torrent_file").up("div").addClassName("error");$("torrent_files").up("div").addClassName("error");$("span_error_on_form").style.display="block"}else{$("upload_torrent_file").up("div").removeClassName("error");$("torrent_files").up("div").removeClassName("error");$("span_error_on_form").style.display="none"}});if($("upload_torrent_file")){var a=$("upload_torrent_file").value}$("torrent_upload_types")&&$("torrent_upload_types").observe("click",function(l){if(!l.isLeftClick()){return}var p=l.element(),o=$("upload_torrent_file");if(p==$("file_is_collection")){$("upload_torrent_form").removeClassName("separate_files");o.disabled=false;if(a){o.value=a}}else{if(p==$("file_is_torrent")){$("upload_torrent_form").addClassName("separate_files");o.disabled=true;a=o.value;o.value=""}}})}function initTorrentFile(){$("torrent_queue_submit")&&$("torrent_queue_submit").observe("click",function(a){if(!a.isLeftClick()){return}$("hidden_file_titile")&&$("hidden_file_titile").setValue($("hidden_file_titile").next("input.text_field").value);if(!$("torrent_files").up("div").hasClassName("requirementsMet")){a.stop();$("torrent_files").up("div").addClassName("error")}else{$("torrent_files").up("div").removeClassName("error")}})}function initVideoCollectionScroller(a){if(a>2){$("video_collection").down("div.scroll_block").scrollTop=(a-2)*33}}(function(){$("collapsible_form_btn")&&document.observe("mousedown",function(d){if(!d.isLeftClick()){return}var e=d.element(),c=$("comment_text"),a=c.up("div.form_field");if(e.hasClassName("reply")||$("originalComment")&&e.descendantOf($("originalComment"))){return}if(e==c){if(a.hasClassName("relative_block")){return}a.removeClassName("collapsible_form");$("smileys")&&$("smileys").show();$("collapsible_form_btn")&&$("collapsible_form_btn").removeClassName("collapsible_form");$("upload_link")&&$("upload_link").show()}else{if(e!=$("upload_link")&&!e.hasClassName("butt")&&$F("comment_text").blank()&&e!=$("upload_block_the")&&($("upload_block_the")?e!=$("upload_block_the").down("input[type=file]"):true)&&$("smileys")&&!e.descendantOf($("smileys"))){a.addClassName("collapsible_form");$("smileys")&&$("smileys").hide();$("collapsible_form_btn")&&$("collapsible_form_btn").addClassName("collapsible_form");$("upload_block_the")&&$("upload_block_the").hide()}}})})();(function(){$("torrent_submit")&&$("torrent_submit").observe("click",function(e){if(!e.isLeftClick()){return}var a=$("torrent_name"),f=a.up("div"),c=$("torrent_file"),d=c.up("div");if((a?!f.hasClassName("requirementsMet"):false)||!d.hasClassName("requirementsMet")){e.stop();a&&f.addClassName("error");d.addClassName("error");if(d.next("span")){d.next("span").style.top="auto"}}else{a&&f.removeClassName("error");d.removeClassName("error")}})})();function initMediaAddTorrentFile(){$("media_add_torrent_form").observe("click",function(c){if(!c.isLeftClick()){return}var e=c.element(),h=$("media_add_torrent_more"),a=h.down("div.what_block"),f=h.down("div.where_block"),d=h.down("div.more_block");if(e.hasClassName("what")||e.hasClassName("where")||e.hasClassName("more")){c.stop();if(h.hasClassName("hide")){h.removeClassName("hide")}if(e.hasClassName("what")){if(a.hasClassName("hide")){a.removeClassName("hide")}else{a.addClassName("hide");h.addClassName("hide")}f.addClassName("hide");d.addClassName("hide");return}if(e.hasClassName("where")){if(f.hasClassName("hide")){f.removeClassName("hide")}else{f.addClassName("hide");h.addClassName("hide")}a.addClassName("hide");d.addClassName("hide");return}if(e.hasClassName("more")){if(d.hasClassName("hide")){d.removeClassName("hide")}else{d.addClassName("hide");h.addClassName("hide")}a.addClassName("hide");f.addClassName("hide");return}}})}function initAudioHandlers(){var c=$("app_search_field"),l=$("audio_file"),e=$("audio_title"),f=$("add_audio_form");l&&l.makeRequired();e&&e.makeRequired();$("supercontainer")&&$("supercontainer").observe("click",function(o){if(!o.isLeftClick()){return}var p=o.element();if(p.hasClassName("copy_audio")){o.stop();var n=p.up("form"),m=n.next("span");n.request({method:"post",add2url:"json",onSuccess:function(s){var q=Ajax.parseResult(s);if(q.ok){p.addClassName("hide");m.removeClassName("hide")}else{alert(Dic.word("audio_copy_failure"))}},onFailure:function(){alert(Dic.word("audio_copy_failure"))}});return}});f&&f.observe("submit",function(m){var n=this.down(".form_field");if(n.hasClassName("requirementsMet")){window.modalWindow.showWindow({id:"uploading_block"});$("uploading_block").up(".modal_window").style.marginTop="233px";$("uploading_block").previous("a.delete").style.display="none"}else{m.stop();n.addClassName("error")}});var k=document.title,a=0,j=1000,d=77;function h(m){if(window.stopAnimateTitle){return}document.title=m.substring(a,m.length);if(a==m.length){document.title=k;a=0;setTimeout(function(){h(m)},j)}else{a++;setTimeout(function(){h(m)},d)}}}var TrDics=TrDics||{};var UntrClauses=UntrClauses||[];function initDicWordsCount(){window.domReady.push(function(){setTimeout(function(){var f=0,d="",c=0,a="";for(var e in TrDics){f++;d+=d?"+"+e:e;if(!TrDics[e]){c++;a+=a?"+"+e:e}}setDicWordsCount("alltranslated",f,d);setDicWordsCount("untranslated",c,a);if($("untrclauses")&&UntrClauses.length){$("untrclauses").show()}},1000)})}function setDicWordsCount(c,d,a){if(d>0&&$(c)&&$(c+"Count")){$(c).show();$(c+"Count").update(d);$(c+"Link").href+="?"+a}}function showUntrClauses(){alert(Object.toJSON($(UntrClauses)))}if(window.Dklab_Realplexor){window.Realplexor=function(c,d,a){this.__setcursor_calls=[];this.__subscribe_calls=[];this.__unsubscribe_calls=[];this.__unsubscribeAll_calls=false;this.dr=new Dklab_Realplexor(c,d,a)};window.Realplexor.prototype.logon=function(){this.dr.logon(Array.prototype.slice.call(arguments,1))};window.Realplexor.prototype.setCursor=function(c,a){this.__setcursor_calls.push({id:c,cursor:a});this.dr.setCursor(c,a);return this};window.Realplexor.prototype.subscribe=function(c,a){this.__subscribe_calls.push({id:c,callback:a});this.dr.subscribe(c,a);return this};window.Realplexor.prototype.unsubscribe=function(c,a){this.__unsubscribe_calls.push({id:c,callback:a});this.dr.unsubscribe(c,a);return this};window.Realplexor.prototype.unsubscribeAll=function(){this.__unsubscribe_calls=true;this.dr._map={};return this};window.Realplexor.prototype.execute=function(){if(this.__subscribe_calls.length>0||this.__unsubscribe_calls.length>0||this.__unsubscribeAll_calls){this.dr.execute();this.__subscribe_calls=[];this.__unsubscribe_calls=[];this.__unsubscribeAll_calls=false}return this}}var realplexors=realplexors||{},realplexorsArray=[];function initRealplexors(e,c,d){if(!realplexors[e+"-"+c]){realplexors[e+"-"+c]=new Realplexor(e,c);realplexors[e+"-"+c].__name=e+"-"+c}if(Object.isArray(d)){d.map(function(f){realplexorsArray.push(e+"-"+c+"||"+f)})}else{realplexorsArray.push(e+"-"+c+"||"+d)}var a=realplexors[e+"-"+c];return a}function resetAllRealplexors(){for(r in realplexors){realplexors[r].unsubscribeAll().execute()}}function getCaretPos(c){c.focus();if(c.selectionStart){return c.selectionStart}else{if(document.selection){var a=document.selection.createRange();var d=a.duplicate();a.collapse(true);d.moveToElementText(c);d.setEndPoint("EndToEnd",a);return d.text.length}}return 0}function dateCounter(a,f){var d=$(a);if(!d||!f){return}function e(){var l=new Date(getServerTimestamp()*1000),k=new Date(f*1000),n=k.getTime()-l.getTime(),m=Math.floor(n/1000),j=Math.floor(m/60),h=Math.floor(j/60),o=Math.floor(h/24);m%=60;j%=60;h%=24;d.update((o?(o+" "+Dic.word("discounts_till_days")+" "):"")+c(h)+":"+c(j)+":"+c(m)).addClassName("date_counter");setTimeout(function(){e()},1000)}if(d.next("span")){d.next("span").show()}else{if(d.previous("span")){d.previous("span").show()}}e();function c(h){return(h<10?"0":"")+h}}function checkAreaLength(a,c){a&&a.observe(["keypress","change","keydown","click"],function(){if(this.value.length>c){this.setValue(this.value.substring(0,c))}})}var canCollapseTextarea=null;function initSmileysHandlers(h){var a=h&&h.indexOf("textarea_")!=-1?h.substring(h.indexOf("textarea_")+8):"",c=$("smileys"+a),f=$(h)||$("textarea"),e=$("more_smileys"+a),d=$("smileys_extended"+a);c&&c.observe("click",function(l){canCollapseTextarea=false;var n=l.element();if(n.match("div")){f.focus();return}if(n.match("img")){n=n.parentNode}var o=f.value;if(o!=""){var k=getCaretPos(f);var m=o.substring(0,k);var j=o.substring(k,o.length);f.setValue(m+n.title+j);f.selectionStart=k+n.title.length;f.selectionEnd=k+n.title.length}else{f.setValue(n.title).focus();f.selectionStart=f.value.length+n.title.length;f.selectionEnd=f.value.length+n.title.length}});if(!e){return}document.observe("click",function(j){if(!j.isLeftClick()){return}var k=j.element();if(k!=e&&k!=e.down("img")&&k!=d&&k!=j.findElement("div.block_in")&&k!=j.findElement("div.line")&&k!=j.findElement("span.smiley_block")&&d.style.display!="none"){d.hide();e.removeClassName("hover").style.backgroundPosition="0 bottom"}});e.observe("click",function(j){var k=d.style.display=="none";if(e.up("div.comment")){e.up("div.comment").style.overflow=k?"visible":"hidden"}d[k?"show":"hide"]();e.removeClassName("hover").down("i").style.backgroundPosition=k?"0 0":"0 bottom"})}function collapsibleBlocks(c){var a=$(c);if(!a){return}a.observe("click",function(d){if(!d.isLeftClick()||!d.findElement(".jsCollapseChanger")){return}var e=d.findElement(".jsCollapseChanger"),f=e.next(".jsCollapseContent");f[e.hasClassName("changerHover")?"hide":"show"]();e.toggleClassName("changerHover")})}(function(){$("upload_video_button")&&$("upload_video_button").observe("click",function(j){if($("video_name").up("div").hasClassName("requirementsMet")&&$("upload_video_file").up("div").hasClassName("requirementsMet")){window.modalWindow.showWindow({id:"uploading_block"});$("uploading_block").up(".modal_window").style.marginTop="233px";$("uploading_block").previous("a.delete").style.display="none"}else{j.stop();if(!$("video_name").up("div").hasClassName("requirementsMet")){$("video_name").up("div").addClassName("error")}if(!$("upload_video_file").up("div").hasClassName("requirementsMet")){$("upload_video_file").up("div").addClassName("error")}}});$("load_video_button")&&$("load_video_button").observe("click",function(j){if(!$("video_url").up("div").hasClassName("requirementsMet")){j.stop();$("video_url").up("div").addClassName("error")}});if($("supercontainer")&&$("supercontainer").down("div.media_edit")){var f=$("supercontainer").down("div.media_edit").down("a.head",0),d=$("supercontainer").down("div.media_edit").down("a.head",1),a=$("supercontainer").down("div.media_edit").down("a.head",2),h=f?f.next("div.block_add"):null,e=d?d.next("div.block_add"):null,c=a?a.next("div.block_add"):null;$("supercontainer").down("div.media_edit").observe("click",function(j){if(!j.isLeftClick()){return}var k=j.element();if(f&&(k==f||k==f.down("span")||k==f.down("i")||k.id=="toggle_iload")&&!h.hasClassName("hover")){if(k.id=="toggle_iload"){j.stop()}if(e.hasClassName("hover")){Effect.BlindUp(e,{duration:0.3});e.removeClassName("hover");d.removeClassName("hover")}else{if(a&&c.hasClassName("hover")){Effect.BlindUp(c,{duration:0.3});c.removeClassName("hover");a.removeClassName("hover")}}Effect.BlindDown(h,{duration:0.3});h.addClassName("hover");f.addClassName("hover")}else{if(d&&(k==d||k==d.down("span")||k==d.down("i")||k==d.down("em"))&&!e.hasClassName("hover")){if(h.hasClassName("hover")){Effect.BlindUp(h,{duration:0.3});h.removeClassName("hover");f.removeClassName("hover")}else{if(a&&c.hasClassName("hover")){Effect.BlindUp(c,{duration:0.3});c.removeClassName("hover");a.removeClassName("hover")}}Effect.BlindDown(e,{duration:0.3});e.addClassName("hover");d.addClassName("hover")}else{if(a&&(k==a||k==a.down("span"))&&!c.hasClassName("hover")){if(e.hasClassName("hover")){Effect.BlindUp(e,{duration:0.3});e.removeClassName("hover");d.removeClassName("hover")}else{if(h.hasClassName("hover")){Effect.BlindUp(h,{duration:0.3});h.removeClassName("hover");f.removeClassName("hover")}}Effect.BlindDown(c,{duration:0.3});c.addClassName("hover");a.addClassName("hover")}}}})}})();var playerIdArrayBySubIdByIndex=new Array();var playerIndexArrayById=new Array();var loadedPlayerIdArray=new Array();var playerSettingArrayById=new Array();var playerSubIdArrayById=new Array();var playerIdArray=new Array();var nextPlayerID=null;function setSeekAfterPlay(a){if($(a).getUppod("getstatus")){setTimeout(function(){$(a).sendToUppod("seek:"+$(a+"_paused_seconds").value)},1000);setTimeout(function(){$(a).sendToUppod("pause")},1500)}else{setTimeout(function(){setSeekAfterPlay(a)},100)}}function uppodInit(a){if($(a+"_paused_seconds")&&parseInt($(a+"_paused_seconds").value)){playPlayer(a);setSeekAfterPlay(a)}if(isAudioUppodPlayer(a)&&playerSettingArrayById[a]["autoplay"]){playPlayer(a)}}function uppodTheEnd(a){if($(a+"_delete_form")){$(a+"_delete_form").request({method:"post",add2url:"json"})}if(isAudioUppodPlayer(a)&&playerSettingArrayById[a]["autoplay"]){playNextPlayer(a)}if(isVideoUppodPlayer(a)){var c=redirectToNextEpisode();if(c){window.location=c}}}function playNextPlayer(a){var c=playerSubIdArrayById[a];if(playerIndexArrayById[a]<(playerIdArrayBySubIdByIndex[c].length-1)){nextPlayerID=playerIdArrayBySubIdByIndex[c][playerIndexArrayById[a]+1]}else{nextPlayerID=playerIdArrayBySubIdByIndex[c][0]}var d=$(nextPlayerID).parentNode;do{if(d.style.display=="none"){nextPlayerID=playerIdArrayBySubIdByIndex[c][0];break}if(d.nodeName=="BODY"){break}}while(d=d.parentNode);showPlayer(nextPlayerID)}function registerPlayer(j,a,h,e,c,l,d,k){if(!playerIdArrayBySubIdByIndex[a]){playerIdArrayBySubIdByIndex[a]=new Array()}var f=playerIdArrayBySubIdByIndex[a].length;playerIdArrayBySubIdByIndex[a][f]=j;playerIndexArrayById[j]=f;playerSubIdArrayById[j]=a;playerIdArray[playerIdArray.length]=j;playerSettingArrayById[j]={type:h,playerUrl:e,width:c,height:l,autoplay:d};if(k){loadPlayer(j)}}function loadPlayer(k){var j=playerSettingArrayById[k]["type"];var h=playerSettingArrayById[k]["playerUrl"];var a=playerSettingArrayById[k]["width"];var l=playerSettingArrayById[k]["height"];if(isAudioUppodPlayer(k)){var c=false;var d="transparent"}else{var c=true;var d="opaque"}var e={m:j,file:h,uid:k};var f={id:k,allowFullScreen:c,allowScriptAccess:"always",wmode:d};new swfobject.embedSWF(h,k,a,l,"9.0.115",false,e,f);loadedPlayerIdArray[loadedPlayerIdArray.length]=k;if(isAudioUppodPlayer(k)&&$("play_button_"+k)){$("play_button_"+k).addClassName("hide");$("play_button_"+k).next("i.player").addClassName("hide")}}function showPlayer(a){stopPlayers(a);if(!isLoadedPlayer(a)){loadPlayer(a)}else{if($(a).style.visibility!="visible"){$(a).style.visibility="visible";$(a).up("div.player").down("span.play").addClassName("hide");$(a).up("div.player").down("i.player").addClassName("hide")}if(playerSettingArrayById[a]["autoplay"]){playPlayer(a)}}}function stopPlayers(d){for(var c=0,a=loadedPlayerIdArray.length;c<a;c++){if(loadedPlayerIdArray[c]!=d&&isAudioUppodPlayer(loadedPlayerIdArray[c])&&isLoadedPlayer(loadedPlayerIdArray[c])){$(loadedPlayerIdArray[c]).sendToUppod("stop");$(loadedPlayerIdArray[c]).style.visibility="hidden";$(loadedPlayerIdArray[c]).up("div.player").down("span.play").removeClassName("hide");$(loadedPlayerIdArray[c]).up("div.player").down("i.player").removeClassName("hide")}}}function isLoadedPlayer(a){return loadedPlayerIdArray.indexOf(a)!=-1}function isAudioUppodPlayer(a){return(a.indexOf("audio_")>-1)}function isVideoUppodPlayer(a){return(a.indexOf("video_")>-1)}function playPlayer(a){$(a).sendToUppod("play")}function initPlayerHandler(){for(var d=0,a=playerIdArray.length;d<a;d++){var c=playerIdArray[d];$("play_button_"+c)&&$("play_button_"+c).observe("click",function(e){showPlayer(this.id.split("play_button_").join(""))})}}window.domReady.push(function(){initPlayerHandler()});function dynamicTags(){var j=$("tag_div");if(!j){return}var c,n=false,p=false,a,w=$("tag_area"),m=$("tag_list"),v,u=w.value.toLowerCase().split(/\s*,\s*/),f=[];m.childElements().each(function(y){f.push(y.innerHTML)});v=Builder.node("div.hidden");m.insert({after:v});q();function o(y){if(y.keyCode!=Event.KEY_BACKSPACE){return}if(!y.findElement("input")){y.stop()}}function h(y){document[y?"observe":"stopObserving"](["keydown","keypress"],o)}m.observe("click",function(z){var A=z.target;if(!A.match("a")){return}j.update();var y=A.innerHTML;storedValue=A.title,foundIndex=null;u.each(function(C,B){if(storedValue.toLowerCase()==C.toLowerCase()){if(foundIndex==null){foundIndex=B}else{u.splice(B,1)}}});if(foundIndex==null){u.push(y);s(y,true)}else{u.splice(foundIndex,1);s(y,false)}q()});j.observe("click",function(y){var z=y.target;if(!z.match("a")){y.stop();a.focus();return}if(!z.hasClassName("remove")){return}s(z.up().title,false);x(z.up().title)});function t(A,y){y=y||A;var z=Builder.node("span",{title:y},[A,Builder.node("a.remove")," "]);j.insert(z)}function x(z,y){u.each(function(B,A){if(z==B){u.splice(A,1)}});q(y?z:null)}function q(y){if(a){a.blur();v.insert(a)}j.update();h(true);u.each(function(A,z){if(!A.empty()){t(A,A);s(A,true)}});w.value=u.join(", ");d(y)}function k(y,C){var z,B=null,A;y=RegExp.escape(y);A=new RegExp("^"+y+"$","i");C.each(function(E,D){if(E.match(A)){B=D}});return B}function s(y,z){var A=k(y,f);if(A==null){return}m.childElements()[A][z?"addClassName":"removeClassName"]("act")}function d(y){if(a){a.value=y||"";j.insert(a);e()}else{a=Builder.node("input#tag_input.tag",{type:"text",name:"tags",value:(y||""),style:"width: 20px;"});j.insert(a);(function(){a.style.width=20+a.value.length*8+"px"}).defer();c=tagsAutoComplete(a.id,"tags_input_suggest",{noTokens:true,pinnedBox:true,updateElement:function(z){if(n||p){u.push(z.innerHTML);q()}else{l()}},callback:function(z,A){return A.replace(/^tags=(%20)+/,"tags=")}});c.active=false;c.update.observe("mouseover",function(){p=true});c.update.observe("mouseout",function(){p=false});a.observe(["keydown","keypress"],function(z){if(z.keyCode!=Event.KEY_RETURN&&z.keyCode!=Event.KEY_BACKSPACE&&z.keyCode!=188&&z.charCode!=188&&z.keyCode!=Event.KEY_UP&&z.keyCode!=Event.KEY_DOWN){e();return}else{if(z.keyCode==Event.KEY_BACKSPACE){var A=z.findElement("input");if(!A){return}if(!A.value.empty()){e();return}z.stop();s(u.last(),false);x(u.last(),true);e()}else{if(z.keyCode==Event.KEY_UP||z.keyCode==Event.KEY_DOWN){c.hasFocus=true;n=true}else{var A=z.element();if(!A.match("input")){return}z.stop();(function(){if(!A.value.empty()){l()}}).defer()}}}}).observe("keyup",function(z){if(z.keyCode!=Event.KEY_BACKSPACE||!Prototype.Browser.IE){return}var A=z.findElement("input");if(!A||!A.value.empty()){return}s(u.last(),false);x(u.last(),true)})}(function(){a.focus()}).defer()}function e(){(function(){a.style.width=20+a.value.length*8+"px"}).defer()}function l(){if(a.value.empty()){return}var y=k(a.value,u);if(y!=null){u.splice(y,1)}u.push(a.value);s(a.value,true);q()}}var Helper=Class.create();Helper.prototype={initialize:function(a){this.text=a},makeDiv:function(){if(this.div){return}this.div=Builder.node("div.helper",[Builder.node("p",this.text),Builder.node("div",Builder.node("hr"))]);this.div.setStyle({left:"-1000px",zIndex:"1000"});document.body.appendChild(this.div);this.height=this.div.getHeight();this.div.hide();return this},shown:false,show:function(c){this.makeDiv();var a=$(c).cumulativeOffset();var e=a[0]+c.getWidth()-5;var d=a[1]-this.height+8;this.div.setStyle({top:""+d+"px",left:""+e+"px"});this.div.show();this.shown=true;return this},hide:function(){this.makeDiv();this.div.hide();this.shown=false;return this},input:function(a){a=$(a);if(!this.text&&a.title){this.text=a.title;a.title=""}var d=false;var c=function(f){if(!this.shown||f.element().descendantOf(this.div)){return}Event.stopObserving(document,"mousedown",c);this.hide()}.bind(this);a.observe("focus",function(){this.makeDiv();this.show(a);d=true;document.observe("mousedown",c);this.div.observe("mousedown",e)}.bind(this));a.observe("blur",function(){setTimeout(function(){if(d){this.hide()}}.bind(this),10)}.bind(this));var e=function(){d=false};return this},element:function(c){c=$(c);var d=function(e){this.makeDiv();this[e?"show":"hide"](c);this.div.observe("mouseover",function(){clearTimeout(a.timeouts.out)});this.div.delayedHover(d,{over:0})}.bind(this);var a=c.delayedHover(d);return this}};var DoublePost=(function(){var j,k,d,e,h;function c(l){l=$(l);if(l==h){return}f();h=l;e=(function(){f()}).delay(300);a.delay(0,l,false)}function f(){if(h){a(h,true)}h=undefined;j&&j.hide();k&&k.hide();if(d){clearTimeout(d)}if(e){clearTimeout(e)}}function a(l,m){l[m?"enable":"disable"]();$(l.form)[m?"removeClassName":"addClassName"]("disabled")}return{prevent:c,hide:f}})();function initMessagesList(){$("messages_content").observe("click",function(d){if(!d.isLeftClick()){return}if(d.findElement("a")){return true}if(d.findElement("input")){return true}var f=d.element().down();if(f&&f.match("input")){return true}var e=d.findElement("div.msg_person_list");if(!e){return}d.stop();window.location=e.down().down().href});if(Prototype.Browser.IE){$("messages_content").childElements().each(function(d){if(!d.hasClassName("msg_person_list")){return}d.hover("msg_hover")})}$("selectorCheckbox1","selectorCheckbox2").invoke("observe","click",function(d){var e=d.findElement("input.selector_checkbox");if(!e){return}(function(){$("messages_content").getElements().each(function(f){if(f.hasClassName("msg_delete_checkbox")){f.checked=e.checked}});$("selectorCheckbox1").checked=$("selectorCheckbox2").checked=e.checked}).defer()});if($("msg_person_block")){$("msg_person_block").observe("click",function(k){var e=k.findElement("input.msg_delete_checkbox");if(!e){return}if(!e.checked){$("selectorCheckbox1").checked=$("selectorCheckbox2").checked=e.checked}else{var h=$$("#msg_person_block input.msg_delete_checkbox");var f=true;for(var j=0,d=h.length;j<d;j++){if(!h[j].checked){f=false}}if(f){$("selectorCheckbox1").checked=$("selectorCheckbox2").checked=e.checked}}});if($("msg_person_block")){var c=$$("#msg_person_block div");for(var a=0;a<c.length;a++){c[a].onmouseover=function(){this.className+=" sfhover"};c[a].onmouseout=function(){this.className=this.className.replace(new RegExp(" sfhover\\b"),"")}}}}}function setExceedLimitFriendsNotice(){if(!$("msg_buttons")){return}if(!canUserJoinFriends){$("msg_buttons").innerHTML=noticePrefix+userExceedLimitFriendsNotice+noticePostfix}else{if(!canYouJoinFriends){$("msg_buttons").innerHTML=noticePrefix+youExceedLimitFriendsNotice+noticePostfix}}}function initMessagingSystem(G,j,y,D,m,C,h,e){var f={name:G,url:j,portrait:y};var E={bool:true,counter:0};var d=$("messageForm");if(!d){return}var v=$("msg_list");var t=$("msg_buttons");var w=d.action.add2url("json");var s=h;v.preventDocumentScroll();popout("popout",{height:680});setInterval(function(H){if(!v.down()||v.scrollTop>500||m==undefined){return}new Ajax.Request(w,{method:"get",parameters:{historyBefore:encodeURIComponent(m)},onSuccess:function(L){var I=Ajax.parseResult(L);var K=v.down();var J=v.scrollTop-(K&&K.offsetTop)||0;K.insert({before:I.html});(function(){v.scrollTop=K.offsetTop+J;m=!I.noMoreItems?I.firstTime:undefined;v.fire("document:changed")}).defer()}});m=undefined},100);var q=$("textarea");var o=$("sendMessage");var u=q.rows;var z={action_type_invite_offer_email:true,action_type_join_request_message:true,action_type_join_request_link:true};d.observe("submit",function(J){J.stop();var H=$F(q);if(H.blank()&&(o.name!="invite[invite]")){return}o.disable();d.action=w;var I={};if(o.name=="invite[invite]"){I["invite[invite]"]=1}d.request({parameters:I,onSuccess:function(N){var K=Ajax.parseResult(N,function(){o.enable()});if(E.bool||!(++E.counter%4)){new Ajax.Request(w,{method:"get",parameters:{background:true,from:s!=undefined?encodeURIComponent(s):""},onSuccess:a,on403:function(){window.location.reload()}})}x(f,null,H,true,o.name?"action_type_join_request_message":"message_generic_type_generic",o.name?"text_for_action_type_join_request_message":undefined);if(o.name=="invite[invite]"){var L=Builder.node("input.butt",{type:"submit",value:Dic.word("write_button")});d.replaceChild(L,o);o=L;var M=$("inviteForm");if(M){M.next().update(Dic.word("waiting_invite_offer_accept"));M.remove()}}q.value=q.value.replace(H,"");q.rows=u;if(K.lastMessageTimestamp){s=K.lastMessageTimestamp}},onComplete:function(){o.enable()},onException:function(L,K){if(K.type!="badResult"||!K.message){return}v.appendChild(Builder.node("div.message_error",K.message));v.scrollTop=100000}});d.action=window.location.href});function n(I,H){if(!t){return}t.update();if(H){t.appendChild(document.createTextNode(Dic.word(I)));t.appendChild(H)}else{t.appendChild(Builder.node("div.inv_status",Dic.word(I)))}}function l(){var J=$("inviteForm");if(!J){return}var H=J.action;var I=H.add2url("json");J.observe("submit",function(K){K.stop();J.action=I;J.request({parameters:{"invite[invite]":1},onSuccess:function(M){var L=Ajax.parseResult(M);n("waiting_invite_offer_accept");!e&&x(f,null,"",true,"action_type_join_request_message","text_for_action_type_join_request_message")},onComplete:function(){J.enable()}});J.disable();J.action=H})}l();function A(){var J=$("incomingInviteForm");if(!J){return}var H=J.action;var I=H.add2url("json");$(J["invite[accept]"]).observe("click",function(K){if(!K.isLeftClick()){return}K.stop();J.action=I;J.request({parameters:{"invite[accept]":1,"invite[reject]":""},onSuccess:function(M){var L=Ajax.parseResult(M);if(t){t.remove()}v.removeClassName("truncated");x(f,null,"",true,"action_type_invite_or_join_accepted","text_for_action_type_invite_or_join_accepted")},onComplete:function(){J.enable()}});J.disable();J["invite[accept]"].className="loading_button";J.action=H});$(J["invite[reject]"]).observe("click",function(K){if(!K.isLeftClick()){return}K.stop();J.action=I;J.request({parameters:{"invite[accept]":"","invite[reject]":1},onSuccess:function(M){var L=Ajax.parseResult(M);p();l.defer();x(f,null,"",true,"action_type_invite_or_join_rejected","text_for_action_type_invite_or_join_rejected")},onComplete:function(){J.enable()}});J.disable();J["invite[reject]"].className="loading_button";J.action=H})}A();setInterval(function(){if(E.bool||!(++E.counter%4)){new Ajax.Request(w,{method:"get",parameters:{background:true,from:s!=undefined?encodeURIComponent(s):""},onSuccess:a,on403:function(){window.location.reload()}})}},5000);var B=$("onlineLink"),c=true,F=document.title;function k(H){c=H.type=="focus";if(c){titleTicker.stop()}}Event.observe(document,["focus","blur"],k);Event.observe(window,["focus","blur"],k);function a(I){var H=Ajax.parseResult(I);if(H.lastMessageTimestamp){s=H.lastMessageTimestamp}E.bool=H.online;if(B){B.replaceClassNameWith("online|away|offline",H.online||"offline")}if(!H.messages||!H.messages.length){return}if(!c){titleTicker(F)}v.insert({bottom:H.html});(function(){v.scrollTop=100000}).defer();$A(H.messages).each(function(J){J=J.message;if(z[J.type]){n("do_you_want_to_accept_invitation",Builder.node("form",{action:window.location.href,method:"post",id:"incomingInviteForm"},[Builder.node("input",{type:"hidden",name:"csrf",value:window.csrf}),document.createTextNode(" "),(C?Builder.node("input",{className:"butt_light ignoreDouble",name:"invite[accept]",type:"submit",value:Dic.word("invite_accept_button")}):Builder.node("input",{className:"butt_light ignoreDouble",name:"invite[accept]",type:"button",value:Dic.word("invite_accept_button")}).observe("click",function(K){setExceedLimitFriendsNotice()})),document.createTextNode(" "),Builder.node("input#cancel_friendship",{className:"butt_light ignoreDouble",name:"invite[reject]",type:"submit",value:Dic.word("invite_reject_button")})]));A.defer()}if(J.type=="action_type_invite_or_join_accepted"){if(t){t.remove()}v.removeClassName("truncated")}if(J.type=="action_type_invite_or_join_rejected"){p();l.defer()}})}function p(){n("do_you_want_send_join_request",Builder.node("form",{method:"post",action:window.location.href,id:"inviteForm"},[Builder.node("input",{type:"hidden",name:"csrf",value:window.csrf}),document.createTextNode(" "),(C?Builder.node("input",{className:"butt_light ignoreDouble",type:"submit",name:"invite[invite]",value:Dic.word("invite_this_person_button")}):Builder.node("input",{className:"butt_light ignoreDouble",type:"button",name:"invite[invite]",value:Dic.word("invite_this_person_button")}).observe("click",function(H){setExceedLimitFriendsNotice()}))]))}function x(P,M,O,L,N,H,K){if(!M){var J=new Date();J.serverShift();M=J.getHours()+":"+J.getMinutes()+":"+J.getSeconds();M=M.replace(/\b(\d)\b/g,"0$1");M=" - "+J.getDate()+" "+D+", "+M}O=O||"";var Q=H?[Builder.node("span.sys",Dic.word(H)),Builder.node("br")]:[];$A(O.split(/\n/)).each(function(S){Q.push(S);Q.push(Builder.node("br"))});Q.pop();if(K&&K.url&&(N=="action_type_invite_group")){Q.push(Builder.node("a",{href:K.url},Dic.word("join_group")))}var I=[Builder.node("a.portrait",{href:P.url},Builder.node("img",{src:P.portrait,alt:""})),Builder.node("a",{href:P.url},P.name),Builder.node("span.date"," "+M),Builder.node("p",Q)];v.appendChild(Builder.node("div."+N,Builder.node("div",{className:"msg_item "+(L?"type_out":"type_in")},I)));v.scrollTop=100000;var R=I[2];(function(){R.update(String.replaceSmiles(R.innerHTML.linkify()));v.scrollTop=100000}).defer()}}function initMessagesPerson(){var a=$("msg_list");if(!a){return}a.scrollTop=100000;var e=$("textarea");var d=$("sendMessage");e&&e.observe("keypress",function(h){if(!Event.isCtrlEnter(h)){return}if($F(e).blank()){return}h.stop();if(!d.disabled){d.click()}}).focus();scroll(0,0);var f=$$("#invite_friends_block input");for(var c=0;c<f.length;c++){f[c].onmouseover=function(){this.className+=" sfhover"};f[c].onmouseout=function(){this.className=this.className.replace(new RegExp(" sfhover\\b"),"")}}initSmileysHandlers()}function targetPseudoselectorShim(){if(!Prototype.Browser.IE){return}var a;document.observe("click",function(d){var c=d.element().readAttribute("href");if(!c||!c.startsWith("#")){return}a&&a.removeClassName("pseudo-selector-target");a=$(c.substring(1));if(!a){return}a.addClassName("pseudo-selector-target")})}if(window.isGuest){window.domReady.push(function(){var a=$("login_field");if(!a){return}a.focus();var c=$("remember");if(!c){return}c.observe("click",d);function d(){(function(){Cookie.set("mirtesen_dontremember",c.checked?"0":"1",365)}).defer()}})}window.domReady.push(function userClicksMonitor(){var a;if(a=window.location_clone.hash.match(/^#?showCoords:(\d+):(\d+)/)){document.body.appendChild(Builder.node("div").setStyle({position:"absolute",top:"0px",left:parseInt(a[1])-3+"px",width:"6px",height:"10000px",background:"green",opacity:".2"}));document.body.appendChild(Builder.node("div").setStyle({position:"absolute",left:"0px",top:parseInt(a[2])-3+"px",width:"1280px",height:"6px",background:"green",opacity:".2"}))}if(!Cookie.get("click")){return}document.observe("click",function(c){var e,f,d=[c.pointerX(),c.pointerY()];if(f=c.findElement("a")){e=$H({page:window.location.href,type:"link",target:f.href,name:f.innerHTML,"coords[]":d}).toQueryString()}if(f=c.findElement("input[type=submit]")){e=$H({page:window.location.href,type:"button",target:f.form.action||window.location.href,name:f.value,"coords[]":d}).toQueryString()}if(e){(new Image()).src="/click?"+e}})});window.domReady.push(function ctrlNavigation(){document.observe("keyup",function a(e){if(!e.ctrlKey||(e.keyCode!=Event.KEY_LEFT&&e.keyCode!=Event.KEY_RIGHT)){return}if(e.element().nodeName.match(/input|textarea/i)){return}var c='link[rel="'+(e.keyCode==Event.KEY_LEFT?"prev":"next")+'"]';var d=$(document.lastChild.firstChild).childElements().find(function(f){return f.match(c)});if(d){window.location=d.href}})});function supportCollapsibleContent(){window.supportCollapsibleContent=Prototype.emptyFunction;document.observe("click",function a(h){var j=h.element();if(!j.ancestors){return}var e=[j].concat(j.ancestors());var c=e.find(function(k){return k.hasClassName("collapse")});var f=e.find(function(k){return k.hasClassName("expand")});if(!c&&!f){return}var d=e.find(function(k){return k.hasClassName("collapsible")});if(!d){return}h.stop();c&&d.replaceClassNameWith("expanded","collapsed");f&&d.replaceClassNameWith("collapsed","expanded")})}function KindaLightBoxer(){window.KindaLightBoxer=Prototype.emptyFunction;document.observe("click",function a(c){if(!c.isLeftClick()){return}var d=c.element();if(/img/i.test(d.nodeName)){d=d.parentNode}if(!/kindaLightbox/i.test(d.className)){return}c.stop();d.href&&kindaLightbox(d.href)})}window.domReady.push(function focusOnload(){var a=$(window.focus_onload_id||"focus_onload");if(a){a.activate()}});if(!window.isGuest){window.domReady.push(function geostatusChanger(){var f=$("status_selector");if(!f){return}var d=f.previous();var e=d.down().down();Prototype.Browser.IE&&d.hover("status_hover");var a=false;d.observe("click",function c(){if(!a){a=true;f.cleanWhitespace().hideOnOuterClick(d,function(){f.hide();d.removeClassName("status_act")});new Ajax.Request("/profile/places/json?type=places",{method:"get",onSuccess:function(k){var j=Ajax.parseResult(k);$A(j.places).each(function(l){if(l.id!=j.main){f.insertBefore(Builder.node("li.place#place_"+l.id,Builder.node("span",l.name)).hover(),f.lastChild)}});if(Prototype.Browser.IE){f.style.width=Math.max(142,f.getWidth())+"px"}}});f.observe("click",function(j){if(!j.isLeftClick()){return}var k=j.findElement("li.place");if(!k){return}f.hide();d.removeClassName("status_act");if(k.hasClassName("act")){return}e.addClassName("loading").update(Dic.word("updating_geostatus"));new Ajax.Request("/profile/places/"+k.id.replace(/place_/,"")+"/edit/json/",{method:"post",parameters:{main_place:1,csrf:f.className},onSuccess:function(m){var l=Ajax.parseResult(m);f.childElements().invoke("removeClassName","act");k.addClassName("act");e.removeClassName("loading").update(k.down().firstChild.nodeValue)},onFailure:function(l){e.replaceClassNameWith("loading","error").update(Dic.word("error_setting_geostatus"))}})});if(Prototype.Browser.IE){f.style.left="-10000px";f.show().hide().style.left=""}}f.toggle();d.toggleClassName("status_act");if(Prototype.Browser.Gecko&&f.previous()==d){var h=f.cumulativeOffset();document.body.appendChild(f);f.setStyle({left:h[0]+"px",top:h[1]+"px"})}})})}window.domReady.push(function preventDoubleSubmits(){document.observe("click",function a(c){if(c?!c.isLeftClick():true){return}var d=c.element();if(!d||!/input/i.test(d.nodeName)||!/submit/i.test(d.type)){return}if(!$(d.form)){return}if(!d.form.hasClassName("needDouble")&&(d.hasClassName("ignoreDouble"))){return}window.DoublePost.prevent(d)});Event.observe(window,"unload",function(c){window.DoublePost.hide();a()})});window.domReady.push(function createNotifier(){var a;window.notify=function(c){if(!a){a=Builder.node("span#notifier").hide();document.body.appendChild(a)}a.update(c).show();setTimeout(function(){a.hide()},10000)}});function highlightInReplyComment(){document.observe("click",function a(h){if(!h.isLeftClick()){return}var j=h.element();if(!/inReplyTo/i.test(j.name)){return}var e=j.href.match(/#(.*)/)[1];var f=null;var k=document.getElementsByName(e);for(var d=0,c=k.length;d<c;d++){if(!k[d].hasClassName("comment_in_widget_mode")&&k[d].up()&&k[d].up().down("span.commentContents")){f=k[d].up().down("span.commentContents").innerHTML;break}}if(!f){f=additionalCommentsText&&additionalCommentsText[e]}if(!f){return}h.stop();if(!j.hasClassName("clicked")){j.addClassName("clicked");j.next(1).show().update(f)}})}function resizeTextarea(){window.resizeTextarea=Prototype.emptyFunction;function a(d){var c=d.element();if(!/textarea/i.test(c.nodeName)){return}c.fitText&&c.fitText()}document.observe(["keyup","click"],a)}function supportVoting(a){window.supportVoting=Prototype.emptyFunction;document.observe("click",function c(d){if(!d.isLeftClick()){return}var m=d.element(),p=d.findElement(".like_button");if(m.disabled||!/rate\[(plus|minus)\]/i.test(m.name)||m.className.indexOf("_auth")!=-1){return}d.stop();if(p&&!m.up("div.comment")){var o=$("like_popup"),k=o.up(".modal_window"),n=p.up(".content_item_likeblock");if(n){window.modalWindow.showWindow({id:"like_popup"});if(k.identify()!="like_popup_modal"){k.id="like_popup_modal";k.down(".delete").update("X").title=Dic.word("modal_close_window")}}if(m.hasClassName("butt_plus_selected")){return}}var f=$(m.form);var j=$(f["rate[plus]"]);var e=$(f["rate[minus]"]);var l=(m==j);m.addClassName("butt_"+(l?"plus":"minus")+"_selected").blur();m.previous(".icon_vote")&&m.previous(".icon_vote").addClassName("icon_selected");j&&j.disable("butt_plus_disabled");e&&e.disable("butt_minus_disabled");if(l){e&&e.previous(".icon_vote")&&e.previous(".icon_vote").addClassName("icon_disabled")}else{j&&j.previous(".icon_vote")&&j.previous(".icon_vote").addClassName("icon_disabled")}if(l&&!m.up("div.comment")){m.disabled=false}var h={};h[l?"rate[plus]":"rate[minus]"]=1;f.request({add2url:"json",method:"post",parameters:h,onSuccess:function(w){var t=Ajax.parseResult(w);var v=f.down("span.mark");if(!v){return}v.className=(t.mark==0)?"mark":(t.mark>0?"mark_plus":"mark_minus");if(t.mark>0){t.mark="+"+t.mark}v.replaceChild(document.createTextNode(t.mark),v.firstChild);var s=v.up("div.has_counter");if(s){var u=s.down(".profile_rating_count");u&&u.update(u.innerHTML.replace(/\d+/,t.count))}if(m.hasClassName("replaceable")){var q=Builder.node("span.submitted",(a||""));m.replace(q)}}})})}function buildForeignLikeButtons(l,d,j,f,h,k,a,e){var c=$("content_item_"+l)||$("items_list_content_"+l);if(!c){return}document.observe("click",function(q){if(!q.isLeftClick()){return}var t=q.element(),m=q.findElement(".like_button");if(!t.descendantOf(c)||!m||t.up("div.comment")||t.disabled||!/rate\[(plus|minus)\]/i.test(t.name)||t.className.indexOf("_auth")!=-1){return}q.stop();var p=$("like_popup"),u=p.up(".modal_window"),n=m.up(".content_item_likeblock");window.modalWindow.showWindow({id:"like_popup"});if(u.identify()!="like_popup_modal"){u.id="like_popup_modal";u.down(".delete").update("X").title=Dic.word("modal_close_window")}if(!p.down(".foreign_like_buttons")||p.down(".foreign_like_buttons").identify().substr(8)!=l){var o=Builder.node("div",{className:"foreign_like_buttons",id:"buttons_"+l},Builder.node("table",Builder.node("tbody",Builder.node("tr",[Builder.node("td.left",Dic.word("foreign_like_buttons_text")),Builder.node("td",[f?Builder.node("div.button_item",Builder.node("iframe",{src:"http://www.facebook.com/plugins/like.php?href="+d+"&layout=button_count&show_faces=false&width=200&action=like&font&locale=ru_RU&colorscheme=light&height=21",scrolling:"no",frameborder:"0",style:"border: none; overflow: hidden; width: 200px; height: 21px;",allowTransparency:"true"})):"",h?Builder.node("div",{className:"button_item",id:"twitter_block"},Builder.node("iframe",{src:"http://platform.twitter.com/widgets/tweet_button.html?url="+encodeURIComponent(d)+"&text="+encodeURIComponent(j)+"&count=horizontal",allowtransparency:"true",frameborder:"0",scrolling:"no",style:"width: 96px; height: 20px;"})):"",k?Builder.node("div.button_item",Builder.node("div",{id:"vk_like_"+l})):"",a?Builder.node("div",{className:"button_item",id:"mailru_block"},Builder.node("a",{target:"_blank",className:"mrc__plugin_like_button",href:"http://connect.mail.ru/share?share_url="+d,"data-mrc-config":"{'type' : 'button'}"},Dic.word("action_links_like"))):"",e&&!Prototype.Browser.IE?Builder.node("div.button_item",Builder.node("a",{className:"odkl-klass",href:d,onclick:"ODKL.Share(this);return false;"},"Класс!")):""])]))));p.update(o);if(k){VK.Widgets.Like("vk_like_"+l,{type:"button",pageUrl:d,pageTitle:j})}if(a){var s=document.createElement("script");s.setAttribute("type","text/javascript");s.setAttribute("src","http://cdn.connect.mail.ru/js/loader.js");$("mailru_block").appendChild(s)}}})}function supportFavoring(){window.supportFavoring=Prototype.emptyFunction;document.observe("click",function a(e){if(!e.isLeftClick()){return}var f=e.element();if(f.disabled||!/favorite_button/i.test(f.name)){return}e.stop();var d=$(f.form);var c=(d.favorite.value=="t")?true:false;f.addClassName("busy").blur();d.request({add2url:"json",method:"post",isFav:c,onSuccess:function(h){starInput=d.down("input[name=favorite_button]");starInput.removeClassName("busy").toggleClassName("active").title=Dic.word(c?"unmark_as_favorite":"mark_as_favorite")}})})}if(window.isGuest){window.domReady.push(function(){var a=$("password_recovery_link");if(!a){return}var c=a.href;$("login_field").observe("change",function(){a.href=c+"?email="+encodeURIComponent($F("login_field"))})})}function updateUnreadMessagesCounter(f){var m=$("unmarkedCount");if(!m){return}var p=$("msg_popup"),d=60000,n=0,e=m.next(),c=e&&e.hasClassName("helper")&&e.down().down(),a=$("navigation_in_group")&&$("navigation_in_group").hasClassName("new_style"),l,o=a||window.project=="comon";function j(){new Ajax.Request(f,{method:"get",parameters:{background:true},onSuccess:function(u){var q=Ajax.parseResult(u);if(q.unmarkedCount!="0"&&q.message&&q.message.text){m.update((o?"":"(")+q.unmarkedCount+(o?"":")")).show();var t=Cookie.get("msgs_unread_id");if($("navigation")&&t==q.message.id){p&&p.hide()}if($("navigation")&&t!=q.message.id){if(p){p.down("a",1).writeAttribute({href:q.message.page_url,className:q.message.id});p.down("span.top").update(q.message.author.name.truncate(21));p.down("span.bot").update(String.replaceSmiles(q.message.text));p.show()}$("messages").addClassName("there_is_new").addClassName("new_msg");function s(){if($("messages").hasClassName("new_msg")){if(a){Effect.Pulsate("unmarkedCount",{pulses:16,duration:5});setTimeout(function(){titleTicker.stop()},5000)}else{Effect.Pulsate("messages");Effect.Pulsate("letter")}}a||setTimeout(function(){s()},4000)}setTimeout(function(){s()},1000)}else{titleTicker.stop()}}else{if($("navigation")){p&&p.hide();balloonIsClose=true;$("messages").removeClassName("new_msg").removeClassName("there_is_new");titleTicker.stop()}m.hide()}if(q.message&&q.message.text&&n<q.unmarkedCount&&!Cookie.get(q.message.id)&&(!e||e.style.display=="none")){n=q.unmarkedCount;if(window.type=="chat"){m.show().previous().addClassName("mail_new")}else{c&&(c.id="close"+q.message.id);e&&h(q.message.author,q.message.text,q.message.page_url);if($("navigation")&&(t!=q.message.id)&&!a){l=titleTicker((q.message.author.name+": "+q.message.text).truncate(50))}}}}});d*=1.5;setTimeout(j,d)}j();if(!e){return}if(c){c.observe("click",function(){e.hide();Cookie.set(this.id.replace("close",""),1);titleTicker.stop()});var k=e.down().down().next();k.observe("click",function(){e.hide();titleTicker.stop()})}function h(s,t,q){k.update().insert(s.name).insert(Builder.node("br")).insert(t.truncate(100));k.href=q;e.show()}}if(!window.isGuest){window.domReady.push(function(){updateUnreadMessagesCounter(unread_messages_counter_json_url)})}window.domReady.push(function initScrollToSmoother(){scrollToSmoother()});function tagBoxesHoverable(d,c){var a=tagBoxesHoverable.boxes={};$("boxes").childElements().slice(1).invoke("hover").each(function(e){a[e.id.substring(4)]=e});$("people_tags").childElements().concat($("question_tags").childElements()).each(function(e){if(!e.match("span")){return}var f=a[e.className];e.hover(function(j){f[j?"addClassName":"removeClassName"]("full_hover")});e.observe("click",function(j){if(!e.descendantOf($("question_tags"))){return}j.stop();f.toggleClassName("fixed_hover");h()});if(f.hasClassName("full_hover")){h()}function h(){f.down("a.close").observe("click",function(){f.replaceClassNameWith("fixed_hover|full_hover|hover","hidden");(function(){f.removeClassName("hidden")}).delay(2)})}});document.observe("click",function(f){var e=f.findElement("#tags a.approve");if(!e||!f.isLeftClick()){return}f.stop();a[e.up().className].toggleClassName("fixed_hover")});document.observe("click",function(h){var f=h.findElement("#tags a.delete");if(!f||!h.isLeftClick()){return}h.stop();if(f.href.empty()){return}if(!confirm(d)){return}var e=f.href;new Ajax.Request(e.add2url("json"),{parameters:{confirmed:1,confirm_deletion:1,csrf:c},method:"post",onSuccess:function(l){var k=Ajax.parseResult(l);a[f.up().className].remove();f.up().style.visibility="hidden"},onFailure:j,onException:j});f.href="";function j(){f.href=e}})}function waitForCropper(a){if(window.Cropper){a()}else{waitForCropper.curry(a).defer()}}function photoTagger(u,d){var f,w,n=$("photo_tag"),q=$("photo_tag_area_baloon"),e=$("photo"),k=$("baloon_start"),s,h=$("baloon_friends"),m=$("friend_form"),p=e.getWidth(),o=e.getHeight(),a={displayOnInit:true,minWidth:50,minHeight:50,onloadCoords:{x1:0.4*p,x2:0.6*p,y1:0.2*o,y2:0.4*o},onEndCrop:function(y){w=y;q.clonePosition(e,{offsetTop:y.y1,offsetLeft:y.x2+15,setWidth:false,setHeight:false}).show();t("friend_form","box",y)}};q.select("a.close","a[name=cancel]").invoke("observe","click",function(){c();j()});n.observe("click",function(){c();j();if(!window.Cropper){window.cropLocationUrl.each(function(y){document.body.appendChild(document.createElement("script")).src=y})}waitForCropper(function(){f=new Cropper.Img(e,a);var y=Element.hide.curry(q);$w("N NE E SE S SW W NW").each(function(z){f["handle"+z].observe("mousedown",y)});f.dragArea.observe("mousedown",y);f.selArea.observe("mousedown",y)})});$("tag_friends").observe("click",function(){k.hide();h.show();if(!s){x()}});$("tag_me").observe("click",function(){var y=w;var z=m.serialize(true);z["box[bound_id]"]=u;delete z["box[email]"];delete z["box[firstname]"];delete z["box[lastname]"];new Ajax.Request(m.action.add2url("json"),{parameters:z,onSuccess:function(B){var A=Ajax.parseResult(B);l(A.name,A.page_url,y,A.deleteLink,A.box_id)},onException:v});q.hide();j()});m.observe("submit",function(D){D.stop();var E=this.serialize(true);var B,y,A=w;var C=E["box[bound_id]"];if(C){var z=$A(this.elements).find(function(F){return F.value==C});if(z){B=z.next().nextSibling.nodeValue;y="/people/"+C}}if(!B){return}this.request({add2url:"json",onSuccess:function(G){var F=Ajax.parseResult(G);B=F.name||B;l(B,y,A,F.deleteLink,F.box_id)},onException:v});q.hide();j();this.reset()});function l(y,z,F,H,B){var A=$("tags").down().show().down();var E=Builder.node("span",y);var C=z?Builder.node("a",{href:z,rel:"#"+B},E):E;var D=$("boxes").appendChild(Builder.node("div.tag_box full_hover",{id:"box_"+B},Builder.node("div.link_holder",[Builder.node("img.balloon_pointer",{src:"/static/images/bg_balloon_area_tag_pointer_small.gif"}),C]).setStyle({left:(Math.round((F.x2-F.x1)/2)-100)+"px"})).setStyle({top:F.y1+"px",left:F.x1+"px",width:F.x2-F.x1+"px",height:F.y2-F.y1+"px"}));tagBoxesHoverable.boxes[B]=D;document.fire("document:changed");(function(){D.removeClassName("full_hover")}).delay(3);var G=Builder.node("span",{className:B},[Builder.node("a.nopopup",{href:z},y)," (",Builder.node("a.delete",{href:H},Dic.word("delete_photo_tag")),(A.empty()?") ":"), ")]).hover(function(I){D[I?"addClassName":"removeClassName"]("full_hover")});A.insert({top:G})}function v(z,y){if(y&&/Data(Mapper)?Exception/i.test(y.serverType)&&y.message){alert(y.message)}}function j(){if(!f){return}f.remove();f=undefined}function c(){q.hide();h.hide();k.show()}function t(y,A,z){y=$(y);$w("x1 x2 y1 y2").each(function(C,B){y[A+"[box]["+C+"]"].value=z[C]/(B<2?p:o)})}function x(){s=true;new Ajax.Request("/friends/json",{method:"get",onSuccess:function(B){var y=Ajax.parseResult(B),z=HtmlBuilder.node;function A(C){return z("li",[z("label.inline",{"for":"user_"+C.id},[z("input.checker#user_"+C.id,{type:"radio",name:"box[bound_id]",value:C.id}),z("img",{src:C.photo_small}),C.name])])}$("friends_list").preventDocumentScroll().update($A(y.friends).collect(A).join(""))}})}}function deletePhoto(){function a(d){var c=this;d.stop();c.request({parameters:{confirm_deletion:1},onSuccess:function(){c.up("li").setStyle({visibility:"hidden"})},add2url:"json"})}document.observe("click",function(c){var d=c.element();if(d.match("input[type=submit][class~=delete]")){if(d.hasClassName("album_delete")){return}$(d.form).observe("submit",a)}})}function initImageEditor(d,x,a,o,e){var j,h,q,p;d=$(d);var c=$("form");var l=$("crop_start");var s=$("crop_stop");var A=$("rotate_right");var k=$("rotate_left");var f=$A([$(c["photo[tool_crop][x1]"]),$(c["photo[tool_crop][y1]"]),$(c["photo[tool_crop][x2]"]),$(c["photo[tool_crop][y2]"])]);l.up().show();var y={x1:f[0].getAttribute("value"),y1:f[1].getAttribute("value"),x2:f[2].getAttribute("value"),y2:f[3].getAttribute("value")};function n(){q=d.getWidth();p=d.getHeight();h={displayOnInit:true,onEndCrop:function(B){if("x1" in B){f[0].value=(h.onloadCoords.x1=B.x1)/q}if("y1" in B){f[1].value=(h.onloadCoords.y1=B.y1)/p}if("x2" in B){f[2].value=(h.onloadCoords.x2=B.x2)/q}if("y2" in B){f[3].value=(h.onloadCoords.y2=B.y2)/p}},onloadCoords:{x1:(y.x1||0.2)*q,y1:(y.y1||0.2)*p,x2:(y.x2||0.8)*q,y2:(y.y2||0.8)*p}}}d.observe("load",n);n();a=a.replace(/0$/,"");var t={0:a+"0",90:a+"90",180:a+"180",270:a+"270"};if(y.x1){w()}l.observe("click",w);function w(){if(o&&!m()){return}if(j){return}s.show();if(!window.Cropper){window.cropLocationUrl.each(function(B){document.body.appendChild(document.createElement("script")).src=B})}waitForCropper(function(){j=new Cropper.Img(d,h)})}s.observe("click",z);function z(){if(!j){return}j.remove();j=undefined;s.hide();f.invoke("setValue","")}c["photo[tool_rotate]"].value=x;function v(B){if(o&&!m()){return}if(j){z()}B=c["photo[tool_rotate]"].value=(c["photo[tool_rotate]"].value.parseInt()+B)%360;d.src=t[B];f.invoke("setValue","")}A.observe("click",v.curry(270));k.observe("click",v.curry(90));var u=false;function m(){if(u){return true}if(confirm(o)){return u=true}return false}}function newPhotoAlbum(){var c=$("albumSelector");var d=$("new_album_baloon");var e=$("new_album_submit");$("new_photo_album").observe("click",function(h){h.stop();d.show();WCH.Apply(d,d.up())});$("album_close").observe("click",function(){WCH.Discard(d,d.up());d.hide()});e.observe("click",function(m){var k=this;var h=this.form["album[name]"].value;var j=Builder.node("div.error_container",[Builder.node("p.error",Dic.word("error_required_missed"))]);if(c.match("select")){c.selectedIndex=0}m.stop();if(h.empty()){if(!this.form["album[name]"].up().hasClassName("error")){this.form["album[name]"].insert({after:j}).up().addClassName("error")}return}var l;switch($(this.form).serialize(true)["album[vislvl]"].parseInt()){case 0:l="private";break;case 1:l="friends";break;case 9:default:l="public";break}document.fire("form:submitted");k.disable().up().addClassName("submit_loading");$(k.form).addClassName("disabled");$(this.form).request({add2url:"json",onSuccess:function(p){var n=Ajax.parseResult(p);if(c.match("select")){c.insertBefore(Builder.node("option",{className:l,value:n.album_id},h),$A(c.options).last());(function(){c.selectedIndex=c.options.length-2;c.fire("album:changed")}).defer()}else{var o="photo_in_album_"+n.album_id;c.insertBefore(Builder.node("input.checker "+l,{type:"checkbox",value:1,id:o,name:"photo_in_album["+n.album_id+"]",checked:"checked"}),$("new_photo_album"));c.insertBefore(Builder.node("label.inline",{"for":o},h),$("new_photo_album"));c.insertBefore(Builder.node("br"),$("new_photo_album"))}d.hide()},onComplete:function(){k.enable().up().removeClassName("submit_loading");$(k.form).removeClassName("disabled")}})});function a(h){(function(){$(e.form["album[notify]"])[h?"enable":"disable"]().checked=h}).defer()}a($(e.form).serialize(true)["album[vislvl]"]!=0);var f=e.form["album[vislvl]"];$A([f[0],f[1]]).invoke("observe","click",a.curry(true));f[2].observe("click",a.curry(false))}function photoUploader(){newPhotoAlbum();var d=$("albumSelector"),m=$("boundObjectSelector"),n=$("photo_album_listing"),f=$("submitButton");$(f.form);c();var k=$("upload_form");var j=k.down().childElements();var a=j[1];j=j[0];j.observe("click",function(o){o.stop();j.down().addClassName("act");a.down().removeClassName("act");k.addClassName("local").removeClassName("remote")});a.observe("click",function(o){o.stop();a.down().addClassName("act");j.down().removeClassName("act");k.removeClassName("local").addClassName("remote")});document.observe("click",function(o){if($F(d)!="new"){return}if(d.match("select")){d.selectedIndex=0}$("new_album_baloon").show()});d.observe(["click","keyup","change","album:changed"],function(){var o=d.options[d.selectedIndex].className||"public";k.replaceClassNameWith("private|friends|public",o)});function e(){var p=d.options[d.selectedIndex].className||"public";var o=Builder.node("li.loading "+p,[Builder.node("span.photo"),Builder.node("span.photo_plaque",Dic.word("photo_being_uploaded"))]);n.insertBefore(o,n.firstChild);return o}function l(p,o){function q(){return Builder.node("input",{name:"csrf",type:"hidden",value:d.form.csrf.value})}p.removeClassName("loading").firstChild.appendChild(Builder.node("a",{href:o.photo_edit_link},Builder.node("img",{src:o.url,width:o.width,height:o.height})));var t=Builder.node("form.simple required",{action:o.photo_edit_link,method:"post"},[q(),h(Builder.node("input.name",{value:o.title,name:"photo[title]"}))]);var s=p.firstChild.next();s.update().appendChild(t);s.appendChild(o.album_name?Builder.node("a.album_link",{href:o.album_page_url},o.album_name):Builder.node("span.album_link",Dic.word("photo_has_no_album")));s.appendChild(Builder.node("hr"));s.appendChild(Builder.node("form.simple",{method:"post",action:o.photo_delete_link},[Builder.node("input.delete",{type:"submit",value:"".nbsp,name:"confirm_deletion"}),q(),Builder.node("input",{type:"hidden",name:"confirmed"})]));s.appendChild(Builder.node("a.edit_link",{href:o.photo_edit_link},Dic.word("photo_edit")))}function c(){$(d.form.photo_file).observe("change",function(){f.click()})}f.observe("click",function(t){t.stop();if(!j.down().hasClassName("act")){return}var s=$(d.form.photo_file);if(s.value==""){return}var p=Builder.node("input#file.file",{type:"file",name:"photo_file",size:8,accept:"image/jpg,image/gif,image/png"});s.parentNode.insertBefore(p,s);s.addClassName("hidden");var o=e();o.addClassName(d.options[d.selectedIndex].className);o.appendChild(s);f.form.select("div.errors_container").invoke("update");var u=d.form.readAttribute("action");var q=s.uploadFile(u.add2url("json"),{parameters:{"photo[album_id]":$F(d),"photo[bound_object]":m?$F(m):"",csrf:d.form.csrf.value},onComplete:function(w,x){var v=(w.firstChild.textContent||w.firstChild.outerText).evalJSON();v=v.result;if(v.ok){l(o,v.photo);q();return}if(v.errorMap){var y=$H(v.errorMap).values().first();y=$A(y).first();f.up().down("div.errors_container").appendChild(Builder.node("p.error",y));f.up(1).addClassName("error");alert(y);o.remove();return}if(v.exception){if(v.exception.type=="QuotaException"){$(d.form).disable()}if(v.exception.message){alert(v.exception.message);o.remove();return}}o.remove()}});c()});f.observe("click",function(s){s.stop();if(!a.down().hasClassName("act")){return}var p=f.form["photo[url]"];if(p.value.blank()){return}var o=e();function t(){o.remove()}var q=f.form.request({add2url:"json",onSuccess:function(v){var u=Ajax.parseResult(v);l(o,u.photo);p.value=""},onFailure:t});q.options.onException=q.options.onException.wrap(function(u,w,v){t();u.call(this,w,v)})});function h(p){var o=p.value;var q=(new Helper(Dic.word("press_enter_to_save"))).input(p);p.observe(["change","keyup","mouseup","blur"],function(){(function(){var s=!p.value.blank();q.div.firstChild.update(Dic.word(s?"press_enter_to_save":"error_required_missed"));p.up()[s?"removeClassName":"addClassName"]("error")}).defer()});p.observe(["keypress","blur"],function(t){if(t.type=="keypress"&&t.keyCode!=Event.KEY_RETURN){return}t.stop();if(!$(this.form)){return}var s=this;if(s.hasClassName("loading")||s.value.blank()){return}s.addClassName("loading");(function(){s.removeClassName("loading")}).defer();s.up().removeClassName("error");this.form.request({add2url:"json",onSuccess:function(v){Ajax.parseResult(v);s.up().addClassName("saved");(function(){s.up().removeClassName("saved")}).delay(2)},onFailure:function(){s.up().addClassName("error")}});try{p.blur()}catch(u){}});return p}$$("input.name").each(h)}var DomainChecker=Class.create();DomainChecker.prototype={observer:null,lastCheckedDomain:null,initialize:function(f,a,e,d,c){this.url=a;this.element=$(f);this.loadingElement=$(e);this.messagesElement=$(d);this.options=Object.extend({delay:1,ajaxOptions:{method:"get"}},c||{});Event.observe(this.element,"blur",this.onBlurListener.bindAsEventListener(this));Event.observe(this.element,"keyup",this.onKeyupListener.bindAsEventListener(this));this.hideLoadingBlock()},getElementValue:function(){return this.element.getValue().replace(/^\s+|\s+$/g,"")},onBlurListener:function(a){this.onDomainNameChange(this.getElementValue(),0)},onKeyupListener:function(a){if([Event.KEY_TAB,Event.KEY_END,Event.KEY_HOME,Event.KEY_RETURN,Event.KEY_ESC,Event.KEY_LEFT,Event.KEY_RIGHT,Event.KEY_DOWN,Event.KEY_UP].indexOf(a.keyCode)!=-1){return}this.onDomainNameChange(this.getElementValue(),this.options.delay);this.hideCheckMessages();this.lastCheckedDomain=null},onDomainNameChange:function(c,a){if(this.observer){clearTimeout(this.observer)}this.observer=setTimeout(this.fireDomainCheckRequest.bindAsEventListener(this,c),a*1000)},fireDomainCheckRequest:function(c,a){if(a&&this.lastCheckedDomain!=a){this.lastCheckedDomain=a;this.showLoadingBlock();this.hideCheckMessages();new Ajax.Request(this.url,Object.extend({asynchronous:true,evalScripts:false,parameters:{"group[prefix]":a},onComplete:this.onCheckSuccess.bind(this),onFailure:this.onCheckFailure.bind(this)},this.options.ajaxOptions))}},onCheckSuccess:function(response){this.hideLoadingBlock();response=eval(response.responseText);if(response.result.prefix==this.getElementValue()){if(response.result.errors){this.showCheckMessages("error",response.result.errors)}else{this.showCheckMessages("ok",response.result.messages)}if(response.result.alternatives){var trs=$A([Builder.node("tr",Builder.node("th",{colspan:"2"},Dic.word("urls_add_address_likes")))]);$A(response.result.alternatives).each((function(el){el=$H(el);var link=Builder.node("a",{style:"border-bottom: 1px dashed #09C; text-decoration: none;"},[el.get("prefix"),Builder.node("span",{className:"alias"},[".",el.get("domain")])]);link.observe("click",(function(event){this.element.value=event.findElement("a").cleanWhitespace().firstChild.nodeValue;event.stop();this.onDomainNameChange(this.getElementValue(),0)}).bindAsEventListener(this));trs.push(Builder.node("tr",Builder.node("td",link)))}).bind(this));var table=Builder.node("div",{id:"alts"},Builder.node("table",Builder.node("tbody",trs)));this.messagesElement.appendChild(table)}}},onCheckFailure:function(a){this.hideLoadingBlock()},showCheckMessages:function(a,d){if(this.oldStatus){this.messagesElement.removeClassName(this.oldStatus)}this.hideCheckMessages();this.messagesElement.addClassName(a);var c=Builder.node("ul",[Builder.node("li",d[0])]);this.messagesElement.appendChild(c);this.oldStatus=a},hideCheckMessages:function(){this.messagesElement.descendants().each(function(a){a.remove()})},showLoadingBlock:function(){this.loadingElement.show()},hideLoadingBlock:function(){this.loadingElement.hide()}};function initDocumentClick(){document.observe("click",function(a){if(!a.isLeftClick()){return}searchReset();var c=a.element();if(!c.match("input.ajax_button")){return}a.stop();if(c.hasClassName("not_enough")){window.modalWindow.showWindow({id:"not_enough_block"})}})}function searchReset(){if(!$("search")){return}if($F("search_field").blank()){var a=$("navigation_in_group")&&$("navigation_in_group").hasClassName("new_style");$("navigation").down("ul.right_part")&&$("navigation").down("ul.right_part").show();a&&($("navigation").down(".last_comments")||$("navigation").down(".nevada_people")).show();$("sitename")&&$("sitename").show();$("search_field").setStyle({background:"url(/static/images/navigation_searchfield_bg"+(a?"3":"")+".gif) 0 0 no-repeat",width:(a?"77px":"64px")});$("search_span").hide()}$("search_popup").hide()}function initDocumentClickGroup(){document.observe("click",function(e){if(!e.isLeftClick()){return}searchReset();var h=e.element(),f=$$("#redact_drop li"),a=$$("#redact_drop a"),d=false;for(var c=0;c<f.length;c++){if(!d&&h==f[c]){d=true}}if(!d){for(var c=0;c<a.length;c++){if(!d&&h==a[c]){d=true}}}if($("redact_drop")){if($("redact_drop").style.display=="block"&&h!=$("redact_drop_a")&&!h.descendantOf($("redact_drop"))&&!d){$("redact_drop").style.display="none";$("redact_drop_a").removeClassName("hover")}}if($("balance_btn")){if(h.id=="balance_btn"||h.descendantOf($("balance_btn"))){$("balance_drop")[$("balance_drop").visible()?"hide":"show"]();return}if($("balance_drop").visible()&&!h.descendantOf($("balance_btn"))&&!h.descendantOf($("balance_drop"))){$("balance_drop").hide()}}})}if($("navigation")){var new_style=$("navigation_in_group")&&$("navigation_in_group").hasClassName("new_style");window.domReady.push(function initNavigation(){$("navigation").removeClassName("css_only");var e=170;var m=$("username"),s=$("navigation").down("div.last_comments");if(!new_style){q($("sites"));q($("applications"));q($("entertainment"))}q($("balance"));function q(B){if(!B){return}var x,z,w=B.down("div.popup"),y=B.down("a.first_level");if(!w){return}B.observe(new_style?"click":"mouseover",function(C){if(new_style){if(!C.findElement(".first_level")){return}C.stop();$$("#navigation div.popup").each(function(D){D.hide().previous(".first_level").removeClassName("hover")})}x=true;z=false;window.setTimeout(function(){if(x){w.style.display="block";y.addClassName("hover")}},e)}).observe("mouseout",function(){if(new_style){return}x=false;window.setTimeout(function(){!x&&A()},e)});w.observe("mouseout",function(){if(new_style){return}x=true;z=true;window.setTimeout(function(){z&&A()},e)}).observe("mouseover",function(){if(new_style){return}z=false}).hideOnOuterClick(B,function(){if(!new_style){return}A()},true);function A(){w.hide();y.removeClassName("hover")}}if(m){var n,d,t=m.down("div.popup");m.observe(new_style?"click":"mouseover",function(w){if(new_style){if(!w.findElement(".first_level")){return}w.stop();if(t.style.display=="block"){t&&t.hide();m.down("a.first_level").removeClassName("hover");return}$$("#navigation div.popup").each(function(y){y.hide().previous(".first_level").removeClassName("hover")})}n=true;d=false;window.setTimeout(function(){if(n){if(t){t.style.display="block"}m.down("a.first_level").addClassName("hover");$("redact_drop")&&$("redact_drop").hide();$("balance_drop")&&$("balance_drop").hide()}},e);var x=m.down("input.btn_left_group");if(x){x.removeClassName("sfhover").enable();x.up("form").removeClassName("disabled")}}).observe("mouseout",function(){if(new_style){return}n=false;window.setTimeout(function(){if(!n){t&&t.hide();m.down("a.first_level").removeClassName("hover")}},e)});t&&t.observe("mouseout",function(){if(new_style){return}n=true;d=true;window.setTimeout(function(){if(d){t.style.display="none";m.down("a.first_level").removeClassName("hover")}},e)}).observe("mouseover",function(){if(new_style){return}d=false}).hideOnOuterClick(m,function(){if(!new_style){return}t&&t.hide();m.down("a.first_level").removeClassName("hover")},true);if($("username_edit")){$("username_edit").observe("mouseover",function(){this.next("a").addClassName("hovered")}).next("a").observe("mouseout",function(){this.removeClassName("hovered")})}m.observe("mouseover",function(w){if(!w.findElement("a.second")&&!w.findElement("a.fourth")){return}$("friends_link").removeClassName("hovered")});if($("search_friends")){$("search_friends").observe("mouseover",function(){$("friends_link").addClassName("hovered")})}}if(s){var k=s.down("div.popup");s.observe("click",function(w){if(!w.findElement(".first_level")){return}w.stop();if(k.style.display=="block"){k&&k.hide();s.down("a.first_level").removeClassName("hover");return}$$("#navigation div.popup").each(function(x){x.hide().previous(".first_level").removeClassName("hover")});window.setTimeout(function(){if(k){k.style.display="block"}s.down("a.first_level").addClassName("hover")},e)});k&&k.hideOnOuterClick(s,function(){if(!new_style){return}k&&k.hide();s.down("a.first_level").removeClassName("hover")},true)}for(var o=0,v=$$("#navigation div"),p=v.length;o<p;o++){v[o].onmouseover=function(){this.className+=" sfhover"};v[o].onmouseout=function(){this.className=this.className.replace(new RegExp(" sfhover\\b"),"")}}for(var o=0,f=$$("#navigation input"),p=f.length;o<p;o++){f[o].onmouseover=function(){this.className+=" sfhover"};f[o].onmouseout=function(){this.className=this.className.replace(new RegExp(" sfhover\\b"),"")}}for(var o=0,c=$$("#navigation li"),p=c.length;o<p;o++){c[o].onmouseover=function(){this.className+=" sfhover"};c[o].onmouseout=function(){this.className=this.className.replace(new RegExp(" sfhover\\b"),"")}}if($("search")){$("search").observe("click",function(x){var w=Event.element(x);if(w.name!="search"){x.stop()}}).down("form").observe("submit",function(w){if($F("search_field").blank()){w.stop()}$("search_field").focus();$F("search_field").blank()||$("search_popup").hide()});$("search_span").observe("click",function(){$("search_field").focus()})}if($("msg_popup")){$("msg_popup").observe("mouseover",function(){focusBalloon=true;$("messages").removeClassName("new_msg")}).observe("mouseout",function(){focusBalloon=false;$("messages").addClassName("new_msg")});if($("msg_person")){$("msg_person").observe("click",function(){updateUnreadMessagesCounter(unread_messages_counter_json_url)})}}if($("sitename")&&$("sitename").down("div.redact")){$("redact_drop_a").observe("click",function(){if($("redact_drop").style.display=="block"){$("redact_drop").hide();$("redact_drop_a").removeClassName("hover")}else{$("redact_drop").setStyle({display:"block"});$("redact_drop_a").addClassName("hover")}})}$("sms_link")&&$("sms_link").observe("click",function(w){w.stop();window.modalWindow.showWindow({id:"payment_block"})});$("sms_link_2")&&$("sms_link_2").observe("click",function(w){w.stop();window.modalWindow.showWindow({id:"payment_block"})});$("sms_link_nav")&&$("sms_link_nav").observe("click",function(w){w.stop();$("balance_block")&&$("username").down("div.popup").hide();$("balance_drop")&&$("balance_drop").hide();window.modalWindow.showWindow({id:"payment_block"})});$("sms_link_nav_site")&&$("sms_link_nav_site").observe("click",function(w){w.stop();$("balance_block")&&$("username").down("div.popup").hide();$("balance_drop")&&$("balance_drop").hide();window.modalWindow.showWindow({id:"payment_block"})});$("balance_block")&&$("balance_block").observe("click",function(w){if(w.findElement("li")){m.down("div.popup").hide()}});$("balance_drop")&&$("balance_drop").observe("click",function(w){if(w.findElement("li")){$("balance_drop").hide()}});if(new_style&&$("sites")){var a=200,j=0.2,u,h,l;$("sites").observe("mouseover",function(){h&&clearTimeout(h);l&&l.cancel();var w=this.down("div.block");u=setTimeout(function(){w.setStyle({opacity:1}).show()},a)}).observe("mouseout",function(){u&&clearTimeout(u);var w=this.down("div.block");h=setTimeout(function(){if(w.visible()){l=Effect.Fade(w,{duration:j})}},a)})}});if($("search")){function initSearchFieldFocus(c,f){var a=$("search_field"),e=$("search_span"),d=$("search_popup");a.observe("focus",function(){$("navigation").down("ul.right_part")&&$("navigation").down("ul.right_part").hide();if(new_style){($("navigation").down(".last_comments")||$("navigation").down(".nevada_people")).hide()}a.setStyle({width:"282px"});e.setStyle({display:"block",color:"#000"}).addClassName("hover");var h=0;if(e.innerHTML.blank()){switch(c){case"groups":h=1;break;case"places":h=2;break;case"photos_search":h=3;break;case"audio":case"people_item_audio":case"people_item_audio_add":h=4;break;case"people_item_videos":h=5;break;case"applications":h=6;break}d.down("li",h).addClassName("active");e.update($("search_popup").down("li",h).innerHTML);$("search").down("form").writeAttribute("action",f[h])}d.childElements().size()&&d.setStyle({display:"block"});a.style.background="none"})}function initGroupSearchFieldFocus(a,c){var d=$("search_field"),f=$("search_span"),e=$("search_popup");d.observe("focus",function(h){$("navigation").down("ul.right_part")&&$("navigation").down("ul.right_part").hide();if(new_style){($("navigation").down(".last_comments")||$("navigation").down(".nevada_people")).hide()}else{$("sitename")&&$("sitename").hide()}d.setStyle({width:"282px",background:"none"});f.setStyle({display:"block",color:"#000"}).addClassName("hover");if(f.innerHTML.strip().blank()){$("search").down("form").action=c;if(e.down("li",a)){e.down("li",a).addClassName("active");$("search_span").update($("search_popup").down("li",a).innerHTML)}}e.childElements().size()&&e.setStyle({display:"block"});if(new_style){$("username").down("div.popup").hide();$("username").down("a.first_level").removeClassName("hover")}})}function initSearchPopup(e){var a=$("search_field"),d=$("search_span"),c=$("search_popup");c.observe("click",function(h){var f=0,j=$$("#search_popup li"),l=h.findElement("li");j.each(function(k){k.removeClassName("active")});d.update(l.cleanWhitespace().firstChild.nodeValue);l.addClassName("active");j.each(function(m,k){if(m.hasClassName("active")){f=k}});$("search").down("form").writeAttribute("action",e[f]);a.focus();c.hide();d.setStyle({color:"#aaa"}).removeClassName("hover")})}}$("msg_popup")&&$("msg_popup").observe("click",function(a){if(a.findElement("a.close")){$("msg_popup").hide();balloonIsClose=true;setMsgCookie($("msg_person").className);titleTicker.stop()}});function setMsgCookie(e){var c="",d=new Date(),a=d.getFullYear(),f=d.getMonth();c+="msgs_unread_id=";c+=e;c+=";";c+="expires="+(new Date(a+1,f)).toUTCString()+";path=/;";document.cookie=c}var balloonIsClose=false;var focusBalloon=false;function updateMsg(){if(!balloonIsClose&&!focusBalloon&&$("unmarkedCount").visible()){if(new_style){Effect.Pulsate("unmarkedCount",{pulses:16,duration:5})}else{Effect.Pulsate("messages");Effect.Pulsate("letter")}}new_style||setTimeout(function(){updateMsg()},4000)}}var gadgets=gadgets||{};gadgets.util=function(){function j(){var p;var o=document.location.href;var m=o.indexOf("?");var n=o.indexOf("#");if(n===-1){p=o.substr(m+1)}else{p=[o.substr(m+1,n-m-1),"&",o.substr(n+1)].join("")}return p.split("&")}var f=null;var e={};var d={};var h=[];var a={0:false,10:true,13:true,34:true,39:true,60:true,62:true,92:true,8232:true,8233:true};function c(l,m){return String.fromCharCode(m)}function k(l){e=l["core.util"]||{}}if(gadgets.config){gadgets.config.register("core.util",null,k)}return{getUrlParameters:function(){if(f!==null){return f}f={};var o=j();var s=window.decodeURIComponent?decodeURIComponent:unescape;for(var m=0,l=o.length;m<l;++m){var q=o[m].indexOf("=");if(q===-1){continue}var p=o[m].substring(0,q);var n=o[m].substring(q+1);n=n.replace(/\+/g," ");f[p]=s(n)}return f},makeClosure:function(o,q,p){var n=[];for(var m=2,l=arguments.length;m<l;++m){n.push(arguments[m])}return function(){var s=n.slice();for(var u=0,t=arguments.length;u<t;++u){s.push(arguments[u])}return q.apply(o,s)}},makeEnum:function(m){var o={};for(var n=0,l;(l=m[n]);++n){o[l]=l}return o},getFeatureParameters:function(l){return typeof e[l]==="undefined"?null:e[l]},hasFeature:function(l){return typeof e[l]!=="undefined"},getServices:function(){return d},registerOnLoadHandler:function(l){h.push(l)},runOnLoadHandlers:function(){for(var m=0,l=h.length;m<l;++m){h[m]()}},escape:function(l,p){if(!l){return l}else{if(typeof l==="string"){return gadgets.util.escapeString(l)}else{if(typeof l==="array"){for(var o=0,m=l.length;o<m;++o){l[o]=gadgets.util.escape(l[o])}}else{if(typeof l==="object"&&p){var n={};for(var q in l){if(l.hasOwnProperty(q)){n[gadgets.util.escapeString(q)]=gadgets.util.escape(l[q],true)}}return n}}}}return l},escapeString:function(p){var m=[],o,q;for(var n=0,l=p.length;n<l;++n){o=p.charCodeAt(n);q=a[o];if(q===true){m.push("&#",o,";")}else{if(q!==false){m.push(p.charAt(n))}}}return m.join("")},unescapeString:function(l){return l.replace(/&#([0-9]+);/g,c)}}}();gadgets.util.getUrlParameters();var gadgets=gadgets||{};if(window.JSON){gadgets.json={parse:function(c){try{return window.JSON.parse(c)}catch(a){return false}},stringify:function(c){try{return window.JSON.stringify(c)}catch(a){return null}}}}else{gadgets.json=function(){function f(n){return n<10?"0"+n:n}Date.prototype.toJSON=function(){return[this.getUTCFullYear(),"-",f(this.getUTCMonth()+1),"-",f(this.getUTCDate()),"T",f(this.getUTCHours()),":",f(this.getUTCMinutes()),":",f(this.getUTCSeconds()),"Z"].join("")};var m={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function stringify(value){var a,i,k,l,r=/["\\\x00-\x1f\x7f-\x9f]/g,v;switch(typeof value){case"string":return r.test(value)?'"'+value.replace(r,function(a){var c=m[a];if(c){return c}c=a.charCodeAt();return"\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16)})+'"':'"'+value+'"';case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}a=[];if(typeof value.length==="number"&&!value.propertyIsEnumerable("length")){l=value.length;for(i=0;i<l;i+=1){a.push(stringify(value[i])||"null")}return"["+a.join(",")+"]"}for(k in value){if(value.hasOwnProperty(k)){if(typeof k==="string"){v=stringify(value[k]);if(v){a.push(stringify(k)+":"+v)}}}}return"{"+a.join(",")+"}"}}return{stringify:stringify,parse:function(text){if(/^[\],:{}\s]*$/.test(text.replace(/\\["\\\/b-u]/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){return eval("("+text+")")}return false}}}()}var gadgets=gadgets||{};gadgets.rpctx=gadgets.rpctx||{};gadgets.rpctx.frameElement=function(){var f="__g2c_rpc";var c="__c2g_rpc";var e;var d;function a(j,n,m){try{if(n!==".."){var h=window.frameElement;if(typeof h[f]==="function"){if(typeof h[f][c]!=="function"){h[f][c]=function(o){e(gadgets.json.parse(o))}}h[f](gadgets.json.stringify(m));return}}else{var l=document.getElementById(j);if(typeof l[f]==="function"&&typeof l[f][c]==="function"){l[f][c](gadgets.json.stringify(m));return}}}catch(k){}return true}return{getCode:function(){return"fe"},isParentVerifiable:function(){return false},init:function(h,j){e=h;d=j;return true},setup:function(m,h){if(m!==".."){try{var l=document.getElementById(m);l[f]=function(n){e(gadgets.json.parse(n))}}catch(k){return false}}if(m===".."){d("..",true);var j=function(){window.setTimeout(function(){gadgets.rpc.call(m,gadgets.rpc.ACK)},500)};gadgets.util.registerOnLoadHandler(j)}return true},call:function(h,k,j){a(h,k,j)}}}();var gadgets=gadgets||{};gadgets.rpctx=gadgets.rpctx||{};gadgets.rpctx.ifpc=function(){var f=[];var e=0;var d;function c(l){var h=[];for(var m=0,k=l.length;m<k;++m){h.push(encodeURIComponent(gadgets.json.stringify(l[m])))}return h.join("&")}function a(l){var j;for(var h=f.length-1;h>=0;--h){var m=f[h];try{if(m&&(m.recyclable||m.readyState==="complete")){m.parentNode.removeChild(m);if(window.ActiveXObject){f[h]=m=null;f.splice(h,1)}else{m.recyclable=false;j=m;break}}}catch(k){}}if(!j){j=document.createElement("iframe");j.style.border=j.style.width=j.style.height="0px";j.style.visibility="hidden";j.style.position="absolute";j.onload=function(){this.recyclable=true};f.push(j)}j.src=l;setTimeout(function(){document.body.appendChild(j)},0)}return{getCode:function(){return"ifpc"},isParentVerifiable:function(){return true},init:function(h,j){d=j;d("..",true);return true},setup:function(j,h){d(j,true);return true},call:function(h,n,l){var m=gadgets.rpc.getRelayUrl(h);++e;if(!m){gadgets.warn("No relay file assigned for IFPC");return}var k=null;if(l.l){var j=l.a;k=[m,"#",c([n,e,1,0,c([n,l.s,"","",n].concat(j))])].join("")}else{k=[m,"#",h,"&",n,"@",e,"&1&0&",encodeURIComponent(gadgets.json.stringify(l))].join("")}a(k);return true}}}();var gadgets=gadgets||{};gadgets.rpctx=gadgets.rpctx||{};gadgets.rpctx.nix=function(){var d="GRPC____NIXVBS_wrapper";var e="GRPC____NIXVBS_get_wrapper";var h="GRPC____NIXVBS_handle_message";var c="GRPC____NIXVBS_create_channel";var a=10;var m=500;var l={};var k;var j=0;function f(){var o=l[".."];if(o){return}if(++j>a){gadgets.warn("Nix transport setup failed, falling back...");k("..",false);return}if(!o&&window.opener&&"GetAuthToken" in window.opener){o=window.opener;if(o.GetAuthToken()==gadgets.rpc.getAuthToken("..")){var n=gadgets.rpc.getAuthToken("..");o.CreateChannel(window[e]("..",n),n);l[".."]=o;window.opener=null;k("..",true);return}}window.setTimeout(function(){f()},m)}return{getCode:function(){return"nix"},isParentVerifiable:function(){return false},init:function(o,p){k=p;if(typeof window[e]!=="unknown"){window[h]=function(s){window.setTimeout(function(){o(gadgets.json.parse(s))},0)};window[c]=function(s,u,t){if(gadgets.rpc.getAuthToken(s)===t){l[s]=u;k(s,true)}};var n="Class "+d+"\n Private m_Intended\nPrivate m_Auth\nPublic Sub SetIntendedName(name)\n If isEmpty(m_Intended) Then\nm_Intended = name\nEnd If\nEnd Sub\nPublic Sub SetAuth(auth)\n If isEmpty(m_Auth) Then\nm_Auth = auth\nEnd If\nEnd Sub\nPublic Sub SendMessage(data)\n "+h+"(data)\nEnd Sub\nPublic Function GetAuthToken()\n GetAuthToken = m_Auth\nEnd Function\nPublic Sub CreateChannel(channel, auth)\n Call "+c+"(m_Intended, channel, auth)\nEnd Sub\nEnd Class\nFunction "+e+"(name, auth)\nDim wrap\nSet wrap = New "+d+"\nwrap.SetIntendedName name\nwrap.SetAuth auth\nSet "+e+" = wrap\nEnd Function";try{window.execScript(n,"vbscript")}catch(q){return false}}return true},setup:function(s,n){if(s===".."){f();return true}try{var p=document.getElementById(s);var q=window[e](s,n);p.contentWindow.opener=q}catch(o){return false}return true},call:function(n,q,p){try{if(l[n]){l[n].SendMessage(gadgets.json.stringify(p))}}catch(o){return false}return true}}}();var gadgets=gadgets||{};gadgets.rpctx=gadgets.rpctx||{};gadgets.rpctx.rmr=function(){var j=500;var f=10;var k={};var c;var l;function n(s,p,q){var t=function(){document.body.appendChild(s);s.src="about:blank";s.src=p+"#"+q};if(document.body){t()}else{gadgets.util.registerOnLoadHandler(function(){t()})}}function d(s){if(typeof k[s]==="object"){return}var t=document.createElement("iframe");var p=t.style;p.position="absolute";p.top="0px";p.border="0";p.opacity="0";p.width="10px";p.height="1px";t.id="rmrtransport-"+s;t.name=t.id;var q=gadgets.rpc.getOrigin(gadgets.rpc.getRelayUrl(s))+"/robots.txt";k[s]={frame:t,receiveWindow:null,relayUri:q,searchCounter:0,width:10,waiting:true,queue:[],sendId:0,recvId:0};if(s!==".."){n(t,q,a(s))}e(s)}function e(q){var s=null;k[q].searchCounter++;if(q===".."){s=window.parent.frames["rmrtransport-"+window.name]}else{s=window.frames[q].frames["rmrtransport-.."]}var p=false;if(s){p=h(q,s)}if(!p){if(k[q].searchCounter>f){return}setTimeout(function(){e(q)},j)}}function m(q,t,x,w){var s=null;if(x!==".."){s=k[".."]}else{s=k[q]}if(s){if(t!==gadgets.rpc.ACK){s.queue.push(w)}if(s.waiting||(s.queue.length===0&&!(t===gadgets.rpc.ACK&&w&&w.ackAlone===true))){return true}if(s.queue.length>0){s.waiting=true}var p=s.relayUri+"#"+a(q);try{s.frame.contentWindow.location=p;var u=s.width==10?20:10;s.frame.style.width=u+"px";s.width=u}catch(v){return false}}return true}function a(q){var s=k[q];var p={id:s.sendId};if(s){p.d=Array.prototype.slice.call(s.queue,0);p.d.push({s:gadgets.rpc.ACK,id:s.recvId})}return gadgets.json.stringify(p)}function o(B){var y=k[B];var u=y.receiveWindow.location.hash.substring(1);var C=gadgets.json.parse(decodeURIComponent(u))||{};var q=C.d||[];var s=false;var x=false;var z=0;var p=(y.recvId-C.id);for(var t=0;t<q.length;++t){var w=q[t];if(w.s===gadgets.rpc.ACK){l(B,true);if(y.waiting){x=true}y.waiting=false;var v=Math.max(0,w.id-y.sendId);y.queue.splice(0,v);y.sendId=Math.max(y.sendId,w.id||0);continue}s=true;if(++z<=p){continue}++y.recvId;c(w)}if(s||(x&&y.queue.length>0)){var A=(B==="..")?window.name:"..";m(B,gadgets.rpc.ACK,A,{ackAlone:s})}}function h(t,v){var s=k[t];try{var q=false;q="document" in v;if(!q){return false}q=typeof v.document=="object";if(!q){return false}var u=v.location.href;if(u==="about:blank"){return false}}catch(p){return false}s.receiveWindow=v;v.onresize=function(){o(t)};if(t===".."){n(s.frame,s.relayUri,a(t))}o(t);return true}return{getCode:function(){return"rmr"},isParentVerifiable:function(){return true},init:function(p,q){c=p;l=q;return true},setup:function(s,p){try{d(s)}catch(q){gadgets.warn("Caught exception setting up RMR: "+q);return false}return true},call:function(p,s,q){return m(p,q.s,s,q)}}}();var gadgets=gadgets||{};gadgets.rpctx=gadgets.rpctx||{};gadgets.rpctx.wpm=function(){var a;return{getCode:function(){return"wpm"},isParentVerifiable:function(){return true},init:function(c,d){a=d;var e=function(f){c(gadgets.json.parse(f.data))};if(typeof window.addEventListener!="undefined"){window.addEventListener("message",e,false)}else{if(typeof window.attachEvent!="undefined"){window.attachEvent("onmessage",e)}}a("..",true);return true},setup:function(d,c){if(d===".."){gadgets.rpc.call(d,gadgets.rpc.ACK)}return true},call:function(c,h,e){var d=c===".."?parent:window.frames[c];var f=gadgets.rpc.getRelayUrl(c);if(f){d.postMessage(gadgets.json.stringify(e),f)}else{gadgets.error("No relay set, cannot send cross-domain message")}return true}}}();var gadgets=gadgets||{};gadgets.rpc=function(){var s="__cb";var p="";var h="__ack";var o=500;var j=10;var c={};var d={};var w={};var k={};var m=0;var F={};var v={};var e={};var D={};var l={};var u={};var x=(window.top!==window.self);var E=gadgets.rpctx.Ifpc;if(gadgets.util){D=gadgets.util.getUrlParameters()}k[".."]=D.rpctoken||D.ifpctok||0;var y=(D.rpc_earlyq==="1");function a(){return typeof window.postMessage==="function"?gadgets.rpctx.wpm:typeof window.postMessage==="object"?gadgets.rpctx.wpm:window.ActiveXObject?gadgets.rpctx.nix:navigator.userAgent.indexOf("WebKit")>0?gadgets.rpctx.rmr:navigator.product==="Gecko"?gadgets.rpctx.frameElement:gadgets.rpctx.ifpc}function A(L,J){var H=B;if(!J){H=E}l[L]=H;var G=u[L]||[];for(var I=0;I<G.length;++I){var K=G[I];K.t=gadgets.rpc.getAuthToken(L);H.call(L,K.f,K)}u[L]=[]}function t(H){if(H&&typeof H.s==="string"&&typeof H.f==="string"&&H.a instanceof Array){if(k[H.f]){if(k[H.f]!==H.t){throw new Error("Invalid auth token. "+k[H.f]+" vs "+H.t)}}if(H.s===h){window.setTimeout(function(){A(H.f,true)},0);return}if(H.c){H.callback=function(I){gadgets.rpc.call(H.f,s,null,H.c,I)}}var G=(c[H.s]||c[p]).apply(H,H.a);if(H.c&&typeof G!=="undefined"){gadgets.rpc.call(H.f,s,null,H.c,G)}}}function C(I){if(!I){return""}I=I.toLowerCase();if(I.indexOf("//")==0){I=window.location.protocol+":"+I}if(I.indexOf("http://")!=0&&I.indexOf("https://")!=0){I=window.location.protocol+"://"+I}var J=I.substring(I.indexOf("://")+3);var G=J.indexOf("/");if(G!=-1){J=J.substring(0,G)}var L=I.substring(0,I.indexOf("://"));var K="";var M=J.indexOf(":");if(M!=-1){var H=J.substring(M+1);J=J.substring(0,M);if((L==="http"&&H!=="80")||(L==="https"&&H!=="443")){K=":"+H}}return L+"://"+J+K}var B=a();c[p]=function(){gadgets.warn("Unknown RPC service: "+this.s)};c[s]=function(H,G){var I=F[H];if(I){delete F[H];I(G)}};function n(I,G){if(v[I]===true){return}if(typeof v[I]==="undefined"){v[I]=0}var H=document.getElementById(I);if(I===".."||H!=null){if(B.setup(I,G)===true){v[I]=true;return}}if(v[I]!==true&&v[I]++<j){window.setTimeout(function(){n(I,G)},o)}else{B=E;v[I]=true}}function f(H,K){if(typeof e[H]==="undefined"){e[H]=false;var J=gadgets.rpc.getRelayUrl(H);if(C(J)!==C(window.location.href)){return false}var I=null;if(H===".."){I=parent}else{I=frames[H]}try{e[H]=I.gadgets.rpc.receiveSameDomain}catch(G){gadgets.error("Same domain call failed: parent= incorrectly set.")}}if(typeof e[H]==="function"){e[H](K);return true}return false}if(x&&gadgets.config){function z(H){var J=H?H.rpc:{};var G=J.parentRelayUrl;if(G.substring(0,7)!=="http://"&&G.substring(0,8)!=="https://"&&G.substring(0,2)!=="//"){if(D.parent!==""){G=C(D.parent)+G}}d[".."]=G;var I=!!J.useLegacyProtocol;w[".."]=I;if(I){B=gadgets.rpctx.Ifpc;B.init(t,A)}if(B.setup("..")===false){B=E}}var q={parentRelayUrl:gadgets.config.NonEmptyStringValidator};gadgets.config.register("rpc",q,z)}return{register:function(H,G){if(H===s||H===h){throw new Error("Cannot overwrite callback/ack service")}if(H===p){throw new Error("Cannot overwrite default service: use registerDefault")}c[H]=G},unregister:function(G){if(G===s||G===h){throw new Error("Cannot delete callback/ack service")}if(G===p){throw new Error("Cannot delete default service: use unregisterDefault")}delete c[G]},registerDefault:function(G){c[p]=G},unregisterDefault:function(){delete c[p]},forceParentVerifiable:function(){if(!B.isParentVerifiable()){B=gadgets.rpctx.Ifpc}},call:function(G,H,M,K){G=G||"..";var L="..";if(G===".."){L=window.name}++m;if(M){F[m]=M}var J={s:H,f:L,c:M?m:0,a:Array.prototype.slice.call(arguments,3),t:k[G],l:w[G]};if(f(G,J)){return}var I=y?l[G]:B;if(!I){if(!u[G]){u[G]=[J]}else{u[G].push(J)}return}if(w[G]){I=gadgets.rpctx.Ifpc}if(I.call(G,L,J)===false){B=E;B.call(G,L,J)}},getRelayUrl:function(H){var G=d[H];if(G&&G.indexOf("//")==0){G=document.location.protocol+G}return G},setRelayUrl:function(H,G,I){d[H]=G;w[H]=!!I},setAuthToken:function(G,H){H=H||"";k[G]=String(H);n(G,H)},getAuthToken:function(G){return k[G]},getRelayChannel:function(){return B.getCode()},receive:function(G){if(G.length>4){t(gadgets.json.parse(decodeURIComponent(G[G.length-1])))}},receiveSameDomain:function(G){G.a=Array.prototype.slice.call(G.a);window.setTimeout(function(){t(G)},0)},getOrigin:C,init:function(){if(B.init(t,A)===false){B=E}},ACK:h}}();gadgets.rpc.init();var GadgetContainer=Class.create();GadgetContainer.prototype={maxHeight:4096,isCanvas:false,setCanvas:function(a){this.isCanvas=a},initialize:function(){gadgets.rpc.register("resize_iframe",this.setHeight);gadgets.rpc.register("set_pref",this.setUserPref);gadgets.rpc.register("set_title",this.setTitle);gadgets.rpc.register("requestNavigateTo",this.requestNavigateTo)},setHeight:function(a){if($(this.f)!=undefined){if(a>gadgets.container.maxHeight){a=gadgets.container.maxHeight}Element.setStyle($(this.f),{height:a+"px"})}},_parseIframeUrl:function(d){var c=new Object();var a=d.replace(/#.*$/,"").split("&");var e=key=val="";for(i=0;i<a.length;i++){e=a[i];key=e.substr(0,e.indexOf("="));val=e.substr(e.indexOf("=")+1);c[key]=val}return c},setUserPref:function(e,a,c){if($(this.f)!=undefined){var d=gadgets.container._parseIframeUrl($(this.f).src);new Ajax.Request("/applications/settings/json/set",{method:"post",parameters:{"settings[name]":a,"settings[value]":c,"settings[st]":decodeURIComponent(d.st),"settings[isCanvas]":gadgets.container.isCanvas,csrf:window.csrf}})}},setTitle:function(c){var a=$(this.f+"_title");if(a!=undefined){a.update(c.replace(/&/g,"&amp;").replace(/</g,"&lt;"))}},_getUrlForView:function(a,c,e,d){switch(a){case"profile":return"/people/"+c+"/applications";case"canvas":return"/people/"+c+"/applications/"+e;default:return null}},requestNavigateTo:function(a,e){if($(this.f)!=undefined){var f=gadgets.container._parseIframeUrl($(this.f).src);var c=gadgets.container._getUrlForView(a,f.owner,f.aid,f.mid);if(e){var d=Object.toJSON(e);if(d.length>0){c+="?appParams="+encodeURIComponent(d)}}if(c&&window.location.href.indexOf(c)==-1){window.location.href=c}}}};gadgets.container=new GadgetContainer();
