Element.addMethods({appendText:function(A,B){B=document.createTextNode(B);A.appendChild(B);return $(A)},appendChildren:function(B){for(var A=1;A<arguments.length;A++){B.appendChild(arguments[A])}return $(B)}});function enlarge(B,A){attr=$(B);tr=attr.src;$("large_image2").src=tr}function clearOnce(A){if(A.cleared){return }A.value="";A.cleared=true}function SID(){var B=document.cookie;var A=B.match("PHPSESSID=(.*?)(;|$)");if(A!=null&&A!=""){return A[1]}else{return false}}var Map=Class.create({initialize:function(A){A=A||{};this.domToggleLink=$("quickFilter").down(".hidemap");this.domMapContainer=$("flashcontent");this.domTopCorners=$("topcorners");try{if(!this.isHidden()){this.domToggleLink.update("Hide Map")}this.domToggleLink.observe("click",this.toggle.bind(this))}catch(B){}if(A.show!=false){this.show()}else{this.hide()}},isHidden:function(){try{if(this.domTopCorners.getStyle("display")=="block"){return true}}catch(A){return false}return false},show:function(){try{this.domMapContainer.style.border="";this.domMapContainer.style.height="";this.domMapContainer.style.display="block";this.domTopCorners.hide();this.domToggleLink.update("Hide Map")}catch(A){}},hide:function(){try{this.domMapContainer.style.border="none";this.domMapContainer.style.height="0";this.domMapContainer.style.display="none";this.domTopCorners.show();this.domToggleLink.update("Show Map")}catch(A){}},toggle:function(){try{if(!this.isHidden()){this.hide()}else{this.show()}}catch(A){}}});var LoginMenu=Class.create({initialize:function(){this.domContainer=$("topMenu");this.domLoginLink=this.domContainer.down("a[nav=login]");this.domSlidingDiv=this.domContainer.down(".center_bg");this.domForm=this.domSlidingDiv.down("form");this.domLoginLink.onfocus=function(){this.blur()};this.domLoginLink.observe("click",this.loginClick.bindAsEventListener(this));this.bodyClickBound=this.bodyClick.bindAsEventListener(this);this.visible=false},loginClick:function(A){if(this.visible){this.hide()}else{this.show()}A.stop()},show:function(){if(this.effect){this.effect.cancel()}this.effect=new Effect.Morph(this.domSlidingDiv,{style:"height: "+(this.domForm.getHeight()+14)+"px",duration:0.8});$(document.body).observe("click",this.bodyClickBound);this.visible=true},hide:function(){if(this.effect){this.effect.cancel()}this.effect=new Effect.Morph(this.domSlidingDiv,{style:"height: 5px",duration:0.8});this.visible=false},bodyClick:function(A){if(A.element().descendantOf(this.domContainer)){return }this.hide()}});Ajax.Request.prototype.evalResponse=function(){if(!this.options.evalContext){this.options.evalContext=this}try{toEval=(this.transport.responseText||"").unfilterJSON();return function(){eval(toEval)}.bind(this.options.evalContext)()}catch(e){this.dispatchException(e)}};var AjaxObject=Class.create({showLoading:function(){},hideLoading:function(){},ajaxFailed:function(A){if(A.status==401){new Ajax.Request("/users/register",{method:"get",onSuccess:this.showRegistration.bind(this),onFailure:this.ajaxFailed.bind(this)})}else{this.hideLoading();alert("Sorry. request failed.")}},showRegistration:function(A){this.hideLoading();new PopupDiv(A.responseText,null,null,"registration-ajax-form")}});var AlertVerification=Class.create(AjaxObject,{initialize:function(A){this.domElement=$(A);this.domElement.select(".yes",".no").each(function(B){B.observe("click",this.buttonClick.bindAsEventListener(this))}.bind(this))},buttonClick:function(A){if(this.domElement.hasClassName("inactive_l")||this.domElement.hasClassName("inactive_v")){A.stop();return }this.showLoading();new Ajax.Request(A.element().href,{onSuccess:this.ajaxSuccess.bind(this),onFailure:this.ajaxFailed.bind(this)});A.stop()},ajaxSuccess:function(A){this.domElement.replace(A.responseText)}});var ToggleActive=Class.create(AjaxObject,{initialize:function(A){this.domContainer=$(A);this.domCheckbox=$(A).down("input[type=checkbox]");this.domLink=$(A).down("a");this.domLink.observe("click",this.linkClick.bindAsEventListener(this));this.domCheckbox.observe("click",this.sendRequest.bind(this))},linkClick:function(A){A.stop();this.domCheckbox.checked=!this.domCheckbox.checked;this.sendRequest()},sendRequest:function(){new Ajax.Request(this.domLink.href,{onSuccess:this.requestSuccessful.bind(this),onFailure:this.ajaxFailed.bind(this)})},requestSuccessful:function(A){new Notification("Alert updated")}});var EntitiesList=Class.create(AjaxObject,{initialize:function(B,E,D,A){this.firstPageUrl=E;this.currentPageUrl=D;this.domContainer=$(B);this.domPagers=this.domContainer.select(".pager");this.domList=this.domContainer.down(".p_list");this.domContainer.jsObject=this;if(this.domPagers.length){for(var C=0;C<this.domPagers.length;C++){this.initPager(this.domPagers[C])}}if(A){if(window.mapLoaded){$("MSMV").loadMapFeed(A)}else{window.xmlToLoad=A}}this.domContainer.observe("List:reload",this.reload.bind(this));this.domContainer.observe("List:showLoading",this.showLoading.bind(this));this.domContainer.observe("List:hideLoading",this.hideLoading.bind(this))},initPager:function(A){A.select(".pageNum > a").each(function(C){C.onfocus=function(){this.blur()};if(C.href=="javascript:void(0)"){return }C.observe("click",this.pageClick.bindAsEventListener(this))}.bind(this));var B;if(B=A.down("select[name=page_size]")){B.onchange=this.loadPageForm.bind(this,B.form)}},showLoading:function(){if(this.domContainer.down("img.loading")){this.domContainer.down("img.loading").show()}},hideLoading:function(){if(this.domContainer.down("img.loading")){this.domContainer.down("img.loading").hide()}},loadPage:function(A){this.showLoading();new Ajax.Request(A,{onSuccess:this.onListLoad.bind(this),onFailure:this.ajaxFailed.bind(this)})},loadPageForm:function(A){this.showLoading();$(A).request({onSuccess:this.onListLoad.bind(this),onFailure:this.ajaxFailed.bind(this)})},pageClick:function(A){this.loadPage(A.element().href);A.stop()},reload:function(){this.loadPage(this.currentPageUrl)},reset:function(){this.loadPage(this.firstPageUrl)},onListLoad:function(A){this.domContainer.replace(A.responseText);this.hideLoading();$(document).fire("List:relocalize_time")}});function entityMenuChange(B,C,A){$("mainMenu").select("li").each(function(D){D.removeClassName("current")});AList.setUrl(C);AList.setParam("alert_id",A);AList.resetPage();AList.reload();if(B.parentNode){B.parentNode.addClassName("current")}}var AlertList=Class.create(AjaxObject,{initialize:function(B,C,A,D){this.setUrl(C);this.domContainer=$(B);this.isLoadMap=A;this.params=D;this.domContainer.observe("List:reload",this.reload.bind(this));this.domContainer.observe("List:showLoading",this.showLoading.bind(this));this.domContainer.observe("List:hideLoading",this.hideLoading.bind(this))},loadMap:function(){BingMapsObj=new BingMaps("flashmap2",this.getUrl());BingMapsObj.init()},resetPage:function(){this.params.page="1"},setParam:function(A,B){this.params[A]=B},getParams:function(){return this.params},showLoading:function(){if(this.domContainer.down("img.loading")){this.domContainer.down("img.loading").show()}},hideLoading:function(){if(this.domContainer.down("img.loading")){this.domContainer.down("img.loading").hide()}},loadPage:function(A){this.showLoading();if(this.isLoadMap){BingMapsObj.url=this.getUrl();BingMapsObj.loadXML()}new Ajax.Request(A,{parameters:this.params,onSuccess:this.onListLoad.bind(this),onFailure:this.ajaxFailed.bind(this)})},loadPageAlternative:function(B,A){if(B.className.indexOf("end")!=-1){return false}if(A>0){if((this.params.max_page>1)&&(this.params.page<this.params.max_page)){this.params.page++}else{return false}}else{if(this.params.page>1){this.params.page--}else{return false}}this.reload()},loadPageForm:function(A){this.showLoading();$(A).request({onSuccess:this.onListLoad.bind(this),onFailure:this.ajaxFailed.bind(this)})},pageClick:function(A){this.loadPage(this.currentPageUrl);A.stop()},reload:function(){this.loadPage(this.currentPageUrl)},reset:function(){this.loadPage(this.firstPageUrl)},onListLoad:function(A){if(A.responseText){var B=A.responseText.indexOf("(extra):");if(B==-1){this.domContainer.update(A.responseText)}else{this.domContainer.update(A.responseText.substring(0,B-1));if($("categories_cloud")){$("categories_cloud").update(A.responseText.substring(B+8))}}}this.hideLoading();$(document).fire("List:relocalize_time")},getUrl:function(){currentPageXmlUrl="/iweb/hazards_xml.jsp";return currentPageXmlUrl},setUrl:function(A){this.currentPageUrl=A}});var AlertItem=Class.create(AjaxObject,{initialize:function(A){this.domContainer=$(A);this.domWatchlistLink=this.domContainer.down(".actions a[class*=wl_]");if(this.domWatchlistLink){this.domWatchlistLink.observe("click",this.onWatchlistClick.bindAsEventListener(this))}},onWatchlistClick:function(A){A.stop();this.showLoading();new Ajax.Request(A.element().href,{onSuccess:this.onReload.bind(this),onFailure:this.ajaxFailed.bind(this)})},onReload:function(A){this.hideLoading();this.domContainer.replace(A.responseText)},showLoading:function(){this.domContainer.fire("List:showLoading")},hideLoading:function(){this.domContainer.fire("List:hideLoading")}});var UserList=Class.create(EntitiesList,{initialize:function($super,B,E,D,A){$super(B,E,D,A);var C=this.itemMouseOver.bindAsEventListener(this);var F=this.itemMouseOut.bindAsEventListener(this);this.domList.select("li.photo4").each(function(G){G.observe("mouseover",C);G.observe("mouseout",F)}.bind(this))},itemMouseOver:function(A){e=A.findElement("li");e.down(".user_info").show()},itemMouseOut:function(A){e=A.findElement("li");e.down(".user_info").hide()}});var CommentList=Class.create(EntitiesList,{initialize:function($super,A,C,B){$super(A,C,B);this.domList=this.domContainer.down(".comments");this.domAddLink=this.domContainer.down(".a_add");if(this.domAddLink){this.domAddLink.observe("click",this.showAddDialog.bindAsEventListener(this))}this.domList.select(".user_info .actions a.remove").each((function(D){D.observe("click",this.onDeleteClick.bindAsEventListener(this))}).bind(this))},onDeleteClick:function(A){A.stop();this.showLoading();new Ajax.Request(A.element().href,{method:"get",onSuccess:this.onDeleteSuccess.bind(this),onFailure:this.ajaxFailed.bind(this)})},onDeleteSuccess:function(A){this.hideLoading();this.reload()},showAddDialog:function(A){this.showLoading();new Ajax.Request(A.element().href,{method:"get",onSuccess:this.addDialogReady.bind(this),onFailure:this.ajaxFailed.bind(this)});A.stop()},addDialogReady:function(A){this.addDialogPopup=new PopupDiv(A.responseText);this.addDialogPopup.toElement().observe("FormDialog:success",this.newCommentPosted.bindAsEventListener(this));this.hideLoading()},newCommentPosted:function(A){this.reset()}});var PhotoList=Class.create(EntitiesList,{initialize:function($super,A,E,C,D){$super(A,E,C);this.domList=this.domContainer.down(".gallery");this.domAddLink=this.domContainer.down(".links2 .a_add");this.onReloadHook=D;if(this.domAddLink){this.domAddLink.observe("click",this.showAddDialog.bindAsEventListener(this))}var B;if(B=this.domPagers[0].down("select[name=sort]")){B.onchange=this.loadPageForm.bind(this,B.form)}},showAddDialog:function(A){this.showLoading();new Ajax.Request(A.element().href,{method:"get",onSuccess:this.addDialogReady.bind(this),onFailure:this.ajaxFailed.bind(this)});A.stop()},addDialogReady:function(A){this.addDialogPopup=new PopupDiv(A.responseText);this.addDialogPopup.toElement().observe("AddPhotoDialog:posted",this.newPhotosPosted.bindAsEventListener(this));this.hideLoading()},newPhotosPosted:function(A){if(this.onReloadHook){this.onReloadHook()}this.reset()},reload:function($super,A){if(this.onReloadHook){this.onReloadHook()}$super(A)},showDetails:function(A){this.domCurrentItem=A;this.showLoading();new Ajax.Request(A.href,{method:"get",onSuccess:this.detailsDialogReady.bind(this),onFailure:this.ajaxFailed.bind(this)})},detailsDialogReady:function(A){this.detailsPopup=new PopupDiv(A.responseText);this.hideLoading()}});var PhotoThumb=Class.create(AjaxObject,{initialize:function(B,C,A){this.domContainer=$(B);this.domLink=$(this.domContainer.id+"-a");this.domLink2=$(this.domContainer.id+"-a2");this.domEditLink=this.domContainer.down(".p_edit");this.domDeleteLink=this.domContainer.down(".p_remove");this.width=C;this.height=A;this.domContainer.jsObject=this;if(this.domLink){this.domLink.onfocus=function(){this.blur()}}this.domContainer.observe("mouseover",this.onMouseOver.bindAsEventListener(this));this.domContainer.observe("mouseout",this.onMouseOut.bindAsEventListener(this));if(this.domLink){this.domLink.observe("click",this.onClick.bindAsEventListener(this))}if(this.domLink2){this.domLink2.observe("click",this.onClick.bindAsEventListener(this))}if(this.domEditLink){this.domEditLink.observe("click",this.onEditClick.bindAsEventListener(this))}if(this.domDeleteLink){this.domDeleteLink.observe("click",this.onDeleteClick.bindAsEventListener(this))}},showLoading:function(){try{this.domContainer.up(".list_wrapper").down("img.loading").show()}catch(A){}},hideLoading:function(){try{this.domContainer.up(".list_wrapper").down("img.loading").hide()}catch(A){}},onMouseOver:function(A){this.domContainer.addClassName("p_hover")},onMouseOut:function(A){this.domContainer.removeClassName("p_hover")},onClick:function(B){B.stop();var A=B.findElement("a");if(A==document){return }if(A.href=="javascript:void(0)"){return }this.showLoading();new Ajax.Request(A.href,{onSuccess:this.popupLoaded.bind(this),onFailure:this.ajaxFailed.bind(this)})},popupLoaded:function(A){this.detailsPopup=new PopupDiv(A.responseText,this.width,this.height,"photo_thumb_popup");var B=this.detailsPopup.domContainer.down(".pageNum .prev");var C=this.detailsPopup.domContainer.down(".pageNum .next");if(B){B.observe("click",this.onClick.bindAsEventListener(this))}if(C){C.observe("click",this.onClick.bindAsEventListener(this))}this.hideLoading()},onEditClick:function(A){A.stop();domLink=A.findElement("a");this.showLoading();new Ajax.Request(domLink.href,{method:"get",onSuccess:this.editPopupLoaded.bind(this),onFailure:this.ajaxFailed.bind(this)})},editPopupLoaded:function(A){this.editPopup=new PopupDiv(A.responseText);this.hideLoading()},onDeleteClick:function(A){A.stop();domLink=A.findElement("a");msg=domLink.readAttribute("confirm_message");if(msg&&msg!=""){if(!confirm(msg)){return }}new Ajax.Request(domLink.href,{method:"post",onSuccess:this.deleteSuccess.bind(this),onFailure:this.ajaxFailed.bind(this)})},deleteSuccess:function(A){var B;if(this.domContainer.id.indexOf("news")!=-1){B="news"}if(this.domContainer.id.indexOf("photo")!=-1){B="images"}if(this.domContainer.id.indexOf("video")!=-1){B="videos"}if(B){el=$("entity-menu-item-"+B).down("b").down("small").down("span");if(el){el.update(parseInt(el.innerHTML)-1)}}this.domContainer.fire("List:reload")}});var RegisterForm=Class.create({initialize:function(E,F,H,J,I,B,D,A,G,C){this.folder_name="180x180-fit";this.uploadUrl=E;this.domImageIdInput=$(F);this.domImage=$(H);this.domProgressBar=$(J);this.domUploadLink=$(I);this.domActions=this.domImage.next(".actions");this.ImagePath=D;this.width=A;this.height=G;this.map_render=C;this.isRenderedMap=false;this.domImageHolder=this.domImage.down("span");if((this.domIAgree=$("i_agree"))&&(this.domIAgree.up("form"))){this.domIAgree.up("form").observe("submit",this.on_submit.bind(this))}this.domUploadLink.hide();this.domProgressBar.hide();this.show_hide();this.initUploader.bind(this).delay(0)},show_hide_notifications:function(){if(this.domRecieveMessages.checked){this.domNotificationsSelector.setStyle({display:"block"});if(!this.notification_showed){if(this.map_render&&!this.isRenderedMap){renderUserMap();this.isRenderedMap=true}this.notification_showed=true}}else{this.domNotificationsSelector.setStyle({display:"none"})}},on_submit:function(A){if(!this.domIAgree.checked){alert("Please confirm you have read and agree with terms of use and privacy policy.");Event.stop(A)}},show_hide:function(){if(this.domImageHolder.style.backgroundImage){this.domImage.show()}else{this.domImage.hide();this.domActions.addClassName("no-margin-top")}},initUploader:function(){uploadUrl=this.uploadUrl;if(this.uploadUrl.match(/\?/)){uploadUrl+="&"}else{uploadUrl+="?"}uploadUrl+="swfupload_sid="+SID();if(getFlashVersion()!="0,0,0"){this.swfu=new SWFUpload({button_window_mode:"transparent",upload_url:uploadUrl,flash_url:"/js/dui/swfupload/swfupload.swf",post_params:{folder:this.folder_name,type:"user"},file_size_limit:"200",file_types_description:"Image Files",file_types:"*.jpg;*.gif;*.png",button_placeholder_id:this.domUploadLink.id,button_image_url:this.ImagePath,button_width:89,button_height:22,swfupload_loaded_handler:this.onFlashLoaded.bind(this),file_queued_handler:this.onFileQueued.bind(this),upload_progress_handler:this.uploadProgress.bind(this),upload_success_handler:this.uploadSuccess.bind(this)})}else{$("upload_photo_disable").setStyle({display:"block"})}},onFlashLoaded:function(){this.domUploadLink.show()},browse:function(){this.swfu.cancelUpload();this.swfu.selectFile()},onFileQueued:function(A){this.domUploadLink.hide();this.domProgressBar.down().style.width="0";this.domProgressBar.show();this.swfu.startUpload()},uploadProgress:function(B,A,C){this.domProgressBar.down().style.width=(100*A/C)+"%"},uploadSuccess:function(C,B){var A=B.evalJSON();this.domProgressBar.hide();this.domUploadLink.show();if(A.success==true){this.domImageIdInput.value=A.id;this.domImage.down().style.backgroundImage="url('/utils/phpThumb?src=/resampled/#{size}/uploads/#{filename}&w=#{width}&h=#{height}')".interpolate({width:this.width,height:this.height,size:this.folder_name,filename:A.filename});this.show_hide()}},remove:function(){this.domImageIdInput.value="";this.domImage.down().style.backgroundImage="";this.show_hide()}});var EditAlertForm=Class.create(AjaxObject,{initialize:function(B,A){this.ajaxUrl=B;this.isNewRecord=A;this.domForm=$("edit_alert_form");this.domCategorySelect=$("alert_category_id");if($F(this.domCategorySelect)){resetCategory("categity_"+$F(this.domCategorySelect),false)}},updateCategoryIcon:function(){iconPath=categoryIcons[$F(this.domCategorySelect)];if(iconPath){$("alert_category_icon").src=iconPath}else{$("alert_category_icon").src="/img/e.gif"}},categoryChanged:function(){this.showLoading();new Ajax.Request(this.ajaxUrl,{parameters:$H({category_id:$F(this.domCategorySelect)}),onSuccess:this.contentLoaded.bind(this),onFailure:this.ajaxFailed.bind(this)})},contentLoaded:function(B){first_row=this.domForm.down("[sc=start]").up();last_row=this.domForm.down("[sc=end]").up();to_delete=[];row=first_row.next();while(1){to_delete.push(row);if(row==last_row){break}row=row.next()}for(var A=0;A<to_delete.length;A++){to_delete[A].remove()}first_row.replace(B.responseText);this.hideLoading()}});var PopupDiv=Class.create({initialize:function(D,C,A,B){if(B&&$(B)){previousClosed=true;$(B).fire("Window:close")}else{previousClosed=false}document.getElementById("layer_test").style.height=document.body.parentNode.scrollHeight+"px";document.getElementById("layer_test").style.display="block";new Effect.Opacity("layer_test",{from:0,to:0.2,duration:0});domContainerId="popup1";this.domContainer=new Element("div",{id:domContainerId}).appendChildren(this.domCloseLink=new Element("a",{href:"javascript:void(0)"}).appendText("Close Window"),this.domLoading=new Element("img",{src:"/images/loading2.gif",style:"display: none;"}),this.domContent=new Element("div"));this.domContainer.addClassName("popup1");this.domCloseLink.addClassName("close");this.domLoading.addClassName("loading");this.domContent.update(D);this.domCloseLink.observe("click",this.close.bind(this));$("layer_test").observe("click",this.close.bind(this));this.domContainer.observe("Window:close",this.close.bind(this));this.domContainer.observe("Window:center",this.center.bindAsEventListener(this));this.domContainer.observe("Window:showLoading",this.showLoading.bind(this));this.domContainer.observe("Window:hideLoading",this.hideLoading.bind(this));this.domContainer.observe("Window:loaded",this.center.bindAsEventListener(this));this.domContainer.style.width=(C||"auto");this.domContainer.style.height=(A||"auto");this.domContainer.style.display="none";document.body.appendChild(this.domContainer);this.center();if(previousClosed){this.domContainer.show()}else{new Effect.Appear(this.domContainer,{duration:0.2})}},showContent:function(B,A,C){alert(A)},setContent:function(A){this.domContent.update(A);this.center()},center:function(F){var A=false;if(F&&F.eventName){if(F.memo==true){A=true}}else{A=F}var D=document.viewport.getDimensions();var H=this.domContainer.getDimensions();var J=[(D.width-H.width)/2,(D.height-H.height)/2];var I=this.domContainer.viewportOffset();var B=this.domContainer.cumulativeOffset();var G=[J[0]-I[0]+B[0],J[1]-I[1]+B[1]];var E=G[0]+"px";var C=G[1]+"px";if(A){new Effect.Morph(this.domContainer,{style:{left:E,top:C},duration:0.5})}else{this.domContainer.style.left=E;this.domContainer.style.top=C}},toElement:function(){return this.domContainer},close:function(){this.domContainer.id=null;this.remove();new Effect.Opacity("layer_test",{from:0.2,to:0,duration:0});document.getElementById("layer_test").style.display="none"},remove:function(){this.domContainer.remove()},showLoading:function(){this.domLoading.show()},hideLoading:function(){this.domLoading.hide()}});var AddPhotoDialog=Class.create(AjaxObject,{initialize:function(C,A,B){this.uploadUrl=C;this.domContainer=$(A);this.domList=this.domContainer.down(".uploads_list");this.initUploader.bind(this).delay(0);this.ImagePath=B;this.domUploadButton=this.domContainer.down("#upload_photos");this.domPostButton=this.domContainer.down("[action=post]");this.domPostButton.observe("click",this.postSelected.bindAsEventListener(this))},showLoading:function(){this.domContainer.fire("Window:showLoading")},hideLoading:function(){this.domContainer.fire("Window:hideLoading")},initUploader:function(){uploadUrl=this.uploadUrl;if(this.uploadUrl.match(/\?/)){uploadUrl+="&"}else{uploadUrl+="?"}uploadUrl+="swfupload_sid="+SID();if(getFlashVersion()!="0,0,0"){this.swfu=new SWFUpload({upload_url:uploadUrl,flash_url:"/js/dui/swfupload/swfupload.swf",file_size_limit:"3000",file_types:"*.jpg;*.gif;*.png",button_placeholder_id:this.domUploadButton.id,button_image_url:this.ImagePath,button_width:126,button_height:22,swfupload_loaded_handler:this.onFlashLoaded.bind(this),file_queued_handler:this.onFileQueued.bind(this),upload_progress_handler:this.uploadProgress.bind(this),upload_success_handler:this.uploadSuccess.bind(this),upload_complete_handler:this.uploadComplete.bind(this),file_dialog_complete_handler:this.fileDialogComplete.bind(this)})}},onFlashLoaded:function(){this.domUploadButton.disabled=false},browse:function(A){this.swfu.selectFiles();A.stop()},onFileQueued:function(A){var B=new Element("div",{"class":"uploadBlock",file_id:A.id}).appendChildren(new Element("div",{"class":"p_progress"}).appendChildren(new Element("div").appendChildren(new Element("span").appendText(A.name))));if(this.domList.down(".uploadBlock")){this.domList.insert({top:'<p class="pl">&nbsp;</p>'})}this.domList.insert({top:B})},uploadProgress:function(B,A,C){this.domList.down("[file_id="+B.id+"]").down(".p_progress div").style.width=(100*A/C)+"%"},uploadSuccess:function(B,A){this.domList.down("[file_id="+B.id+"]").replace(A)},uploadComplete:function(A){this.swfu.startUpload();stats=this.swfu.getStats();if(stats.files_queued==0){this.done()}},fileDialogComplete:function(A,B){if(A==0){return }this.domPostButton.disabled=true;this.domUploadButton.disabled=true;this.showLoading();this.swfu.startUpload()},done:function(){this.domUploadButton.disabled=false;this.domPostButton.disabled=false;this.hideLoading()},postSelected:function(A){if(this.domContainer.up(".popup")){A.stop();this.showLoading();this.domContainer.down("form").request({method:"post",onSuccess:this.postSelectedSuccess.bind(this),onFailure:this.ajaxFailed.bind(this)});return }},postSelectedSuccess:function(A){this.domContainer.fire("AddPhotoDialog:posted");this.domContainer.fire("Window:close");this.hideLoading()}});var BaseFormDialog=Class.create(AjaxObject,{initialize:function(A){this.domContainer=$(A);if(this.domContainer.down("form input[type=submit]")){this.domContainer.down("form input[type=submit]").observe("click",this.onSubmitClick.bindAsEventListener(this))}if(!this.domContainer.up(".popup")){return }},showLoading:function(){this.domContainer.fire("Window:showLoading")},hideLoading:function(){this.domContainer.fire("Window:hideLoading")},onSubmitClick:function(A){A.stop();this.domContainer.down("form").request({method:"post",onSuccess:this.submitSuccess.bind(this),onFailure:this.ajaxFailed.bind(this)})},submitSuccess:function(A){this.hideLoading();if(A.responseJSON){this.domContainer.fire("FormDialog:success");this.domContainer.fire("Window:close");if(AList){AList.resetPage();AList.reload()}}else{this.domContainer.replace(A.responseText);this.domContainer.fire("Window:center")}}});var EditPhotoDialog=Class.create(BaseFormDialog,{});var AddCommentDialog=Class.create(BaseFormDialog,{});var Notification=Class.create({timeout:2,initialize:function(B,A){this.initContainer();this.initList();this.domNotification=new Element("li",{"class":(A||"")}).appendText(B);this.domList.insert({bottom:this.domNotification});setTimeout(this.onTimeout.bind(this),this.timeout*1000)},initContainer:function(){this.domContainer=$("notifications_container");if(this.domContainer){return }this.domContainer=new Element("div",{id:"notifications_container"});$(document.body).insert({bottom:this.domContainer});$(document.body).observe("mousemove",this.onMouseMove.bindAsEventListener(this))},initList:function(){this.domList=this.domContainer.down("ul");if(this.domList){return }this.domList=new Element("ul");this.domContainer.insert({bottom:this.domList})},onMouseMove:function(A){this.domContainer.style.left=A.pointerX()+"px";this.domContainer.style.top=A.pointerY()+"px"},onTimeout:function(){this.domNotification.remove();if(!this.domList.down("li")){this.domList.remove()}}});var VideoList=Class.create(PhotoList,{addDialogReady:function($super,A){$super(A);this.addDialogPopup.toElement().observe("FormDialog:success",this.newPhotosPosted.bindAsEventListener(this))}});var VideoThumb=Class.create(PhotoThumb,{initialize:function($super,B,C,A){$super(B,C,A)}});var NewsThumb=Class.create(PhotoThumb,{});var AddVideoDialog=Class.create(BaseFormDialog,{});var AddNewsDialog=Class.create(BaseFormDialog,{});var UpdateList=Class.create(CommentList,{});var AddUpdateDialog=Class.create(BaseFormDialog,{});var NewlinksList=Class.create(AjaxObject,{initialize:function(A,B){this.domContainer=$(A);this.listUrl=B;this.domAddLink=this.domContainer.down(".links2 .add");this.domAddLink.observe("click",this.showAddDialog.bindAsEventListener(this));this.addHandlers()},addHandlers:function(){this.domContainer.select("li .actions .remove").each(function(A){A.observe("click",this.deleteClick.bindAsEventListener(this))}.bind(this))},reloadList:function(){new Ajax.Request(this.listUrl,{method:"get",onSuccess:this.onlistLoad.bind(this),onFailure:this.ajaxFailed.bind(this)})},onlistLoad:function(A){this.domContainer.down("ul.news").update(A.responseText);this.addHandlers()},showAddDialog:function(A){this.showLoading();new Ajax.Request(A.element().href,{method:"get",onSuccess:this.addDialogReady.bind(this),onFailure:this.ajaxFailed.bind(this)});A.stop()},addDialogReady:function(A){this.addDialogPopup=new PopupDiv(A.responseText);this.addDialogPopup.toElement().observe("FormDialog:success",this.reloadList.bind(this));this.hideLoading()},deleteClick:function(A){A.stop();new Ajax.Request(A.element().href,{method:"get",onSuccess:this.reloadList.bind(this),onFailure:this.ajaxFailed.bind(this)})}});var UploadBlock=Class.create(AjaxObject,{initialize:function(A){this.domContainer=$(A);this.domToggleLink=this.domContainer.down(".p_toggle");this.domToggleLink.observe("click",this.toggle.bind(this))},expand:function(){this.domContainer.adjacent(".ub_expanded").each(function(A){A.removeClassName("ub_expanded")});this.domContainer.addClassName("ub_expanded");this.domContainer.up().scrollTop=this.domContainer.positionedOffset()[1]},collapse:function(){this.domContainer.removeClassName("ub_expanded")},toggle:function(){if(this.domContainer.hasClassName("ub_expanded")){this.collapse()}else{this.expand()}}});function go_to(A){location.href=A;return false}function create_reload_for_alert(B,A){if(!$(B)){return null}return function(){new Ajax.Request(A)}}var video_types_by_value={other:{holder_class:"",code_url_text:"Code:",code_url_desc:"Paste embed code here"},youtube:{holder_class:"invisible-field",code_url_text:"Code or url:",code_url_desc:"Paste code or url from youtube.com here"}};function embedded_video_type_change(A){var C=A.up("table");var B=C.down(".embedded-video-code-or-url");C.rows[C.rows.length-2].className=video_types_by_value[A.value].holder_class;B.next(".field_decription").update(video_types_by_value[A.value].code_url_desc);B.up("tr").down("label").update(video_types_by_value[A.value].code_url_text)}function video_type_change(A){if(A.value=="other"){document.getElementById("videos_thumb").style.display="block"}else{document.getElementById("videos_thumb").style.display="none"}}function mapIsLoaded(){window.mapLoaded=true}function show_hide_us(B,A){try{if($(B).value!=61){($(A)||$("states_selector")).hide()}else{($(A)||$("states_selector")).show()}}catch(C){}}var obs=function(){$$(".local_time").each(function(A){try{A.writeAttribute("unconverted",A.innerHTML);A.update((new Date(A.innerHTML)).toLocaleString())}catch(A){}})};document.observe("dom:loaded",obs);document.observe("List:relocalize_time",obs);function defaulter(A){var D={};for(var C=0;C<arguments.length;++C){var B=$(arguments[C]);D[B.id]=B.value;B.observe("focus",function(){if(this.value==D[this.id]){this.value=""}});B.observe("blur",function(){if(this.value.length==0){this.value=D[this.id]}})}}function disable_text(D,C){if(D){D=$(D)}for(var B in C){var A=$(B);C[B]={handler:C[B],value:A.value};A.observe("focus",function(E){if(C[this.id].handler){C[this.id].handler(E)}Event.stop(E);D.focus()});A.observe("change",function(E){if(C[this.id].handler){C[this.id].handler(E)}this.value=C[this.id].value;Event.stop(E);D.focus()})}}var Locker=Class.create({initialize:function(B,C,A){if(B){this.elem=$(B);if(!this.elem.id){this.elem.id=this.unique_id()}}this.color=A||"#000";this.show_spinner=Object.isUndefined(C)?true:C;this.locker={}},lock:function(A,C){A=A?$(A)||this.elem:this.elem;if(Object.isUndefined(C)){C=this.show_spinner}if(!A.id){A.id=this.unique_id()}if(!A||this.locker[A.id]){return false}var E=new Element("div",{"class":"locker"});E.setOpacity(0.5);E.style.backgroundColor=this.color;document.body.appendChild(E);E.clonePosition(A);var D=null;if(C){D=new Element("img",{src:"/images/spinner.gif","class":"locker"});var B=E.cumulativeOffset();D.setStyle({top:(B[1]+parseInt(E.getHeight()/2-24))+"px",left:(B[0]+parseInt(E.getWidth()/2-24))+"px"});document.body.appendChild(D)}this.locker[A.id]={spinner:D,lock:E};return true},unique_id:function(){var A="dynamic_id_";do{A+=Math.random().toString().substring(2)}while($(A));return A},unlock:function(A){A=A?$(A)||this.elem:this.elem;if(!A||!this.locker[A.id]){return false}if(this.locker[A.id].spinner){this.locker[A.id].spinner.remove()}this.locker[A.id].lock.remove();delete this.locker[A.id];return true}});var MultiLock=Class.create({initialize:function(A){this.locker=new Locker(null,Object.isUndefined(A.show_spinner)?true:A.show_spinner,A.color||"#000");this.to_lock=$A(["div","input","select"]);if(A.elem){this.elem=$(A.elem);if(A.lock){this.lock()}}},lock:function(A){return this.pass_through_elms(A,"lock")},unlock:function(A){return this.pass_through_elms(A,"unlock")},pass_through_elms:function(D,C){if(!(D=$(D))&&!(D=this.elem)){return false}var B=$(D).getElementsByTagName("*");for(var A=0;A<B.length;++A){if(Object.isElement(B[A])&&this.to_lock.indexOf(B[A].nodeName.toLowerCase())!=-1){this.locker[C](B[A])}}return true}});var NamedInsertion=Class.create({initialize:function(){this.insertions={}},add:function(A,C,D,B){this.insertions[A]={element:$(C),content:D,predicate:B}},insert_for:function(A){if(!(A in this.insertions)){return }this.insertions[A].element.insert({bottom:this.insertions[A].predicate?this.insertions[A].predicate(this.insertions[A].content):this.insertions[A].content})}});function degree_to_km(A){if((Math.round(((6378137*Math.PI*A)/180)/1000))<500){return(500)}else{return(Math.round(((6378137*Math.PI*A)/180)/1000))}}function radius_degree(A){return(A*180*1000)/(6378137*Math.PI)}function change_radius(){var A=this.value;if(change_radius.prev==A){return }change_radius.prev=A;if(!A.match(/^\d+(?:\.\d+)?$/)){$(this).addClassName("error-radius-input");return }$(this).removeClassName("error-radius-input");$("MAPIT").changeFlashRadius(radius_degree(parseFloat(A))*(miles()?1.609344:1))}function flashIsLoaded(){}function fade_page(){if($("layer_test")){$("layer_test").update("&nbsp;")}if($("layer_test2")){$("layer_test2").update("&nbsp;")}document.getElementById("page").style.opacity="0.9999";if(document.getElementById("page").style.filter){document.getElementById("page").style.filter="alpha(opacity=10000)"}if($("video_from_utube")){Effect.toggle("video_from_utube")}if($("video_snapshot")){Effect.toggle("video_snapshot")}}function hide_flash_object(){if($("video_from_utube")){Effect.toggle("video_from_utube")}if($("video_snapshot")){Effect.toggle("video_snapshot")}}function set_border(A,B){carousel_images=document.getElementsByClassName("img_all");for(i=0;i<carousel_images.length;i++){document.getElementById(carousel_images[i].id).style.border="0px solid red"}document.getElementById("img_bdr_"+A).style.border="1px solid red"}function border_on_hover(A,B){if(document.getElementById("img_bdr_"+A).activeElement){document.getElementById("img_bdr_"+A).style.border="1px solid red"}document.getElementById("img_bdr_"+A).style.border="0"}function remove_border(A,B){document.getElementById("img_bdr_"+A).style.border="0";if(document.getElementById("large_photo_id")){large_id=document.getElementById("large_photo_id").value;if(large_id==A){document.getElementById("img_bdr_"+A).style.border="1px solid red"}}}function show_email_form(A){if(A=="email_plus"){document.getElementById(A).style.display="none";document.getElementById("email_minus").style.display="block"}if(A=="email_minus"){document.getElementById(A).style.display="none";document.getElementById("email_plus").style.display="block"}}function show_minus(){document.getElementById("share_plus_minus").style.display="block";document.getElementById("share_minus_plus").style.display="none"}function show_plus(){document.getElementById("share_plus_minus").style.display="none";document.getElementById("share_minus_plus").style.display="block"}function watchlist_option(A){if(A=="watch_plus"){document.getElementById(A).style.display="none";document.getElementById("watch_minus").style.display="block"}if(A=="watch_minus"){document.getElementById(A).style.display="none";document.getElementById("watch_plus").style.display="block"}}function watchlist_lists_update(A){if(A.className=="button grey"){A.innerHTML="<b>Unsubscribe</b>";A.className="button grey_unsubscribe"}else{if(A.className=="button grey_unsubscribe"){A.innerHTML="<b>Subscribe</b>";A.className="button grey"}}}function watchlist_lists_update_alert(A){if(A.id=="alert_not_subscribed"){A.innerHTML="<b>Unsubscribe</b>";A.id="alert_subscribed"}else{if(A.id=="alert_subscribed"){A.innerHTML="<b>Subscribe</b>";A.id="alert_not_subscribed"}}}function text_options(A){if(A=="text_plus"){document.getElementById(A).style.display="none";document.getElementById("text_minus").style.display="block"}if(A=="text_minus"){document.getElementById(A).style.display="none";document.getElementById("text_plus").style.display="block"}Effect.toggle("text_size","blind")}function getFlashVersion(){try{try{var A=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");try{A.AllowScriptAccess="always"}catch(B){return"6,0,0"}}catch(B){}return new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(B){try{if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){return(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}}catch(B){}}return"0,0,0"}function changeContinent(B,A){$("filter_content").select("div.manage_row > a").each(function(C){C.removeClassName("current_manager")});new Ajax.Updater("managed_rows","/countries_list",{asynchronous:true,evalScripts:false,parameters:"continent="+B});A.addClassName("current_manager");if(B=="all"){B="All Countries"}$("filter_select_countries").update(B)}function changeFilterDate(A,C,D){var B=new Date();B.setDate(B.getDate()+1);setCookie("alerts_age",C,B.toUTCString());AList.setParam("age",C);AList.resetPage();AList.reload()}function changeOrder(A,B){AList.setParam("order",B);AList.resetPage();AList.reload()}function changeFilterCategory(A,B){AList.resetPage();AList.setParam("category_id",B);AList.reload();$("filter_select_category_value").update(A.innerHTML);closeFilterBlocks()}function changeFilterDateCustom(){var B=$("filter_date_field1").innerHTML;var A=$("filter_date_field2").innerHTML;if(B.match(/^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d/)&&A.match(/^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d/)){AList.setParam("age",B+","+A);AList.reload()}else{alert("Please choose date")}}function mainMenuChange(A,C){$("mainMenu").select("li").each(function(D){D.removeClassName("current")});var B=new Date();B.setDate(B.getDate()+1);setCookie("alerts_sort",C,B.toUTCString());AList.setParam("sort",C);AList.resetPage();AList.reload();A.parentNode.addClassName("current")}function pageSizeChange(A){AList.setParam("page_size",A);AList.resetPage();AList.reload()}function closeFilterBlocks(){$("manageFilterBlocks").select(".selectItem").each(function(A){A.removeClassName("filter_selector_current")});$("filter_block_countries").update("");$("filter_block_category").hide()}function manageFilterBlocks(A){closeFilterBlocks();A=A.parentNode;$("manageFilterBlocks").select(".selectItem").each(function(B){B.removeClassName("filter_selector_current")});A.addClassName("filter_selector_current");params=AList.getParams();if(A.id=="filter_select_countries"){params.filter_type="location";new Ajax.Updater("filter_block_countries","/filter",{asynchronous:true,evalScripts:true,parameters:params})}else{if(A.id=="filter_select_category"){if(!$("categories_filter_table")){params.filter_type="category";new Ajax.Updater("filter_block_category","/filter",{asynchronous:true,evalScripts:true,parameters:params})}$("filter_block_category").show()}}}function resetFilterCategories(A){$$("#categories_filter_table a[rel]").each(function(B){B.removeClassName("current");B.style.display="none"});$$("#categories_filter_table tr td:first-child a[rel]").each(function(B){B.style.display="block"});$("categories_breadcrumbs").update("");default_title="All Categories";if(A){AList.setParam("category_id","");$("filter_select_category_value").update(default_title)}else{$("alert_category_id").setValue("");$("filter_select_category_value").update(default_title);$("category_icon").setAttribute("src","/img/e.gif")}}function resetCategory(B,A){el=$(B);$(el.parentNode).nextSiblings().each(function(C){C.select("a").each(function(D){D.removeClassName("current");D.style.display="none"})});$(el.parentNode).select("a").each(function(C){C.removeClassName("current")});el.className="current";current_id=el.getAttribute("rev");current_title=el.getAttribute("title");if(A){AList.setParam("category_id",current_id);$("filter_select_category_value").update(current_title)}else{$("alert_category_id").setValue(current_id);new Ajax.Updater("cat_spl_char","/alerts/cat_spl_char",{asynchronous:true,evalScripts:true,parameters:"value="+encodeURIComponent(current_id)});if(el.firstDescendant()!==null&&el.firstDescendant().tagName=="IMG"){$("category_icon").setAttribute("src",el.firstDescendant().getAttribute("src"))}$("filter_select_category_value").update(current_title)}$$("#categories_filter_table a[rel="+current_id+"]").each(function(C){C.style.display="block"});$("categories_breadcrumbs").update(getCategoriesFilterBreadCrumbs(A))}function getCategoriesFilterBreadCrumbs(D){var B=[];var A="";$$("#categories_filter_table tr td").each(function(E){E.select("a").each(function(F){if(F.hasClassName("current")){B.push(F)}})});if(B.length){for(var C=0;C<B.length;C++){A+="<a href='javascript:void(0)' onClick=\"resetCategory('"+B[C].id+"', "+D+'); return false;">'+B[C].getAttribute("title")+"</a>";if(B[C].firstDescendant()!==null&&B[C].firstDescendant().tagName=="IMG"){A+="<img src='"+B[C].firstDescendant().getAttribute("src")+"'>"}if((C+1)!=B.length){A+="<strong>&raquo;</strong>"}}}return A}function contactFormChange(A){$("contact_descriptions").getElementsBySelector("p").each(function(B){B.hide()});if(A!=null&&A!=""){$("contact_descr-"+A).show()}}function flashSetCountry(A){$("countries_filter_continent_block").update('<strong>»</strong><a id="countries_filter_continent" href="'+A.replace(" ","_").toLowerCase()+'" class="current_manager">'+A+"</a>");$("countries_filter_country_block").update("")}function fireElement(B){var C=document.getElementById(B);if(document.dispatchEvent){var A=document.createEvent("MouseEvents");A.initMouseEvent("click",true,true,window,1,1,1,1,1,false,false,false,false,0,C);C.dispatchEvent(A)}else{if(document.fireEvent){C.fireEvent("onclick")}}}function contribute_menu(A){$("contribute_block").select("li").each(function(B){if(document.getElementById(B.id.replace("_tab",""))){document.getElementById(B.id.replace("_tab","")).style.display="none"}B.removeClassName("current")});if($("contribute_msg")){$("contribute_msg").update("")}$(A+"_tab").addClassName("current");if(document.getElementById(A)){document.getElementById(A).style.display="block"}}function contribute_success(E,A,D){if(response=E.responseText){var C=$(D).getElements();for(var B=0;B<C.length;B++){if((C[B].type!="submit")&&(C[B].type!="hidden")){C[B].clear()}}$("contribute_msg").update("Information was posted!");if(A=="updates"){if(!$("alert_impact").visible()){$("alert_impact").show()}}if(A=="comments"){current=parseInt($("alert_comments_count").innerHTML);$("alert_comments_count").update(current+1)}el=$("entity-menu-item-"+A).down("b").down("small").down("span");if(el){current=parseInt(el.innerHTML);if(A=="news"){if(E.responseJSON){if((!E.responseJSON.matched_with_alert)&&($("news_matched_with_alert"))){$("news_matched_with_alert").show()}el.update(current+parseInt(E.responseJSON.qty))}else{el.update(current+parseInt(response))}}else{el.update(current+1)}}AList.reload()}else{$("contribute_msg").update("Information wasn't posted!")}}function show_hide_reply_block(A){el=$("reply_block_"+A);if(el){state=el.getStyle("display");if(state=="none"){el.setStyle({display:"block"})}else{el.setStyle({display:"none"})}}}function addComment(B,E,A,C){var D={attachable_type:B,attachable_id:E,parent_of:A};D.comment=$F(C);new Ajax.Request("/comments/add",{method:"POST",parameters:D,onSuccess:function(F){AList.reload()}})}function changeCommentCredibitity(B,A){new Ajax.Request("/comments/comment_vote",{method:"POST",parameters:{comment_id:B,rate:A},onSuccess:function(C){}})}function showEditCommentArea(B){if(!$("comments_textarea_"+B)){var A=$("comments_content_"+B).innerHTML;$("comments_content_"+B).update('<textarea id="comments_textarea_'+B+'">'+A+"</textarea>");$("comment_edit_handler_"+B).show()}}function editComment(A){content=$("comments_textarea_"+A).getValue();new Ajax.Request("/comments/edit",{method:"POST",parameters:{id:A,text:content},onSuccess:function(B){AList.reload()}})}function editCommentCancel(A){AList.reload()}function removeComment(A){if(confirm("Are you sure?")){new Ajax.Request("/comments/delete",{method:"POST",parameters:{id:A},onSuccess:function(B){AList.reload()}})}}function changeQuickForm(B,A){if(B=="login"){$("quick_register_form").setStyle({display:"none"});$("quick_login_form").setStyle({display:"block"});if(!A){$("reg_radio_login").checked="checked";new Effect.ScrollTo("quick_login_form");$("login_username").focus()}}else{$("quick_login_form").setStyle({display:"none"});$("quick_register_form").setStyle({display:"block"});if(!A){$("reg_radio_register").checked="checked";new Effect.ScrollTo("quick_register_form");$("register_username").focus()}}}function QuickHandle(A){if(A=="login"){username=$F("login_username");password=$F("login_password");params={action:A,username:username,password:password}}else{if(A=="register"){photo_id=$F("user_photo_id");email=$F("register_email");i_agree=$("i_agree");recive_messages=$("recive_messages");username=$F("register_username");password=$F("register_password");re_password=$F("register_re_password");if(!email){new PopupDiv("<h3>Error</h3>Please specify email","400px");return false}if(!i_agree.checked){new PopupDiv("<h3>Error</h3>Please confirm you have read and agree with terms of use and privacy policy.","400px");return false}params={action:A,username:username,password:password,password_confirmation:re_password,email:email,photo_id:photo_id}}}if(!username||!password){new PopupDiv("<h3>Error</h3>Please specify username and password","400px")}else{new Ajax.Request("/login/quick",{method:"POST",parameters:params,onSuccess:function(B){if(B.responseJSON.success){window.location.reload()}else{new PopupDiv("<h3>Error</h3>"+B.responseJSON.data+"","400px")}}})}}function FBLogin(A){if(A.session){new Ajax.Request("/login/fb",{method:"POST",parameters:{session:Object.toJSON(A.session)},onSuccess:function(B){if(B.responseJSON.success){window.location.reload()}}})}}function textareaMaxChars(B,A,C){if($(B).value.length>A){$(B).value=$(B).value.substring(0,A)}else{$(C).update(A-$(B).value.length)}return false}function setCookie(B,D,A,F,C,E){document.cookie=B+"="+escape(D)+((A)?"; expires="+A:"")+((F)?"; path="+F:"")+((C)?"; domain="+C:"")+((E)?"; secure":"")}function getCookie(B){var D=" "+document.cookie;var C=" "+B+"=";var E=null;var F=0;var A=0;if(D.length>0){F=D.indexOf(C);if(F!=-1){F+=C.length;A=D.indexOf(";",F);if(A==-1){A=D.length}E=unescape(D.substring(F,A))}}return(E)}function dateFormatTimezoned(C){var D=new Array(12);D[0]="Jan";D[1]="Febr";D[2]="Mar";D[3]="Apr";D[4]="May";D[5]="Jun";D[6]="Jul";D[7]="Aug";D[8]="Sep";D[9]="Oct";D[10]="Nov";D[11]="Dec";var E=new Date();var B=new Date(C);E.setTime(B.getTime()-(E.getTimezoneOffset()*60*1000));var A=new String(E.getMinutes());if(A.length<2){A="0"+A}return D[E.getMonth()]+". "+E.getDate()+", "+E.getFullYear()+" "+E.getHours()+":"+A}function prefetchNews(A,E){var C=$("news_url");var D=$("news_title");var B=$("news_description");if(A&&C&&C.value&&D&&B){new Ajax.Request("/news?mode=news_prefetch&alert_id="+A,{method:"POST",parameters:"url="+escape(C.value),onSuccess:function(F){if(F.responseJSON){if(F.responseJSON.title&&F.responseJSON.title.length>0){D.value=F.responseJSON.title}if(F.responseJSON.description&&F.responseJSON.description.length>0){B.value=F.responseJSON.description}if(!F.responseJSON.matched_with_alert){$("news_matched_with_alert").show()}}}})}}function categoriesAutocompleterInit(){new Ajax.Autocompleter("category_name","category_choices","/filter?filter_type=category",{paramName:"title",onSuccess:function(B){var A=$("category_choices");A.style.opacity="1";if(A.style.filter){A.style.filter="alpha(opacity=100)"}A.update(B.responseText);A.show();return false},afterUpdateElement:function(){$("category_name").value="Search for a category keyword..."}})};
