IBSYS.using("treet");YAHOO.util.Event.onDOMReady(function(){var toggle=document.getElementById("toggle_vis");if(toggle.offsetHeight>0){IBSYS.treet.SevereWxLoader.init();}else{IBSYS.treet.SevereWxLoader.placeholder();}});IBSYS.treet.SevereWxLoader={coid:siteinfo.emailsignup.severeCOID||16439124,listobj:"http://"+window.location.hostname+"/_objectxml/"+siteinfo.emailsignup.severeCOID+"/detail.html",placeholder:function(){var h2=document.createElement("h2");h2.className="treetCategoryTitle";h2.innerHTML="Severe Weather Alerts";var divBod=document.createElement("div");divBod.className="treetCategoryBody";divBod.innerHTML='<div class="treetBody"><div class="treetDescription">Please enter an e-mail address above to subscribe to severe weather alerts.</div></div>';var links=document.getElementsByTagName("a");for(var i=0;i<links.length;i++){if(links[i].className=="pageLink"&&links[i].href.match("severeweather")){links[i].parentNode.replaceChild(divBod,links[i]);divBod.parentNode.insertBefore(h2,divBod);}}},init:function(){var links=document.getElementsByTagName("a");for(var i=0;i<links.length;i++){if(links[i].className=="pageLink"&&links[i].href.match("severeweather")){IBSYS.treet.SevereWxLoader.linkLoad(links[i]);}}},linkLoad:function(t){t.nodeName=="A"?t=t:t=t.parentNode;IBSYS.treet.t=t;var con=YAHOO.util.Connect.asyncRequest("GET",IBSYS.treet.SevereWxLoader.listobj,IBSYS.treet.SevereWxLoader);},success:function(o){if(o.responseXML!==undefined){IBSYS.treet.SevereWxLoader.buildSelect(o);}},failure:function(o){},buildSelect:function(o){var severeTitle=document.createElement("div");severeTitle.setAttribute("class","treetCategoryBody");var counties=o.responseXML;counties=counties.getElementsByTagName("zone");var treetDiv=document.createElement("div");treetDiv.setAttribute("class","treetBody");severeTitle.appendChild(treetDiv);var selector=document.createElement("select");selector.setAttribute("id","severeSelector");var treetBody=document.createElement("div");var selectIn=document.createElement("input");selectIn.setAttribute("value","Add");selectIn.setAttribute("type","button");selectIn.onclick=IBSYS.treet.SevereWxLoader.addZone;treetBody.setAttribute("class","treetDescription");treetBody.appendChild(selector);treetBody.appendChild(selectIn);treetDiv.appendChild(treetBody);for(var i=0;i<counties.length;i++){var tmpOpt=document.createElement("option");tmpOpt.setAttribute("name","dlist");tmpOpt.setAttribute("value",counties[i].getAttribute("dlistkey"));tmpOpt.innerHTML=counties[i].firstChild.nodeValue;selector.appendChild(tmpOpt);}IBSYS.treet.t.parentNode.replaceChild(severeTitle,IBSYS.treet.t);var catTitle=document.createElement("h2");catTitle.className="treetCategoryTitle";catTitle.innerHTML="Severe Weather Alerts";severeTitle.parentNode.insertBefore(catTitle,severeTitle);var inputs=document.getElementsByTagName("input");var sevSubscribed=new Array();for(var i=0;i<inputs.length;i++){if(inputs[i].name=="unsublist"&&inputs[i].value.indexOf("wx_svr_")>=0){sevSubscribed.push(inputs[i].value);}}var selectBox=document.getElementById("severeSelector");var sevOptions=selectBox.getElementsByTagName("option");var sevSubscribedPlaces=new Array;for(var i=0;i<sevOptions.length;i++){for(var j=0;j<sevSubscribed.length;j++){if(sevOptions[i].getAttribute("value")==sevSubscribed[j]){sevSubscribedPlaces.push(sevOptions[i].innerHTML);selectBox.removeChild(sevOptions[i]);}}}var newZone=document.createElement("div");for(i=0;i<sevSubscribedPlaces.length;i++){newZone.innerHTML=newZone.innerHTML+'<div class="treetTitle" style="background-color: rgb(255, 255, 255) ;">'+'<div class="treetSelection"><a class="treetFormatHolder"><label class="treetFormat" style="color: rgb(0, 0, 0) !important;" for="'+sevSubscribed[i]+'">Text</label><input id="'+'"  type="checkbox" value="'+sevSubscribed[i]+'"name="dlist" checked="checked"/></a></div>Alerts for '+sevSubscribedPlaces[i]+"</div>";}selectBox.parentNode.parentNode.insertBefore(newZone,selectBox.parentNode);IBSYS.treet.SubscriptionHighlighter.init("sub_unsub_content","#FFFFFF","#d5e4e4");},addZone:function(){var selectBox=document.getElementById("severeSelector");var selChildren=selectBox.getElementsByTagName("option");for(var i=0;i<selChildren.length;i++){if(selChildren[i].selected){var selVal=selChildren[i];}}if(selVal){var newZone2=document.createElement("div");newZone2.innerHTML='<div class="treetTitle" style="background-color: rgb(255, 255, 255) ;">'+'<div class="treetSelection"><a class="treetFormatHolder"><label class="treetFormat" style="color: rgb(0, 0, 0) !important;" for="'+selVal.getAttribute("value")+'">Text</label><input id="'+selVal.getAttribute("value")+'"  type="checkbox" value="'+selVal.getAttribute("value")+'"name="dlist" checked="checked"/></a></div> Alerts for '+selVal.innerHTML+"</div>";selectBox.parentNode.parentNode.insertBefore(newZone2,selectBox.parentNode);selectBox.removeChild(selVal);IBSYS.treet.SubscriptionHighlighter.init("sub_unsub_content","#FFFFFF","#d5e4e4");}}};
