﻿(function () {
    CNB.initNavOverlay = function () {
        try {
                var a = $("header-sec");
                var g = a.getElements(".nav-sec li");
                var e = a.getElements(".overlay-pop");
                var c = g.pop(); var h = e.pop();
                var b = new CNB.Pop(c, h, { offset: { x: -510 }, position: { x: "right"} }).load(); var i = new CNB.Pop(g, e).load();
                var f = new CNB.Pop(a.getElements(".geo-loc"), a.getElements(".overlay-global"), { offset: { x: -20} }).load()
            } 
            catch (d) { }
        };

    CNB.getRelatedContent = function (k) {
        try {
            var d = relassets();
            var j = relimpressions();
            if (d.length == 0 && j.length == 0) { return }
            var b = $(k);
            if (d.length > 0) {
                var a = new Element("div", { "class": "space-3" });
                var c = new Element("div", { "class": "hed hed-1", html: '<h6 class="h s-6 c-1"><span class="int">People who read this, also read...</span></h6>' }).inject(a); var i = new Element("ul", { "class": "list-1" }).inject(a, "bottom"); d.each(function (e) { var l = new Element("li", { html: '<a href="' + e.url + '">' + e.title + "</a></li>" }).inject(i, "bottom") }); b.adopt(a)
            } if (j.length > 0) { var f = ""; j.each(function (e) { f += e }); var g = new Element("div", { html: f, styles: { position: "absolute", left: "-9999px"} }).inject(b) } 
        } catch (h) { } 
    }; CNB.clickableSkin = { load: function (c, b, a) { this.elements = $$(c); this.container = $(a); this.content = $(b); if (!$chk(this.elements) || !$chk(this.container) || !$chk(this.content)) { return false } this.container.setStyle("position", "relative"); this.setClickableArea(); window.addEvent("resize", this.setClickableArea.bind(this)) }, setClickableArea: function () { var e = this.container.getScrollSize(); var d = this.content.getSize(); var c = e.x - d.x; var b = (c > 0) ? Math.floor(c / 2) : 0; var a = e.y; if (b > 0 && a > 0) { this.elements.each(function (g, f) { g.setStyles({ position: "absolute", "z-index": "1", top: "0", left: 0, width: b, height: a }); if (f == 1) { g.setStyles({ left: "auto", right: "0" }) } }) } } }; CNB.Overlay.loadEmail = function (b) { var c = function (g, f) { g.stop(); a.loader.add(); var d = new Request.JSON({ url: f.getProperty("action"), data: f.toJSON(), onSuccess: function (e) { if (e.status == "success") { a.notify("Your message has been sent.") } else { a.notify("Sorry we can't send your message at this time.") } }, onComplete: a.loader.remove.bind(a.loader), onFailure: function (e) { a.notify("Sorry we can't send your message at this time.") } }).post() }; var a = new CNB.Overlay.Async(b); a.addOneEvent("contentReady", function (d) { var e = new CNB.Validator(d.getElement("form"), { onValidateSuccess: c }) }); a.open() }; CNB.SubscribePromo = new Class({ initialize: function (b, a) { this.loggedOutForm = $(a); this.loggedInForm = $(b); this.loader = new CNB.Loading(this.loggedInForm); this.loggedOutForm.addEvent("submit", this.loggedOutSubmit.bind(this)); this.validate = new CNB.Validator(this.loggedInForm, { onValidateSuccess: CNB.Reg.checkLoggedIn.bindWithEvent(CNB.Reg, this.loggedInSubmit.bind(this)) }) }, loggedOutSubmit: function (a) { a.stop(); CNB.Reg.join({ data: this.loggedOutForm.toJSON() }) }, loggedInSubmit: function () { this.loader.add(); var a = new Request.JSON({ url: this.loggedInForm.getProperty("action"), data: $merge(this.loggedInForm.toJSON(), { appId: "187", updateUser: true }), onSuccess: this.subscribeResponse.bind(this), onComplete: this.loader.remove.bind(this.loader), onFailure: function (b) { this.subscribeResponse({ status: "failure" }) } }).post() }, subscribeResponse: function (a) { switch (a.status) { case "success": msg = "Thank you for subscribing."; break; default: msg = "Sorry, we encountered a problem, and can't process your request at this time." } this.loggedInForm.empty().set("html", '<p class="fancy s-8">' + msg + "</p>") } }); CNB.RegOverlay = new Class({ initialize: function () { this.isUser = (Cookie.read("purs_3") != null) ? true : false; this.hasViewed = (Cookie.read("reg-overlay") != null) ? true : false }, load: function () { if (this.isUser || this.hasViewed) { return false } var a = location.pathname; if (a != "/" && a != "/news" && a != "/reviews") { return false } if (!CNB.hasCookiesEnabled()) { return false } this.overlay = new CNB.Overlay({ id: "reg-pop-overlay", containerClass: "contain-overlay-10", content: this.buildContent(), onClose: function () { DW.redir({ ctype: "reg-ol;act", cval: "close" }) }, onOpen: function () { DW.redir({ ctype: "reg-ol;act", cval: "load" }); Cookie.write("reg-overlay", "1", { duration: 30, domain: CNB.getCookieHost(), path: "/" }) } }).open() }, buildContent: function () { var b = '<h2 class="h s-4 fancy space-1">Join the largest community of IT Professionals on the web.</h2><div class="hed hed-1"><h4 class="h s-6 c-1"><span class="int">ZDNet members receive FREE access to:</span></h4></div><div class=" view-6 space-1"><ul class="list-2"><li class="space-1">All-star team of technology experts delivering dozens of reports daily</li><li class="space-1">50,000+ white papers, case studies and webcasts</li><li class="space-1">400,000+ downloads featuring scripts, executables, and other time-saving tools</li><li class="space-1">100,000+ products reviewed from around the web</li><li class="space-1">Informative newsletters covering a wide variety of topics</li><li>Breaking IT alerts as the news happens</li></ul></div>'; var e = new Element("div", { "class": "content", html: b }); var g = new Element("div", { "class": "lvl-btn clear space-1" }).inject(e, "bottom"); var f = new Element("a", { "class": "btn-1", text: "Join ZDNet", events: { click: function () { DW.redir({ ctype: "reg-ol;act", cval: "signmeup" }); this.overlay.remove(); CNB.Reg.join({ regSrc: "reg-over" }) } .bind(this)} }).inject(g, "bottom"); var d = new Element("span", { "class": "other-options right fancy c-2", text: " | " }).inject(g, "bottom"); var a = new Element("a", { html: "I&#8217;m already a member", events: { click: function () { DW.redir({ ctype: "reg-ol;act", cval: "currentmember" }); this.overlay.remove(); if (typeof CNB.Reg.logIn != "undefined") { CNB.Reg.logIn({ regSource: "reg-over" }) } else { CNB.Reg.login({ regSrc: "reg-over" }) } } .bind(this)} }).inject(d, "top"); var c = new Element("a", { text: "No thanks", "class": "close", events: { click: function () { this.overlay.removeEvents("close"); DW.redir({ ctype: "reg-ol;act", cval: "nothanks" }) } .bind(this)} }).inject(d, "bottom"); return e } }); CNB.SearchSection = new Class({ Implements: Options, options: { defaultSection: "" }, initialize: function (a, b) { this.setOptions(b); this.container = $(a); this.form = this.container.getElement("form"); this.overlay = this.container.getElement(".overlay-search"); this.sectionOptions = this.overlay.getElements("a") }, load: function () {
        this.sectionOptions.each(function (b) { b.addEvent("click", this.handleClick.bindWithEvent(this, b)) } .bind(this));
        
        var a = new CNB.Pop(this.form, this.overlay, { offset: { x: -5, y: 5} }).load();
        if ($chk(this.options.defaultSection)) {
            this.setOnState(this.overlay.getElement("a[section=" + this.options.defaultSection + "]"));
            this.setSection(this.options.defaultSection)
        }
        this.form.addEvent("submit", this.handleSubmitEvent.bind(this)) 
                 }, handleClick: function (c, a) { c.stop(); var b = a.getProperty("section"); this.setSection(b); this.setOnState(a) }, setOnState: function (a) { this.sectionOptions.each(function (b) { b.removeClass("on") }); a.addClass("on") }, setSection: function (b) { switch (b) { case "reviews": action = "http://reviews-search.zdnet.com/search"; title = "Search Reviews"; break; case "downloads": action = "http://downloads.zdnet.com/search.aspx"; title = "Search Downloads"; break; case "whitepapers": action = "http://whitepapers.zdnet.com/search.aspx"; title = "Search Whitepapers"; break; default: action = "http://www.zdnet.com/search"; title = "Search All" } this.form.setProperty("action", action); var a = this.form.getElement("input"); if (a.hasClass("placeholder")) { a.set("value", title) } a.setProperty("placeholder", title) }, handleSubmitEvent: function (b) { b.stop(); var a = this.form.getElement("input"); a.set("value", a.get("value").toLowerCase()); this.form.submit() } }); window.addEvent("domready", function () { var b = new CNB.RegOverlay().load(); var a = $$(".skinClick"); if ($chk(a)) { CNB.clickableSkin.load(a, "content", "mantle_skin") } } .bind(this))
})();
