﻿var g_titleUriEnc = escape(document.title).replace(/%20/g, "+"); var g_urlUriEnc = escape(document.location).replace(/\//g, "%2f"); function StringBuilder() { this._buffer = []; } StringBuilder.prototype.Append = function(str) { this._buffer[this._buffer.length] = str; }; StringBuilder.prototype.ToString = function() { return this._buffer.join(""); }; function OpenWindow(url, val, height, width, ShowHeader) { docwidth = width; docheight = height; leftVal = (screen.width - docwidth) / 2; topVal = (screen.height - docheight) / 2; var args = "toolbar=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1"; if (ShowHeader != true) { args = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1"; } var newWin = window.open(url + val, "view", "height=" + docheight + ",width=" + docwidth + ",left=" + leftVal + ",top=" + topVal + "toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes"); if (newWin != null) { newWin.focus(); } } function PrintDoc(id, l) { var docwidth = 717, docheight = 550; var top = (screen.height - docheight) / 2; var left = (screen.width - docwidth) / 2; var printWin = window.open("/PrintContent.aspx?id=" + id + "&l=" + l, "printWin", "height=" + docheight + ",width=" + docwidth + ",top=" + top + ", left=" + left + ",toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no"); if (printWin != null) { printWin.focus(); } } function ViewResource(id) { var docwidth = 500, docheight = 350; var top = (screen.height - docheight) / 2; var left = (screen.width - docwidth) / 2; var viewWin = window.open("/ViewResource.aspx?id=" + id, "viewWin", "height=" + docheight + ",width=" + docwidth + ",top=" + top + ", left=" + left + ",toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no"); if (viewWin != null) { viewWin.focus(); } } function CharCountDisplay(txtBox, divCountDisplay, maxLength) { var charCount = GetTextCount(txtBox); var divC = document.getElementById(divCountDisplay); var remainingC = maxLength - charCount; var outText = ""; if (remainingC >= 0) { outText = remainingC + " character"; if (remainingC != 1) { outText = outText + "s"; } outText = outText + " remaining"; divC.className = "CharNormal"; } else { outText = "You are over the character limit (" + maxLength + ")"; divC.className = "CharError"; } divC.innerHTML = outText; } function GetTextCount(txt) { try { var txtDisplay = document.getElementById(txt); return txtDisplay.value.length; } catch (err) { alert(err.message); } } function SetUniqueRadioButton(nameregex, current) { re = new RegExp(nameregex); for (i = 0; i < document.forms[0].elements.length; i++) { elm = document.forms[0].elements[i]; if (elm.type == "radio") { if (re.test(elm.name)) { elm.checked = false; } } } current.checked = true; } function HtmlDecode(str) { var x = str.replace(/\&lt\;/g, "<"); x = x.replace(/\&gt\;/g, ">"); x = x.replace(/\&amp\;/g, "&"); x = x.replace(/\&quot\;/g, "'"); x = x.replace(/\&\#39\;/g, "'"); return x; } function GetEventKeyNum(e) { var keynum; if (window.event) { keynum = e.keyCode; } else { if (e.which) { keynum = e.which; } } return keynum; } function audio(audioNbr) { var leftVal = (screen.width - 220) / 2; var topVal = (screen.height - 100) / 2; var url = "/Audio/AudioPlayer.htm?id=" + audioNbr; window.open(url, "Audio", "width=220,height=100,menubar=0,toolbar=0,status=0,scrollbars=0,resizable=0,top=" + topVal + ",left=" + leftVal); } function video(videoNbr) { var url = "/Video/VideoPlayer.htm?id=" + videoNbr; window.open(url, "Video", "width=400,height=336,menubar=0,toolbar=0,status=0,scrollbars=0,resizable=0"); } try { document.execCommand("BackgroundImageCache", false, true); } catch (err) { } function GetOmnitureVarsForSWF() { try { return s.pageName + "," + s.channel; } catch (err) { return "None,None"; } } function RunSearch(sTerm) { var searchTerm = escape(sTerm); searchTerm = searchTerm.replace("<", "").replace("&#", "").replace("%20", "+"); if (searchTerm == "Search" || searchTerm == "") { location.href = "/Search/"; } else { location.href = "/Search/?q=" + searchTerm; } } function goSearch() { RunSearch(document.getElementById("txtSearch").value); } function submitSearchBox(e) { var keynum = GetEventKeyNum(e); if (keynum == 60) { return false; } if (keynum == 35) { var temp = document.getElementById("txtSearch").value; var ampTest = temp.endsWith("&"); if (ampTest === true) { return false; } } if (keynum == 13 || keynum == 10) { goSearch(); return false; } } function clearSearchText(txtSearch) { if (txtSearch.value == "Search") { txtSearch.value = ""; } } function resetSearchText(txtSearch) { var trimmedText = txtSearch.value.replace(/^\s\s*/, "").replace(/\s\s*$/, ""); if (trimmedText == "") { txtSearch.value = "Search"; } } function FeaturedVideo(iId, sTitle, sDescr) { this.Id = iId; this.Title = sTitle; this.Descr = sDescr; } function ShowFeaturedVideo(featVid) { document.getElementById("dFeaturedVideo").innerHTML = ""; so = new SWFObject("/video/flash/featuredVideo.swf", "eFeaturedVideo", "195px", "175px", "9", ""); so.addParam("allowScriptAccess", "sameDomain"); so.addParam("wmode", "Opaque"); so.addParam("quality", "High"); so.addParam("play", "True"); so.addParam("loop", "False"); so.addParam("menu", "False"); so.addParam("scale", "Showall"); so.addVariable("xmlpath", "http%3a%2f%2f" + window.location.hostname + "%2fVideo%2fStreamXml.aspx%3fembed%3dtrue%26id%3d" + featVid.Id); so.write("dFeaturedVideo"); document.getElementById("spnVideoTitle").innerHTML = featVid.Title; document.getElementById("spnVideoDescription").innerHTML = featVid.Descr; } function LoadDivFeaturedVideo() { if (g_featVids.length == 0) { return; } ShowFeaturedVideo(g_featVids[g_featVidIndex]); g_featVidIndex++; if (g_featVidIndex >= g_featVids.length) { g_featVidIndex = 0; } } function LoadDivFact() { document.getElementById("divFact").innerHTML = g_facts[g_factIndex]; g_factIndex++; if (g_factIndex >= g_facts.length) { g_factIndex = 0; } } function GeatFeaturedVideoIndex() { var index = 0; if (g_featVids.length > 1) { if (g_featVidsRandom) { index = Math.floor(Math.random() * g_featVids.length - 1); if (index < 0) { index = 0; } } } return index; } function ShowShareThis() { $("#dShareThisModal").modal(); $("#aDelicious").attr("href", "http://del.icio.us/post?url=" + g_urlUriEnc + "&title=" + g_titleUriEnc); $("#aDigg").attr("href", "http://digg.com/submit?phase=2&url=" + g_urlUriEnc + "&title=" + g_titleUriEnc); $("#aStumbleUpon").attr("href", "http://www.stumbleupon.com/submit?url=" + g_urlUriEnc + "&title=" + g_titleUriEnc); $("#aFurl").attr("href", "http://furl.net/storeIt.jsp?u=" + g_urlUriEnc + "&t=" + g_titleUriEnc); $("#aNetscape").attr("href", "http://www.netscape.com/submit/?U=" + g_urlUriEnc + "&T=" + g_titleUriEnc); $("#aYahoo").attr("href", "http://myweb2.search.yahoo.com/myresults/bookmarklet?u=" + g_urlUriEnc + "&t=" + g_titleUriEnc); $("#aTechnorati").attr("href", "http://www.technorati.com/faves?add=" + g_urlUriEnc); $("#aGoogle").attr("href", "http://www.google.com/bookmarks/mark?op=edit&bkmk=" + g_urlUriEnc + "&title=" + g_titleUriEnc); $("#aNewsvine").attr("href", "http://www.newsvine.com/_wine/save?u=" + g_urlUriEnc + "&h=" + g_titleUriEnc); $("#aBlinkList").attr("href", "http://blinklist.com/index.php?Action=Blink/addblink.php&Url=" + g_urlUriEnc + "&Title=" + g_titleUriEnc); $("#aReddit").attr("href", "http://reddit.com/submit?url=" + g_urlUriEnc + "&title=" + g_titleUriEnc); $("#aBlogmarks").attr("href", "http://blogmarks.net/my/new.php?mini=1&url=" + g_urlUriEnc + "&title=" + g_titleUriEnc); $("#aWindowsLive").attr("href", "http://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url=" + g_urlUriEnc + "&title=" + g_titleUriEnc + "&top=1"); $("#aTailrank").attr("href", "http://tailrank.com/share/?link_href=" + g_urlUriEnc + "&title=" + g_titleUriEnc); $("#aSlashdot").attr("href", "http://slashdot.org/bookmark.pl?url=" + g_urlUriEnc + "&title=" + g_titleUriEnc); $("#aFacebook").attr("href", "http://www.facebook.com/share.php?u=" + g_urlUriEnc); } function ShowEmailThis() { OpenWindow("/P/EmailContent.aspx?title=" + g_titleUriEnc + "&url=" + g_urlUriEnc, "", "630", "420", "False"); return false; } function ShowLogin() { if (Get_Cookie("displayName") != null) { if (Get_Cookie("displayName") != "") { $("#divLogin").css("display", "none"); $("#divLogout").css("display", "block"); $("#aUser").html(Get_Cookie("displayName")); } } else { $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", dataType: "json", data: "{}", url: "/Svc/User.asmx/GetLoginDipsplayName", success: function(msg) { if (msg.d != "") { $("#divLogin").css("display", "none"); $("#divLogout").css("display", "block"); $("#aUser").html(msg.d); } } }); } } function get_text_cookie(cookie_name) { var results = document.cookie.match(cookie_name + "=(.*?)(;|$)"); if (results) { return (unescape(results[1])); } else { return null; } } function 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 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 eraseCookie(name) { createCookie(name, "", -1); } function Set_Cookie(name, value, expires, path, domain, secure) { var today = new Date(); today.setTime(today.getTime()); if (expires) { expires = expires * 1000 * 60 * 60 * 24; } var expires_date = new Date(today.getTime() + (expires)); document.cookie = name + "=" + escape(value) + ((expires) ? ";expires=" + expires_date.toGMTString() : "") + ((path) ? ";path=" + path : "") + ((domain) ? ";domain=" + domain : "") + ((secure) ? ";secure" : ""); } function Get_Cookie(check_name) { var a_all_cookies = document.cookie.split(";"); var a_temp_cookie = ""; var cookie_name = ""; var cookie_value = ""; var b_cookie_found = false; for (i = 0; i < a_all_cookies.length; i++) { a_temp_cookie = a_all_cookies[i].split("="); cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, ""); if (cookie_name == check_name) { b_cookie_found = true; if (a_temp_cookie.length > 1) { cookie_value = unescape(a_temp_cookie[1].replace(/^\s+|\s+$/g, "")); } return cookie_value; break; } a_temp_cookie = null; cookie_name = ""; } if (!b_cookie_found) { return null; } } function Get_Int_Cookie(check_name) { var intVal = null; if (Get_Cookie(check_name)) { intVal = parseInt(Get_Cookie(check_name)); } return intVal; } function Delete_Cookie(name, path, domain) { if (Get_Cookie(name)) { document.cookie = name + "=" + ((path) ? ";path=" + path : "") + ((domain) ? ";domain=" + domain : "") + ";expires=Thu, 01-Jan-1970 00:00:01 GMT"; } } function GetDomain() { var dm = window.location.hostname; dm = dm.replace(/www./i, ""); return dm; } var currentTextSize = null; var currentLineHeight = null; if (get_text_cookie("ihtfontsize")) { currentTextSize = get_text_cookie("ihtfontsize"); if (currentTextSize == 0.85) { currentLineHeight = 1.45; } else { if ((currentTextSize == 1) || (currentTextSize == 1.15)) { currentLineHeight = 1.4; } else { if (currentTextSize == 1.35) { currentLineHeight = 1.3; } } } } else { currentTextSize = 1; currentLineHeight = 1.4; createCookie("ihtfontsize", currentTextSize, 90); } function textSize(dir) { if (dir == "up") { if (currentTextSize == 1.15) { currentTextSize = 1.35; currentLineHeight = 1.3; } else { if (currentTextSize == 1) { currentTextSize = 1.15; currentLineHeight = 1.4; } else { if (currentTextSize == 0.85) { currentTextSize = 1; currentLineHeight = 1.4; } } } } else { if (dir == "down") { if (currentTextSize == 1) { currentTextSize = 0.85; currentLineHeight = 1.45; } else { if (currentTextSize == 1.15) { currentTextSize = 1; currentLineHeight = 1.4; } else { if (currentTextSize == 1.35) { currentTextSize = 1.15; currentLineHeight = 1.4; } } } } } SetContentStyles(); createCookie("ihtfontsize", currentTextSize, 90); } function SetContentStyles() { var div = document.getElementById("divContent"); if (div != null) { div.style.fontSize = currentTextSize + "em"; div.style.lineHeight = currentLineHeight + "em"; } } function SavePdf(id, l) { var printWin; if (id) { if (l) { printWin = window.open("/SaveContent.aspx?id=" + id + "&l=" + l); } else { printWin = window.open("/SaveContent.aspx?id=" + id); } } else { if (window.location.href.indexOf("?") > 0) { printWin = window.open("/SaveContent.aspx?url=" + escape(window.location + "&print=true")); } else { printWin = window.open("/SaveContent.aspx?url=" + escape(window.location + "?print=true")); } } if (printWin != null) { printWin.focus(); } } function PrintPage(id, l) { var docwidth = 717, docheight = 550; var top = (screen.height - docheight) / 2; var left = (screen.width - docwidth) / 2; var printWin; if (id) { if (l) { printWin = window.open("/PrintContent.aspx?id=" + id, "printWin", "height=" + docheight + ",width=" + docwidth + ",top=" + top + ", left=" + left + ",toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no"); } else { printWin = window.open("/PrintContent.aspx?id=" + id + "&l=" + l, "printWin", "height=" + docheight + ",width=" + docwidth + ",top=" + top + ", left=" + left + ",toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no"); } } else { if (window.location.href.indexOf("?") > 0) { printWin = window.open(window.location + "&print=true", "printWin", "height=" + docheight + ",width=" + docwidth + ",top=" + top + ", left=" + left + ",toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no"); } else { printWin = window.open(window.location + "?print=true", "printWin", "height=" + docheight + ",width=" + docwidth + ",top=" + top + ", left=" + left + ",toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no"); } } if (printWin != null) { printWin.focus(); } }