serverPicked = "dc_"; var custom_ad = true; var magnetImage = new Image(116, 31); magnetImage.src = ""; if(undefined===window.wt_sponsor_html) var wt_sponsor_html = ''; // 2014: adsense or default ad depending on if there are closings var default_ad = 'Alert data from Weatherthreat.com'; //---------------------------------------------- function dc_createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } //---------------------------------------------- function dc_readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } //---------------------------------------------- function dc_eraseCookie(name) { createCookie(name,"",-1); } //---------------------------------------------- function dc_decodeString(theString){ return theString; } // END FUNCTION //---------------------------------------------- function dc_closing(theData){ a = theData.split("~~"); this.closing_type_id = dc_decodeString(a[0]); this.org_type_id = dc_decodeString(a[1]); this.user_id = dc_decodeString(a[2]); this.closing_short_details = dc_decodeString(a[3]); this.closing_long_details = dc_decodeString(a[4]); this.org_name = dc_decodeString(a[5].toUpperCase()); // if national weather service alert //if(this.closing_type_id == 'weat') this.org_name = 'NWS WEATHER ALERT'; this.org_city = dc_decodeString(a[6].toUpperCase()); this.org_state = dc_decodeString(a[7]); this.county = dc_decodeString(a[8]); this.closing_description = dc_decodeString(a[9]); this.org_type_description = dc_decodeString(a[10]); this.closing_start_date = dc_decodeString(a[11]); this.closing_end_date = dc_decodeString(a[12]); this.closing_effective_day = dc_closingEffectiveDay(dc_decodeString(a[13])); this.closing_entered_date = dc_decodeString(a[14]); this.org_id = dc_decodeString(a[15]); this.closing_id = dc_decodeString(a[16]); return this; } // END FUNCTION //----------------------------------------------------------------- function dc_closingEffectiveDay(theDay){ if(theDay == '1') return 'Sunday'; else if(theDay == '2') return 'Mon'; else if(theDay == '3') return 'Tue'; else if(theDay == '4') return 'Wed'; else if(theDay == '5') return 'Thu'; else if(theDay == '6') return 'Fri'; else if(theDay == '7') return 'Sat'; else return ''; } // END FUNCTION //----------------------------------------------------------------- function createTabs(htmlStr) { var frag = document.createDocumentFragment(), temp = document.getElementById('closingsWidget'); temp.innerHTML = htmlStr; while (temp.firstChild) { frag.appendChild(temp.firstChild); } return frag; } function loginContent(htmlStr) { var frag = document.createDocumentFragment(), temp = document.getElementById('closingsWidget_container'); temp.innerHTML = htmlStr; while (temp.firstChild) { frag.appendChild(temp.firstChild); } return frag; }//end function function signupContent(htmlStr) { var frag = document.createDocumentFragment(), temp = document.getElementById('closingsWidget_container'); temp.innerHTML = htmlStr; while (temp.firstChild) { frag.appendChild(temp.firstChild); } return frag; }//end function function infoContent(htmlStr) { var frag = document.createDocumentFragment(), temp = document.getElementById('closingsWidget_container'); temp.innerHTML = htmlStr; while (temp.firstChild) { frag.appendChild(temp.firstChild); } return frag; }//end function var fragment_tabs = createTabs('
' + 'Alerts' + 'Login' + 'Signup' + 'Help' + '
'); function showTab(tab_id) { var tab_items = document.getElementById("wt_tab_menu").getElementsByTagName("a"); var tab_clicked = document.getElementById(tab_id); if(tab_id == "closings_tab") { dc_showClosings(); // 2014: only if there are closings if(dc_closings.length > 0) intervalId = setInterval(dc_showClosings, 3000); } // end if closings_tab else { clearInterval(intervalId); } // end else not closings tab if(tab_id == "login_tab") { var fragment = loginContent('
' + '


' + '


' + '

' + '

View our User Agreement.

' + '
'); //write coresponding fragment to closingsWidget_container document.getElementById("closingsWidget_container").appendChild(fragment); } if(tab_id == "signup_tab") { var fragment = signupContent('

Get your WeatherThreat account today and start posting closings for your organization!

'); //write coresponding fragment to closingsWidget_container document.getElementById("closingsWidget_container").appendChild(fragment); } if(tab_id == "info_tab") { var fragment = infoContent('

Get all of the closings on your phone and notifications as well. Or submit your own closing right from your phone.

'); //write coresponding fragment to closingsWidget_container document.getElementById("closingsWidget_container").appendChild(fragment); } for (var i = 0; i < tab_items.length; i++) { if (tab_items[i].className.toLowerCase() == "tab active") { tab_items[i].setAttribute("class","tab"); } }//end for loop //activate clicked tab tab_clicked.setAttribute("class","tab active"); }//end function function dc_showClosings(){ if(serverPicked != "dc_") return; dc_rotationCounter++; if(document.getElementById('closingsWidget_link') && document.getElementById('closingsWidget_link').href == '') { var css_link = document.getElementById('closingsWidget_link').setAttribute("href","https://wt3.weatherthreat.com/wt_widget/light_theme2/css/styles.css"); } var cs = document.getElementById('closingsWidget'); var widget_width = document.getElementById('closingsWidget').style.width="180px"; var widget_height = document.getElementById('closingsWidget').style.height="130px"; var url_left_tag = ''; var closings_style_tag = ''; if(undefined!==window.closings_target) url_left_tag = ''; else url_left_tag = ''; var toWrite = ''; //LEAVE BLANK FOR MUTLIPLE BACKGROUNDS if(dc_theIndex == dc_closings.length) dc_theIndex = 0; // 2014: show ad only; no rotation if(dc_rotationCounter % 4 == 0 || dc_closings.length < 1) { //var toWrite = ''; toWrite += '
'; toWrite += url_left_tag; if(dc_closings.length < 1) toWrite += 'No Alerts Found
'; toWrite += wt_sponsor_html; } //END IF SPONSOR else if(dc_closings.length < 1) { toWrite += '
'+ url_left_tag; toWrite += 'No Alerts Found'; } //END IF NO CLOSINGS else{ toWrite += '
'+ url_left_tag; var c = dc_closings[dc_theIndex]; // IF CITY IN NAME THEN DO NOT SHOW CITY var showCity = c.org_name.search(c.org_city) > -1 ? '' : ' (' + c.org_city + ')' toWrite += url_left_tag + c.org_name + showCity + ': ' + c.closing_description + ' ' + c.closing_effective_day + ' (details...)'; cs.innerHTML = toWrite; dc_createCookie('closing_index', dc_theIndex, 1); dc_theIndex++; toWrite += ''; } // END ELSE THERE ARE CLOSINGS toWrite += '
'; cs.innerHTML = toWrite; //var text_margin = document.getElementById('closingsWidget_text').style.marginTop="60px"; //var logo_w = document.getElementById('wt_logo_false').style.width="px"; } // END FUNCTION var dc_closings = new Array(); var dc_theIndex = 0; var dc_rotationCounter = 0; // FOR COUNTING NUMBER OF ROTATIONS var dc_cookieIndex = dc_readCookie('closing_index'); if(dc_cookieIndex && dc_closings[dc_cookieIndex]) dc_theIndex = dc_cookieIndex; // 2014: don't show adsense if the widget is rotating if(dc_closings.length > 0 && !custom_ad) wt_sponsor_html = default_ad; dc_showClosings(); // 2014: only if there are closings if(dc_closings.length > 0) var intervalId = setInterval("dc_showClosings()", 3000); document.getElementById('wt_tab_menu').appendChild(fragment_tabs); var doneLoading = '2.1';