﻿var detail_url="http://"+window.location.host+"/Services/NewsAndEvents/Details.aspx?id="
function GetNewsEvents(results_pane,department_id){$.ajax({type:"POST",url:"http://"+window.location.host+"/NewsAndEvents/NewsEventsService.asmx/GetNewsEvents",data:"{'DepartmentID' :"+department_id+"  }",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var arrEvents=(typeof response.d)=='string'?eval('('+response.d+')'):response.d;results_pane.html("");if(arrEvents.length>0){results_pane.css("visibility","visible");}
if(results_pane.attr("label")){results_pane.append("<h2>"+results_pane.attr("label")+"</h2>");}
for(var i=0;i<arrEvents.length;i++){results_pane.append("<h4><a href=\""+detail_url+arrEvents[i].ID+"\">"+arrEvents[i].Headline+"</a></h4><p>"+arrEvents[i].Message+" <a href=\""+detail_url+arrEvents[i].ID+"\">Read More»</a></p>");}},error:function(response){results_pane.html("Information currently unavailable ("+response.status+" "+response.statusText+response.responseText+")");}});}
function GetStreetClosures(results_pane_id,department_id){$.ajax({type:"POST",url:"http://"+window.location.host+"/Services/NewsAndEvents/NewsEventsService.asmx/GetStreetClosures",data:"{}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var arrEvents=(typeof response.d)=='string'?eval('('+response.d+')'):response.d;$("#"+results_pane_id).html("");for(var i=0;i<arrEvents.length;i++){$("#"+results_pane_id).append("<p><strong>"+arrEvents[i].Headline+"</strong></p><blockquote><p>"+arrEvents[i].Message+"</p></blockquote><hr/>");}},error:function(response){$("#"+results_pane_id).html("Information currently unavailable ("+response.status+" "+response.statusText+response.responseText+")");}});}
function GetNewsEventDetails(results_pane_id,newsevent_id){if(!newsevent_id==''){$.ajax({type:"POST",url:"http://"+window.location.host+"/Services/NewsAndEvents/NewsEventsService.asmx/GetNewsEventDetails",data:"{'NewsEventID' :"+newsevent_id+"  }",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var newsevent=(typeof response.d)=='string'?eval('('+response.d+')'):response.d;$("#"+results_pane_id).html("");if(newsevent.ID!=null&&newsevent.Message!=null){$("#"+results_pane_id).append("<h3>"+newsevent.Headline+"</h3><blockquote id=\"newsevents\">"+newsevent.Message+"</blockquote>");}
else{$("#"+results_pane_id).append("Invalid news and event ID");}},error:function(response){$("#"+results_pane_id).html("Information currently unavailable ("+response.status+" "+response.statusText+response.responseText+")");}});}
else{$("#"+results_pane_id).html("");$("#"+results_pane_id).append("Invalid news and event ID");}}
$(document).ready(function(){$(".NewsAndEventsContainer").each(function(){GetNewsEvents($(this),$(this).attr("dept"));});if($("#NewsAndEventsContainer").length>0){GetNewsEvents($("#NewsAndEventsContainer"),$("#NewsAndEventsContainer").attr("dept"));}
if($("#StreetClosureContainer").length>0){GetStreetClosures("StreetClosureContainer");}
$("div#goto-bar select.goto-box").each(function(){$(this).change(function(){if($(this).val()!="/"){document.location.href="http://"+window.location.host+$(this).val();}});});$("div#goto-bar input:submit").remove();$("div#goto-bar select.goto-box").prepend("<option value=\"/\">--Select Department--</option>");$("div#goto-bar select.goto-box").val("/");var re=new RegExp(".+MSIE 6.0.+");var re2=new RegExp(".+MSIE [78].0.+");if(navigator.appVersion.match(re)&&!navigator.appVersion.match(re2))
{alert("Microsoft Internet Explorer 6 is no longer supported.  Please update your browser.");}
$("#ctl00_ctl00_txtSearch").each(function(){$(this).focus(function(){$(this).val("");});});});
