/**
 * TrimPath Template. Release 1.0.38.
 * Copyright (C) 2004, 2005 Metaha.
 * 
 * TrimPath Template is licensed under the GNU General Public License
 * and the Apache License, Version 2.0, as follows:
 *
 * This program is free software; you can redistribute it and/or 
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed WITHOUT ANY WARRANTY; without even the 
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var PodTrimPath; // we have namespaced this to keep a separate instance for Pod to use.
(function() {               // Using a closure to keep global namespace clean.
    if (PodTrimPath == null)
        PodTrimPath = new Object();
    if (PodTrimPath.evalEx == null)
        PodTrimPath.evalEx = function(src) { return eval(src); };
    var UNDEFINED;
    if (Array.prototype.pop == null)  // IE 5.x fix from Igor Poteryaev.
        Array.prototype.pop = function() {
            if (this.length === 0) {return UNDEFINED;}
            return this[--this.length];
        };
    if (Array.prototype.push == null) // IE 5.x fix from Igor Poteryaev.
        Array.prototype.push = function() {
            for (var i = 0; i < arguments.length; ++i) {this[this.length] = arguments[i];}
            return this.length;
        };
    PodTrimPath.parseTemplate = function(tmplContent, optTmplName, optEtc) {
        if (optEtc == null)
            optEtc = PodTrimPath.parseTemplate_etc;
        var funcSrc = parse(tmplContent, optTmplName, optEtc);
        var func = PodTrimPath.evalEx(funcSrc, optTmplName, 1);
        if (func != null)
            return new optEtc.Template(optTmplName, tmplContent, funcSrc, func, optEtc);
        return null;
    }
    try {
        String.prototype.process = function(context, optFlags) {
            var template = PodTrimPath.parseTemplate(this, null);
            if (template != null)
                return template.process(context, optFlags);
            return this;
        }
    } catch (e) { // Swallow exception, such as when String.prototype is sealed.
    }
    PodTrimPath.parseTemplate_etc = {};            // Exposed for extensibility.
    PodTrimPath.parseTemplate_etc.statementTag = "forelse|for|if|elseif|else|var|macro";
    PodTrimPath.parseTemplate_etc.statementDef = { // Lookup table for statement tags.
        "if"     : { delta:  1, prefix: "if (", suffix: ") {", paramMin: 1 },
        "else"   : { delta:  0, prefix: "} else {" },
        "elseif" : { delta:  0, prefix: "} else if (", suffix: ") {", paramDefault: "true" },
        "/if"    : { delta: -1, prefix: "}" },
        "for"    : { delta:  1, paramMin: 3, 
                     prefixFunc : function(stmtParts, state, tmplName, etc) {
                        if (stmtParts[2] != "in")
                            throw new etc.ParseError(tmplName, state.line, "bad for loop statement: " + stmtParts.join(' '));
                        var iterVar = stmtParts[1];
                        var listVar = "__LIST__" + iterVar;
                        return [ "var ", listVar, " = ", stmtParts[3], ";",
                             "var __LENGTH_STACK__;",
                             "if (typeof(__LENGTH_STACK__) == 'undefined' || !__LENGTH_STACK__.length) __LENGTH_STACK__ = new Array();", 
                             "__LENGTH_STACK__[__LENGTH_STACK__.length] = 0;", // Push a new for-loop onto the stack of loop lengths.
                             "if ((", listVar, ") != null) { ",
                             "var ", iterVar, "_ct = 0;",       // iterVar_ct variable, added by B. Bittman     
                             "for (var ", iterVar, "_index in ", listVar, ") { ",
                             iterVar, "_ct++;",
                             "if (typeof(", listVar, "[", iterVar, "_index]) == 'function') {continue;}", // IE 5.x fix from Igor Poteryaev.
                             "__LENGTH_STACK__[__LENGTH_STACK__.length - 1]++;",
                             "var ", iterVar, " = ", listVar, "[", iterVar, "_index];" ].join("");
                     } },
        "forelse" : { delta:  0, prefix: "} } if (__LENGTH_STACK__[__LENGTH_STACK__.length - 1] == 0) { if (", suffix: ") {", paramDefault: "true" },
        "/for"    : { delta: -1, prefix: "} }; delete __LENGTH_STACK__[__LENGTH_STACK__.length - 1];" }, // Remove the just-finished for-loop from the stack of loop lengths.
        "var"     : { delta:  0, prefix: "var ", suffix: ";" },
        "macro"   : { delta:  1, 
                      prefixFunc : function(stmtParts, state, tmplName, etc) {
                          var macroName = stmtParts[1].split('(')[0];
                          return [ "var ", macroName, " = function", 
                                   stmtParts.slice(1).join(' ').substring(macroName.length),
                                   "{ var _OUT_arr = []; var _OUT = { write: function(m) { if (m) _OUT_arr.push(m); } }; " ].join('');
                     } }, 
        "/macro"  : { delta: -1, prefix: " return _OUT_arr.join(''); };" }
    }
    PodTrimPath.parseTemplate_etc.modifierDef = {
        "eat"        : function(v)    { return ""; },
        "escape"     : function(s)    { return String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"); },
        "capitalize" : function(s)    { return String(s).toUpperCase(); },
        "default"    : function(s, d) { return s != null ? s : d; }
    }
    PodTrimPath.parseTemplate_etc.modifierDef.h = PodTrimPath.parseTemplate_etc.modifierDef.escape;
    PodTrimPath.parseTemplate_etc.Template = function(tmplName, tmplContent, funcSrc, func, etc) {
        this.process = function(context, flags) {
            if (context == null)
                context = {};
            if (context._MODIFIERS == null)
                context._MODIFIERS = {};
            if (context.defined == null)
                context.defined = function(str) { return (context[str] != undefined); };
            for (var k in etc.modifierDef) {
                if (context._MODIFIERS[k] == null)
                    context._MODIFIERS[k] = etc.modifierDef[k];
            }
            if (flags == null)
                flags = {};
            var resultArr = [];
            var resultOut = { write: function(m) { resultArr.push(m); } };
            try {
                func(resultOut, context, flags);
            } catch (e) {
                if (flags.throwExceptions == true)
                    throw e;
                var result = new String(resultArr.join("") + "[ERROR: " + e.toString() + (e.message ? '; ' + e.message : '') + "]");
                result["exception"] = e;
                return result;
            }
            return resultArr.join("");
        }
        this.name       = tmplName;
        this.source     = tmplContent; 
        this.sourceFunc = funcSrc;
        this.toString   = function() { return "PodTrimPath.Template [" + tmplName + "]"; }
    }
    PodTrimPath.parseTemplate_etc.ParseError = function(name, line, message) {
        this.name    = name;
        this.line    = line;
        this.message = message;
    }
    PodTrimPath.parseTemplate_etc.ParseError.prototype.toString = function() { 
        return ("PodTrimPath template ParseError in " + this.name + ": line " + this.line + ", " + this.message);
    }
    var parse = function(body, tmplName, etc) {
        body = cleanWhiteSpace(body);
        var funcText = [ "var PodTrimPath_Template_TEMP = function(_OUT, _CONTEXT, _FLAGS) { with (_CONTEXT) {" ];
        var state    = { stack: [], line: 1 };                              // TODO: Fix line number counting.
        var endStmtPrev = -1;
        while (endStmtPrev + 1 < body.length) {
            var begStmt = endStmtPrev;
            begStmt = body.indexOf("{", begStmt + 1);
            while (begStmt >= 0) {
                var endStmt = body.indexOf('}', begStmt + 1);
                var stmt = body.substring(begStmt, endStmt);
                var blockrx = stmt.match(/^\{(cdata|minify|eval)/); // From B. Bittman, minify/eval/cdata implementation.
                if (blockrx) {
                    var blockType = blockrx[1]; 
                    var blockMarkerBeg = begStmt + blockType.length + 1;
                    var blockMarkerEnd = body.indexOf('}', blockMarkerBeg);
                    if (blockMarkerEnd >= 0) {
                        var blockMarker;
                        if( blockMarkerEnd - blockMarkerBeg <= 0 ) {
                            blockMarker = "{/" + blockType + "}";
                        } else {
                            blockMarker = body.substring(blockMarkerBeg + 1, blockMarkerEnd);
                        }                        
                        var blockEnd = body.indexOf(blockMarker, blockMarkerEnd + 1);
                        if (blockEnd >= 0) {                            
                            emitSectionText(body.substring(endStmtPrev + 1, begStmt), funcText);
                            var blockText = body.substring(blockMarkerEnd + 1, blockEnd);
                            if (blockType == 'cdata') {
                                emitText(blockText, funcText);
                            } else if (blockType == 'minify') {
                                emitText(scrubWhiteSpace(blockText), funcText);
                            } else if (blockType == 'eval') {
                                if (blockText != null && blockText.length > 0) // From B. Bittman, eval should not execute until process().
                                    funcText.push('_OUT.write( (function() { ' + blockText + ' })() );');
                            }
                            begStmt = endStmtPrev = blockEnd + blockMarker.length - 1;
                        }
                    }                        
                } else if (body.charAt(begStmt - 1) != '$' &&               // Not an expression or backslashed,
                           body.charAt(begStmt - 1) != '\\') {              // so check if it is a statement tag.
                    var offset = (body.charAt(begStmt + 1) == '/' ? 2 : 1); // Close tags offset of 2 skips '/'.
                    if (body.substring(begStmt + offset, begStmt + 10 + offset).search(PodTrimPath.parseTemplate_etc.statementTag) == 0) 
                        break;                                              // Found a match.
                }
                begStmt = body.indexOf("{", begStmt + 1);
            }
            if (begStmt < 0)                              // In "a{for}c", begStmt will be 1.
                break;
            var endStmt = body.indexOf("}", begStmt + 1); // In "a{for}c", endStmt will be 5.
            if (endStmt < 0)
                break;
            emitSectionText(body.substring(endStmtPrev + 1, begStmt), funcText);
            emitStatement(body.substring(begStmt, endStmt + 1), state, funcText, tmplName, etc);
            endStmtPrev = endStmt;
        }
        emitSectionText(body.substring(endStmtPrev + 1), funcText);
        if (state.stack.length != 0)
            throw new etc.ParseError(tmplName, state.line, "unclosed, unmatched statement(s): " + state.stack.join(","));
        funcText.push("}}; PodTrimPath_Template_TEMP");
        return funcText.join("");
    }
    var emitStatement = function(stmtStr, state, funcText, tmplName, etc) {
        var parts = stmtStr.slice(1, -1).split(' ');
        var stmt = etc.statementDef[parts[0]]; // Here, parts[0] == for/if/else/...
        if (stmt == null) {                    // Not a real statement.
            emitSectionText(stmtStr, funcText);
            return;
        }
        if (stmt.delta < 0) {
            if (state.stack.length <= 0)
                throw new etc.ParseError(tmplName, state.line, "close tag does not match any previous statement: " + stmtStr);
            state.stack.pop();
        } 
        if (stmt.delta > 0)
            state.stack.push(stmtStr);
        if (stmt.paramMin != null &&
            stmt.paramMin >= parts.length)
            throw new etc.ParseError(tmplName, state.line, "statement needs more parameters: " + stmtStr);
        if (stmt.prefixFunc != null)
            funcText.push(stmt.prefixFunc(parts, state, tmplName, etc));
        else 
            funcText.push(stmt.prefix);
        if (stmt.suffix != null) {
            if (parts.length <= 1) {
                if (stmt.paramDefault != null)
                    funcText.push(stmt.paramDefault);
            } else {
                for (var i = 1; i < parts.length; i++) {
                    if (i > 1)
                        funcText.push(' ');
                    funcText.push(parts[i]);
                }
            }
            funcText.push(stmt.suffix);
        }
    }
    var emitSectionText = function(text, funcText) {
        if (text.length <= 0)
            return;
        var nlPrefix = 0;               // Index to first non-newline in prefix.
        var nlSuffix = text.length - 1; // Index to first non-space/tab in suffix.
        while (nlPrefix < text.length && (text.charAt(nlPrefix) == '\n'))
            nlPrefix++;
        while (nlSuffix >= 0 && (text.charAt(nlSuffix) == ' ' || text.charAt(nlSuffix) == '\t'))
            nlSuffix--;
        if (nlSuffix < nlPrefix)
            nlSuffix = nlPrefix;
        if (nlPrefix > 0) {
            funcText.push('if (_FLAGS.keepWhitespace == true) _OUT.write("');
            var s = text.substring(0, nlPrefix).replace('\n', '\\n'); // A macro IE fix from BJessen.
            if (s.charAt(s.length - 1) == '\n')
            	s = s.substring(0, s.length - 1);
            funcText.push(s);
            funcText.push('");');
        }
        var lines = text.substring(nlPrefix, nlSuffix + 1).split('\n');
        for (var i = 0; i < lines.length; i++) {
            emitSectionTextLine(lines[i], funcText);
            if (i < lines.length - 1)
                funcText.push('_OUT.write("\\n");\n');
        }
        if (nlSuffix + 1 < text.length) {
            funcText.push('if (_FLAGS.keepWhitespace == true) _OUT.write("');
            var s = text.substring(nlSuffix + 1).replace('\n', '\\n');
            if (s.charAt(s.length - 1) == '\n')
            	s = s.substring(0, s.length - 1);
            funcText.push(s);
            funcText.push('");');
        }
    }
    var emitSectionTextLine = function(line, funcText) {
        var endMarkPrev = '}';
        var endExprPrev = -1;
        while (endExprPrev + endMarkPrev.length < line.length) {
            var begMark = "${", endMark = "}";
            var begExpr = line.indexOf(begMark, endExprPrev + endMarkPrev.length); // In "a${b}c", begExpr == 1
            if (begExpr < 0)
                break;
            if (line.charAt(begExpr + 2) == '%') {
                begMark = "${%";
                endMark = "%}";
            }
            var endExpr = line.indexOf(endMark, begExpr + begMark.length);         // In "a${b}c", endExpr == 4;
            if (endExpr < 0)
                break;
            emitText(line.substring(endExprPrev + endMarkPrev.length, begExpr), funcText);                
            var exprArr = line.substring(begExpr + begMark.length, endExpr).replace(/\|\|/g, "#@@#").split('|');
            for (var k in exprArr) {
                if (exprArr[k].replace) // IE 5.x fix from Igor Poteryaev.
                    exprArr[k] = exprArr[k].replace(/#@@#/g, '||');
            }
            funcText.push('_OUT.write(');
            emitExpression(exprArr, exprArr.length - 1, funcText); 
            funcText.push(');');
            endExprPrev = endExpr;
            endMarkPrev = endMark;
        }
        emitText(line.substring(endExprPrev + endMarkPrev.length), funcText); 
    }
    var emitText = function(text, funcText) {
        if (text == null ||
            text.length <= 0)
            return;
        text = text.replace(/\\/g, '\\\\');
        text = text.replace(/\n/g, '\\n');
        text = text.replace(/"/g,  '\\"');
        funcText.push('_OUT.write("');
        funcText.push(text);
        funcText.push('");');
    }
    var emitExpression = function(exprArr, index, funcText) {
        var expr = exprArr[index]; // Ex: exprArr == [firstName,capitalize,default:"John Doe"]
        if (index <= 0) {          // Ex: expr    == 'default:"John Doe"'
            funcText.push(expr);
            return;
        }
        var parts = expr.split(':');
        funcText.push('_MODIFIERS["');
        funcText.push(parts[0]); // The parts[0] is a modifier function name, like capitalize.
        funcText.push('"](');
        emitExpression(exprArr, index - 1, funcText);
        if (parts.length > 1) {
            funcText.push(',');
            funcText.push(parts[1]);
        }
        funcText.push(')');
    }
    var cleanWhiteSpace = function(result) {
        result = result.replace(/\t/g,   "    ");
        result = result.replace(/\r\n/g, "\n");
        result = result.replace(/\r/g,   "\n");
        result = result.replace(/^(\s*\S*(\s+\S+)*)\s*$/, '$1'); // Right trim by Igor Poteryaev.
        return result;
    }
    var scrubWhiteSpace = function(result) {
        result = result.replace(/^\s+/g,   "");
        result = result.replace(/\s+$/g,   "");
        result = result.replace(/\s+/g,   " ");
        result = result.replace(/^(\s*\S*(\s+\S+)*)\s*$/, '$1'); // Right trim by Igor Poteryaev.
        return result;
    }
    PodTrimPath.parseDOMTemplate = function(elementId, optDocument, optEtc) {
        if (optDocument == null)
            optDocument = document;
        var element = optDocument.getElementById(elementId);
        var content = element.value;     // Like textarea.value.
        if (content == null)
            content = element.innerHTML; // Like textarea.innerHTML.
        content = content.replace(/&lt;/g, "<").replace(/&gt;/g, ">");
        return PodTrimPath.parseTemplate(content, elementId, optEtc);
    }
    PodTrimPath.processDOMTemplate = function(elementId, context, optFlags, optDocument, optEtc) {
        return PodTrimPath.parseDOMTemplate(elementId, optDocument, optEtc).process(context, optFlags);
    }
}) ();
/* Copyright (c) Pluck Corporation 2008. This software code and related intellectual property are the 
property of Pluck Corporation and are licensed for use solely on designated websites. Any distribution, 
copying, or other use of this intellectual property other than pursuant to a written agreement 
with Pluck Corporation is strictly prohibited. All Rights Reserved.
*/
(function(){
  if (typeof dmpod === 'undefined') {
    dmpod = {};
    dmpod.extendObject = function(obj, source) {
      for (var _var in source) {
        obj[_var] = source[_var];
      }
    }
    dmpod.extend = function(source) { dmpod.extendObject(dmpod, source); };
  };
  if (typeof dmpod.serviceFramework === 'undefined') {
    dmpod.serviceFramework = 1;
    var PODServiceDetails = {
      isIE: (navigator.userAgent.indexOf('MSIE')!= -1 && navigator.userAgent.indexOf('Opera') == -1),
      getHost: function() { 
         var where = document.location.toString();
         if (where.match(/https/i)) {
           return 'https://pluckit.demandmedia.com/';
         } else {
           return 'http://pluckit.demandmedia.com/';
         }
      },
      getAssetsHost: function() { 
         var where = document.location.toString();
         if (where.match(/https/i)) {
           return 'https://pluckit.demandmedia.com/';
         } else {
           return 'http://cdn-docs.pluckit.pluck.com/';
         }
      },
      getServerUrl: function(apiKey, authToken) { var url = this.getHost()+'requests?apiKey=' + apiKey; if (typeof(authToken) !== 'undefined' && authToken != null) { url += '&at=' + escape(authToken); } return url; },
      getFlashTunnelUrl: function(apiKey) { return this.getHost()+'assets/v1/PluckFlashDAPIService.swf?apiKey=' + apiKey; },
      getFlashExpressInstallUrl: function(apiKey) { return this.getHost()+'assets/v1/expressinstall.swf?apiKey=' + apiKey; },
      getFlashFileUploaderUrl: function(apiKey) { return this.getHost()+'assets/v1/PluckItUploader.swf?apiKey=' + apiKey; },
      getFlashClipboardCopierUrl: function(apiKey) { return this.getHost()+'assets/v1/PluckItClipboard.swf?apiKey=' + apiKey; },
      prepareServerRequest: function(requests, service){
        if (requests.constructor != Array) { // handle single requests gracefully
          requests = [requests];
        }
        var envelopes = [];
        for (var i = 0, request; request = requests[i]; i++) {
          var envelope = new dmpod.RequestEnvelope();
          envelope.payloadType = request.objectType;
          envelope.payload = this.JSON.stringify(request);
          envelopes.push(envelope);
        }
        return {
            Envelopes: envelopes,
            returnDiagnostics: (service.debugging.on && service.debugging.firebug),
            executeMethod: requests.hasOwnProperty("executeMethod") ? requests.executeMethod : 'ExecuteAll'
        }
      },
      extractBatchResponse: function(response, service){
        if (typeof(response) == 'string') {
          if (response.indexOf("Envelopes") >= 0 || response.indexOf("envelopes") >= 0) {
            response = this.JSON.parse(response);
          } else {
            return response;
          }
        } else if (!response.hasOwnProperty("Envelopes")) {
          return response;
        }
        if (service.debugging.firebug && response.diagnostics != null) {
          console.group('RECEIVED DIAGNOSTICS FROM SERVER');
          console.dir(response.diagnostics);
          console.groupEnd();
        }
        var batchResponse = { Responses: [] };
        batchResponse.ContentTrackingJavaScript = response.ContentTrackingJavaScript;
        batchResponse.ContentTrackingSrc = response.ContentTrackingSrc;
        for (var i = 0, envelope; envelope = response.Envelopes[i]; i++) {
          batchResponse.Responses.push(this.JSON.parse(envelope.payload));
        }
        return batchResponse;
      },
      JSON: function(){var m={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},s={'boolean':function(x){return String(x);},number:function(x){return isFinite(x)?String(x):'null';},string:function(x){if(/["\\\x00-\x1f]/.test(x)){x=x.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c){return c;}c=b.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);});}return'"'+x+'"';},object:function(x){if(x){var a=[],b,f,i,l,v;if(x instanceof Array){a[0]='[';l=x.length;for(i=0;i<l;i+=1){v=x[i];f=s[typeof v];if(f){v=f(v);if(typeof v=='string'){if(b){a[a.length]=',';}a[a.length]=v;b=true;}}}a[a.length]=']';}else if(x instanceof Object){a[0]='{';for(i in x){v=x[i];f=s[typeof v];if(f){v=f(v);if(typeof v=='string'){if(b){a[a.length]=',';}a.push(s.string(i));a.push(':');a.push(v);b=true;}}}a[a.length]='}';}else{return;}return a.join('');}return'null';}};return{copyright:'(c)2005 JSON.org',license:'http://www.crockford.com/JSON/license.html',stringify:function(v){var f=s[typeof v];if(f){v=f(v);if(typeof v=='string'){return v;}}return null;},eval:function(text){try{return!(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(text.replace(/"(\\.|[^"\\])*"/g,'')))&&eval('('+text+')');}catch(e){return false;}},parse:function(text){var at=0;var ch=' ';function error(m){throw{name:'JSONError',message:m,at:at-1,text:text};}function next(){ch=text.charAt(at);at+=1;return ch;}function white(){while(ch){if(ch<=' '){next();}else if(ch=='/'){switch(next()){case'/':while(next()&&ch!='\n'&&ch!='\r'){}break;case'*':next();for(;;){if(ch){if(ch=='*'){if(next()=='/'){next();break;}}else{next();}}else{error("Unterminated comment");}}break;default:error("Syntax error");}}else{break;}}}function string(){var i,s='',t,u;if(ch=='"'){outer:while(next()){if(ch=='"'){next();return s;}else if(ch=='\\'){switch(next()){case'b':s+='\b';break;case'f':s+='\f';break;case'n':s+='\n';break;case'r':s+='\r';break;case't':s+='\t';break;case'u':u=0;for(i=0;i<4;i+=1){t=parseInt(next(),16);if(!isFinite(t)){break outer;}u=u*16+t;}s+=String.fromCharCode(u);break;default:s+=ch;}}else{s+=ch;}}}error("Bad string");}function array(){var a=[];if(ch=='['){next();white();if(ch==']'){next();return a;}while(ch){a.push(value());white();if(ch==']'){next();return a;}else if(ch!=','){break;}next();white();}}error("Bad array");}function object(){var k,o={};if(ch=='{'){next();white();if(ch=='}'){next();return o;}while(ch){k=string();white();if(ch!=':'){break;}next();o[k]=value();white();if(ch=='}'){next();return o;}else if(ch!=','){break;}next();white();}}error("Bad object");}function number(){var n='',v;if(ch=='-'){n='-';next();}while(ch>='0'&&ch<='9'){n+=ch;next();}if(ch=='.'){n+='.';while(next()&&ch>='0'&&ch<='9'){n+=ch;}}if(ch=='e'||ch=='E'){n+='e';next();if(ch=='-'||ch=='+'){n+=ch;next();}while(ch>='0'&&ch<='9'){n+=ch;next();}}v=+n;if(!isFinite(v)){}else{return v;}}function word(){switch(ch){case't':if(next()=='r'&&next()=='u'&&next()=='e'){next();return true;}break;case'f':if(next()=='a'&&next()=='l'&&next()=='s'&&next()=='e'){next();return false;}break;case'n':if(next()=='u'&&next()=='l'&&next()=='l'){next();return null;}break;}error("Syntax error");}function value(){white();switch(ch){case'{':return object();case'[':return array();case'"':return string();case'-':return number();default:return ch>='0'&&ch<='9'?number():word();}}return value();}};}()
    }
    if (PODServiceDetails.isIE) {
      PODServiceDetails.JSON.parse = function(json) { return eval('('+json+')'); };
    }
    dmpod.createDAAPIRequestService = function(){
      return new PluckItService('00000000-0000-0000-0000-000000000000', DAAPIServiceDetails);
    };
    dmpod.createPODRequestService = function(apiKey) {
      return new PluckItService(apiKey, PODServiceDetails);
    }
    dmpod.createRequestService = function(apiKey) {
      return dmpod.createPODRequestService(apiKey); // default
    }
    dmpod.RequestServiceInstances = {};
    var PluckItService = function(){
      var debugging = 0;
      var match = location.search.match(new RegExp('[\?&]PLUCK_DEBUG=([^&]+)'));
      if (match) {
        debugging = match[1];
      } else if (typeof(_DEBUG) !== 'undefined') {
        debugging = _DEBUG;
      }
      if (debugging != false && debugging != 'false') {
        if (debugging == true || debugging == 'true') {
          debugging = 1;
        }
      } else {
        debugging = 0;
      }
      this.debugging = {
        level: debugging,
        on: debugging > 0,
        alerts: debugging > 1,
        firebug: false
      };
      if (typeof(window.console) !== 'undefined' && typeof(window.console.firebug) !== 'undefined') {
        try {
          if (parseFloat(window.console.firebug) >= 1.05 && document.location.toString().toLowerCase().indexOf('firebug=false') < 0) {
            this.debugging.firebug = true;
          }
        } catch (e) {
        }
      }
      this.init.apply(this, arguments);
    }
    PluckItService.prototype = (function(){
      function $(id){
        if (document.getElementById) {
          return document.getElementById(id);
        }
        if (document.all) {
          return document.all[id];
        }
      }
      var isIE = (navigator.userAgent.indexOf('MSIE')!= -1 && navigator.userAgent.indexOf('Opera') == -1);
      var flashVersion = (function() {
          var versionNumber = 0;
          try {
            if (isIE) {
              try {
                activeXObject = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
                versionVariable = activeXObject.GetVariable('$version');
                versionNumber = versionVariable.match(/win[^\d]+?(\d+)[^\d].*/i)[1];
              } catch(e) {
              }
            }
            for (var i=0; i<navigator.plugins.length; i++) {
              var match = navigator.plugins[i].description.match(/shockwave flash.*?(\d+)[^\d].*/i);
              if (match != null && match.length == 2) {
                var version = parseInt(match[1]);
                if (version > versionNumber) {
                  versionNumber = version;
                }
              }
            }
          } catch(e) {
          }
          return versionNumber;
        })();
      var transport = "flash";
      if (typeof(PLUCKIT_TRANSPORT) !== 'undefined') {
        transport = PLUCKIT_TRANSPORT.toLowerCase();
      }
      var lowerurl = document.location.toString().toLowerCase();
      var m = lowerurl.match(new RegExp('pluckit_transport=([a-z]+)'));
      if (m && m.length > 0) {
        transport = m[1];
      }
      var jsonpmax = 4000;
      if (typeof(PLUCKIT_JSONPMAX) !== 'undefined') {
        jsonpmax = PLUCKIT_JSONPMAX;
      }
      m = lowerurl.match(new RegExp('pluckit_jsonpmax=([0-9]+)'));
      if (m && m.length > 0) {
        jsonpmax = m[1];
      }
      var flashNeeded = false;
      if (transport == "flashonly") {
        flashNeeded = flashVersion < 9;
      }
      return {
        constructor: PluckItService,
        FLASHONLY: "flashonly",
        JSONPONLY: "jsonponly",
        FLASH: "flash",
        JSONP: "jsonp",
        flashReady: false,
        jsonpReady: false,
        transport: transport,
        jsonpmax: jsonpmax,
        isIE: isIE,
        flashVersion: flashVersion, 
        flashNeeded: flashNeeded,
        init: function(apiKey, serviceDetails){
          this.serviceDetails = serviceDetails;
          this.apiKey = apiKey;
          this.requestQueue = [];
          this.instanceID = 'pluckit_' + this.uniqueID()
          this.jsonpCounter = Math.floor(Math.random()*0x7fffffff);
          this.callbackContexts = {};
          var my = this;
          this.initProxy = (function(my){
            return function(){
              var flashObject = document.body.appendChild(document.createElement('div'));
              flashObject.id = 'flashProxy_' + my.instanceID + '_DIV';
              if (my.transport == my.JSONPONLY) {
                flashObject.innerHTML = "&nbsp;";
                return;
              }
              var swfUrl = my.serviceDetails.getFlashTunnelUrl(my.apiKey);
              var swfId = 'flashProxy_' + my.instanceID;
              var swfWidth = '0';
              var swfHeight = '0';
              var swfVersion = '9.0.0';
              var params = {
                autostart: 'true',
                width: swfWidth,
                height: swfHeight,
                allowfullscreen: 'false',
                allowscriptaccess: 'always'
              };
              var attributes = {};
              window[my.instanceID+'flashready'] = function() { my.flashReadyCallback(); };
              window[my.instanceID+'flashstatus'] = function(status) { my.flashReadyCallback(status); };
              var podRevisionNumber = "7034";
              var fvars = 'onLoadCallbackName='+my.instanceID+'flashready&onStatusCallbackName='+my.instanceID+'flashstatus&podRevisionNumber='+podRevisionNumber;
              my.loadFlashCount = 0;
              my.loadFlash = function() {
                if (my.loadFlashCount <= 1) { // allow one addition load
                  my.loadFlashCount++;
                  my.flashReady = false;
                  my.safeEmbedSWF(flashObject, swfId, swfUrl, swfWidth, swfHeight, fvars, swfVersion, my.serviceDetails.getFlashExpressInstallUrl(my.apiKey));
                }
              }
              my.loadFlash();
            };
          })(my);
          this.serverUrl = my.serviceDetails.getServerUrl(my.apiKey,my.getUserAuthToken());
          dmpod.RequestServiceInstances[this.instanceID] = this;
          if (my.transport != my.FLASHONLY) {
            my.jsonpReady = true;
            my.processQueue();
          }
          if (document.body && ((typeof document.readyState == 'undefined') || /loaded|complete/.test(document.readyState))) { // setup the proxy
            this.initProxy();
          } else {
            this.addLoadEvent(this.initProxy);
          }
        },
        debug: function(data) {
          if (this.debugging.on) {
            if (window.opera) {
              opera.postError(data);
            } else if (window.console) {
              console.log(data);
            } else if (this.debugging.alerts) {
              alert(data);
            }
          }
        },
        getSafeEmbedSWFHTML: function(swfId, swfUrl, width, height, flashvars, version, expressInstallUrl) {
          var ie=(navigator.userAgent.indexOf('MSIE')!= -1 && navigator.userAgent.indexOf('Opera') == -1);
          if (ie) {
            return '<OBJECT id='+swfId+' height='+height+' width='+width+' classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000> \
              <PARAM NAME="FlashVars" VALUE="'+flashvars+'">\
              <PARAM NAME="Movie" VALUE="'+swfUrl+'&'+flashvars+'">\
              <PARAM NAME="Src" VALUE="'+swfUrl+'&'+flashvars+'">\
              <PARAM NAME="AllowScriptAccess" VALUE="always">\
              <PARAM NAME="AllowNetworking" VALUE="all">\
              <PARAM NAME="AllowFullScreen" VALUE="false">\
              <PARAM NAME="wmode" VALUE="window">\
              <PARAM NAME="Width" VALUE="'+width+'">\
              <PARAM NAME="Height" VALUE="'+height+'">\
              </OBJECT>';
          } else {
            return '<object id="'+swfId+'" width="'+width+'" height="'+height+'" type="application/x-shockwave-flash" data="'+swfUrl+'" style="visibility: visible;">\
              <param name="autostart" value="true"/>\
              <param name="width" value="'+width+'"/>\
              <param name="height" value="'+height+'"/>\
              <param name="allowfullscreen" value="false"/>\
              <param name="allowscriptaccess" value="always"/>\
              <param name="wmode" value="window"/>\
              <param name="flashvars" value="'+flashvars+'"/>\
              </object>';              
          }
        },
        safeEmbedSWF: function(hostObj, swfId, swfUrl, width, height, flashvars, version, expressInstallUrl) {
          hostObj.innerHTML = this.getSafeEmbedSWFHTML(swfId, swfUrl, width, height, flashvars, version, expressInstallUrl);
        },
        processQueue: function(){
          if (this.requestQueue.length > 0) {
            var func = this.requestQueue.pop();
            if (!func()) {
              this.requestQueue.push(func);
              var self = this;
              setTimeout(function() { self.processQueue(); }, 1000);
            }
          }
        },
        registerCallbackContext: function(context){
          var asyncToken = 'request_' + this.uniqueID();
          this.callbackContexts[asyncToken] = context;
          return asyncToken;
        },
        uniqueID: function() {
          var seed = (new Date()).getTime();
          return Math.floor(Math.random() * seed);// + '_' + Math.floor(Math.random() * seed);
        },
        DownloadUrl: function(serverUrl, queryString, callback){
          var me = this;
          this.requestQueue.push(function(){
            return me.doDownload(serverUrl, queryString, callback);
          });
          this.debug('[DownloadUrl/id:' + this.instanceID + '] queuing request -- total: ' + this.requestQueue.length);
          this.processQueue();
        },
        doDownload: function(serverUrl, queryString, callback){
          if (this.flashReady) {
            var asyncToken = this.registerCallbackContext({ callback: callback });
            if (queryString) {
              queryString = escape(queryString);
            }
            this.flashProxy.DownloadUrl(serverUrl, queryString, 'dmpod.RequestServiceInstances[\'' + this.instanceID + '\'].flashRequestCallback', asyncToken);
            return true;
          }
          return false;
        },
        PostForm: function(serverUrl, queryString, callback){
          var me = this;
          this.requestQueue.push(function(){
            return me.doPost(serverUrl, queryString, callback);
          });
          this.debug('[PostForm/id:' + this.instanceID + '] queuing request -- total: ' + this.requestQueue.length);
          this.processQueue();
        },
        doPost: function(serverUrl, queryString, callback){
          if (this.flashReady) {
            var asyncToken = this.registerCallbackContext({ callback: callback });
            if (queryString) {
              queryString = escape(queryString);
            }
            this.flashProxy.PostForm(serverUrl, queryString, 'dmpod.RequestServiceInstances[\'' + this.instanceID + '\'].flashRequestCallback', asyncToken,document.location.toString());
            return true;
          }
          return false;
        },
        SendRequests: function(requests, callback){
          if (requests) {
            if (requests.constructor != Array) { // handle single requests gracefully
              requests = [requests];
            }
            if (requests.length > 0) {
              var me = this;
              this.requestQueue.push(function() { return me.transmitRequests(requests, callback, false); });
              this.processQueue();
              return;
            }
          }
          this.debug("asked to send 0 requests");
        },
        transmitRequests: function(requests, context, useJsonp){
          if (!context.hasOwnProperty("asyncToken")) {
            context = { isBatchResponse: 1, callback: context }
            context.asyncToken = this.registerCallbackContext(context);
          }
          var method = null;
          if (useJsonp) {
            method = this.JSONP;
          } else {
            var flash = this.flashReady ? (typeof(this.flashProxy.CallDAPI) !== 'undefined') : false;
            var jsonp = this.jsonpReady;
            if (this.transport == this.JSONPONLY) {
              method = jsonp ? this.JSONP : null;
            } else if (this.transport == this.FLASHONLY) {
              method = flash ? this.FLASH : null;
            } else if (this.transport == this.FLASH) {
              if (flash) {
                method = this.FLASH;
              } else if (jsonp) {
                method = this.JSONP;
              }
            } else if (jsonp) {
              method = this.JSONP;
            } else if (flash) {
              method = flash;
            }
            if (method == null) {
              return false;
            }
          }
          context.method = method;
          if (this.debugging.on) {
            if (this.debugging.firebug) {
              console.group(method+': SENDING REQUESTS TO SERVER - %s', context.asyncToken);
              for (var i=0;i<requests.length;i++) { 
                console.group(requests[i].objectType); 
                console.dir(requests[i]);
                console.groupEnd(); 
              }
              console.groupEnd();
              console.time(context.asyncToken);
            }
          }
          if (method == this.FLASH) {
            var jsonRequest = this.serviceDetails.JSON.stringify(this.serviceDetails.prepareServerRequest(requests, this));
            this.flashProxy.CallDAPI(this.serverUrl, jsonRequest, 'dmpod.RequestServiceInstances[\'' + this.instanceID + '\'].flashRequestCallback', context.asyncToken,document.location.toString());
            return true;
          }
          this.buildJsonpRequest(context, requests);
          context.elem = null;
          context.scriptNode = null;
          context.elem = document.getElementsByTagName('head')[0];
          context.scriptNode = document.createElement('script');
          context.scriptNode.type = "text/javascript";
          context.scriptNode.src = this.serverUrl+'&jsonpCallback=dmpod.RequestServiceInstances[\'' + this.instanceID + '\'].jsonpCallback&jsonpContext='+context.asyncToken+'&jsonRequest='+escape(context.jsonRequest);
          context.elem.appendChild(context.scriptNode);
          return true;
        },
        buildJsonpRequest: function(context, requests) {
          var split = 1;
          var pos = requests.length / split;
          var set = requests;
          var maxurl = this.isIE ? 1500 : this.jsonpmax;
          do {
            context.jsonRequest = this.serviceDetails.JSON.stringify(this.serviceDetails.prepareServerRequest(set, this));
            if (set.length > 1) {
              if (escape(context.jsonRequest).length > maxurl && pos > 0) {
                split++;
                pos = requests.length / split;
                set = requests.slice(0, pos);
                context.moreRequests = requests.slice(pos);
              } else {
                break;
              }
            } else {
              break;
            }
          } while (true);
        },
        flashReadyCallback: function(){
          var proxy = $('flashProxy_' + this.instanceID);
          if (proxy != null && typeof(proxy.CallDAPI) !== 'undefined') {
            this.debug('flash is ready');
            this.flashProxy = proxy;
            this.flashReady = true;
            this.processQueue();
          } else {
            this.debug('Flash ready failed!');
          }
        },
        flashStatusCallback: function(status){
          this.debug('flash proxy status: '+status);
        },
        flashRequestCallback: function(successful, response, asyncToken){
          this.processRequestResponse(this.FLASH, successful, response, asyncToken);
        },
        jsonpCallback: function(response, asyncToken){
          var context = this.callbackContexts[asyncToken];
          delete context.elem;
          delete context.scriptNode;
          if (context.hasOwnProperty("response")) {
            context.response.isError = context.response.isError || response.isError;
            context.response.Envelopes = context.response.Envelopes.concat(response.Envelopes);
          } else {
            context.response = response;
          }
          if (context.hasOwnProperty("moreRequests")) {
            var requests = context.moreRequests;
            delete context.moreRequests;
            this.transmitRequests(requests, context, true);
          } else {
            this.processRequestResponse(this.JSONP, true, context.response, asyncToken);
          }
        },
        processRequestResponse: function(transport, successful, response, asyncToken){
          if (this.debugging.on && this.debugging.firebug) { console.timeEnd(asyncToken); }
          try {
            if (!successful) {
              this.onError('Communication error: '+response);
              return;
            }
            var context = this.callbackContexts[asyncToken];
            if (typeof(response) == 'string') {
              response = unescape(response);
            }
            if (context.hasOwnProperty("isBatchResponse")) {
              response = this.serviceDetails.extractBatchResponse(response, this);
              if (this.debugging.on && this.debugging.firebug) {
                console.group(transport+': RECEIVED RESPONSES FROM SERVER - %s', asyncToken);
                for (var i=0;i<response.Responses.length;i++) { console.group(response.Responses[i].objectType); console.dir(response.Responses[i]); console.groupEnd(); }
                console.groupEnd();
              }
            } else {
              this.debug(transport+': RECEIVED DATA FROM SERVER - ', asyncToken);
            }
            context.callback(response);
            delete this.callbackContexts[asyncToken];
          } catch (e) {
            this.onError(e);
            this.debug('exception: ',e.toString());
          }
        },
        addLoadEvent: function(func){
          if (window.addEventListener) 
            window.addEventListener('load', func, false);
          else 
            if (window.attachEvent) 
              window.attachEvent('onload', func);
            else { /* epic fail */
            }
        },
        getClipboardCopierHTML: function(flashId, getClipboardTextCallback, width, height, buttonUrl) {
          var swfUrl = this.serviceDetails.getFlashClipboardCopierUrl(this.apiKey);
          var flashvars = "getClipboardTextCallback="+getClipboardTextCallback+"&buttonUrl="+encodeURIComponent(buttonUrl);
          return this.getSafeEmbedSWFHTML(flashId, swfUrl, width, height, flashvars, '9.0.0', this.serviceDetails.getFlashExpressInstallUrl(this.apiKey));
        },
        getFileUploaderHTML: function(flashId, onLoadCallbackName, width, height, buttonUrl) {
          var swfUrl = this.serviceDetails.getFlashFileUploaderUrl(this.apiKey);
          var flashvars = "onLoadCallbackName="+onLoadCallbackName+"&buttonUrl="+encodeURIComponent(buttonUrl);
          return this.getSafeEmbedSWFHTML(flashId, swfUrl, width, height, flashvars, '9.0.0', this.serviceDetails.getFlashExpressInstallUrl(this.apiKey));
        },
        uploadFile: function(flashId, serverUrl, mediaTypesPrompt, mediaTypesFilter, callerThis, responseCallback, progressCallback) {
          var response = 'callback'+this.uniqueID();
          var progress = 'callback'+this.uniqueID();
          window[response] = function(success, data) {
            responseCallback.apply(callerThis,arguments);
          };
          window[progress] = function(percent) {
            progressCallback.apply(callerThis,arguments);
          };
          document.getElementById(flashId).PerformUpload(serverUrl,mediaTypesPrompt,mediaTypesFilter,response,progress);
        },
        JsonStringify: function(what){
          return this.serviceDetails.JSON.stringify(what);
        },
        JsonParse: function(what){
          return this.serviceDetails.JSON.parse(what);
        },
        getHost: function() {
          return this.serviceDetails.getHost();
        },
        getAssetsHost: function() {
          return this.serviceDetails.getAssetsHost();
        },
        getClientCookieName: function(){
          if (typeof PLUCKIT_CLIENTCOOKIENAME != 'undefined') {
            return PLUCKIT_CLIENTCOOKIENAME;
          } else {
            return 'piat';
          }
        },
        isUserLoggedIn: function(){
          return typeof(this.getUserAuthToken()) !== 'undefined';
        },
        getUserAuthToken: function(){
          var cookies = document.cookie;
          if (cookies) {
            cookies = ";" + cookies + ";";
            var matches = cookies.match(new RegExp(';\\s*' + this.getClientCookieName() + '=(.+?);'));
            if (matches && matches.length > 1) {
              return matches[1];
            }
          }
        },
        setUserAuthToken: function(token){
          if (token) {
            document.cookie = this.getClientCookieName() + '=' + escape(token) + '; path=/;';
          } else {
            var d = new Date();
            d.setTime(d.getTime() - 86400000 /* 1 earth day */);
            document.cookie = this.getClientCookieName() + '=; expires=' + d.toGMTString() + '; path=/;';
            ;
          }
          this.serverUrl = this.serviceDetails.getServerUrl(this.apiKey,escape(token));
        },
        getCookieValue: function(cookieName){
          var cookies = document.cookie;
          if (cookies) {
            cookies = ";" + cookies + ";";
            var matches = cookies.match(new RegExp(';\\s*' + cookieName + '=(.+?);'));
            if (matches && matches.length > 1) {
              return matches[1];
            }
          }
        },
        setCookieValue: function(cookieName, cookieValue, expiresDay){
            var d = new Date();
            d.setTime(d.getTime() + (expiresDay * 86400000));        
            document.cookie = cookieName + '=' + cookieValue + '; expires=' + d.toGMTString();
        },        
        changeApiKey: function(apiKey){
          this.apiKey = apiKey;
          this.serverUrl = this.serviceDetails.getServerUrl(this.apiKey,this.getUserAuthToken());
        },
        onError: function(e){
          this.debug('Error: ' + e);
          if (this.debugging.on && this.debugging.firebug) {
            console.trace();
          }
        }
      };
    })();
  }
})();
(function() {
  /* Demand Media Javascript Library Request Objects */
  dmpod.extend({
    UpdateContentSourceRequest: function(contentSource) {
      this.contentSource = contentSource;
      this.callerSDK = 'js';
      this.objectType = 'Admin.UpdateContentSourceRequest';
    },
    UpdateCustomerUserContentModeRequest: function(userContentMode) {
      this.userContentMode = userContentMode;
      this.callerSDK = 'js';
      this.objectType = 'Admin.UpdateCustomerUserContentModeRequest';
    },
    UpdateCustomerSDKAccessRequest: function(sdkAccessAllowed) {
      this.sdkAccessAllowed = sdkAccessAllowed;
      this.callerSDK = 'js';
      this.objectType = 'Admin.UpdateCustomerSDKAccessRequest';
    },
    UpdateCustomerSocialMediaAccessRequest: function(socialMediaEnabled) {
      this.socialMediaEnabled = socialMediaEnabled;
      this.callerSDK = 'js';
      this.objectType = 'Admin.UpdateCustomerSocialMediaAccessRequest';
    },
    UpdateCustomerSupportInfoRequest: function() {
      this.callerSDK = 'js';
      this.objectType = 'Admin.UpdateCustomerSupportInfoRequest';
    },
    UpdateCustomerNetworkRequest: function(publisherNetwork) {
      this.publisherNetwork = publisherNetwork;
      this.callerSDK = 'js';
      this.objectType = 'Admin.UpdateCustomerNetworkRequest';
    },
    GetAllContentSourcesRequest: function() {
      this.callerSDK = 'js';
      this.objectType = 'Admin.GetAllContentSourcesRequest';
    },
    MakeUserPluckAdminRequest: function(password, userKey) {
      this.password = password;
      this.userKey = userKey;
      this.callerSDK = 'js';
      this.objectType = 'Admin.MakeUserPluckAdminRequest';
    },
    GetCaptchaInfoRequest: function(width, height) {
      this.width = width;
      this.height = height;
      this.callerSDK = 'js';
      this.objectType = 'Admin.GetCaptchaInfoRequest';
    },
    UpdateAllowedContentSourcesForWriteRequest: function(userKey, contentSourceKeys) {
      this.userKey = userKey;
      this.contentSourceKeys = contentSourceKeys;
      this.callerSDK = 'js';
      this.objectType = 'Admin.UpdateAllowedContentSourcesForWriteRequest';
    },
    UpdateAllowedContentSourcesForReadRequest: function(contentSourceKeys) {
      this.contentSourceKeys = contentSourceKeys;
      this.callerSDK = 'js';
      this.objectType = 'Admin.UpdateAllowedContentSourcesForReadRequest';
    },
    GenerateNewCustomerKeyRequest: function() {
      this.callerSDK = 'js';
      this.objectType = 'Admin.GenerateNewCustomerKeyRequest';
    },
    GetKeyForUserRequest: function(userEmail) {
      this.userEmail = userEmail;
      this.callerSDK = 'js';
      this.objectType = 'Admin.GetKeyForUserRequest';
    },
    GetLoginTokenRequest: function(userEmail, password) {
      this.userEmail = userEmail;
      this.password = password;
      this.callerSDK = 'js';
      this.objectType = 'Admin.GetLoginTokenRequest';
    },
    VerifyUsersPublisherNetworkRequest: function(network) {
      this.network = network;
      this.callerSDK = 'js';
      this.objectType = 'Admin.VerifyUsersPublisherNetworkRequest';
    },
    UnlockUserRequest: function(userEmail, newPassword) {
      this.userEmail = userEmail;
      this.newPassword = newPassword;
      this.callerSDK = 'js';
      this.objectType = 'Admin.UnlockUserRequest';
    },
    GetApiKeysRequest: function() {
      this.callerSDK = 'js';
      this.objectType = 'Admin.GetApiKeysRequest';
    },
    GetAssociatedCustomersRequest: function() {
      this.callerSDK = 'js';
      this.objectType = 'Admin.GetAssociatedCustomersRequest';
    },
    RegisterUserRequest: function(displayName, userEmail, password) {
      this.displayName = displayName;
      this.userEmail = userEmail;
      this.password = password;
      this.callerSDK = 'js';
      this.objectType = 'Admin.RegisterUserRequest';
    },
    MakeUserCustomerAdminRequest: function(userKey, apiKey) {
      this.userKey = userKey;
      this.apiKey = apiKey;
      this.callerSDK = 'js';
      this.objectType = 'Admin.MakeUserCustomerAdminRequest';
    },
    ResetPasswordRequest: function(userEmail) {
      this.userEmail = userEmail;
      this.callerSDK = 'js';
      this.objectType = 'Admin.ResetPasswordRequest';
    },
    ChangePasswordRequest: function(userKey, oldPassword, newPassword) {
      this.userKey = userKey;
      this.oldPassword = oldPassword;
      this.newPassword = newPassword;
      this.callerSDK = 'js';
      this.objectType = 'Admin.ChangePasswordRequest';
    },
    GetEnabledDomainsForCustomerRequest: function() {
      this.callerSDK = 'js';
      this.objectType = 'Admin.GetEnabledDomainsForCustomerRequest';
    },
    EnableDomainForCustomerRequest: function(domain) {
      this.domain = domain;
      this.callerSDK = 'js';
      this.objectType = 'Admin.EnableDomainForCustomerRequest';
    },
    DisableDomainForCustomerRequest: function(domain) {
      this.domain = domain;
      this.callerSDK = 'js';
      this.objectType = 'Admin.DisableDomainForCustomerRequest';
    },
    AddDomainToExceptionListRequest: function(exceptionList, domain, reason) {
      this.exceptionList = exceptionList;
      this.domain = domain;
      this.reason = reason;
      this.callerSDK = 'js';
      this.objectType = 'Admin.AddDomainToExceptionListRequest';
    },
    RemoveDomainFromExceptionListRequest: function(exceptionList, domain) {
      this.exceptionList = exceptionList;
      this.domain = domain;
      this.callerSDK = 'js';
      this.objectType = 'Admin.RemoveDomainFromExceptionListRequest';
    },
    CreateBundleTemplateListRequest: function(name) {
      this.name = name;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.CreateBundleTemplateListRequest';
    },
    GetBundleTemplateListRequest: function(bundleTemplateListKey) {
      this.bundleTemplateListKey = bundleTemplateListKey;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.GetBundleTemplateListRequest';
    },
    MoveBundleTemplateListRequest: function(bundleTemplateListKey, parentKey) {
      this.bundleTemplateListKey = bundleTemplateListKey;
      this.parentKey = parentKey;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.MoveBundleTemplateListRequest';
    },
    UpdateBundleTemplateAliasRequest: function(aliasKey, bundleTemplateKey) {
      this.aliasKey = aliasKey;
      this.bundleTemplateKey = bundleTemplateKey;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.UpdateBundleTemplateAliasRequest';
    },
    DeleteBundleTemplateAliasRequest: function(aliasKey) {
      this.aliasKey = aliasKey;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.DeleteBundleTemplateAliasRequest';
    },
    GetBundleTemplateAliasesRequest: function(bundleTemplateKey) {
      this.bundleTemplateKey = bundleTemplateKey;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.GetBundleTemplateAliasesRequest';
    },
    UpdateBundleTemplateListRequest: function(bundleTemplateListKey, name) {
      this.bundleTemplateListKey = bundleTemplateListKey;
      this.name = name;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.UpdateBundleTemplateListRequest';
    },
    DeleteBundleTemplateListRequest: function(bundleTemplateListKey) {
      this.bundleTemplateListKey = bundleTemplateListKey;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.DeleteBundleTemplateListRequest';
    },
    MoveBundleTemplateRequest: function(bundleTemplateKey, parentKey) {
      this.bundleTemplateKey = bundleTemplateKey;
      this.parentKey = parentKey;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.MoveBundleTemplateRequest';
    },
    CreateBundleTemplateRequest: function(parentKey, name, criteria) {
      this.parentKey = parentKey;
      this.name = name;
      this.criteria = criteria;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.CreateBundleTemplateRequest';
    },
    UpdateBundleTemplateRequest: function(bundleTemplateKey, name, criteria) {
      this.bundleTemplateKey = bundleTemplateKey;
      this.name = name;
      this.criteria = criteria;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.UpdateBundleTemplateRequest';
    },
    UpdateCustomDataRequest: function(key, customData) {
      if (key.constructor != dmpod.BaseKey) {
        var typeName = (typeof key.objectType == 'string') && key.objectType.split('.')[1],
            key = new dmpod.BaseKey(key.key, typeName || null);
      }
      this.key = key;
      this.customData = customData;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.UpdateCustomDataRequest';
    },
    DeleteBundleTemplateRequest: function(bundleTemplateKey) {
      this.bundleTemplateKey = bundleTemplateKey;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.DeleteBundleTemplateRequest';
    },
    GetBundleTemplateRequest: function(bundleTemplateKey) {
      this.bundleTemplateKey = bundleTemplateKey;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.GetBundleTemplateRequest';
    },
    GetBundleTemplateByAliasRequest: function(aliasKey) {
      this.aliasKey = aliasKey;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.GetBundleTemplateByAliasRequest';
    },
    GetBundleRequest: function(bundleId) {
      this.bundleId = bundleId;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.GetBundleRequest';
    },
    DeleteContentActionRequest: function(deleteThisContentKey) {
      if (deleteThisContentKey.constructor != dmpod.BaseKey) {
        var typeName = (typeof deleteThisContentKey.objectType == 'string') && deleteThisContentKey.objectType.split('.')[1],
            deleteThisContentKey = new dmpod.BaseKey(deleteThisContentKey.key, typeName || null);
      }
      this.deleteThisContentKey = deleteThisContentKey;
      this.callerSDK = 'js';
      this.objectType = 'Common.DeleteContentActionRequest';
    },
    HardDeleteContentActionRequest: function(deleteThisContentKey) {
      if (deleteThisContentKey.constructor != dmpod.BaseKey) {
        var typeName = (typeof deleteThisContentKey.objectType == 'string') && deleteThisContentKey.objectType.split('.')[1],
            deleteThisContentKey = new dmpod.BaseKey(deleteThisContentKey.key, typeName || null);
      }
      this.deleteThisContentKey = deleteThisContentKey;
      this.callerSDK = 'js';
      this.objectType = 'Common.HardDeleteContentActionRequest';
    },
    GetArticlesRelatedToUrlRequest: function(url) {
      this.url = url;
      this.callerSDK = 'js';
      this.objectType = 'Content.GetArticlesRelatedToUrlRequest';
    },
    GetArticlesRelatedToArticleRequest: function(articleId) {
      this.articleId = articleId;
      this.callerSDK = 'js';
      this.objectType = 'Content.GetArticlesRelatedToArticleRequest';
    },
    GetArticlesRelatedToTagRequest: function(tag) {
      this.tag = tag;
      this.callerSDK = 'js';
      this.objectType = 'Content.GetArticlesRelatedToTagRequest';
    },
    GetArticlesRelatedToTextRequest: function(text) {
      this.text = text;
      this.callerSDK = 'js';
      this.objectType = 'Content.GetArticlesRelatedToTextRequest';
    },
    GetTagsForUrlRequest: function(url) {
      this.url = url;
      this.callerSDK = 'js';
      this.objectType = 'Content.GetTagsForUrlRequest';
    },
    GetTagsForArticleRequest: function(articleId) {
      this.articleId = articleId;
      this.callerSDK = 'js';
      this.objectType = 'Content.GetTagsForArticleRequest';
    },
    GetTagsForTagRequest: function(tag) {
      this.tag = tag;
      this.callerSDK = 'js';
      this.objectType = 'Content.GetTagsForTagRequest';
    },
    GetTagsForTextRequest: function(text) {
      this.text = text;
      this.callerSDK = 'js';
      this.objectType = 'Content.GetTagsForTextRequest';
    },
    GetPublisherLinksRelatedToUrlRequest: function(linkSource, url) {
      this.linkSource = linkSource;
      this.url = url;
      this.callerSDK = 'js';
      this.objectType = 'Content.GetPublisherLinksRelatedToUrlRequest';
    },
    GetPublisherLinksRelatedToArticleRequest: function(linkSource, articleId) {
      this.linkSource = linkSource;
      this.articleId = articleId;
      this.callerSDK = 'js';
      this.objectType = 'Content.GetPublisherLinksRelatedToArticleRequest';
    },
    GetPublisherLinksRelatedToTagRequest: function(linkSource, tag) {
      this.linkSource = linkSource;
      this.tag = tag;
      this.callerSDK = 'js';
      this.objectType = 'Content.GetPublisherLinksRelatedToTagRequest';
    },
    GetPublisherLinksRelatedToTextRequest: function(linkSource, text) {
      this.linkSource = linkSource;
      this.text = text;
      this.callerSDK = 'js';
      this.objectType = 'Content.GetPublisherLinksRelatedToTextRequest';
    },
    GetAdsForArticleRequest: function(articleId, adFormats) {
      this.articleId = articleId;
      this.adFormats = adFormats;
      this.callerSDK = 'js';
      this.objectType = 'Content.GetAdsForArticleRequest';
    },
    GetAdsRequest: function(adFormats) {
      this.adFormats = adFormats;
      this.callerSDK = 'js';
      this.objectType = 'Content.GetAdsRequest';
    },
    GetSponsoredLinksRequest: function(numberOfLinks) {
      this.numberOfLinks = numberOfLinks;
      this.callerSDK = 'js';
      this.objectType = 'Content.GetSponsoredLinksRequest';
    },
    GetRelatedAdLinksRequest: function(pageUrl) {
      this.pageUrl = pageUrl;
      this.callerSDK = 'js';
      this.objectType = 'Content.GetRelatedAdLinksRequest';
    },
    GetArticleRequest: function(articleId) {
      this.articleId = articleId;
      this.callerSDK = 'js';
      this.objectType = 'Content.GetArticleRequest';
    },
    GetExternalUrlContentRequest: function(contentLabel, relativePath) {
      this.contentLabel = contentLabel;
      this.relativePath = relativePath;
      this.callerSDK = 'js';
      this.objectType = 'Content.GetExternalUrlContentRequest';
    },
    GetContentCategoriesRequest: function() {
      this.callerSDK = 'js';
      this.objectType = 'Content.GetContentCategoriesRequest';
    },
    SearchArticlesRequest: function(query) {
      this.query = query;
      this.callerSDK = 'js';
      this.objectType = 'Content.SearchArticlesRequest';
    },
    SearchArticlesFilteredRequest: function(query) {
      this.query = query;
      this.callerSDK = 'js';
      this.objectType = 'Content.SearchArticlesFilteredRequest';
    },
    BlockArticleRequest: function(articleKey) {
      this.articleKey = articleKey;
      this.callerSDK = 'js';
      this.objectType = 'Content.BlockArticleRequest';
    },
    BlockPublisherLinkRequest: function(publisherLinkKey) {
      this.publisherLinkKey = publisherLinkKey;
      this.callerSDK = 'js';
      this.objectType = 'Content.BlockPublisherLinkRequest';
    },
    FindArticlesByKeywordsRequest: function(keywords, criteria) {
      this.keywords = keywords;
      this.criteria = criteria;
      this.callerSDK = 'js';
      this.objectType = 'Content.FindArticlesByKeywordsRequest';
    },
    FindArticlesSimilarToTextRequest: function(text, criteria) {
      this.text = text;
      this.criteria = criteria;
      this.callerSDK = 'js';
      this.objectType = 'Content.FindArticlesSimilarToTextRequest';
    },
    FindArticlesSimilarToArticleRequest: function(articleKey, criteria) {
      this.articleKey = articleKey;
      this.criteria = criteria;
      this.callerSDK = 'js';
      this.objectType = 'Content.FindArticlesSimilarToArticleRequest';
    },
    UpdateArticleRequest: function(publisherId, contentSourceKey, title, content, url, thumbnailUrl) {
      this.publisherId = publisherId;
      this.contentSourceKey = contentSourceKey;
      this.title = title;
      this.content = content;
      this.url = url;
      this.thumbnailUrl = thumbnailUrl;
      this.callerSDK = 'js';
      this.objectType = 'ContentRegistry.UpdateArticleRequest';
    },
    GetArticleByPublisherIdRequest: function(sourceKey, publisherId) {
      this.sourceKey = sourceKey;
      this.publisherId = publisherId;
      this.callerSDK = 'js';
      this.objectType = 'ContentRegistry.GetArticleByPublisherIdRequest';
    },
    RegisterUsersCustomerAccountRequest: function(apiKey, domain, customerType, publisherNetwork, inlineTextAdsAllowed, userContentMode, mpaaRating, captchaId, captchaText) {
      this.apiKey = apiKey;
      this.domain = domain;
      this.customerType = customerType;
      this.publisherNetwork = publisherNetwork;
      this.inlineTextAdsAllowed = inlineTextAdsAllowed;
      this.userContentMode = userContentMode;
      this.mpaaRating = mpaaRating;
      this.captchaId = captchaId;
      this.captchaText = captchaText;
      this.callerSDK = 'js';
      this.objectType = 'Customers.RegisterUsersCustomerAccountRequest';
    },
    GetCustomerRequest: function() {
      this.callerSDK = 'js';
      this.objectType = 'Customers.GetCustomerRequest';
    },
    GetCustomerByResellerIdRequest: function(publisherNetwork, publisherSubNetwork, resellerCustomerId) {
      this.publisherNetwork = publisherNetwork;
      this.publisherSubNetwork = publisherSubNetwork;
      this.resellerCustomerId = resellerCustomerId;
      this.callerSDK = 'js';
      this.objectType = 'Customers.GetCustomerByResellerIdRequest';
    },
    UpdateCustomerRequest: function(domain) {
      this.domain = domain;
      this.callerSDK = 'js';
      this.objectType = 'Customers.UpdateCustomerRequest';
    },
    UpdateCustomerAdDetailsRequest: function(inlineTextAdsAllowed, sponsoredLinksAllowed) {
      this.inlineTextAdsAllowed = inlineTextAdsAllowed;
      this.sponsoredLinksAllowed = sponsoredLinksAllowed;
      this.callerSDK = 'js';
      this.objectType = 'Customers.UpdateCustomerAdDetailsRequest';
    },
    UpdateCustomerDeploymentDetailsRequest: function() { /* This function has been deprecated. */
      this.callerSDK = 'js';
      this.objectType = 'Customers.UpdateCustomerDeploymentDetailsRequest';
    },
    UpdateCustomerPlatformRequest: function(platform) {
      this.platform = platform;
      this.callerSDK = 'js';
      this.objectType = 'Customers.UpdateCustomerPlatformRequest';
    },
    UpdateCustomerLandingPageUrlRequest: function(widgetLandingPageUrl, forDomain) {
      this.widgetLandingPageUrl = widgetLandingPageUrl;
      this.forDomain = forDomain;
      this.callerSDK = 'js';
      this.objectType = 'Customers.UpdateCustomerLandingPageUrlRequest';
    },
    ClearCustomerLandingPageUrlRequest: function(forDomain) {
      this.forDomain = forDomain;
      this.callerSDK = 'js';
      this.objectType = 'Customers.ClearCustomerLandingPageUrlRequest';
    },
    UseGlobalDefaultLandingPageUrlRequest: function() {
      this.callerSDK = 'js';
      this.objectType = 'Customers.UseGlobalDefaultLandingPageUrlRequest';
    },
    GetCustomerLandingPageUrlsRequest: function() {
      this.callerSDK = 'js';
      this.objectType = 'Customers.GetCustomerLandingPageUrlsRequest';
    },
    UpdateAdNetworksRequest: function(activeAdNetworks, adNetworkDetails) {
      this.activeAdNetworks = activeAdNetworks;
      this.adNetworkDetails = adNetworkDetails;
      this.callerSDK = 'js';
      this.objectType = 'Customers.UpdateAdNetworksRequest';
    },
    GetAdNetworksRequest: function() {
      this.callerSDK = 'js';
      this.objectType = 'Customers.GetAdNetworksRequest';
    },
    UpdatePaymentSystemsRequest: function() {
      this.callerSDK = 'js';
      this.objectType = 'Customers.UpdatePaymentSystemsRequest';
    },
    GetPaymentSystemsRequest: function() {
      this.callerSDK = 'js';
      this.objectType = 'Customers.GetPaymentSystemsRequest';
    },
    GetCustomerSearchRecordsRequest: function(numberPerPage, onPage, sort) {
      this.numberPerPage = numberPerPage;
      this.onPage = onPage;
      this.sort = sort;
      this.callerSDK = 'js';
      this.objectType = 'Customers.GetCustomerSearchRecordsRequest';
    },
    GetUserRequest: function() {
      this.callerSDK = 'js';
      this.objectType = 'Users.GetUserRequest';
    },
    UpdateUserRequest: function(displayName) {
      this.displayName = displayName;
      this.callerSDK = 'js';
      this.objectType = 'Users.UpdateUserRequest';
    },
    BlockUserRequest: function(userKey) {
      this.userKey = userKey;
      this.callerSDK = 'js';
      this.objectType = 'Users.BlockUserRequest';
    },
    CheckDomainAgainstExceptionListRequest: function(exceptionList, domain) {
      this.exceptionList = exceptionList;
      this.domain = domain;
      this.callerSDK = 'js';
      this.objectType = 'Customers.CheckDomainAgainstExceptionListRequest';
    },
    GetMediaItemRequest: function(mediaItemKey) {
      this.mediaItemKey = mediaItemKey;
      this.callerSDK = 'js';
      this.objectType = 'Media.GetMediaItemRequest';
    },
    GetMediaGalleryRequest: function(mediaGalleryKey) {
      this.mediaGalleryKey = mediaGalleryKey;
      this.callerSDK = 'js';
      this.objectType = 'Media.GetMediaGalleryRequest';
    },
    GetMediaItemPageRequest: function(mediaGalleryKey, submissionState, numberPerPage, onPage, sort) {
      this.mediaGalleryKey = mediaGalleryKey;
      this.submissionState = submissionState;
      this.numberPerPage = numberPerPage;
      this.onPage = onPage;
      this.sort = sort;
      this.callerSDK = 'js';
      this.objectType = 'Media.GetMediaItemPageRequest';
    },
    UpdateMediaItemActionRequest: function(mediaItemKey, title, description, tags, attribution, attributionDate, attributionEmail) {
      this.mediaItemKey = mediaItemKey;
      this.title = title;
      this.description = description;
      this.tags = tags;
      this.attribution = attribution;
      this.attributionDate = attributionDate;
      this.attributionEmail = attributionEmail;
      this.callerSDK = 'js';
      this.objectType = 'Media.UpdateMediaItemActionRequest';
    },
    UpdateMediaGalleryActionRequest: function(mediaGalleryKey, title, description, tags) {
      this.mediaGalleryKey = mediaGalleryKey;
      this.title = title;
      this.description = description;
      this.tags = tags;
      this.callerSDK = 'js';
      this.objectType = 'Media.UpdateMediaGalleryActionRequest';
    },
    UpdateMediaGalleryPromotionActionRequest: function(mediaGalleryKey, mediaItemKey) {
      this.mediaGalleryKey = mediaGalleryKey;
      this.mediaItemKey = mediaItemKey;
      this.callerSDK = 'js';
      this.objectType = 'Media.UpdateMediaGalleryPromotionActionRequest';
    },
    UpdateMediaStateActionRequest: function(mediaGalleryKey, mediaItemKey, submissionState) {
      this.mediaGalleryKey = mediaGalleryKey;
      this.mediaItemKey = mediaItemKey;
      this.submissionState = submissionState;
      this.callerSDK = 'js';
      this.objectType = 'Media.UpdateMediaStateActionRequest';
    },
    UpdateMediaPositionActionRequest: function(moveThisMediaItemKey, moveBeforeMediaItemKey) {
      this.moveThisMediaItemKey = moveThisMediaItemKey;
      this.moveBeforeMediaItemKey = moveBeforeMediaItemKey;
      this.callerSDK = 'js';
      this.objectType = 'Media.UpdateMediaPositionActionRequest';
    },
    CommentOnRequest: function(reactionTargetKey, body) {
      if (reactionTargetKey.constructor != dmpod.BaseKey) {
        var typeName = (typeof reactionTargetKey.objectType == 'string') && reactionTargetKey.objectType.split('.')[1],
            reactionTargetKey = new dmpod.BaseKey(reactionTargetKey.key, typeName || null);
      }
      this.reactionTargetKey = reactionTargetKey;
      this.body = body;
      this.callerSDK = 'js';
      this.objectType = 'Reactions.CommentOnRequest';
    },
    GetCommentPageRequest: function(reactionTargetKey, numberPerPage, onPage, sort) {
      if (reactionTargetKey.constructor != dmpod.BaseKey) {
        var typeName = (typeof reactionTargetKey.objectType == 'string') && reactionTargetKey.objectType.split('.')[1],
            reactionTargetKey = new dmpod.BaseKey(reactionTargetKey.key, typeName || null);
      }
      this.reactionTargetKey = reactionTargetKey;
      this.numberPerPage = numberPerPage;
      this.onPage = onPage;
      this.sort = sort;
      this.callerSDK = 'js';
      this.objectType = 'Reactions.GetCommentPageRequest';
    },
    GetReactionSummaryRequest: function(reactionTargetKey) {
      if (reactionTargetKey.constructor != dmpod.BaseKey) {
        var typeName = (typeof reactionTargetKey.objectType == 'string') && reactionTargetKey.objectType.split('.')[1],
            reactionTargetKey = new dmpod.BaseKey(reactionTargetKey.key, typeName || null);
      }
      this.reactionTargetKey = reactionTargetKey;
      this.callerSDK = 'js';
      this.objectType = 'Reactions.GetReactionSummaryRequest';
    },
    RecommendRequest: function(reactionTargetKey, recommendationCategory) {
      if (reactionTargetKey.constructor != dmpod.BaseKey) {
        var typeName = (typeof reactionTargetKey.objectType == 'string') && reactionTargetKey.objectType.split('.')[1],
            reactionTargetKey = new dmpod.BaseKey(reactionTargetKey.key, typeName || null);
      }
      this.reactionTargetKey = reactionTargetKey;
      this.recommendationCategory = (typeof recommendationCategory != 'undefined' ? recommendationCategory : '');
      this.callerSDK = 'js';
      this.objectType = 'Reactions.RecommendRequest';
    },
    ReportAbuseOnRequest: function(reactionTargetKey, abuseReason) {
      if (reactionTargetKey.constructor != dmpod.BaseKey) {
        var typeName = (typeof reactionTargetKey.objectType == 'string') && reactionTargetKey.objectType.split('.')[1],
            reactionTargetKey = new dmpod.BaseKey(reactionTargetKey.key, typeName || null);
      }
      this.reactionTargetKey = reactionTargetKey;
      this.abuseReason = abuseReason;
      this.callerSDK = 'js';
      this.objectType = 'Reactions.ReportAbuseOnRequest';
    },
    ClearAbuseReportRequest: function(reactionTargetKey) {
      if (reactionTargetKey.constructor != dmpod.BaseKey) {
        var typeName = (typeof reactionTargetKey.objectType == 'string') && reactionTargetKey.objectType.split('.')[1],
            reactionTargetKey = new dmpod.BaseKey(reactionTargetKey.key, typeName || null);
      }
      this.reactionTargetKey = reactionTargetKey;
      this.callerSDK = 'js';
      this.objectType = 'Reactions.ClearAbuseReportRequest';
    },
    GetAbuseReportPageRequest: function(numberPerPage, onPage, maxReportersPerReport) {
      this.numberPerPage = numberPerPage;
      this.onPage = onPage;
      this.maxReportersPerReport = maxReportersPerReport;
      this.callerSDK = 'js';
      this.objectType = 'Reactions.GetAbuseReportPageRequest';
    },
    GetAbuseReportRequest: function(reactionTargetKey, maxReporters) {
      if (reactionTargetKey.constructor != dmpod.BaseKey) {
        var typeName = (typeof reactionTargetKey.objectType == 'string') && reactionTargetKey.objectType.split('.')[1],
            reactionTargetKey = new dmpod.BaseKey(reactionTargetKey.key, typeName || null);
      }
      this.reactionTargetKey = reactionTargetKey;
      this.maxReporters = maxReporters;
      this.callerSDK = 'js';
      this.objectType = 'Reactions.GetAbuseReportRequest';
    },
    DiscoverArticlesRequest: function(activity, age) {
      this.activity = activity;
      this.age = age;
      this.callerSDK = 'js';
      this.objectType = 'Discovery.DiscoverArticlesRequest';
    },
    DiscoverUsersRequest: function(activity, age) {
      this.activity = activity;
      this.age = age;
      this.callerSDK = 'js';
      this.objectType = 'Discovery.DiscoverUsersRequest';
    },
    UserRecentActivityRequest: function(userKey) {
      this.userKey = userKey;
      this.callerSDK = 'js';
      this.objectType = 'Reactions.UserRecentActivityRequest';
    },
    GetPublisherMonthlyReportRequest: function(month, year, apiKey) {
      this.month = month;
      this.year = year;
      this.apiKey = apiKey;
      this.callerSDK = 'js';
      this.objectType = 'Reporting.GetPublisherMonthlyReportRequest';
    },
    EchoRequest: function(message) {
      this.message = message;
      this.callerSDK = 'js';
      this.objectType = 'Util.EchoRequest';
    },
    ErrorRequest: function() {
      this.callerSDK = 'js';
      this.objectType = 'Util.ErrorRequest';
    }
  });
})();
(function() {
  /* Demand Media Javascript Library Model Objects */
  dmpod.extend({
    AdNetworkDetails: function() {
      this.callerSDK = 'js';
      this.objectType = 'AdNetworks.AdNetworkDetails';
    },
    AdDescription: function(width, height) {
      this.width = width;
      this.height = height;
      this.callerSDK = 'js';
      this.objectType = 'AdNetworks.AdDescription';
    },
    Advertisement: function(adDescription, source) {
      this.adDescription = adDescription;
      this.source = source;
      this.callerSDK = 'js';
      this.objectType = 'AdNetworks.Advertisement';
    },
    SponsoredLink: function(title, description, url, clickUrl) {
      this.title = title;
      this.description = description;
      this.url = url;
      this.clickUrl = clickUrl;
      this.callerSDK = 'js';
      this.objectType = 'AdNetworks.SponsoredLink';
    },
    RelatedAdLink: function(searchTerm, searchToken, searchLinkType, searchLinkRank, searchLinkIsGeneric) {
      this.searchTerm = searchTerm;
      this.searchToken = searchToken;
      this.searchLinkType = searchLinkType;
      this.searchLinkRank = searchLinkRank;
      this.searchLinkIsGeneric = searchLinkIsGeneric;
      this.callerSDK = 'js';
      this.objectType = 'AdNetworks.RelatedAdLink';
    },
    RelatedAdResultLink: function(title, description, displayUrl, clickUrl) {
      this.title = title;
      this.description = description;
      this.displayUrl = displayUrl;
      this.clickUrl = clickUrl;
      this.callerSDK = 'js';
      this.objectType = 'AdNetworks.RelatedAdResultLink';
    },
    BundleTemplateListKey: function(key) {
      this.key = key;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.BundleTemplateListKey';
    },
    BundleTemplateList: function(parentKey, key, name) {
      this.parentKey = parentKey;
      this.key = key;
      this.name = name;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.BundleTemplateList';
    },
    BundleTemplateKey: function(key) {
      this.key = key;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.BundleTemplateKey';
    },
    BundleTemplate: function(parentListKey, key, name, criteria) {
      this.parentListKey = parentListKey;
      this.key = key;
      this.name = name;
      this.criteria = criteria;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.BundleTemplate';
    },
    BundleTemplateAliasKey: function(key) {
      this.key = key;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.BundleTemplateAliasKey';
    },
    BundleTemplateAlias: function(bundleTemplateKey) {
      this.bundleTemplateKey = bundleTemplateKey;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.BundleTemplateAlias';
    },
    Bundle: function(templateKey) {
      this.templateKey = templateKey;
      this.callerSDK = 'js';
      this.objectType = 'Bundles.Bundle';
    },
    Article: function(key, id) {
      this.key = key;
      this.id = id;
      this.callerSDK = 'js';
      this.objectType = 'Content.Article';
    },
    Tag: function(name) {
      this.name = name;
      this.callerSDK = 'js';
      this.objectType = 'Content.Tag';
    },
    ArticleKey: function(key) {
      this.key = key;
      this.callerSDK = 'js';
      this.objectType = 'Content.ArticleKey';
    },
    PublisherContentKey: function(key) {
      this.key = key;
      this.callerSDK = 'js';
      this.objectType = 'Content.PublisherContentKey';
    },
    ContentCategory: function(id, name) {
      this.id = id;
      this.name = name;
      this.callerSDK = 'js';
      this.objectType = 'Content.ContentCategory';
    },
    RelatedLink: function(title, url, key) {
      this.title = title;
      this.url = url;
      this.key = key;
      this.callerSDK = 'js';
      this.objectType = 'Content.RelatedLink';
    },
    QueryCriteria: function() {
      this.callerSDK = 'js';
      this.objectType = 'Content.QueryCriteria';
    },
    RequestEnvelope: function() {
      this.callerSDK = 'js';
      this.objectType = 'Core.RequestEnvelope';
    },
    ResponseEnvelope: function() {
      this.callerSDK = 'js';
      this.objectType = 'Core.ResponseEnvelope';
    },
    ItemEnvelope: function() {
      this.callerSDK = 'js';
      this.objectType = 'Core.ItemEnvelope';
    },
    BaseKey: function(key, keyType) {
      this.key = key;
      this.keyType = keyType;
      this.callerSDK = 'js';
      this.objectType = 'Core.BaseKey';
    },
    KeyValuePair: function(key, data) {
      this.key = key;
      this.data = data;
      this.callerSDK = 'js';
      this.objectType = 'Core.KeyValuePair';
    },
    Customer: function(domain, contactEmail, isInternalProperty, widgetLandingPageUrl, platform, enabledState, userContentMode, apiKey, publisherNetwork, publisherSubNetwork, resellerCustomerId, publisherNetworkCustomerId, publisherNetworkAccountId, inlineTextAdsAllowed, inlineImageAdsAllowed, sponsoredLinksAllowed, relatedAdLinksAllowed, sdkAccessAllowed, socialMediaEnabled, popupWidgetLandingPage) {
      this.domain = domain;
      this.contactEmail = contactEmail;
      this.isInternalProperty = isInternalProperty;
      this.widgetLandingPageUrl = widgetLandingPageUrl;
      this.platform = platform;
      this.enabledState = enabledState;
      this.userContentMode = userContentMode;
      this.apiKey = apiKey;
      this.publisherNetwork = publisherNetwork;
      this.publisherSubNetwork = publisherSubNetwork;
      this.resellerCustomerId = resellerCustomerId;
      this.publisherNetworkCustomerId = publisherNetworkCustomerId;
      this.publisherNetworkAccountId = publisherNetworkAccountId;
      this.inlineTextAdsAllowed = inlineTextAdsAllowed;
      this.inlineImageAdsAllowed = inlineImageAdsAllowed;
      this.sponsoredLinksAllowed = sponsoredLinksAllowed;
      this.relatedAdLinksAllowed = relatedAdLinksAllowed;
      this.sdkAccessAllowed = sdkAccessAllowed;
      this.socialMediaEnabled = socialMediaEnabled;
      this.popupWidgetLandingPage = popupWidgetLandingPage;
      this.callerSDK = 'js';
      this.objectType = 'Customers.Customer';
    },
    ContentSourceKey: function(key) {
      this.key = key;
      this.callerSDK = 'js';
      this.objectType = 'Content.ContentSourceKey';
    },
    ContentSource: function(key, displayName, url, contentCrawlingAllowed, inlineTextAdsAllowed, hasOwnAds) {
      this.key = key;
      this.displayName = displayName;
      this.url = url;
      this.contentCrawlingAllowed = contentCrawlingAllowed;
      this.inlineTextAdsAllowed = inlineTextAdsAllowed;
      this.hasOwnAds = hasOwnAds;
      this.callerSDK = 'js';
      this.objectType = 'Content.ContentSource';
    },
    UserKey: function(key) {
      this.key = key;
      this.callerSDK = 'js';
      this.objectType = 'Users.UserKey';
    },
    User: function(userKey) {
      this.userKey = userKey;
      this.callerSDK = 'js';
      this.objectType = 'Users.User';
    },
    CustomerSearchRecord: function(apiKey, widgetLandingPageUrl, platform, publisherSubNetwork, resellerCustomerId) {
      this.apiKey = apiKey;
      this.widgetLandingPageUrl = widgetLandingPageUrl;
      this.platform = platform;
      this.publisherSubNetwork = publisherSubNetwork;
      this.resellerCustomerId = resellerCustomerId;
      this.callerSDK = 'js';
      this.objectType = 'Customers.CustomerSearchRecord';
    },
    CustomerSearchRecordPage: function() {
      this.callerSDK = 'js';
      this.objectType = 'Customers.CustomerSearchRecordPage';
    },
    MediaGalleryKey: function(key) {
      this.key = key;
      this.callerSDK = 'js';
      this.objectType = 'Media.MediaGalleryKey';
    },
    MediaItemKey: function(key) {
      this.key = key;
      this.callerSDK = 'js';
      this.objectType = 'Media.MediaItemKey';
    },
    MediaGallery: function() {
      this.callerSDK = 'js';
      this.objectType = 'Media.MediaGallery';
    },
    MediaItem: function() {
      this.callerSDK = 'js';
      this.objectType = 'Media.MediaItem';
    },
    MediaItemPage: function() {
      this.callerSDK = 'js';
      this.objectType = 'Media.MediaItemPage';
    },
    PaymentSystemDetails: function() {
      this.callerSDK = 'js';
      this.objectType = 'PaymentSystems.PaymentSystemDetails';
    },
    CommentKey: function(key) {
      this.key = key;
      this.callerSDK = 'js';
      this.objectType = 'Reactions.CommentKey';
    },
    ReactionSummary: function() {
      this.callerSDK = 'js';
      this.objectType = 'Reactions.ReactionSummary';
    },
    Comment: function() {
      this.callerSDK = 'js';
      this.objectType = 'Reactions.Comment';
    },
    CommentPage: function() {
      this.callerSDK = 'js';
      this.objectType = 'Reactions.CommentPage';
    },
    AbuseReport: function(reactionTargetKey, reactionTargetType, url, title, abuseReportTotalCount, abuseReportDetail, abuseReporters) {
      if (reactionTargetKey.constructor != dmpod.BaseKey) {
        var typeName = (typeof reactionTargetKey.objectType == 'string') && reactionTargetKey.objectType.split('.')[1],
            reactionTargetKey = new dmpod.BaseKey(reactionTargetKey.key, typeName || null);
      }
      this.reactionTargetKey = reactionTargetKey;
      this.reactionTargetType = reactionTargetType;
      this.url = url;
      this.title = title;
      this.abuseReportTotalCount = abuseReportTotalCount;
      this.abuseReportDetail = abuseReportDetail;
      this.abuseReporters = abuseReporters;
      this.callerSDK = 'js';
      this.objectType = 'Reactions.AbuseReport';
    },
    AbuseReportPage: function() {
      this.callerSDK = 'js';
      this.objectType = 'Reactions.AbuseReportPage';
    },
    AbuseReportDetail: function(abuseReason, abuseReportCount) {
      this.abuseReason = abuseReason;
      this.abuseReportCount = abuseReportCount;
      this.callerSDK = 'js';
      this.objectType = 'Reactions.AbuseReportDetail';
    },
    RecommendationDetail: function(category, count) {
      this.category = category;
      this.count = count;
      this.callerSDK = 'js';
      this.objectType = 'Reactions.RecommendationDetail';
    },
    UserActivity: function(action, targetKey) {
      this.action = action;
      if (targetKey.constructor != dmpod.BaseKey) {
        var typeName = (typeof targetKey.objectType == 'string') && targetKey.objectType.split('.')[1],
            targetKey = new dmpod.BaseKey(targetKey.key, typeName || null);
      }
      this.targetKey = targetKey;
      this.callerSDK = 'js';
      this.objectType = 'Reactions.UserActivity';
    },
    PublisherMonthlyReport: function(month, year, dailyReports) {
      this.month = month;
      this.year = year;
      this.dailyReports = dailyReports;
      this.callerSDK = 'js';
      this.objectType = 'Reporting.PublisherMonthlyReport';
    },
    PublisherDailyReport: function(day, pageViews, totalAdRevenue) {
      this.day = day;
      this.pageViews = pageViews;
      this.totalAdRevenue = totalAdRevenue;
      this.callerSDK = 'js';
      this.objectType = 'Reporting.PublisherDailyReport';
    }
  });
})();

var PLUCKIT_TRACKING_URL = 'http://pod.dmtracker.com/images/zig.gif';

if (typeof(dmpod.service) === 'undefined') {
  dmpod.service = dmpod.createPODRequestService(PLUCKIT_APIKEY);
}
(function(base) {
  if (typeof(base.help) == 'undefined') {
    base.help = {};
    base.extendObject(base.help, {
      isArray: function(obj){
        if (obj.constructor.toString().indexOf("Array") == -1) {
          return false;
        } else {
          return true;
        }
      },
      arrayContains: function(obj, value) {
        for (var i=0; i<obj.length; i++) {
          if (obj[i] == value) {
            return true;
          }
        }
        return false;
      },
      createUniqueId: function(prefix){
        var seed = (new Date()).getTime();
        var id = Math.floor((Math.random() * seed));
        if (typeof prefix !== 'undefined') {
          id = prefix + '_' + id;
        }
        return id;
      },    // creates a unique div for the widget content
      addWidgetDiv: function(prefix, suffix, classvalue, content){
        var divId = null;
        if (typeof prefix === 'undefined') {
          prefix = 'div';
        }
        if (typeof suffix === 'undefined') {
          divId = this.createUniqueId(prefix);
        } else {
          divId = prefix + '_' + suffix;
        }
        var tag = null;
        if (typeof(classvalue) !== 'undefined') {
          tag = '<div class="'+classvalue+'" id="' + divId + '">';
        } else {
          tag = '<div id="' + divId + '">';
        }
        if (typeof(content) !== 'undefined') {
          document.write(tag+content+'<\/div>');
        } else {
          document.write(tag+'<\/div>');
        }
        return divId;
      },    // creates a unique textarea for the widget template
      addTemplateHolder: function(html){
        var id = this.createUniqueId('templateDiv-');
        document.write('<textarea id="' + id + '" style="display: none">' + html + '<\/textarea>');
        return id;
      },
      makeErrorSpan: function(text){
        if (base.service.debugging.on) {
          base.service.debug('WidgetError - ' + text);
          return '<span style="display: block;">WidgetError - ' + text + '</span>';
        } else {
          return '<span style="display: none;">WidgetError - ' + text + '</span>';
        }
      },    // adds the widget stylesheet to the top or bottom of the head
      addWidgetStylesheet: function(url, global, append){
        if (typeof(url) !== 'undefined') {
          if (!this.stylesheets.hasOwnProperty(url)) {
            this.stylesheets[url] = true;
            var headElem = document.getElementsByTagName('head')[0];
            if (headElem !== null) {
              var linkElem = this.os_createElement('link', {
                'rel': 'stylesheet',
                'type': 'text/css',
                'href': url
              }, '');
              if (typeof(append) !== 'undefined' && append == true) {
                headElem.appendChild(linkElem);
              } else {
                var first = headElem.firstChild;
                if (first == null) {
                    headElem.appendChild(linkElem);
                } else if (typeof(global) !== 'undefined' && global == true) {
                    headElem.insertBefore(linkElem, first);
                } else {
                  var second = first.nextSibling;
                  if (second == null) {
                    headElem.appendChild(linkElem);
                  } else {
                    headElem.insertBefore(linkElem, second);
                  }
                }
              }
            }
          }
        }
      },
      isBasicType: function(varType){
        return ":string:number:boolean:".indexOf(':' + varType + ':') > -1;
      },
      overrideOptions: function(from, to){
        for (var option in to) {
          if (from.hasOwnProperty(option)) {
            if (this.isBasicType(typeof(to[option]))) {
              to[option] = from[option];
            } else 
              if (to[option] != null && typeof(to[option]) == 'object') {
                if (to[option].constructor.toString() != "Function") {
                  this.overrideOptions(from[option], to[option]);
                }
              } else 
                if (typeof(to[option]) == 'function') {
                  to[option] = from[option];
                }
          }
        }
      },
      isOverridableOption: function(option) {
        return option!='templateId' && option!='layout' && option!='remoteTemplateUrl' && option!='customCss';
      },
      overrideSingleOptionRecursively: function(option,value,target,externalSource) {
        if (this.isOverridableOption(option)) {
          if (target.hasOwnProperty(option)) {
            if (target[option] != '_' || externalSource) {
              target[option] = value;
            }
          }
          for (var o in target) {
            if (o != option && target[o] != null && typeof(target[o]) == 'object') {
             this.overrideSingleOptionRecursively(option, value, target[o], externalSource);
            }
          }
        }
      },
      overrideOptionsRecursively: function(from, to) {
        var externalSource = from != to;
        for (var o in from) {
          if (typeof(from[o]) != 'object') {
            for (oo in to) {
              if (oo == o) {
                to[o] = from[o];
              } else if (to[oo] != null && typeof(to[oo]) == 'object') {
                this.overrideSingleOptionRecursively(o,from[o],to[oo],externalSource);
              }
            }
          } else {
            if (!to.hasOwnProperty(o)) {
              to[o] = new Object();
            }
            this.overrideOptionsRecursively(from[o],to[o]);
          }
        }
      },
      resolveWidgetResource: function(widgetName, resource){
        return (base.service.getHost()+'Widgets/v1/' + widgetName + '/' + resource + '?apiKey=' + PLUCKIT_APIKEY);
      },
      resolveAssetsResource: function(resource){
        return (base.service.getAssetsHost()+'assets/v1/' + resource + '?apiKey=00000000-0000-0000-0000-000000000000&vn=7034');
      },
      getTrimPathModifiers: function(){
        return {
          resolveWidgetResource: function(str){
            return dmpod.help.resolveWidgetResource(str);
          },
          resolveAssetsResource: function(str){
            return dmpod.help.resolveAssetsResource(str);
          },
          addQueryParam: function(str, name, value){
            return dmpod.help.addQueryParam(str, name, value);
          },
          addQueryParams: function(str, nameValuePairs){
            return dmpod.help.addQueryParams(str, nameValuePairs);
          },
          addPrefixedQueryParam: function(str, name, value){
            return dmpod.help.addPrefixedQueryParam(str, name, value);
          },
          addPrefixedQueryParams: function(str, nameValuePairs) {
            return dmpod.help.addPrefixedQueryParams(str, nameValuePairs);
          },
          showPrettyDate: function(milliseconds){
            return dmpod.help.showPrettyDate(milliseconds);
          },
          showPrettyTime: function(milliseconds){
            return dmpod.help.showPrettyTime(milliseconds);
          },
          titleEncode: function(str){
            return escape(str.replace(/ /g, '_'));
          },
          urlEscape: function(str){
            return escape(str);
          }
        }
      },    // Prefix for query params to avoid name collisions
      queryParamPrefix: 'PLUCK',
      getPrefixedQueryParam: function(parameterName, substituteUrl) {
        return this.getQueryParam(this.queryParamPrefix+parameterName, substituteUrl);
      },
      getQueryParam: function(parameterName, substituteUrl) {
        var search = substituteUrl ? substituteUrl : location.search;
        var match = search.match(new RegExp('[\?&]' + parameterName + '=([^&]+)'));
        var value = match ? match[1] : null;
        if (value == null) {
          return null;
        }
        value = value.replace(/\+/g, '%20');
        return unescape(value);
      },
      replaceQueryParams: function(url, newParams){
        if (url.indexOf('#') != -1) {
          url = url.substring(0, url.indexOf('#'));
        }
        var urlBase;
        var params = newParams;
        if (url.indexOf('?') != -1) {
          var urlParts = url.split('?');
          urlBase = urlParts[0];
          var search = urlParts[1];
          var paramArray = search.split('&');
          params = {};
          for (var index = 0; index < paramArray.length; index++) {
            var keyVal = paramArray[index].split('=');
            params[keyVal[0]] = keyVal[1];
          }
          for (newParam in newParams) {
            params[newParam] = newParams[newParam];
          }
        } else {
          urlBase = url;
        }
        var urlParams = "";
        for (param in params) {
          if (urlParams != "") {
            urlParams += "&";
          }
          urlParams += param + "=" + params[param];
        }
        return urlBase + "?" + urlParams;
      },
      ensureHostUrl: function(hostUrl, allowRelative){
        if (typeof(hostUrl) != 'undefined' && hostUrl != null && !allowRelative) {
          var lower = hostUrl.toLowerCase();
          if (lower.indexOf("http") != 0) {
            hostUrl = '';
          }
        }
        if (typeof(hostUrl) == 'undefined' || hostUrl == null || hostUrl == '') {
          hostUrl = document.location.href;
          var stopChars = "#"; // Stripping off in-page navigation. Query params are okay.
          for (i = 0; i < stopChars.length; ++i) {
            var index = hostUrl.indexOf(stopChars.charAt(i));
            if (index > 0) {
              hostUrl = hostUrl.substring(0, index);
            }
          }
        }
        return hostUrl;
      },
      addPrefixedQueryParam: function(url, name, value) {
        return this.addQueryParam(url, this.queryParamPrefix+name, value);
      },
      addPrefixedQueryParams: function(url, nameValuePairs) {
        for (var name in nameValuePairs) {
          url = this.addPrefixedQueryParam(url, name, nameValuePairs[name]);
        }
        return url;
      },
      addQueryParam: function(url, name, value){
        var regex = new RegExp('([\\?&])' + name + '=[^&;]+');
        var data = name + '=' + value.replace(/\s/g, '_');
        if (regex.test(url)) 
          return url.replace(regex, '$1' + data);
        return url + (url.indexOf('?') > -1 ? '&' : '?') + data;
      },
      addQueryParams: function(url, nameValuePairs) {
        for (var name in nameValuePairs) {
          url = this.addQueryParam(url, name, nameValuePairs[name]);
        }
        return url;
      },
      showPrettyDate: function(milliseconds){
        var monthName = new Array();
        monthName[0] = 'January';
        monthName[1] = 'February';
        monthName[2] = 'March';
        monthName[3] = 'April';
        monthName[4] = 'May';
        monthName[5] = 'June';
        monthName[6] = 'July';
        monthName[7] = 'August';
        monthName[8] = 'September';
        monthName[9] = 'October';
        monthName[10] = 'November';
        monthName[11] = 'December';
        var daySuffix = new Array();
        daySuffix[0] = 'th';
        daySuffix[1] = 'st';
        daySuffix[2] = 'nd';
        daySuffix[3] = 'rd';
        var d = new Date();
        d.setTime(milliseconds);
        var month = monthName[d.getMonth()];
        var day = d.getDate();
        var suffix = daySuffix[0];
        if (day < 21) {
          if (day < 4) {
            suffix = daySuffix[day];
          }
        } else {
          if (day%10 < 4) {
            suffix = daySuffix[day%10];
          }
        }
        var year = d.getFullYear();
        return month + ' ' + day + suffix + ', ' + year;
      },
      showPrettyTime: function(milliseconds){
        var d = new Date();
        d.setTime(milliseconds);
        var hours = d.getHours();
        var amPm = 'AM';
        if (hours == 0) {
          hours = 12;
        } else if (hours > 12) {
          hours = hours - 12;
          amPm = 'PM';
        }
        var minutes = d.getMinutes();
        if (minutes < 10) {
          minutes = '0' + minutes;
        }
        return hours + ':' + minutes + ' ' + amPm;
      },
      injectTrackingCode: function(trackingScript, trackingSrc){
        if (trackingScript.length > 0) {
          if (window.execScript) {
            window.execScript(trackingScript);
          } else {
            eval(trackingScript);
          }
        }
        if (trackingSrc.length > 0) {
          this.os_addScriptSrcNode(trackingSrc);
        }
      },
      trackGuiEvent: function(widgetType, queryParameters){
        var eventBeacon = new Image(1,1);
        var beaconUrl = PLUCKIT_TRACKING_URL + '?CustomerKey=' + PLUCKIT_APIKEY + '&WidgetType=' + widgetType;
        if (typeof queryParameters !== 'undefined') {
          for (param in queryParameters) {
            beaconUrl += '&' + param + '=' + this.encodeTrackingParameter(queryParameters[param]);
          }
        }
        beaconUrl += '&Log=1&v=JT01.02&lt=0&nocache=' + this.createUniqueId('beacon');
        beaconUrl += '&t=' + this.encodeTrackingParameter(document.title)
        beaconUrl += '&r=' + this.encodeTrackingParameter(document.referrer);
        eventBeacon.src= beaconUrl;
      },
      encodeTrackingParameter: function(str){
        return (typeof encodeURI!='undefined') ? encodeURI(str) : escape(str);
      },
      checkApiKey: function(widgetId, apiKey){
        var widget = document.getElementById(widgetId);
        if (apiKey == '00000000-0000-0000-0000-000000000000' && !document.getElementById('podApiKeyWarning')) {
          var apiWarningDiv = document.createElement('div');
          apiWarningDiv.className = 'podAlert podGlobal';
          apiWarningDiv.id = 'podApiKeyWarning';
          apiWarningDiv.style.marginTop = '10px';
          apiWarningDiv.style.marginBottom = '10px';
          apiWarningDiv.innerHTML = 'This sample Pluck On Demand widget contains an improper API key (' + apiKey + '). Please use your assigned API key to ensure complete functionality.';
          widget.insertBefore(apiWarningDiv, widget.firstChild);
        }
      },
      replaceHTMLDivIds: function(html, divId, newDivId){
        html = html.replace(/\r/gm, '---CR---');
        html = html.replace(/\n/gm, '---LF---');
        var m = html.match(new RegExp('^(.*<div.*\\sid\\s*=\\s*[\'\"])(' + divId + ')([\'\"].*?>.*$)', 'i'));
        if (m != null && m.length == 4) {
          html = m[1] + newDivId + m[3];
        }
        html = html.replace(/---CR---/gm, '\r');
        html = html.replace(/---LF---/gm, '\n');
        return html;
      },
      os_createElement: function(elementType, attributes, bodyText){
        var element = document.createElement(elementType);
        for (name in attributes) {
          element.setAttribute(name, attributes[name]);
        }
        if (bodyText.length > 0) {
          element.appendChild(document.createTextNode(bodyText));
        }
        return element;
      },
      os_addToHead: function(elem){
        var head = document.getElementsByTagName("head")[0];
        head.appendChild(elem);
      },
      os_addScriptSrcNode: function(scriptSrc){
        var scriptElement = this.os_createElement('script', {
          'src': scriptSrc,
          'type': 'text/javascript',
          'charset': 'utf-8'
        }, '');
        this.os_addToHead(scriptElement);
      },
      displayElement: function(elem, mode, retry) {
        if (retry && retry <= 1) {
          return;
        }
        if (document.getElementById(elem)) {
          document.getElementById(elem).style.display = mode;
        } else {
          var my = this;
          setTimeout(function() {
            my.displayElement(elem, mode, --retry);
          }, 500);
        }
      },
      swapElements: function(elemToHide, elemToShow, inline) {
        var hideMe = (typeof elemToHide == 'string' ? document.getElementById(elemToHide) : elemToHide),
            showMe = (typeof elemToShow == 'string' ? document.getElementById(elemToShow) : elemToShow);
        hideMe.style.display = 'none';
        if (inline) {
          showMe.style.display = 'inline';
        } else {
          showMe.style.display = 'block';
        }
      },
      addListener: function(element, type, expression, bubbling) {
        bubbling = bubbling || false;
        if (window.addEventListener) { // Non-IE browsers
            element.addEventListener(type, expression, bubbling);
            return true;
        } else if (window.attachEvent) { // IE
            element.attachEvent('on' + type, expression);
            return true;
        } else {
            return false;
        }
      },
      removeListener: function(element, type, expression, bubbling) {
        bubbling = bubbling || false;
        if (window.removeEventListener) { // Non-IE browsers
            element.removeEventListener(type, expression, bubbling);
            return true;
        } else if (window.detachEvent) { // IE
            element.detachEvent('on' + type, expression);
            return true;
        } else {
            return false;
        }
      },
      moveElement: function(elem,startPos,endPos,steps,intervals,powr, callback) {
        if (elem.posChangeMemInt) {
            window.clearInterval(elem.posChangeMemInt);
        }
        var actStep = 0;
        elem.posChangeMemInt = window.setInterval(
          function() {
            if (typeof(startPos[0]) !== 'undefined'
                && typeof(startPos[1]) !== 'undefined'
                && typeof(endPos[0]) !== 'undefined'
                && typeof(endPos[1]) !== 'undefined') {
              elem.currentPos = [
                dmpod.help.easeInOut(startPos[0],endPos[0],steps,actStep,powr),
                dmpod.help.easeInOut(startPos[1],endPos[1],steps,actStep,powr)
              ];
              elem.style.left = elem.currentPos[0]+"px";
              elem.style.top = elem.currentPos[1]+"px";
              actStep++;
              if (actStep > steps) {
                window.clearInterval(elem.posChangeMemInt);
                if (callback) {
                  callback();
                }
              }
            } else {
              window.clearInterval(elem.posChangeMemInt);
              if (callback) {
                callback();
              }
            }
          }
        ,intervals);
      },
      easeInOut: function(minValue,maxValue,totalSteps,actualStep,powr) {
        var delta = maxValue - minValue;
        var stepp = minValue+(Math.pow(((1 / totalSteps)*actualStep),powr)*delta);
        return Math.ceil(stepp)
      },
      changeOpacity: function(elem,startOpacity,endOpacity,steps,intervals,powr, callback) {
        if (elem.opacityChangeMemInt) {
          window.clearInterval(elem.opacityChangeMemInt);
        }
        var actStep = 0;
        elem.opacityChangeMemInt = window.setInterval(
          function() { 
            elem.currentOpacity = dmpod.help.easeInOut(startOpacity,endOpacity,steps,actStep,powr);
            elem.style.opacity = elem.currentOpacity/100;
            elem.style.filter = 'alpha(opacity=' + elem.currentOpacity + ');';
            actStep++;
            if (actStep > steps) {
              if (elem.style.opacity == '0') {
                elem.style.display = 'none';
              }
              window.clearInterval(elem.opacityChangeMemInt);
              if (callback) {
                callback();
              }
            }
          }
        ,intervals)
      },
      submitForm: function(name) {
        var form = document.forms[name];
        if (form && form.onsubmit())
          form.submit();
        return false;
      },
      alert: function(msg) {
        var doc = document, div = doc.body.appendChild(document.createElement('div'));
        div.className = 'podStatusAlert';
        div.appendChild(doc.createTextNode(msg));
        setTimeout(function() {
          dmpod.help.changeOpacity(div, 100, 0, 20, 30, 1);
          setTimeout(function() { doc.body.removeChild(div) }, 3000);
        }, 3000)
      },
      showError: function(elementId, errorMessage) {
        var elem = document.getElementById(elementId);
        if (elem) {
          elem.innerHTML = '<a href="javascript:dmpod.help.hideError(\''+elementId+'\');" class="podClose">close</a>'
          elem.innerHTML += errorMessage;
          elem.style.display = 'block';
        } else {
          alert(errorMessage);
        }
      },
      hideError: function(elementId) {
        var elem = document.getElementById(elementId);
        if (elem) {
          elem.innerHTML = '';
          elem.style.display = 'none';
        } 
      },
      extractDomain: function(domainOrUrl) {
        domainOrUrl = domainOrUrl.replace(/^\s*/, '');
        domainOrUrl = domainOrUrl.replace(/^https?:\/\//i, '');
        domainOrUrl = domainOrUrl.replace(/^(www\.)?/i, '');
        domainOrUrl = domainOrUrl.replace(/\/.*/, '');
        return domainOrUrl;
      },
      convertUrlToPublisherKeyString: function (url) {
        url = url.replace(/https:\/\//i, '');
        url = url.replace(/http:\/\//i, '');
        url = url.replace(/www\./i, '');
        url = url.replace(/#.*/i, '');
        return url;
      },
      grabOption: function(widget, optionName, substituteUrl) {
        var optionSetting = widget.optionSpecified(optionName);
        if (!optionSetting) {
          optionSetting = this.getPrefixedQueryParam(optionName, substituteUrl);
        }
        if (!optionSetting) {
          optionSetting = '';
        }
        return optionSetting;
      },
      submitEnter: function(inputField,e) {
        var keycode;
        if (window.event) {
          keycode = window.event.keyCode;
        } else if (e) {
          keycode = e.which;
        } else {
          return true;
        }
        if (keycode == 13) {
           inputField.form.submit();
           return false;
        } else {
           return true;
        }
      },
      cleanInput: function (str) {
        str = str.replace(/</g, '&lt;');
        str = str.replace(/>/g, '&gt;');
        return str;
      },
      truncateOnBadChar: function (str) {
        var newStr = '';
        var goodChars = '01234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ';
          for (var i = 0; i < str.length; i++) {
            if (goodChars.indexOf(str.charAt(i)) == -1) {
              return newStr + '_...';
            }
            newStr += str.charAt(i);
          }
        return newStr;
      },
      addAnchor: function (url, anchor) {
        url = url.replace(/#.*/i, '');
        url = url + '#' + anchor;
        return url;
      },
      getElementsByClassName: function (className) {
        if (document.getElementsByClassName) {
          return document.getElementsByClassName(className);
        }
        var nodes = [];
        var regex = new RegExp('(^| )' + cl + '( |$)');
        for (var i = 0, elems = document.getElementsByTagName('*'), elem; elem = elems[i]; i++) {
          if (regex.test(elem.className)) {
            nodes.push(elem);
          }
        }
        return nodes;
      },
      getErrorMessageFromResponses: function (responses) {
        for (var i=0; i < responses.length; i++) {
          if (responses[i].isError) {
            return responses[i].message;
          }
        }
        return '';
      },
      isIE: base.service.isIE,
      flashVersion: base.service.flashVersion,
      isValidUrl: function(url) {
        var isValid = false;
        var regex = /^(http|https):\/\/.+/;
        if (regex.test(url)) {
          isValid = true;
        }
        return isValid;
      },
      isEmptyOrNull: function(item) {
        var isEON = false;
        if (item == '' || item == null) {
          isEON = true;
        }
        return isEON;
      },
      setBaseUrl: function(optionUrl, landingPageUrl) {
        var baseUrl;
        if (!this.isEmptyOrNull(optionUrl)) {
          baseUrl = this.ensureHostUrl(optionUrl, true);
        } else if (!this.isEmptyOrNull(landingPageUrl)) {
          baseUrl = landingPageUrl;
        } else {
          baseUrl = this.ensureHostUrl(document.location.href, true);
        }
        return baseUrl;
      },
      eatBlanks: function(str) {
        return str.replace(/^\s*|\s*$/g, '');
      },
      stylesheets: {},
      showMessage: this.showError,
      hideMessage: this.hideError,
      isAncestor: function(childWidget, possibleAncestorClassName) {
        if (childWidget.parent) {
          if (childWidget.parent.classname == possibleAncestorClassName) {
            return true;
          } else {
            return this.isAncestor(childWidget.parent, possibleAncestorClassName);
          }
        }
        return false;
      }
    });
  }
})(dmpod);
(function(base) {
  if (typeof(base.widget) == 'undefined') {
    var aWidget = function() {}
    aWidget.runWidget = function(classname){
      var divSuffix = base.help.createUniqueId();
      if (!base.service) {
        base.help.addWidgetDiv(classname, divSuffix, 'podWidget', base.help.makeErrorSpan("PluckItService instance is null"));
        return;
      }
      if (base.service.flashNeeded) {
        base.help.addWidgetDiv(classname, divSuffix, 'podWidget', '<p>The Adobe Flash Player installed in this browser is out of date. <a href="http://www.adobe.com/go/getflashplayer/" target="_blank">Please upgrade Adobe Flash Player.<\/a></p>');
        return;
      }
      try {
        var defaultOptions = {};
        if (typeof(PLUCKIT_WIDGET_OPTIONS_DEFAULT) !== 'undefined') {
          defaultOptions = PLUCKIT_WIDGET_OPTIONS_DEFAULT;
          PLUCKIT_WIDGET_OPTIONS_DEFAULT = null;
        }
        var events = {};
        if (typeof(PLUCKIT_WIDGET_EVENTS) !== 'undefined') {
          events = PLUCKIT_WIDGET_EVENTS;
          PLUCKIT_WIDGET_EVENTS = null;
        }
        if (typeof(PLUCKIT_WIDGET_OPTIONS) != 'undefined' && PLUCKIT_WIDGET_OPTIONS != null) {
          base.help.overrideOptionsRecursively(PLUCKIT_WIDGET_OPTIONS, defaultOptions);
          PLUCKIT_WIDGET_OPTIONS = null;
        }
        if (base.service.debugging.on && base.service.debugging.firebug) {
          window.console.group('Creating widget '+classname+' with these options:');
          window.console.dir(defaultOptions);
          window.console.groupEnd();
        }
        var mainWidget = aWidget.createWidget(null, classname, classname, divSuffix, defaultOptions, events);
        base.help.addWidgetDiv(classname, divSuffix, 'podWidget', mainWidget.getPreloadHtml());        
        if (mainWidget.preloadImageUrls.length > 0) {
          for (var i=0; i<mainWidget.preloadImageUrls.length; i++) {
            var image = document.createElement('img');
            image.src = base.help.resolveAssetsResource('images/'+mainWidget.preloadImageUrls[i]);
          }
        }
        mainWidget.execute();
      } catch (ex) { alert(ex.message);
        base.help.addWidgetDiv(classname, divSuffix, 'podWidget', base.help.makeErrorSpan('[' + classname + '] ' + ex.name + ': ' + ex.message));
      }
    };
    aWidget.createWidget = function(parent, classname, instanceName, divSuffix, options, events){
      if (parent == null) {
        base.help.addWidgetStylesheet(base.help.resolveAssetsResource('stylesheets/pod.css'), true);
      }
      var widget = new window[classname];
      widget.service = base.service;
      widget.init(parent, classname, instanceName, divSuffix, options, events);
      window[widget.divId] = widget;
      return widget;
    };
    base.widget = aWidget;
    aWidget.prototype = (function(){
      return {
        constructor: aWidget,
        createWidget: aWidget.createWidget,
        init: function(parent, classname, instanceName, divSuffix, options, events){
          var my = this;
          this.help = base.help;
          this.eventInfo = {};
          this.parent = parent;
          this.classname = classname;
          this.instanceName = instanceName;
          this.divSuffix = divSuffix;
          this.divId = this.instanceName + '_' + divSuffix;
          this.context = {};
          this.context._MODIFIERS = this.help.getTrimPathModifiers();
          this.context.options = options;
          this.context.apiKey = PLUCKIT_APIKEY;
          this.context.konteraAds = false;
          this.madeAnyRequests = false;
          this.processedAnyResponses = false;
          this.requests = [];
          this.subWidgets = [];
          this.child = {};
          this.autoRender = true;
          this.currentResponses = [];
          this.content = '';
          this.contentTime = new Date().getTime();
          this.renderedTime = this.contentTime - 1000;
          this.errorText = '';
          this.events = events || {};
          for (var event in this.events) {
            if (this.events.hasOwnProperty(event)) {
              this.addEventCallback(event, this.events[event]);
            }
          }
          if (this.optionSpecified("customCss")) {
            base.help.addWidgetStylesheet(this.context.options.customCss, false, true);
          }
          this.addChildWidgets();
          if (this.optionSpecified("remoteTemplateUrl")) {
            this.template = null;
            this.downloadUrl(this.context.options.remoteTemplateUrl, null, function(template) {
              my.template = template;
            });
          } else {
            if (this.optionSpecified("templateId")) {
              this.template = document.getElementById(this.context.options.templateId).value;
            } else if (this.optionSpecified("layout") && (typeof(this.layouts) !== 'undefined')) {
              this.template = this.layouts[this.context.options.layout];
            }
          }
          this.postInit();
          this.fireEventOnce("onLoaded");
        },
        downloadUrl: function(url, queryString, callback) {
          var my = this;
          var func = function(data) {
            callback.call(my, data);
          }
          this.service.DownloadUrl(url, queryString, func);
        },
        postForm: function(formUrl, queryString, callback) {
          var my = this;
          var func = function(data) {
            callback.call(my, data);
          }
          this.service.PostForm(formUrl, queryString, func);
        },
        sendRequests: function(requests, callback){
          if (this.service.debugging.on) {
            if (requests.constructor != Array) { // handle single requests gracefully
              requests = [requests];
            }
            for (var i=0; i<requests.length; i++) {
              if (!requests[i].hasOwnProperty('requestedBy')) {
                requests[i].requestedBy = this.instanceName+'['+this.classname+']';
              }
            }
          }
          var my = this;
          this.service.SendRequests(requests, function(batchResponse){
            if (batchResponse.hasOwnProperty('ContentTrackingJavaScript')) {
              base.help.injectTrackingCode(batchResponse.ContentTrackingJavaScript, batchResponse.ContentTrackingSrc);
            }
            callback.call(my, batchResponse);
          });
        },
        showHtmlException: function(ex) {
          this.content = this.help.makeErrorSpan('[' + this.classname + ':' + this.instanceName + '] ' + ex.name + ': ' + ex.message);
          this.render();
        },
        execute: function(callback, overrideOptions){
          var my = this;
          try {
            if (typeof(overrideOptions) !== 'undefined') {
                this.help.overrideOptions(this.context.options, overrideOptions);
            }
            var requests = this.getRequests();
            if (requests != null && requests.length > 0) {
              this.sendRequests(requests, function(batchResponse){
                try {
                  my.waitForAllTemplates(function(all) {
                    if (all) {
                      my.replaceChildDivIds();
                      var responses = batchResponse.Responses;
                      my.processResponses(responses);
                      if (my.autoRender) {
                        my.processTemplates();
                      }
                      if (typeof callback !== 'undefined') {
                        callback(my);
                      } else if (my.autoRender) {
                        my.render();
                      }
                    } else { // not all templates were loaded
                      my.showHtmlException({ name : 'Remote Templates', message : 'Not all remote templates could be downloaded' });
                    }
                  });
                } catch (ex) {
                  my.showHtmlException(ex);
                }
              });
            } else {
              this.waitForAllTemplates(function(all) {
                if (all) {
                  my.replaceChildDivIds();
                  if (my.autoRender) {
                    my.processTemplates();
                  }
                  if (typeof callback !== 'undefined') {
                    callback(my);
                  } else if (my.autoRender) {
                    my.render();
                  }
                } else { // not all templates were loaded
                  my.showHtmlException({ name : 'Remote Templates', message : 'Not all remote templates could be downloaded' });
                }
              });
            }
          } catch(ex) {
            this.showHtmlException(ex);
          }
        },
        hasAllTemplates: function() {
          if (this.template) {
            if (this.subWidgets.length > 0) {
              for (var i = 0; i < this.subWidgets.length; i++) {
                if (!this.subWidgets[i].hasAllTemplates()) {
                  return false;
                }
              }
            }
            return true;
          }
          return false;
        },
        waitForAllTemplates: function(callback, retry) { // wait up to 10 seconds for remote templates to load
          var all = this.hasAllTemplates();
          if (all) {
            callback(true);
          } else {
            var retry = retry || 0;
            if (retry++ < 40) {
              var my = this; 
              setTimeout(function(){ my.waitForAllTemplates(callback, retry); }, 250 * retry);
            } else {
              callback(false);
            }
          }
        },
        replaceChildDivIds: function() {
          this.template = this.template.replace(/WIDGETINSTANCE/gm, 'window[\'' + this.divId + '\']');
          if (this.subWidgets.length > 0) {
            for (var i = 0; i < this.subWidgets.length; i++) {
              var child = this.subWidgets[i];
              this.template = this.help.replaceHTMLDivIds(this.template, child.instanceName, child.divId);
              child.replaceChildDivIds();
            }
          }
        },
        render: function(retry) {
          if (this.renderedTime < this.contentTime) {
            if (document.getElementById(this.divId) == null) {
              var retry = retry || 0;
              if (retry++ < 10) {
                var my = this; 
                setTimeout(function(){ my.render(retry); }, 100 * retry);
              }
            } else {
              document.getElementById(this.divId).innerHTML = this.content;
              if (this.parent == null) {
                this.help.checkApiKey(this.divId, PLUCKIT_APIKEY);
              }
              this.processPostRender(this.contentTime);
            }
          }
        },
        processPostRender: function(renderedTime){
          this.renderedTime = renderedTime;
          if (this.subWidgets.length > 0) {
            for (var i = 0; i < this.subWidgets.length; i++) {
              if (this.subWidgets[i].autoRender) {
                this.subWidgets[i].processPostRender(renderedTime);
              }
            }
          }
          if (typeof(this.postRender) === "function") {
            this.postRender();
          }
          this.fireEvent('onRendered');
          if (this.madeAnyRequests) {
            if (this.processedAnyResponses) {
              this.fireEventOnceAfterChildren('onCompleted', 5000);
            }
          } else {
            this.fireEventOnceAfterChildren('onCompleted', 5000);
          }
          if (this.context.konteraAds && typeof(PLUCKIT_INLINETEXTADS_CALLED) === 'undefined' && typeof(startKonaFlow)!== 'undefined') {
            startKonaFlow();
            PLUCKIT_INLINETEXTADS_CALLED = true;
          }
        },
        addChildWidget: function(classname, instanceName){
          var widget = this.createWidget(this, classname, instanceName, this.divSuffix, this.context.options[instanceName], this.events[instanceName]);
          this.subWidgets.push(widget);
          this.child[widget.instanceName] = widget;
          if (this.template != null) {
            this.template = this.help.replaceHTMLDivIds(this.template, instanceName, widget.divId);
          }
        },
        getRequests: function(){
          this.askedForRequests = true;
          this.requests = [];
          this.addRequests();
          this.madeAnyRequests = this.requests.length > 0;
          this.processedAnyRequests = false;
          var requests = this.requests;
          if (this.subWidgets.length > 0) {
            for (var i = 0; i < this.subWidgets.length; i++) {
              requests = requests.concat(this.subWidgets[i].getRequests());
            }
          }
          return requests;
        },
        addRequest: function(request){
          if (typeof request != 'undefined') {
            if (this.service.debugging.on) {
              request.requestedBy = this.instanceName+'['+this.classname+']';
              var p = this.parent;
              while (p != null) {
                 request.requestedBy = p.instanceName+':'+request.requestedBy;
                 p = p.parent;
              }
            }
            this.requests.push(request);
          }
        },
        getEventInfo: function(forEventName) {
          if (!this.eventInfo.hasOwnProperty(forEventName)) {
            this.eventInfo[forEventName] = { widget: this, name: forEventName, callbacks: [], fired: 0, enabled: true, waitingForChildren: false };
          }
          return this.eventInfo[forEventName];
        },
        addEventCallback: function(eventName, callback) {
          this.getEventInfo(eventName).callbacks.push(callback);
        },
        eventFired: function(eventName) {
          return this.getEventInfo(eventName).fired;
        },
        fireEvent: function(eventName) {
          var event = this.getEventInfo(eventName);
          if (event.enabled) {
            event.fired++;
            if (this.service.debugging.on) {
              this.service.debug('event: '+event.name+':'+event.fired+' '+this.instanceName);
            }
            if (event.callbacks !== null) {
                for (var i = 0; i < event.callbacks.length; i++) {
                    event.callbacks[i](event);
                }
            }
          }
        },
        fireEventOnce: function(eventName) {
          if (this.eventFired(eventName) == 0) {
            this.fireEvent(eventName);
          }
        },   
        fireEventAfterChildren: function(eventName, timeout) {
          var event = this.getEventInfo(eventName);
          if (!event.waitingOnChildren) {
            event.waitingOnChildren = true;
            var timeout = timeout || 0;
            var expire = (new Date()).getTime() + timeout;
            var my = this;
            var check = function() {
              for (var i=0; i<my.subWidgets.length; i++) {
                if (0 == my.subWidgets[i].eventFired(eventName)) {
                  if (timeout && ((new Date()).getTime() >= expire)) {
                    break;
                  }
                  setTimeout(check, 100);
                  return;
                }
              }
              my.fireEvent(eventName);
              event.waitingOnChildren = false;
              return;
            }; 
            setTimeout(check, 100);
          }
        },
        fireEventOnceAfterChildren: function(eventName, timeout) {
          if (this.eventFired(eventName) == 0) {
            this.fireEventAfterChildren(eventName, timeout);
          }
        },
        setEventEnabled: function(eventName, enabled) {
          var event = this.getEventInfo(eventName);
          event.enabled = enabled;
        },
        processTemplate: function(){
          this.replaceChildDivIds(); // may have been done initially, but repeat in case template changed
          var html = "";
          if (this.errorText > '') {
            html = this.help.makeErrorSpan(this.errorText);
          } else {
            try {
              html = this.processTemplateData(this.template, this.context);
            } catch (ex) {
              html = this.help.makeErrorSpan('[' + this.classname + ':' +
              this.instanceName +
              '] ' +
              ex.name +
              ': ' +
              ex.message);
            }
          }
          this.contentTime = new Date().getTime();
          return html;
        },
        processTemplateData: function(template, data) {
            var tmpl = PodTrimPath.parseTemplate(template);
            if (tmpl != null) {
              var flags = {};
              flags.throwExceptions = true;
              return html = tmpl.process(data, flags);
            }
            return '';
        },
        multipleShift: function(array, number){
          var returned = [];
          number = Math.min(number, array.length);
          for (var i = 0; i < number; i++) {
            returned.push(array.shift());
          }
          return returned;
        },
        getRequestsTreeLength: function() {
          var length = this.requests.length;
          for (var i=0; i<this.subWidgets.length; i++) {
            length += this.subWidgets[i].getRequestsTreeLength();
          }
          return length;
        },
        processChildResponses: function(responses){
          if (this.subWidgets.length > 0) {
            for (var i = 0; i < this.subWidgets.length; i++) {
              if (this.subWidgets[i].getRequestsTreeLength() > 0) {
                var subresponses = this.multipleShift(responses, this.subWidgets[i].getRequestsTreeLength());
                if (!this.help.isArray(subresponses)) {
                  subresponses = [subresponses];
                }
                this.subWidgets[i].processResponses(subresponses);
              }
            }
          }
        },
        processResponses: function(responses){
          this.currentResponses = responses;
          var _responses = null;
          if (this.requests.length > 0) {
            var _responses = this.multipleShift(responses, this.requests.length);
            if (!this.help.isArray(_responses)) {
              _responses = [_responses];
            }
          }
          this.processChildResponses(responses);
          if (_responses != null) {
            this.buildContextFromResponses(_responses);
            this.processedAnyResponses = true;
          }
          this.finalizeContext();
        },
        processTemplates: function(){
          if (this.subWidgets.length > 0) {
            for (var i = 0; i < this.subWidgets.length; i++) {
              var htmldata = '';
              if (this.subWidgets[i].autoRender) {
                htmldata = this.subWidgets[i].processTemplates();
              }
              this.context[this.subWidgets[i].instanceName] = htmldata;
            }
          }
          this.content = this.processTemplate();
          return this.content;
        },
        optionSpecified: function(option){
          return (this.context.options.hasOwnProperty(option) &&
          this.context.options[option]);
        },
        setRequestOption: function(request, option){
          if (this.optionSpecified(option)) {
            request[option] = this.context.options[option];
          }
        },
        setErrorText: function(text){
          this.errorText = '[' + this.classname + ':' + this.instanceName + '] ' + text;
        },
        appendErrorText: function(text){
          this.errorText = '  ' + text;
        },
        getResponseByType: function(responseType, index, askParents) {
          if (typeof(index) === 'undefined') {
            index = 0;
            askParents = false;
          } else if (typeof(askParents) === 'undefined') {
            askParents = false;
          }
          if (this.currentResponses.length > 0) {
            for (var i=0; i<this.currentResponses; i++) {
              if (this.currentResponses[i].indexOf(responseType) >= 0) {
                if (index == 0) {
                   return this.currentResponses[i];
                } else {
                  index--; // skip
                  askParents = false; // found, so no longer consider parents
                }
              }
            }
          }
          if (typeof(askParents) !== 'undefined') {
            if (parent != null && askParents) {
              return parent.getResponseByType(responseType, askParents);
            }
          }
          return null;
        },
        splitRenderResults: function(parms) {
          if (this.optionSpecified("splitRenderResults")) {
            var spec = this.context.options.splitRenderResults.split(',');
            var areas = [];
            while (spec.length > 0) {
              var area = this.multipleShift(spec,2);
              area[1] = parseInt(area[1]);
              areas.push(area);
            }
            if (areas.length > 0) {
              var wanted = 0;
              for (var i=0; i<areas.length; i++) {
                wanted += areas[i][1];
              }
              var extra = Math.max(parms.results.length - wanted, 0);
              if (extra > 0) {
                for (var i=0; i<areas.length; i++) {
                  if (areas[i][1] == 0) {
                    areas[i][1] = extra;
                    break;
                  }
                }
              }
              var main = this.multipleShift(parms.results, areas[0][1]);
              for (var i=1; i<areas.length; i++) {
                if (parms.results.length > 0) {
                  this.context[parms.data] = this.multipleShift(parms.results, areas[i][1]);
                  var html = this.processTemplateData(this.template, this.context);
                  if (html) {
                    document.getElementById(areas[i][0]).innerHTML = html;
                  }
                }
              }
              this.context[parms.data] = main;
            }
          }
        },
        setTimeout: function(func, timems) {
          var my = this;
          var callback = function() {
            func.call(my);
          }
          setTimeout(callback, timems);
        },
        getPreloadHtml: function() {
          return '';
        },
        postInit: function() {
        },
        addChildWidgets: function(){
        },
        addRequests: function(){
        },
        buildContextFromResponses: function(responses){
        },
        finalizeContext: function(){
        }
      };
    })();
  }
})(dmpod);

var PLUCKIT_WIDGET_OPTIONS_DEFAULT = {"articlePage":{"articleComments":{"abuseReportWidget":{"commentId":"","customCss":"","layout":"","maxReportersPerReport":"5","remoteTemplateUrl":"","templateId":""},"articleId":"","articlePageUrl":"","commentNumberPerPage":"10","commentOnPage":"0","commentSort":"TimeStampDescending","customCss":"","layout":"","loginSignup":{"customCss":"","layout":"","profileWidget":{"articlePageUrl":"","customCss":"","layout":"","remoteTemplateUrl":"","reportAbuse":{"customCss":"","layout":"","reactionTargetId":"","reactionTargetType":"userKey","remoteTemplateUrl":"","templateId":"","userHasReportedAbuse":"false"},"showAbuse":"true","showAvatar":"true","showProfile":"true","showUsername":"false","templateId":"","userKey":""},"remoteTemplateUrl":"","showHeadings":"false","showSignupButton":"true","successPageUrl":"","templateId":""},"pluckFooter":{"customCss":"","layout":"","remoteTemplateUrl":"","showFooter":"true","showLegalPrivacyLink":"false","showLogo":"true","templateId":""},"profileWidget":{"articlePageUrl":"","customCss":"","layout":"","remoteTemplateUrl":"","reportAbuse":{"customCss":"","layout":"","reactionTargetId":"","reactionTargetType":"userKey","remoteTemplateUrl":"","templateId":"","userHasReportedAbuse":"false"},"showAbuse":"true","showAvatar":"true","showProfile":"true","showUsername":"false","templateId":"","userKey":""},"publisherContentId":"","recommendComment":{"articleId":"","commentId":"","customCss":"","layout":"","publisherContentId":"","remoteTemplateUrl":"","showRecommendations":"true","templateId":""},"remoteTemplateUrl":"","showAbuse":"true","showAvatar":"true","showComments":"true","showProfile":"true","templateId":""},"articleId":"","customCss":"","featuredArticle":{"adWidth":"narrow","articleComments":{"abuseReportWidget":{"commentId":"","customCss":"","layout":"","maxReportersPerReport":"5","remoteTemplateUrl":"","templateId":""},"articleId":"","articlePageUrl":"","commentNumberPerPage":"10","commentOnPage":"0","commentSort":"TimeStampDescending","customCss":"","layout":"","loginSignup":{"customCss":"","layout":"","profileWidget":{"articlePageUrl":"","customCss":"","layout":"","remoteTemplateUrl":"","reportAbuse":{"customCss":"","layout":"","reactionTargetId":"","reactionTargetType":"userKey","remoteTemplateUrl":"","templateId":"","userHasReportedAbuse":"false"},"showAbuse":"true","showAvatar":"true","showProfile":"true","showUsername":"false","templateId":"","userKey":""},"remoteTemplateUrl":"","showHeadings":"false","showSignupButton":"true","successPageUrl":"","templateId":""},"pluckFooter":{"customCss":"","layout":"","remoteTemplateUrl":"","showFooter":"true","showLegalPrivacyLink":"false","showLogo":"true","templateId":""},"profileWidget":{"articlePageUrl":"","customCss":"","layout":"","remoteTemplateUrl":"","reportAbuse":{"customCss":"","layout":"","reactionTargetId":"","reactionTargetType":"userKey","remoteTemplateUrl":"","templateId":"","userHasReportedAbuse":"false"},"showAbuse":"true","showAvatar":"true","showProfile":"true","showUsername":"false","templateId":"","userKey":""},"publisherContentId":"","recommendComment":{"articleId":"","commentId":"","customCss":"","layout":"","publisherContentId":"","remoteTemplateUrl":"","showRecommendations":"true","templateId":""},"remoteTemplateUrl":"","showAbuse":"true","showAvatar":"true","showComments":"true","showProfile":"true","templateId":""},"articleId":"","articleLength":"full","articlePageUrl":"","customCss":"","layout":"","recommendArticle":{"articleId":"","commentId":"","customCss":"","layout":"","publisherContentId":"","remoteTemplateUrl":"","showRecommendations":"true","templateId":""},"relatedTags":{"articleId":"","customCss":"","direction":"horizontal","layout":"","linkResultsType":"topicPage","numberOfTags":"5","remoteTemplateUrl":"","showBottomBorder":"false","showRelatedTags":"true","splitRenderResults":"","stringRelatedTagsSectionTitleHorizontal":"Related:","stringRelatedTagsSectionTitleVertical":"Related Key Words","tag":"","templateId":"","textClass":"","textId":"","textKeywords":"","topicPageUrl":"","url":""},"remoteTemplateUrl":"","showComments":"true","showReadCommentsLink":"false","showRecommendations":"true","templateId":""},"layout":"","pluckFooter":{"customCss":"","layout":"","remoteTemplateUrl":"","showFooter":"true","showLegalPrivacyLink":"false","showLogo":"true","templateId":""},"relatedArticles":{"articleId":"","articlePageUrl":"","bundleId":"","contentType":"all","customCss":"","excludeFromDomain":"","excludeSources":"","favorTagBundleAlias":"true","includeSources":"","layout":"","matchCategories":"","maxResults":"5","noResultsMessage":"","pluckFooter":{"customCss":"","layout":"","remoteTemplateUrl":"","showFooter":"true","showLegalPrivacyLink":"false","showLogo":"true","templateId":""},"remoteTemplateUrl":"","retryAttempts":"6","retryInterval":"2","showAbstract":"true","showComments":"true","showFooter":"true","showMediaIcons":"true","showRecommendations":"true","showRelatedContent":"true","showThumbnail":"true","showTitle":"true","splitRenderResults":"","stringRelatedContentPageTitle":"More On This Topic","stringRelatedContentPageTitleText":"Related Articles","stringRelatedContentPageTitleVideo":"Related Videos","tag":"","templateId":"","textClass":"","textId":"","textKeywords":"","url":""},"relatedArticlesOnly":{"articleId":"","articlePageUrl":"","bundleId":"","contentType":"all","customCss":"","excludeFromDomain":"","excludeSources":"","favorTagBundleAlias":"true","includeSources":"","layout":"","matchCategories":"","maxResults":"5","noResultsMessage":"","pluckFooter":{"customCss":"","layout":"","remoteTemplateUrl":"","showFooter":"true","showLegalPrivacyLink":"false","showLogo":"true","templateId":""},"remoteTemplateUrl":"","retryAttempts":"6","retryInterval":"2","showAbstract":"true","showComments":"true","showFooter":"true","showMediaIcons":"true","showRecommendations":"true","showRelatedContent":"true","showThumbnail":"true","showTitle":"true","splitRenderResults":"","stringRelatedContentPageTitle":"More On This Topic","stringRelatedContentPageTitleText":"Related Articles","stringRelatedContentPageTitleVideo":"Related Videos","tag":"","templateId":"","textClass":"","textId":"","textKeywords":"","url":""},"relatedTextArticles":{"articleId":"","articlePageUrl":"","bundleId":"","contentType":"text","customCss":"","excludeFromDomain":"","excludeSources":"","favorTagBundleAlias":"true","includeSources":"","layout":"","matchCategories":"","maxResults":"5","noResultsMessage":"","pluckFooter":{"customCss":"","layout":"","remoteTemplateUrl":"","showFooter":"true","showLegalPrivacyLink":"false","showLogo":"true","templateId":""},"remoteTemplateUrl":"","retryAttempts":"6","retryInterval":"2","showAbstract":"true","showComments":"true","showFooter":"true","showMediaIcons":"true","showRecommendations":"true","showRelatedContent":"true","showThumbnail":"true","showTitle":"true","splitRenderResults":"","stringRelatedContentPageTitle":"More On This Topic","stringRelatedContentPageTitleText":"Related Articles","stringRelatedContentPageTitleVideo":"Related Videos","tag":"","templateId":"","textClass":"","textId":"","textKeywords":"","url":""},"relatedVideoArticles":{"articleId":"","articlePageUrl":"","bundleId":"","contentType":"video","customCss":"","excludeFromDomain":"","excludeSources":"","favorTagBundleAlias":"true","includeSources":"","layout":"","matchCategories":"","maxResults":"5","noResultsMessage":"","pluckFooter":{"customCss":"","layout":"","remoteTemplateUrl":"","showFooter":"true","showLegalPrivacyLink":"false","showLogo":"true","templateId":""},"remoteTemplateUrl":"","retryAttempts":"6","retryInterval":"2","showAbstract":"true","showComments":"true","showFooter":"true","showMediaIcons":"true","showRecommendations":"true","showRelatedContent":"true","showThumbnail":"true","showTitle":"true","splitRenderResults":"","stringRelatedContentPageTitle":"More On This Topic","stringRelatedContentPageTitleText":"Related Articles","stringRelatedContentPageTitleVideo":"Related Videos","tag":"","templateId":"","textClass":"","textId":"","textKeywords":"","url":""},"remoteTemplateUrl":"","templateId":"","userDiscovery":{"age":"15","customCss":"","defaultTab":"RecentCommenters","layout":"","numberOfUsers":"5","pluckFooter":{"customCss":"","layout":"","remoteTemplateUrl":"","showFooter":"true","showLegalPrivacyLink":"false","showLogo":"true","templateId":""},"profileWidget":{"articlePageUrl":"","customCss":"","layout":"","remoteTemplateUrl":"","reportAbuse":{"customCss":"","layout":"","reactionTargetId":"","reactionTargetType":"userKey","remoteTemplateUrl":"","templateId":"","userHasReportedAbuse":"false"},"showAbuse":"true","showAvatar":"true","showProfile":"true","showUsername":"false","templateId":"","userKey":""},"remoteTemplateUrl":"","showProfile":"true","showRecentCommentersTab":"false","showRecentRecommendersTab":"false","showTabs":"false","showUserDiscovery":"true","templateId":""}},"contentWidget":{"adminRequired":"true","contentFile":"index.aspx","contentPath":"wizard/","cssUrl":"","customCss":"","layout":"","loginRequired":"true","remoteTemplateUrl":"","templateId":""},"customCss":"","footerWidget":{"customCss":"","layout":"","remoteTemplateUrl":"","showFooter":"true","showLegalPrivacyLink":"true","showLogo":"true","templateId":""},"layout":"","profileWidget":{"articlePageUrl":"","customCss":"","layout":"","remoteTemplateUrl":"","reportAbuse":{"customCss":"","layout":"","reactionTargetId":"","reactionTargetType":"userKey","remoteTemplateUrl":"","templateId":"","userHasReportedAbuse":"false"},"showAbuse":"true","showAvatar":"false","showProfile":"true","showUsername":"true","templateId":"","userKey":""},"publisherAccount":{"customCss":"","customerType":"RevenueShare","domainList":{"customCss":"","layout":"","remoteTemplateUrl":"","showPublisherDomainList":"true","templateId":""},"layout":"","partnerMode":"default","privacyPolicyUrl":"","remoteTemplateUrl":"","successPageUrl":"","templateId":"","termsOfServiceUrl":""},"publisherReport":{"customCss":"","layout":"","remoteTemplateUrl":"","templateId":""},"relatedAdLinks":{"articlesTaken":"10","articlesThreshold":"5","customCss":"","layout":"","linkResultsPageUrl":"","matchMethod":"smoothedkeywords","numberOfResultLinks":"10","numberOfSearchLinks":"5","pageRelatedAdLinksLabel":"Related Searches","relatedAdLinkNewWindow":"true","relatedAdLinksLabel":"Sponsored Links","relatedAdPageLabel":"top results >>>","relatedAdPageSublabel":"sponsored listings","remoteTemplateUrl":"","showRelatedAdLinksWidget":"true","showRelatedSearches":"true","showSearchBox":"false","splitRenderResults":"","tagsProvider":"","templateId":""},"remoteTemplateUrl":"","smartLoginSignup":{"customCss":"","layout":"","profileWidget":{"articlePageUrl":"","customCss":"","layout":"","remoteTemplateUrl":"","reportAbuse":{"customCss":"","layout":"","reactionTargetId":"","reactionTargetType":"userKey","remoteTemplateUrl":"","templateId":"","userHasReportedAbuse":"false"},"showAbuse":"true","showAvatar":"true","showProfile":"true","showUsername":"false","templateId":"","userKey":""},"remoteTemplateUrl":"","templateId":""},"templateId":"","topicPage":{"customCss":"","featuredArticle":{"adWidth":"narrow","articleComments":{"abuseReportWidget":{"commentId":"","customCss":"","layout":"","maxReportersPerReport":"5","remoteTemplateUrl":"","templateId":""},"articleId":"","articlePageUrl":"","commentNumberPerPage":"10","commentOnPage":"0","commentSort":"TimeStampDescending","customCss":"","layout":"","loginSignup":{"customCss":"","layout":"","profileWidget":{"articlePageUrl":"","customCss":"","layout":"","remoteTemplateUrl":"","reportAbuse":{"customCss":"","layout":"","reactionTargetId":"","reactionTargetType":"userKey","remoteTemplateUrl":"","templateId":"","userHasReportedAbuse":"false"},"showAbuse":"true","showAvatar":"true","showProfile":"true","showUsername":"false","templateId":"","userKey":""},"remoteTemplateUrl":"","showHeadings":"false","showSignupButton":"true","successPageUrl":"","templateId":""},"pluckFooter":{"customCss":"","layout":"","remoteTemplateUrl":"","showFooter":"true","showLegalPrivacyLink":"false","showLogo":"true","templateId":""},"profileWidget":{"articlePageUrl":"","customCss":"","layout":"","remoteTemplateUrl":"","reportAbuse":{"customCss":"","layout":"","reactionTargetId":"","reactionTargetType":"userKey","remoteTemplateUrl":"","templateId":"","userHasReportedAbuse":"false"},"showAbuse":"true","showAvatar":"true","showProfile":"true","showUsername":"false","templateId":"","userKey":""},"publisherContentId":"","recommendComment":{"articleId":"","commentId":"","customCss":"","layout":"","publisherContentId":"","remoteTemplateUrl":"","showRecommendations":"true","templateId":""},"remoteTemplateUrl":"","showAbuse":"true","showAvatar":"true","showComments":"true","showProfile":"true","templateId":""},"articleId":"","articleLength":"summary","articlePageUrl":"","customCss":"","layout":"","recommendArticle":{"articleId":"","commentId":"","customCss":"","layout":"","publisherContentId":"","remoteTemplateUrl":"","showRecommendations":"true","templateId":""},"relatedTags":{"articleId":"","customCss":"","direction":"horizontal","layout":"","linkResultsType":"topicPage","numberOfTags":"5","remoteTemplateUrl":"","showBottomBorder":"false","showRelatedTags":"true","splitRenderResults":"","stringRelatedTagsSectionTitleHorizontal":"Related:","stringRelatedTagsSectionTitleVertical":"Related Key Words","tag":"","templateId":"","textClass":"","textId":"","textKeywords":"","topicPageUrl":"","url":""},"remoteTemplateUrl":"","showComments":"true","showReadCommentsLink":"true","showRecommendations":"true","templateId":""},"latestComments":{"articlePageUrl":"","customCss":"","layout":"","remoteTemplateUrl":"","showLatestComments":"true","templateId":""},"layout":"","maxResults":"8","numberOfRelatedVideos":"6","pluckFooter":{"customCss":"","layout":"","remoteTemplateUrl":"","showFooter":"true","showLegalPrivacyLink":"true","showLogo":"true","templateId":""},"publisherRelatedLinks":{"articleId":"","customCss":"","excludeFromDomains":"","layout":"","linkSource":"MyContent","numberOfPublisherLinks":"3","remoteTemplateUrl":"","showPublisherRelatedLinks":"true","showThumbnail":"false","showTitle":"false","stringPublisherRelatedLinksSelfReference":"from this site","stringPublisherRelatedLinksTitle":"Related Articles","tag":"","templateId":"","textClass":"","textId":"","textKeywords":"","url":""},"relatedArticles":{"articleId":"","articlePageUrl":"","bundleId":"","contentType":"all","customCss":"","excludeFromDomain":"","excludeSources":"","favorTagBundleAlias":"true","includeSources":"","layout":"","matchCategories":"","maxResults":"8","noResultsMessage":"","pluckFooter":{"customCss":"","layout":"","remoteTemplateUrl":"","showFooter":"true","showLegalPrivacyLink":"false","showLogo":"true","templateId":""},"remoteTemplateUrl":"","retryAttempts":"6","retryInterval":"2","showAbstract":"true","showComments":"true","showFooter":"true","showMediaIcons":"true","showRecommendations":"true","showRelatedContent":"true","showThumbnail":"true","showTitle":"true","splitRenderResults":"","stringRelatedContentPageTitle":"More On This Topic","stringRelatedContentPageTitleText":"Related Articles","stringRelatedContentPageTitleVideo":"Related Videos","tag":"","templateId":"","textClass":"","textId":"","textKeywords":"","url":""},"relatedTags":{"articleId":"","customCss":"","direction":"horizontal","layout":"","linkResultsType":"topicPage","numberOfTags":"5","remoteTemplateUrl":"","showBottomBorder":"true","showRelatedTags":"true","splitRenderResults":"","stringRelatedTagsSectionTitleHorizontal":"Related:","stringRelatedTagsSectionTitleVertical":"Related Key Words","tag":"","templateId":"","textClass":"","textId":"","textKeywords":"","topicPageUrl":"","url":""},"remoteTemplateUrl":"","searchWidget":{"customCss":"","layout":"","remoteTemplateUrl":"","showSearch":"true","templateId":""},"stringTopicPagePageTitle":"All about %1","stringTopicPagePageTitleText":"Related Articles","templateId":"","userDiscovery":{"age":"15","customCss":"","defaultTab":"RecentCommenters","layout":"","numberOfUsers":"5","pluckFooter":{"customCss":"","layout":"","remoteTemplateUrl":"","showFooter":"true","showLegalPrivacyLink":"false","showLogo":"true","templateId":""},"profileWidget":{"articlePageUrl":"","customCss":"","layout":"","remoteTemplateUrl":"","reportAbuse":{"customCss":"","layout":"","reactionTargetId":"","reactionTargetType":"userKey","remoteTemplateUrl":"","templateId":"","userHasReportedAbuse":"false"},"showAbuse":"true","showAvatar":"true","showProfile":"true","showUsername":"false","templateId":"","userKey":""},"remoteTemplateUrl":"","showFooter":"false","showProfile":"true","showRecentCommentersTab":"false","showRecentRecommendersTab":"false","showTabs":"false","showUserDiscovery":"true","templateId":""},"videoThumbstrip":{"articleId":"","articlePageUrl":"","bundleId":"","contentType":"all","customCss":"","excludeFromDomain":"","excludeSources":"","favorTagBundleAlias":"false","includeSources":"","layout":"","matchCategories":"","maxResults":"8","noResultsMessage":"","pluckFooter":{"customCss":"","layout":"","remoteTemplateUrl":"","showFooter":"true","showLegalPrivacyLink":"false","showLogo":"true","templateId":""},"remoteTemplateUrl":"","retryAttempts":"6","retryInterval":"2","showAbstract":"true","showComments":"true","showFooter":"true","showMediaIcons":"true","showRecommendations":"true","showRelatedContent":"true","showThumbnail":"true","showTitle":"true","splitRenderResults":"","stringRelatedContentPageTitle":"More On This Topic","stringRelatedContentPageTitleText":"Related Articles","stringRelatedContentPageTitleVideo":"Related Videos","tag":"","templateId":"","textClass":"","textId":"","textKeywords":"","url":""}},"whichPage":"","wizardFaq":{"adminRequired":"true","contentFile":"faqSmartWidget.aspx","contentPath":"wizard/","cssUrl":"","customCss":"","layout":"","loginRequired":"true","remoteTemplateUrl":"","templateId":""}};

(function(){
  var widget = function() {};
  window['PluckItFooterWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// Footer Widget\r\n{/eval}\r\n\r\n{if options.showFooter == \'true\'}\r\n<div class="podFooter podFLC podGlobal"\>\r\n  {if options.showLegalPrivacyLink != \'false\'}\r\n  <a class="podLegalAndPrivacyLink" href="{if customer.publisherNetwork != \'eNom\'}http://ondemand.pluck.com/legal.aspx{else}http://www.richcontentwidget.com/terms.aspx{/if}" target="termsofuse"\>{if customer.publisherNetwork != \'eNom\'}Pluck{/if} Legal and Privacy</a\>\r\n  {/if}\r\n  {if customer.publisherNetwork != \'eNom\' && options.showLogo != \'false\' }\r\n  <a href="http://ondemand.pluck.com/" class="podPluck" target="podPluckOnDemand"\><img class="podLogo" \r\n    src="http://cdn-docs.pluckit.pluck.com/assets/v1/images/pluck_white_distro.gif?apiKey=00000000-0000-0000-0000-000000000000&vn=7034" alt="Powered by Pluck" width="72" height="26" /\></a\>\r\n  {/if}\r\n</div\>\r\n{/if}\r\n\r\n'; 
  widget.prototype.preloadImageUrls = []; 
    widget.prototype.addRequests = function() {
      request = new dmpod.GetCustomerRequest();
      this.addRequest(request);
    }
    widget.prototype.buildContextFromResponses = function(responses) {
      var errorMessage = this.help.getErrorMessageFromResponses(responses);
      if (errorMessage.length > 0) {
        this.setErrorText(errorMessage);
      } else {
        this.context.customer = responses[0].customer;
      }
    }

})();

(function(){
  var widget = function() {};
  window['PluckItRelatedContentWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// RelatedContent Widget\r\n{/eval}\r\n\r\n<div class="podHeadlineWidget"\>\r\n{if contentMatched}\r\n  {if options.showTitle == \'true\'}\r\n  <div class="podPageTitle"\>\r\n    {if options.contentType == "video"}\r\n      ${options.stringRelatedContentPageTitleVideo}\r\n    {elseif options.contentType == "text"}\r\n      ${options.stringRelatedContentPageTitleText}\r\n    {else}\r\n      ${options.stringRelatedContentPageTitle}\r\n    {/if}\r\n  </div\>\r\n  {/if}\r\n  <div class="podBasicList"\>\r\n    {for article in articles} \r\n    <div class="podArticleSummary"\>\r\n      <div class="podArticleInfo podFLC"\>\r\n        {if options.showThumbnail == "true"}\r\n          <a href="${article.articleUrl}" title="{if article.mediaType == \'Video\'}Video{else}Article{/if}: ${article.title}"\r\n          {if customer.popupWidgetLandingPage && iAmNotSmart} target="_dmpodWindow" {/if}\>\r\n            <img alt="${article.title}" src="${article.thumbnailUrl}"/\>\r\n          </a\>\r\n        {/if}\r\n        <div class="podInfoText {if options.showThumbnail == \'true\'} podInfoTextAndAvatar {/if}"\>\r\n          <a href="${article.articleUrl}" title="{if article.mediaType == \'Video\'}Video{else}Article{/if}: ${article.title}"\r\n            class="podHeadline {if options.showMediaIcons == \'true\'}{if article.mediaType == \'Video\'} podIconVideo{else} podIconArticle{/if}{/if}"\r\n            {if customer.popupWidgetLandingPage && iAmNotSmart} target="_dmpodWindow" {/if}\r\n            \>${article.title}{if options.showMediaIcons != \'true\' && article.mediaType == \'Video\'} (video){/if}</a\>\r\n          <span\>by ${article.author}</span\>\r\n        </div\>\r\n      </div\>\r\n      {if options.showAbstract == \'true\'}\r\n      <p {if (konteraAds && article.konteraAds)} class="KonaBody" {/if} \>\r\n        ${article.content}\r\n        <a href="${article.articleUrl}" class="podReadMore"\r\n        {if customer.popupWidgetLandingPage && iAmNotSmart} target="_dmpodWindow" {/if}\>Read More &raquo;</a\>\r\n      </p\>\r\n      {/if}\r\n      {if customer.socialMediaEnabled && article.reactionSummary}\r\n        {if options.showComments == "true" || options.showRecommendations == "true"}\r\n        <div class="podArticleStats podFLC"\>\r\n          {if options.showComments == "true"}\r\n          <a href="${article.articleUrl}#PluckComment" class="podIconComments" \r\n            {if customer.popupWidgetLandingPage && iAmNotSmart} target="_dmpodWindow" {/if}\>${article.reactionSummary.commentCount} Comments</a\>\r\n          {/if}\r\n          {if options.showRecommendations == "true"}\r\n          <div class="podArticleRecommendationCount" \r\n            \><span\>${article.recommendationCount}</span\> Recommendations</div\>\r\n          {/if}\r\n        </div\>\r\n        {/if}\r\n      {/if}\r\n    </div\>\r\n  {/for}\r\n    <div id="${sponsoredLinkId}"\><!-- Sponsored Link --\></div\>\r\n  </div\>\r\n  ${pluckFooter}\r\n{else}\r\n  ${options.noResultsMessage}\r\n{/if}\r\n</div\>\r\n\r\n'; 
  widget.prototype.preloadImageUrls = []; 
  widget.prototype.layouts = []; 
  widget.prototype.layouts['thumbTitleSummary'] = '{eval}\r\n// RelatedContent Widget - thumbTitleSummary\r\n{/eval}\r\n\r\n<div class="podLayoutThumbTitleSummary"\>\r\n  <div class="podHeadlineWidget"\>\r\n  {if contentMatched}\r\n    {if options.showTitle == \'true\'}\r\n    <div class="podPageTitle"\>${options.stringRelatedContentPageTitleText}</div\>\r\n    {/if}\r\n    <div class="podBasicList"\>\r\n      {for article in articles} \r\n      <div class="podArticleSummary2"\>\r\n        <div class="podArticleInfo podFLC"\>\r\n          {if options.showThumbnail == "true"}\r\n          <a class="podThumbnail" href="${article.articleUrl}" title="Article: ${article.title}"\r\n            {if customer.popupWidgetLandingPage && iAmNotSmart} target="_dmpodWindow" {/if}\>\r\n            <img alt="${article.title}" class="podArticleThumbnail" src="${article.thumbnailUrl}"/\>\r\n          </a\>\r\n          {/if}\r\n          <div class="podInfoText {if (konteraAds)} KonaBody {/if} "\>\r\n            <a href="${article.articleUrl}" title="Article: ${article.title}"\r\n              class="podHeadline" {if customer.popupWidgetLandingPage && iAmNotSmart} target="_dmpodWindow" {/if}\>${article.title}</a\>\r\n            <span\>${article.content} <a class="podReadMore" href="${article.articleUrl}"\r\n            {if customer.popupWidgetLandingPage && iAmNotSmart} target="_dmpodWindow" {/if}\>Read More &raquo;</a\></span\>\r\n          </div\>\r\n        </div\>\r\n      </div\>\r\n    {/for}\r\n      <div id="${sponsoredLinkId}"\><!-- Sponsored Link --\></div\>\r\n    </div\>\r\n    ${pluckFooter}\r\n  {else}\r\n    ${options.noResultsMessage}\r\n  {/if}\r\n  </div\>\r\n</div\>\r\n'; 
  widget.prototype.layouts['videoThumbstrip'] = '{eval}\r\n// RelatedContent Widget - videoThumbstrip\r\n{/eval}\r\n\r\n<div class="podLayoutVideoThumbstrip"\>\r\n  <div class="podHeadlineWidget"\>\r\n  {if contentMatched}\r\n    {if options.showTitle == \'true\'}\r\n    <div class="podPageTitle"\>${options.stringRelatedContentPageTitleVideo}</div\>\r\n    {/if}\r\n    <div class="podFLC"\>\r\n    {for article in articles}\r\n      <div class="podThumbnail"\>\r\n        <a href="${article.articleUrl}" title="Video: ${article.title}"\r\n          {if customer.popupWidgetLandingPage && iAmNotSmart} target="_dmpodWindow" {/if}\><img \r\n          alt="${article.title}" src="${article.thumbnailUrl}" /\><img \r\n          class="podVideoPlay" alt="${article.title}" src="http://cdn-docs.pluckit.pluck.com/assets/v1/images/videoPlay.gif?apiKey=00000000-0000-0000-0000-000000000000&vn=7034" \r\n          /\></a\>\r\n        <div class="podCallout"\>${article.shortTitle}</div\>\r\n      </div\>\r\n    {/for}\r\n    </div\>\r\n    ${pluckFooter}\r\n  {else}\r\n    ${options.noResultsMessage}\r\n  {/if}\r\n  </div\>\r\n</div\>\r\n'; 
    widget.prototype.addChildWidgets = function() {
      this.autoRender = false;
      if (this.optionSpecified('showRelatedContent') != 'true') {
        this.dontShowThisWidget = true;
        return;
      }
      this.isOnATopicPage = false;
      if (this.parent) {
        this.isOnATopicPage = (this.parent.classname == 'PluckItTopicPageWidget');
      }
      this.featureArticleRequired = false;
      if (this.isOnATopicPage) {
        this.featureArticleRequired = (this.instanceName == 'relatedArticles');
      }
      this.setEventEnabled('onCompleted', false);
      this.addChildWidget('PluckItFooterWidget','pluckFooter');
    }
    widget.prototype.postInit = function() {
      this.context.contentMatched = false;
      this.context.sponsoredLinkId = 'podSponsoredLink_' + this.divSuffix;
      this.maxTries = parseInt(this.optionSpecified('retryAttempts')) + 1;
      this.retryInterval = parseInt(this.optionSpecified('retryInterval')) * 1000;
      this.context.options.contentType = this.optionSpecified('contentType').toLowerCase();
    }
    widget.prototype.addRequests = function() {
      if (this.dontShowThisWidget) {
        return;
      }
      var request;
      request = new dmpod.GetCustomerRequest();
      this.addRequest(request);
      function convertContentSources (commaDelimitedString) {
        var contentSources = [], input = commaDelimitedString.split(',');;
        for (var i = 0; i < input.length; i++)
          contentSources.push(new dmpod.ContentSourceKey(input[i]));
        return contentSources;
      }
      if (!this.optionSpecified('bundleId') && !this.optionSpecified('articleId') && !this.optionSpecified('tag') && !this.optionSpecified('text') && !this.optionSpecified('url')) {
        if (!(this.context.options.bundleId = this.help.getPrefixedQueryParam('bundleId'))) {
          if (!(this.context.options.articleId = this.help.getPrefixedQueryParam('articleId'))) {
            if (!(this.context.options.tag = this.help.getPrefixedQueryParam('tag'))) {
              this.context.options.url = this.help.getPrefixedQueryParam('url');
            }
          }
        }
      }
      if (this.optionSpecified('bundleId')) {
        request = new dmpod.GetBundleRequest(this.context.options.bundleId);
      }
      else if (this.optionSpecified('articleId')) {
        request = new dmpod.GetArticlesRelatedToArticleRequest(this.context.options.articleId);
      }
      else if (this.optionSpecified('tag')) {
        request = new dmpod.GetArticlesRelatedToTagRequest(this.optionSpecified('tag'));
      }
      else if (this.optionSpecified('textId')) {
        var names = this.optionSpecified('textId').split(/,/g), data = [];
        for (var i = 0, elem; i < names.length; i++) {
          if (elem = document.getElementById(names[i]))
            data.push(elem.innerHTML);
        }
        request = new dmpod.GetArticlesRelatedToTextRequest(data.join('\n'));
      }
      else if (this.optionSpecified('textClass')) {
        var names = this.optionSpecified('textClass').split(/,/g), data = [];
        for (var i = 0; i < names.length; i++) {
          for (var j = 0, elems = this.help.getElementsByClassName(names[i]); j < elems.length; j++)
            data.push(elems[j].innerHTML);
        }
        request = new dmpod.GetArticlesRelatedToTextRequest(data.join('\n'));
      }
      else if (this.optionSpecified('textKeywords')) {
        request = new dmpod.GetArticlesRelatedToTextRequest(this.optionSpecified('textKeywords'));
      }
      else {
        this.context.options.url = this.help.ensureHostUrl(this.context.options.url, false);
        request = new dmpod.GetArticlesRelatedToUrlRequest(this.context.options.url);
      }
      this.setRequestOption(request, 'contentType');
      this.setRequestOption(request, 'maxResults');
      if (this.context.options.includeSources) {
          this.context.options.includeSources = convertContentSources(this.context.options.includeSources);
          this.setRequestOption(request, 'includeSources');
      }
      if (this.context.options.excludeSources) {
          this.context.options.excludeSources = convertContentSources(this.context.options.excludeSources);
          this.setRequestOption(request, 'excludeSources');
      }
      if (this.context.options.matchCategories) {
        this.context.options.matchCategories = this.context.options.matchCategories.split(',');
        var cats = this.context.options.matchCategories;
        for (var i=0; i<cats.length; i++) {
          cats[i] = parseFloat(cats[i]);
        }
      }
      this.setRequestOption(request, 'matchCategories');
      this.setRequestOption(request, 'excludeFromDomain');
      this.deferredRelatedContentRequest = request;
    };
    widget.prototype.buildContextFromResponses = function(responses) {
      if (responses[0].isError) {
        this.setErrorText(responses[0].message);
      } else {
        this.context.customer = responses[0].customer;
        this.context.articlePageUrl = this.help.setBaseUrl(this.optionSpecified('articlePageUrl'), this.context.customer.widgetLandingPageUrl);
        this.getRelatedContent(this.maxTries);
      }
    };
    widget.prototype.getRelatedContent = function(retry) {
      retry--;
      if (retry < 0) {
        this.deferredRender();
        return;
      }
      var requests = [];
      requests.push(this.deferredRelatedContentRequest);
      if (this.optionSpecified('favorTagBundleAlias') == 'true') {
        if (requests[0].objectType == 'Content.GetArticlesRelatedToTagRequest') {
          requests.unshift(new dmpod.GetBundleRequest('tag:'+requests[0].tag));
          requests.executeMethod = "ExecuteToFirstSuccess";
        }
      }
      this.sendRequests(requests, function(batchResponse) {
        var response = batchResponse.Responses[0];
        if (response.isError && batchResponse.Responses.length == 2) {
          response = batchResponse.Responses[1];
        }
        if (response.hasOwnProperty('bundle')) {
          response.relatedContent = response.bundle.relatedContent;
          response.contentMatched = response.bundle.contentMatched;
        }
        if (response.isError) {
          this.setErrorText(response.message);
        } else if (response.relatedContent.length == 0) {
          this.setTimeout(function(){
            this.getRelatedContent(retry);
          }, this.retryInterval);
        } else {
          this.context.articles = response.relatedContent;
          this.context.contentMatched = response.contentMatched;
          if (this.help.isAncestor(this, 'PluckItSmartWidget')) {
            this.context.iAmNotSmart = false;
          } else {
            this.context.iAmNotSmart = true;
          }
          var shortTitleLength = 21;
          for (var i = 0, article; i < this.context.articles.length, article = this.context.articles[i]; i++) {
            article.shortTitle = article.title;
            if (article.shortTitle.length > shortTitleLength) {
              article.shortTitle = article.shortTitle.substring(0, shortTitleLength);
              article.shortTitle = article.shortTitle.substring(0, article.shortTitle.lastIndexOf(' '));
              article.shortTitle += ' ...';
            }
            article.articleUrl = this.context.articlePageUrl;
            article.articleUrl = this.help.addPrefixedQueryParam(article.articleUrl, 'articleId', article.id);
            article.articleUrl = this.help.addPrefixedQueryParam(article.articleUrl, 'title', this.help.truncateOnBadChar(article.title));
            article.articleUrl = this.help.addPrefixedQueryParam(article.articleUrl, 'mediaType', article.mediaType);
            article.articleUrl = this.help.addPrefixedQueryParam(article.articleUrl, 'author', escape(article.author));
            article.articleUrl = this.help.addPrefixedQueryParam(article.articleUrl, 'apiKey', this.context.apiKey);
            article.articleUrl = this.help.addPrefixedQueryParam(article.articleUrl, 'whichPage', 'articlePage');
            var positiveCount = 0;
            var negativeCount = 0;
            if (this.context.customer.socialMediaEnabled && article.reactionSummary) {
              var reactionSummary = article.reactionSummary;
              var recommendationDetails = reactionSummary.recommendationDetails;
              for (var j = 0, recommendation; recommendation = recommendationDetails[j]; j++) {
                if (recommendation.category == 'Positive') {
                  positiveCount = recommendation.count;
                }
                else if (recommendation.category == 'Negative') {
                  negativeCount = recommendation.count;
                }
              }
              article.recommendationCount = positiveCount - negativeCount;
              article.konteraAds = article.sourceAllowsInlineTextAds;
              this.context.userHasRecommended = reactionSummary.userHasRecommended;
            }
          }
          if (this.featureArticleRequired) {
            this.featuredArticle = this.context.articles.pop();
          }
          this.deferredRender();
        }
      });    
    }
    widget.prototype.deferredRender = function() {
      var results = [].concat(this.context.articles);
      this.context.pluckFooter = this.child.pluckFooter.processTemplates();
      this.splitRenderResults({'data':'articles','results':results});
      this.processTemplates();
      this.setEventEnabled('onCompleted', true);
      this.fireEventOnce('onCompleted');
      this.render();
    }
    widget.prototype.postRender = function() {
      if (this.featureArticleRequired && this.featuredArticle) {
        document.getElementById(this.parent.context.podFeaturedArticleImgId).src = this.featuredArticle.thumbnailUrl;
        document.getElementById(this.parent.context.podFeaturedArticleImgId).alt = this.featuredArticle.title;
        document.getElementById(this.parent.context.podFeaturedArticleImgLinkId).href = this.featuredArticle.articleUrl;
        document.getElementById(this.parent.context.podFeaturedArticleImgLinkId).title = 'Article: ' + this.featuredArticle.title;
        document.getElementById(this.parent.context.podFeaturedArticleTitleId).href = this.featuredArticle.articleUrl;
        document.getElementById(this.parent.context.podFeaturedArticleTitleId).title = 'Article: ' + this.featuredArticle.title;
        document.getElementById(this.parent.context.podFeaturedArticleTitleId).innerHTML = this.featuredArticle.title;
        document.getElementById(this.parent.context.podFeaturedArticleSummaryId).innerHTML = this.featuredArticle.summary + ' '; 
        document.getElementById(this.parent.context.podFeaturedArticleReadMoreId).href = this.featuredArticle.articleUrl;
        document.getElementById(this.parent.context.podFeaturedArticleId).style.display = 'block';
      }
      if (document.getElementById(this.context.sponsoredLinkId) && !this.isOnATopicPage && this.optionSpecified('layout') != 'videoThumbstrip') {
        if (this.context.customer.sponsoredLinksAllowed && this.context.customer.customerType == 'RevenueShare') {
          var request = new dmpod.GetSponsoredLinksRequest('1');
          this.sendRequests(request, function(response) {
            var response = response.Responses[0];
            if (response.isError) {
              this.setErrorText(responses.message);
            } else {
              link = response.links[0];
              var html = '';
              html += '<div class="podSponsoredLink">';
              html += '  <div class="podSponsoredLinkHeader">SPONSORED LINK</div>';
              html += '  <div class="podSponsoredLinkInfo podFLC">';
              if (this.optionSpecified('showThumbnail') == 'true') {
                html += '    <a class="podSponsoredLinkTitle podHeadline" href="' + link.clickUrl + '" target="podSponsoredLink" title="' + link.title + '">';
                html += '      <img src="' + link.imageUrl +'" alt="' + link.title +'" />';
                html += '    </a>';
              }
              html += '    <div class="podSponsoredLinkText">';
              html += '      <a class="podSponsoredLinkTitle podHeadline" href="' + link.clickUrl + '" target="podSponsoredLink">' + link.title + '</a>';
              html += '      <div class="podSponsoredLinkDescription">' + link.description +'</div>';
              html += '      <a class="podSponsoredLinkLink podHeadline" href="' + link.clickUrl + '" target="podSponsoredLink">'+ link.url + '</a>';
              html += '    <div>';
              html += '  <div>';
              html += '<div> <!-- podSponsoredLink -->';
              document.getElementById(this.context.sponsoredLinkId).innerHTML = html;
            }
          });
        }
      }
    }

})();

(function(){
  var widget = function() {};
  window['PluckItRelatedTagsWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// Related Tags Widget\r\n{/eval}\r\n\r\n{if options.showRelatedTags == \'true\'}\r\n{if contentMatched}\r\n<div class="podRelatedKeywordsWidget"\> \r\n  {if (options.direction == \'horizontal\') }\r\n    <span class="podRelatedTagsLabel"\>${options.stringRelatedTagsSectionTitleHorizontal}</span\>\r\n    {for tag in tags}{if (tag_index \> 0) },{/if} <a \r\n      {if customer.popupWidgetLandingPage && iAmNotSmart} target="_dmpodWindow" {/if}\r\n      href="${tag.topicPageUrl}"\>${tag.name}</a\>{/for} \r\n  {else}\r\n  <div class="podSectionTitle"\>${options.stringRelatedTagsSectionTitleVertical}</div\> \r\n  <ul\>\r\n    {for tag in tags} \r\n      <li\><a \r\n        {if customer.popupWidgetLandingPage && iAmNotSmart} target="_dmpodWindow" {/if}\r\n        href="${tag.topicPageUrl}"\>${tag.name}</a\></li\>\r\n    {/for}\r\n  </ul\> \r\n  {/if}\r\n</div\>\r\n{else}\r\n<!-- No Content Matched --\>\r\n{/if}\r\n\r\n{if (options.showBottomBorder == \'true\' && contentMatched) }\r\n<hr /\>\r\n{/if}\r\n{/if}\r\n'; 
  widget.prototype.preloadImageUrls = []; 
    widget.prototype.addRequests = function() {
      this.autoRender = false;
      if ((this.parent != null) && ((this.optionSpecified('showRelatedTags') != 'true'))) {
        this.dontShowThisWidget = true;
        return;
      }
      this.setEventEnabled("onCompleted", false);
      var request = new dmpod.GetCustomerRequest();
      this.addRequest(request);
      var request = null;
      if (!this.optionSpecified("articleId") && !this.optionSpecified("tag") && !this.optionSpecified("url")) {
        this.context.options.articleId = this.help.getPrefixedQueryParam("articleId");
        if (!this.optionSpecified("articleId")) {
          this.context.options.tag = this.help.getPrefixedQueryParam("tag");
          if (!this.optionSpecified("tag")) {
            this.context.options.url = this.help.getPrefixedQueryParam("url");
          }
        }
      }
      this.maxTries = 4; // default
      if (this.optionSpecified('articleId')) {
        request = new dmpod.GetTagsForArticleRequest(this.context.options.articleId);
      } else if (this.optionSpecified('tag')) {
        request = new dmpod.GetTagsForTagRequest(this.optionSpecified('tag'));
        this.maxTries = 1;
      } else if (this.optionSpecified('textId')) {
        var names = this.optionSpecified('textId').split(/,/g), data = [];
        for (var i = 0, elem; i < names.length; i++) {
          if (elem = document.getElementById(names[i]))
            data.push(elem.innerHTML);
        }
        request = new dmpod.GetTagsForTextRequest(data.join('\n'));
      } else if (this.optionSpecified('textClass')) {
        var names = this.optionSpecified('textClass').split(/,/g), data = [];
        for (var i = 0; i < names.length; i++) {
          for (var j = 0, elems = this.help.getElementsByClassName(names[i]); j < elems.length; j++)
            data.push(elems[j].innerHTML);
        }
        request = new dmpod.GetTagsForTextRequest(data.join('\n'));
      } else if (this.optionSpecified('textKeywords')) {
        request = new dmpod.GetTagsForTextRequest(this.optionSpecified('textKeywords'));
      } else {
        this.context.options.url = this.help.ensureHostUrl(this.context.options.url, false);
        request = new dmpod.GetTagsForUrlRequest(this.context.options.url);
      }
      request['maxResults'] = this.context.options['numberOfTags'];
      this.deferredRelatedTagsRequest = request;
    }
    widget.prototype.buildContextFromResponses = function(responses) {
      if (this.dontShowThisWidget) {
        return;
      }
      var errorMessage = this.help.getErrorMessageFromResponses(responses);
      if (errorMessage.length > 0) {
        this.setErrorText(errorMessage);
      } else {
        this.context.customer = responses[0].customer;
        this.context.topicPageUrl = this.help.setBaseUrl(this.optionSpecified('topicPageUrl'), this.context.customer.widgetLandingPageUrl);
        if (this.help.isAncestor(this, 'PluckItSmartWidget')) {
          this.context.iAmNotSmart = false;
        } else {
          this.context.iAmNotSmart = true;
        }
        this.getRelatedTags(this.maxTries);
      }
    }
    widget.prototype.getRelatedTags = function(retry, callback) {
      retry--;
      if (retry < 0) {
        if (callback) {
          callback();
        }
        return;
      }
      this.sendRequests(this.deferredRelatedTagsRequest, function(response) {
        var responses = response.Responses[0];
        if (responses.isError) {
          this.setErrorText(responses.message);
        } else if (responses.tags.length == 0) {
          this.setTimeout(function(){
            this.getRelatedTags(retry, callback);
          }, 2000);
        } else {
          this.context.contentMatched = responses.contentMatched;
          for (var i=0; i<responses.tags.length; i++) {
            var tag = responses.tags[i];
            var topicPageUrl = this.context.topicPageUrl;
            if (this.optionSpecified('linkResultsType') == 'relatedAdLinks') {
              topicPageUrl = this.help.addPrefixedQueryParam(topicPageUrl, 'searchTerm', escape(tag.name));
              topicPageUrl = this.help.addPrefixedQueryParam(topicPageUrl, 'whichPage', 'relatedAdLinks');
            } else {
              topicPageUrl = this.help.addPrefixedQueryParam(topicPageUrl, 'tag', escape(tag.name));
              topicPageUrl = this.help.addPrefixedQueryParam(topicPageUrl, 'whichPage', 'topicPage');
            }
            topicPageUrl = this.help.addPrefixedQueryParam(topicPageUrl, 'apiKey', this.context.apiKey);
            responses.tags[i] = { 'name' : tag.name, 'topicPageUrl' : topicPageUrl };
          }
          this.context.tags = responses.tags;
          this.splitRenderResults({'data':'tags','results':responses.tags});
          this.processTemplates();
          this.setEventEnabled("onCompleted", true);
          this.render(callback);
          if (this.context.splitResults) {
            var save = this.context.tags;
            this.context.tags = this.context.splitResults;
            var html = this.processTemplateData(this.template, this.context);
            if (html) {
              document.getElementById(this.context.options.splitResultsDiv).innerHTML = html;
            }
            this.context.tags = save;
          }
        }
      });
    }

})();

(function(){
  var widget = function() {};
  window['PluckItRecommendWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// Recommend Widget\r\n{/eval}\r\n\r\n<div class="podPropsWidget podButton2"\><span class="podButton2_Right"\>\r\n  {if userHasRecommended == "None"}\r\n  <a href="javascript:WIDGETINSTANCE.recommend(\'positive\')" class="podIconRecommendUp"\>${positive}</a\>\r\n  <a href="javascript:WIDGETINSTANCE.recommend(\'negative\')" class="podIconRecommendDown"\>${negative}</a\>\r\n  {else}\r\n  <span class="podIconRecommendUp"\>${positive}</span\>\r\n  <span class="podIconRecommendDown"\>${negative}</span\>\r\n  {/if}\r\n</span\></div\>\r\n\r\n'; 
  widget.prototype.preloadImageUrls = []; 
    widget.prototype.postInit = function() {
      if ((this.parent != null) && ((this.optionSpecified('showRecommendations') != 'true'))) {
        this.dontShowThisWidget = true;
        this.autoRender = false;
        return;
      }
      this.key = new dmpod.PublisherContentKey(this.help.convertUrlToPublisherKeyString(document.location.href));
      if (this.optionSpecified('commentId')) {
        this.key = new dmpod.CommentKey(this.optionSpecified('commentId'));
      } else if (this.optionSpecified('publisherContentId')) {
        this.key = new dmpod.PublisherContentKey(this.optionSpecified('publisherContentId'));
      } else if (this.optionSpecified('articleId')) {
        this.key = new dmpod.ArticleKey(this.optionSpecified('articleId'));
      } else if (this.help.getPrefixedQueryParam('articleId')) {
        this.key = new dmpod.ArticleKey(this.help.getPrefixedQueryParam('articleId'));
      }
    }
    widget.prototype.addRequests = function() {
      if (this.dontShowThisWidget) {
        return;
      }
      var request = new dmpod.GetCustomerRequest();
      this.addRequest(request);
      var request = new dmpod.GetReactionSummaryRequest(this.key);
      this.addRequest(request);
    }
    widget.prototype.buildContextFromResponses = function(responses) {
      var errorMessage = this.help.getErrorMessageFromResponses(responses);
      if (errorMessage.length > 0) {
        this.setErrorText(errorMessage);
      } else {
        this.setTemplateVars(responses[1].reactionSummary)
      }
    }
    widget.prototype.setTemplateVars = function(reactionSummary) {
      this.context.positive = 0;
      this.context.negative = 0;
      for (var i = 0, recommendation; recommendation = reactionSummary.recommendationDetails[i]; i++) {
        if (recommendation.category == 'Positive') {
          this.context.positive = recommendation.count;
        }
        else if (recommendation.category == 'Negative') {
          this.context.negative = recommendation.count;
        }
      }
      this.context.userHasRecommended = reactionSummary.userHasRecommended;
    }
    widget.prototype.recommend = function(flag, callback) {
      request = new dmpod.RecommendRequest(this.key, flag);
      this.sendRequests(request, function(response) {
          response = response.Responses[0];
          if (response.isError) {
            alert('fail: ' + response.message);
          } else {
            this.execute();
            if (typeof(callback) !== 'undefined') {
              callback();
            }
          }
      });
    }

})();

(function(){
  var widget = function() {};
  window['PluckItReportAbuseWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// ReportAbuse Widget\r\n{/eval}\r\n\r\n<div class="podReportAbuse"\>\r\n  <a id="${reportAbuseLinkId}" href="javascript:;" {if userHasReportedAbuse} style="display: none"{/if}\r\n    onclick="javascript:WIDGETINSTANCE.displayForm();" class="podIconAbuse"\>Report Abuse</a\>\r\n  <form id="${reportAbuseFormId}" name="${reportAbuseFormId}" class="podReportAbuseForm" style="display: none;" \r\n    action="javascript:WIDGETINSTANCE.reportAbuse(document.forms[\'${reportAbuseFormId}\'].elements[\'abuseReason\'].value);"\>\r\n    <select name="abuseReason" class="podAbuseReason"\>\r\n      <option value="ObsceneOrVulgar"\>Obscene or vulgar</option\>\r\n      <option value="HateSpeech"\>Hate speech</option\>\r\n      <option value="PersonalAttack"\>Personal attack</option\>\r\n      <option value="AdvertisingSpam"\>Advertising spam</option\>\r\n      <option value="CopyrightOrPlagiarism"\>Copyright/plagiarism</option\>\r\n      <option value="Other"\>Other</option\>\r\n    </select\>\r\n    <a class="podButton2 podSendButton" href="javascript:document.forms[\'${reportAbuseFormId}\'].submit(); "\><span class="podButton2_Right"\>Send</span\></a\>\r\n    <a class="podButtonCancel" href="javascript:;" onclick="javascript:WIDGETINSTANCE.cancelForm();"\>Cancel</a\>\r\n  </form\>\r\n  <div id="${sendingReportId}" class="podWaiting" style="display: none"\>Sending ...</div\>\r\n  <div id="${abuseReportedId}" class="podIconAbuse"{if !userHasReportedAbuse} style="display: none"{/if}\>Abuse Reported</div\>\r\n</div\>\r\n'; 
  widget.prototype.preloadImageUrls = []; 
    widget.prototype.postInit = function() {
      this.context.userHasReportedAbuse = false;
      if (this.optionSpecified('userHasReportedAbuse')) {
        if (this.context.options.userHasReportedAbuse == 'true') {
          this.context.userHasReportedAbuse = true;
        }
      }
      if (!this.optionSpecified('reactionTargetId')) {
        this.autoRender = false;
      }
      if (!this.optionSpecified('reactionTargetType')) {
        this.autoRender = false;
      }
      if (this.optionSpecified('reactionTargetType') == 'userKey') {
        this.reactionTargetKey = new dmpod.UserKey(this.context.options.reactionTargetId);
      } else {
        this.reactionTargetKey = new dmpod.CommentKey(this.context.options.reactionTargetId);
      }
      this.context.reportAbuseFormId = 'podReportAbuseFormId_' + this.optionSpecified('reactionTargetId') + '_' + this.divSuffix;
      this.context.reportAbuseLinkId = 'podReportAbuseLinkId_' + this.optionSpecified('reactionTargetId') + '_' + this.divSuffix;
      this.context.abuseReportedId = 'podReportAbuseReportedId_' + this.optionSpecified('reactionTargetId') + '_' + this.divSuffix;
      this.context.sendingReportId = 'podSendingReportId_' + this.optionSpecified('reactionTargetId') + '_' + this.divSuffix;
    }
    widget.prototype.reportAbuse = function(abuseReason, callback) {
      this.help.displayElement(this.context.reportAbuseFormId, 'none');
      this.help.displayElement(this.context.sendingReportId, 'block');
      var request = new dmpod.ReportAbuseOnRequest(this.reactionTargetKey, abuseReason);
      this.sendRequests(request, function(response) {
        response = response.Responses[0];
        if (response.isError) {
          alert('fail: ' + response.message);
          this.help.swapElements(this.context.sendingReportId, this.context.reportAbuseFormId);
        } else {
          this.help.swapElements(this.context.sendingReportId, this.context.abuseReportedId);
          if (callback) {
            callback();
          }
        }
      });
    }
    widget.prototype.displayForm = function(callback) {
      this.help.swapElements(this.context.reportAbuseLinkId, this.context.reportAbuseFormId);
      if (callback) {
        callback();
      }
    }
    widget.prototype.cancelForm = function(callback) {
      this.help.swapElements(this.context.reportAbuseFormId, this.context.reportAbuseLinkId);
      if (callback) {
        callback();
      }
    }

})();

(function(){
  var widget = function() {};
  window['PluckItProfileWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// Profile Widget\r\n{/eval}\r\n\r\n{if options.showProfile == \'true\'}\r\n<span class="podPersonaWidgetWrapper podGlobal"\>\r\n\r\n  <div id="${profileId}" class="podPersonaWidget podPersonaRoundedContainer" style="visibility: hidden"\>\r\n    <a class="podIconClose" href="javascript:WIDGETINSTANCE.resetProfile();"\></a\>\r\n    <div class="podPersonaBgTL"\><div class="podPersonaBgTR"\></div\></div\>\r\n    <div class="podPersonaContent"\>\r\n      {if user.isOwner}\r\n      <div class="podHorizontalList podButtons podFLC"\>\r\n        <div class="podItem"\><a id="${viewLinkId}" href="javascript:;" onclick="javascript:WIDGETINSTANCE.showContent(\'${viewContentId}\');" class="podButton1Selected podBtnViewProfile"\><span class="podButton1_Right"\>View Profile</span\></a\></div\>\r\n        <div class="podItem"\><a id="${editLinkId}" href="javascript:;" onclick="javascript:WIDGETINSTANCE.showContent(\'${editContentId}\');" class="podButton1 podBtnEditProfile"\><span class="podButton1_Right"\>Edit Profile</span\></a\></div\>\r\n        <div class="podItem"\><a id="${passLinkId}" href="javascript:;" onclick="javascript:WIDGETINSTANCE.showContent(\'${passContentId}\');" class="podButton1 podBtnPassword " style="display: none"\><span class="podButton1_Right"\>Change Password</span\></a\></div\>\r\n      </div\>\r\n      {/if}\r\n\r\n      <div id="${messageBoxId}" class="podMessage" style="display:none"\></div\>\r\n      \r\n      <div class="podPersonaView" id="${viewContentId}"\>\r\n      {if user.profileState == \'Blocked\'}\r\n        <div class="podAlert"\>\r\n        {if user.isOwner}\r\n        Your profile has been blocked by moderators due to objectionable content. \r\n        Please update your personal information and avatar in accordance with the \r\n        acceptable use policy so that your profile can be reactivated.\r\n        {else}\r\n        This profile has been blocked by moderators.\r\n        {/if}\r\n        </div\>\r\n      {/if}\r\n        <div class="podPersonaInfo"\>\r\n          <div class="podPersonaContentBlock"\>\r\n            {if (options.showAbuse == \'true\') && !user.isOwner}\r\n            <div class="podAbuseContainer" id="reportAbuse"\>${reportAbuse}</div\>\r\n            {/if}\r\n            <div class="podFieldAvatar"\>\r\n              <img id="${avatarViewImgId}" src="${user.avatarPhotoUrl}" alt="${user.name}" class="podAvatarMedium"/\>\r\n            </div\>\r\n            <div class="podPersonaData"\>\r\n              <div id="${viewDisplayNameId}" class="podPageTitle"\>${user.name}</div\>\r\n              {if user.isOwner || user.site}\r\n                <p id="${viewSiteId}" class="podWebsiteUrl"\>\r\n                  {if user.isOwner && !user.site}\r\n                  <a href="javascript:WIDGETINSTANCE.showContent(\'${editContentId}\');"\>Add your website here.</a\>\r\n                  {else}\r\n                  <a href="${user.site}" rel="external" target="_blank"\>${user.site}</a\>\r\n                  {/if}\r\n                </p\>\r\n              {/if}\r\n              {if user.isOwner || user.bio}\r\n              <p id="${viewBioId}" class="podAboutMe"\>\r\n                {if user.isOwner && !user.bio}\r\n                <a href="javascript:WIDGETINSTANCE.showContent(\'${editContentId}\');"\>Provide a description of yourself.</a\>\r\n                {else}\r\n                ${user.bio}\r\n                {/if}\r\n              </p\>\r\n              {/if}\r\n            </div\>\r\n            <div class="podActivity podClear"\>\r\n              <div class="podActivitySummary"\>\r\n                <div class="podHeadline"\>Activity Summary</div\>\r\n                <div class="podBasicList"\>\r\n                  <div class="podItem"\><span class="podCallout" id="${commentCountId}"\>{if userSummary.totalComments}${userSummary.totalComments}{else}0{/if}</span\> Comments</div\>\r\n                  <div class="podItem"\><span class="podCallout" id="${recommendationCountId}"\>{if userSummary.totalRecommendations}${userSummary.totalRecommendations}{else}0{/if}</span\> Recommendations</div\>\r\n                </div\>\r\n              </div\>\r\n              <div class="podActivityRecent"\>\r\n                <div class="podHeadline"\>Most Recent Activity</div\>\r\n                <div class="podBasicList" id="${recentActivityId}"\>\r\n                  {if userSummary.recentActivities}\r\n                    ${userSummary.recentActivities}\r\n                  {else}\r\n                    <div class="podItem"\>No recent activity.</div\>\r\n                  {/if}\r\n                </div\>\r\n              </div\>\r\n              <div class="podClear"\></div\>\r\n            </div\>\r\n          </div\>\r\n        </div\>\r\n        <div class="podFormButtons podFLC"\>\r\n          <div class="podPluck" id="${viewPluckLogo}" style="display: none"\>\r\n            <a href="http://ondemand.pluck.com/" target="podPluckOnDemand"\><img class="podLogo" \r\n              src="http://cdn-docs.pluckit.pluck.com/assets/v1/images/pluck_lightgrey.gif?apiKey=00000000-0000-0000-0000-000000000000&vn=7034" \r\n              alt="Powered by Pluck" width="72" height="16" /\></a\>\r\n          </div\>\r\n          <a href="javascript:WIDGETINSTANCE.resetProfile();" class="podButton2"\><span class="podButton2_Right"\>Close</span\></a\>\r\n        </div\>\r\n      </div\>\r\n      {if user.isOwner}\r\n      <div class="podPersonaEdit" id="${editContentId}" style="display: none;"\>\r\n        <form class="podForm" name="${editFormName}" action="javascript:WIDGETINSTANCE.editProfile(document.forms[\'${editFormName}\'])"\>\r\n          <div class="podPersonaContentBlock podFLC"\>\r\n            <div class="podFormField podFieldAvatar"\>\r\n              <img src="${user.avatarPhotoUrl}" class="podAvatarMedium" id="${avatarImgId}"/\>\r\n              <div class="podAvatarMedium" id="${avatarLoadingId}" style="display: none;"\>\r\n                <div class="podAvatarLoading"\>\r\n                  <img src="${avatarLoadingUrl}" /\>\r\n                </div\>\r\n              </div\>\r\n              <label\>Change Avatar</label\>\r\n              <div\>${avatarUploaderFlashHTML}</div\>\r\n              <div class="podErrorMessage" id="${changeAvatarError}" style="display:none"\></div\>\r\n            </div\>\r\n            <div class="podPersonaData"\>\r\n              <div class="podFormField"\>\r\n                <label\>My Name <span class="podNote"\>* Required Field</span\></label\>\r\n                <input type="text" class="podFormInputText" name="EditProfileDisplayName" value="${user.name}" onKeyPress="return WIDGETINSTANCE.help.submitEnter(this,event)" /\>\r\n                <div class="podErrorMessage" id="${editProfileDisplayNameError}" style="display:none"\></div\>\r\n              </div\>\r\n              <div class="podFormField"\>\r\n                <label\>My Website</label\>\r\n                <input type="text" class="podFormInputText" name="EditProfileSite" value="${user.site}" onKeyPress="return WIDGETINSTANCE.help.submitEnter(this,event)" /\>\r\n                <div class="podErrorMessage" id="${editProfileSiteError}" style="display:none"\></div\>\r\n              </div\>\r\n              <div class="podFormField podAboutMe"\>\r\n                <label\>About Me</label\>\r\n                <textarea class="podFormInputText" name="EditProfileBio"\>${user.bio}</textarea\>\r\n                <div class="podErrorMessage" id="${editProfileBioError}" style="display:none"\></div\>\r\n              </div\>\r\n            </div\>\r\n          </div\>\r\n          <div class="podFormButtons podFLC"\>\r\n            <div class="podPluck" id="${editPluckLogo}" style="display: none"\>\r\n              <a href="http://ondemand.pluck.com/" target="podPluckOnDemand"\><img src="http://cdn-docs.pluckit.pluck.com/assets/v1/images/clear.gif?apiKey=00000000-0000-0000-0000-000000000000&vn=7034"/\></a\>\r\n            </div\>\r\n            <a href="javascript:WIDGETINSTANCE.editProfile(document.forms[\'${editFormName}\']);" class="podButton1"\><span class="podButton1_Right"\>Save Changes</span\></a\>\r\n            <a href="javascript:WIDGETINSTANCE.resetProfile();" class="podButtonCancel" \>Cancel</a\>\r\n          </div\>\r\n        </form\>\r\n      </div\>\r\n      <div class="podPersonaChangePassword" id="${passContentId}" style="display: none"\>\r\n        <form class="podForm" name="${passFormName}" action="javascript:WIDGETINSTANCE.changePassword(document.forms[\'${passFormName}\'])"\>\r\n          <div class="podPersonaContentBlock podFLC"\>\r\n            <div class="podFieldAvatar"\>\r\n              <img id="${avatarChangePasswordImgId}" src="${user.avatarPhotoUrl}" alt="${user.name}" class="podAvatarMedium"/\>\r\n            </div\>\r\n            <input type="hidden" name="EditProfileUserKey" value="${user.userKey.key}" /\>\r\n            <div class="podPersonaData"\>\r\n              <div class="podFormField"\>\r\n                <label\>Current Password</label\>\r\n                <input type="password" class="podFormInputText" name="EditProfileOldPassword" onKeyPress="return WIDGETINSTANCE.help.submitEnter(this,event)" /\>\r\n                <div class="podErrorMessage" id="${editCurrentPasswordError}" style="display:none"\></div\>\r\n              </div\>\r\n              <div class="podFormField"\>\r\n                <label\>New Password</label\>\r\n                <input type="password" class="podFormInputText" name="EditProfileNewPassword" onKeyPress="return WIDGETINSTANCE.help.submitEnter(this,event)" /\>\r\n                <div class="podErrorMessage" id="${editNewPasswordError}" style="display:none"\></div\>\r\n              </div\>\r\n              <div class="podFormField"\>\r\n                <label\>Verify Password</label\>\r\n                <input type="password" class="podFormInputText" name="EditProfilePasswordConfirmation" onKeyPress="return WIDGETINSTANCE.help.submitEnter(this,event)" /\>\r\n                <div class="podErrorMessage" id="${editNewPasswordConfirmError}" style="display:none"\></div\>\r\n              </div\>\r\n            </div\>\r\n          </div\>\r\n          <div class="podFormButtons podFLC"\>\r\n            <div class="podPluck" id="${passPluckLogo}" style="display: none"\>\r\n              <a href="http://ondemand.pluck.com/" target="podPluckOnDemand"\><img src="http://cdn-docs.pluckit.pluck.com/assets/v1/images/clear.gif?apiKey=00000000-0000-0000-0000-000000000000&vn=7034"/\></a\>\r\n            </div\>\r\n            <a href="javascript:WIDGETINSTANCE.changePassword(document.forms[\'${passFormName}\']);" class="podButton1"\><span class="podButton1_Right"\>Save Changes</span\></a\>\r\n            <a href="javascript:WIDGETINSTANCE.resetProfile();" class="podButtonCancel" onclick=""\>Cancel</a\>\r\n          </div\>\r\n        </form\>\r\n      </div\>\r\n      {/if}\r\n    </div\>\r\n    <div class="podPersonaBgBL"\><div class="podPersonaBgBR"\></div\></div\>\r\n  </div\>\r\n\r\n</span\>\r\n{/if}\r\n\r\n{if options.showProfile == \'true\'}\r\n<a {if options.showAvatar == \'true\'} class="podAvatarSmallBg podPersonaTrigger" {/if} onclick="javascript:WIDGETINSTANCE.showProfile(0,0);" \r\n  href="javascript:;"\>\r\n  {if options.showAvatar == \'true\'}\r\n    <img id="${targetId}" src="${user.avatarPhotoUrl}" alt="${user.name}" class="podAvatarSmall"/\></a\>\r\n  {/if}\r\n  {if options.showUsername == \'true\'}<span id="${targetId}"\>${user.name}</span\></a\>{/if}\r\n{else}\r\n<div {if options.showAvatar == \'true\'} class="podAvatarSmallBg" {/if} href="javascript:;"\>\r\n  {if options.showAvatar == \'true\'}\r\n  <img id="${targetId}" src="${user.avatarPhotoUrl}" alt="${user.name}" class="podAvatarSmall"/\></div\>\r\n  {/if}\r\n  {if options.showUsername == \'true\'}<span id="${targetId}"\>${user.name}</span\></div\>{/if}\r\n{/if}'; 
  widget.prototype.preloadImageUrls = []; 
    if (typeof PluckItProfileWidgetHander == 'undefined') {
      PluckItProfileWidgetHandler = { 
        profileWidgets: new Array()
      }
    }
    widget.prototype.nextUploaderId = 0;
    widget.prototype.postInit = function() {
      this.context.activeTab = 'view';
      this.context.profileId = 'podProfile_' + this.divSuffix;
      this.context.targetId = 'podTarget_' + this.divSuffix;
      this.context.viewLinkId = 'podViewLink_' + this.divSuffix;
      this.context.editLinkId = 'podEditLink_' + this.divSuffix;
      this.context.passLinkId = 'podPassLink_' + this.divSuffix;
      this.context.viewContentId = 'podViewContent_' + this.divSuffix;
      this.context.editContentId = 'podEditContent_' + this.divSuffix;
      this.context.passContentId = 'podPasswordContent_' + this.divSuffix;
      this.context.editFormName = 'podEditForm_' + this.divSuffix;
      this.context.passFormName = 'podPassForm_' + this.divSuffix;
      this.context.viewDisplayNameId = 'podViewDisplayName_' + this.divSuffix;
      this.context.viewSiteId = 'podViewSite_' + this.divSuffix;
      this.context.viewBioId = 'podViewBio_' + this.divSuffix;
      this.context.editProfileDisplayNameError = 'podEditProfileDisplayNameError_' + this.divSuffix;
      this.context.editProfileSiteError = 'podEditProfileSiteError_' + this.divSuffix;
      this.context.editProfileBioError = 'podEditProfileBioError_' + this.divSuffix;
      this.context.editCurrentPasswordError = 'podEditCurrentPasswordError_' + this.divSuffix;
      this.context.editNewPasswordError = 'podEditNewPasswordError_' + this.divSuffix;
      this.context.editNewPasswordConfirmError = 'podEditNewPasswordConfirmError_' + this.divSuffix;
      this.context.avatarViewImgId = 'podAvatarViewId_' + this.divSuffix;
      this.context.avatarImgId = 'podAvatarEditId_' + this.divSuffix;
      this.context.avatarLoadingId = 'podAvatarLoadingId_' + this.divSuffix;
      this.context.avatarChangePasswordImgId = 'podAvatarChangePasswordId_' + this.divSuffix;
      this.context.changeAvatarError = 'podAvatarErrorId_' + this.divSuffix;
      this.context.avatarUploaderFlashId = 'podUploadAvatarFlash_' + this.divSuffix;
      this.context.messageBoxId = 'podMessageId_' + this.divSuffix;
      this.context.viewPluckLogo = 'podViewPluckLogo_' + this.divSuffix;
      this.context.editPluckLogo = 'podEditPluckLogo_' + this.divSuffix;
      this.context.passPluckLogo = 'podPassPluckLogo_' + this.divSuffix;
      this.context.avatarLoadingUrl = this.help.resolveAssetsResource('images/spinner_large.gif');
      this.uploaderId = 'podAvatarFlashUploader_'+widget.prototype.nextUploaderId++;
      this.context.avatarUploaderFlashHTML = this.service.getFileUploaderHTML(this.context.avatarUploaderFlashId, 
         this.uploaderId, 74, 34, this.help.resolveAssetsResource('images/podUpload.png'));
      this.context.commentCountId = 'podCommentCount_' + this.divSuffix;
      this.context.recommendationCountId = 'podRecommendCount_' + this.divSuffix;
      this.context.recentActivityId = 'podActivity_' + this.divSuffix;
      this.uploaderAdded = false;
      this.context.profileDataHasBeenAltered = false;
      this.userRecentActivityRequested = false;
      this.moveSteps = 10;
      this.moveIntervals = 10;
      this.movePower = 0.5;
      this.opacitySteps = 10;
      this.opacityIntervals = 30;
      this.opacityPower = 0.5;
      PluckItProfileWidgetHandler.profileWidgets.push(this);
      if (typeof PluckItProfileWidgetHandler.profileResponseCallback == 'function') {
        PluckItProfileWidgetHandler.profileResponseCallback();
      }
    }
    widget.prototype.addRequests = function() {
      var request = new dmpod.GetUserRequest();
      this.addRequest(request);
      request = new dmpod.GetCustomerRequest();
      this.addRequest(request);
    };
    widget.prototype.setUsers = function(userRecord) {
      this.context.loggedInUser = userRecord.loggedInUser;
      this.context.loggedInUser.isAnonymous = (this.context.loggedInUser.userKey.key == 'anonymous');
      this.context.user = userRecord.targetUser;
      this.context.user.isAnonymous = (this.context.user.userKey.key == 'anonymous');
      this.context.user.isOwner = (this.context.loggedInUser.userKey.key == this.context.user.userKey.key);
      if (!this.context.userSummary) {
        this.context.userSummary = {};
      }
      if (userRecord.recentActivity) {
        var request = new dmpod.UserRecentActivityRequest(new dmpod.UserKey(this.context.user.userKey.key));
        this.sendRequests(request, function(responses) {
          var errorMessage = this.help.getErrorMessageFromResponses(responses);
          if (errorMessage.length > 0) {
            this.setErrorText(errorMessage);
          } else {
            this.displayActivity(responses.Responses[0]);
          }
        }); 
      }
      var request = new dmpod.VerifyUsersPublisherNetworkRequest('eNom');
      this.sendRequests(request, function(responses) {
        var errorMessage = this.help.getErrorMessageFromResponses(responses);
        if (errorMessage.length > 0) {
          this.setErrorText(errorMessage);
        } else {
          if (!responses.Responses[0].isMember) {
            this.help.displayElement(this.context.passLinkId, 'block', 3);
            this.help.displayElement(this.context.viewPluckLogo, 'block', 3);
            this.help.displayElement(this.context.editPluckLogo, 'block', 3);
            this.help.displayElement(this.context.passPluckLogo, 'block', 3);
          }
        }
      }); 
      if (this.context.loggedInUser.userKey.key == this.context.user.userKey.key) {
        this.context.reportAbuse = '<!-- No reporting abuse. -->';
      } else {
        var reportAbuse = this.createWidget(null, 'PluckItReportAbuseWidget', 'reportAbuse', 'reportAbuse_' + this.divSuffix, {reactionTargetId: this.context.user.userKey.key, reactionTargetType: 'userKey', userHasReportedAbuse: 'false'});
        this.context.reportAbuse = reportAbuse.processTemplate();
      }
      this.uploadFile = (function(widget, key) {
        return function() {
          widget.service.uploadFile(widget.context.avatarUploaderFlashId,'http://pluckit.demandmedia.com/UploadUserAvatar?apiKey=00000000-0000-0000-0000-000000000000&mimetype=image%2fpng&userKey=' + key
            ,'Images (*.jpg, *.jpeg, *.gif, *.png, *.bmp)'
            ,'*.jpg; *.jpeg; *.gif; *.png; *.bmp'
            ,widget
            ,function (success, response) {
              if (!success) {
                this.help.showError(this.context.changeAvatarError, 'There was an error uploading your avatar.');
              } else {
                this.help.hideError(this.context.changeAvatarError);
                this.context.profileDataHasBeenAltered = true;
                var request = new dmpod.UpdateUserRequest(this.context.loggedInUser.name);
                request.site = this.context.loggedInUser.site;
                request.bio = this.context.loggedInUser.bio;
                this.sendRequests(request, function(response) {
                  response = response.Responses[0];
                  if (response.isError) {
                    alert('Error updating user: ' + response.message);
                  } else {
                    widget.sendRequests(new dmpod.GetUserRequest(), function(responses) {
                      document.getElementById(this.context.avatarLoadingId).style.display = 'none';
                      document.getElementById(this.context.avatarImgId).style.display = 'block';
                      response = responses.Responses[0];
                      if (response.isError) {
                        alert('fail: ' + response.message);
                      } else {
                        document.getElementById(this.context.avatarImgId).src = response.user.avatarPhotoUrl;
                        document.getElementById(this.context.avatarViewImgId).src = response.user.avatarPhotoUrl;
                        document.getElementById(this.context.avatarChangePasswordImgId).src = response.user.avatarPhotoUrl;
                        if (document.getElementById(this.context.targetId).tagName.toLowerCase() == 'img') {
                          document.getElementById(this.context.targetId).src = response.user.avatarPhotoUrl;
                        }
                        this.postMessage('Your avatar has been changed.');
                      }
                    });
                  }
                });
              }
            }
            ,function(percent) { 
              document.getElementById(this.context.avatarLoadingId).style.display = 'block';
              document.getElementById(this.context.avatarImgId).style.display = 'none';
            }
          );
        };
      })(this, this.context.loggedInUser.userKey.key);
      window[this.uploaderId] = this.uploadFile;
    };
    widget.prototype.buildContextFromResponses = function(responses) {
      var errorMessage = this.help.getErrorMessageFromResponses(responses);
      if (errorMessage.length > 0) {
        this.setErrorText(errorMessage);
      } else if (!responses[1].customer.socialMediaEnabled) {
          this.setErrorText('Customer account \'' + this.context.apiKey + '\' is not enabled for social-media API calls.');
      } else {
        this.context.customer = responses[1].customer;
        this.setUsers({ loggedInUser: responses[0].user, targetUser: responses[0].user, recentActivity: true });
      }
    };
    widget.prototype.displayActivity = function(response) {
      var html = '';
      for (var i = 0, activities = response.recentActivities, activity, article; activity = activities[i]; i++) {
        article = activity.targetArticle;
        if (article) {
          var articleLinkUrl = '';
          var articleLinkTarget = '';
          var articleLinkUrlAddedParams = {
              articleId: article.id
              ,title: article.title
              ,mediaType: article.mediaType
            }
          html += '<div class="podItem"><span class="podCallout">' + activity.action + '</span> ';
          if (activity.targetUrl != '') {
            articleLinkUrl = this.help.addPrefixedQueryParams(activity.targetUrl, articleLinkUrlAddedParams);
          } else if (this.optionSpecified('articlePageUrl') != ''){
            articleLinkUrl = this.help.addPrefixedQueryParams(this.optionSpecified('articlePageUrl'), articleLinkUrlAddedParams);
          }
          if (articleLinkUrl != '') {
            html += '<a href="' + articleLinkUrl + '" target="PluckPublisher_' + article.publisherId + '">' + article.title + '</a>';
          } else {
            html += article.title;
          }
          html += '</div>';
        }
      }
      var elem;
      if (elem = document.getElementById(this.context.commentCountId))
        elem.innerHTML = response.totalComments;
      if (elem = document.getElementById(this.context.recommendationCountId))
        elem.innerHTML = response.totalRecommendations;
      if (html && (elem = document.getElementById(this.context.recentActivityId)))
        elem.innerHTML = html;
      this.context.userSummary = {
        recentActivities: html
        ,totalComments: response.totalComments
        ,totalRecommendations: response.totalRecommendations
      }
    }
    widget.prototype.showProfile = function(xOffset, yOffset, callback) {
      this.profileElement = document.getElementById(this.context.profileId);
      this.targetElement = document.getElementById(this.context.targetId);
      if (this.profileElement.style.visibility == 'hidden') {
        this.xOffset = xOffset;
        this.yOffset = yOffset;
        this.hideAllProfiles();
        this.profileElement.style.opacity = '0'
        this.profileElement.style.filter = 'alpha(opacity=0);';
        this.profileElement.style.visibility = 'visible';
        if (this.context.activeTab == 'view') {
          this.showContent(this.context.viewContentId);
        } else if (this.context.activeTab == 'edit') {
          this.showContent(this.context.editContentId);
        } else {
          this.showContent(this.context.passContentId);
        }
        var targetElemPos = this.getPosition(this.targetElement);
        var mouseBuffer = 40;
        var profileStartXOffset = -10 + this.xOffset;
        var profileStartYOffset = -50 + this.yOffset;
        var profileAnimationXOffset = 20;
        var profileAnimationYOffset = 20;
        var startX = 0;
        var startY = 0;
        var windowWidth = window.innerWidth;
        var windowHeight = window.innerHeight;
        if (typeof windowHeight === 'undefined') {
          var windowWidth = document.documentElement.clientWidth;
          var windowHeight = document.documentElement.clientHeight;
          if (typeof windowHeight === 'undefined') {
            windowWidth = 0;
            windowHeight = 0;
          }
        }
        if (windowWidth > 0) {
          var scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
          var left = targetElemPos.x - scrollLeft + this.profileElement.clientWidth;
          if (left > windowWidth) {
            var diff = left - windowWidth + mouseBuffer + profileStartXOffset;
            startX = 0 - diff;
          } else {
            startX = 0;
          }
        }
        startX = startX + profileStartXOffset;
        var endX = startX + profileAnimationXOffset;
        if (windowHeight > 0) {
          var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
          var bottom = targetElemPos.y - scrollTop + this.profileElement.clientHeight;
          if (bottom > windowHeight) {
            var diff = bottom - windowHeight + mouseBuffer + profileStartYOffset;
            startY = 0 - diff;
          } else {
            startY = 0;
          }
        }
        startY = startY + profileStartYOffset;
        var endY = startY + profileAnimationYOffset;
        this.startArray = [startX,startY];
        this.endArray = [endX,endY];
        this.help.moveElement(this.profileElement, this.startArray, this.endArray, this.moveSteps, this.moveIntervals, this.movePower);
        this.help.changeOpacity(this.profileElement, 0, 100, this.opacitySteps, this.opacityIntervals, this.opacityPower);
        this.help.trackGuiEvent('UserProfile', { 'UserKey':this.context.user.userKey.key });
      }
      if (callback) {
        callback();
      }
    };
    widget.prototype.hideProfile = function(callback) {
      var profileElement = document.getElementById(this.context.profileId);
      if (!profileElement) {
        return;
      }
      profileElement.style.visibility = 'hidden';
      if (this.context.profileDataHasBeenAltered && typeof this.help.externalCallback == 'function') {
        this.help.externalCallback();
        this.context.profileDataHasBeenAltered = false;
      }
      if (callback) {
        callback();
      }
    };
    widget.prototype.hideAllProfiles = function(callback) {
      for (var i = 0; i < PluckItProfileWidgetHandler.profileWidgets.length; i++) {
        PluckItProfileWidgetHandler.profileWidgets[i].hideProfile();
      }
      if (callback) {
        callback();
      }
    };
    widget.prototype.getPosition = function (elem) {
      var x = 0, y = 0;
      try {
        do {
          x += elem.offsetLeft;
          y += elem.offsetTop;
          elem = elem.offsetParent;
        } while (elem);
      }
      catch (ex) { 
      }
      return {x: x, y: y};
    };
    widget.prototype.showContent = function(elemId) {
      var profileViewLink = document.getElementById(this.context.viewLinkId);
      var profileView = document.getElementById(this.context.viewContentId);
      if (this.context.user.isOwner) {
        var profileEditLink = document.getElementById(this.context.editLinkId);
        var profileEdit = document.getElementById(this.context.editContentId);
        var profilePassLink = document.getElementById(this.context.passLinkId);
        var profilePass = document.getElementById(this.context.passContentId);
        profileViewLink.className = 'podButton1 podBtnViewProfile';
        profileEditLink.className = 'podButton1 podBtnEditProfile';
        profilePassLink.className = 'podButton1 podBtnPassword';
      }
      if (this.context.user.isOwner) {
        profileView.style.display = 'none';
        profileEdit.style.display = 'none';
        profilePass.style.display = 'none';
        if (elemId == this.context.viewContentId ) {
          this.context.activeTab = 'view';
          profileViewLink.className = 'podButton1Selected podBtnViewProfile';
        } else if (elemId == this.context.editContentId) {
          profileEditLink.className = 'podButton1Selected podBtnEditProfile';
          this.context.activeTab = 'edit';
        } else {
          profilePassLink.className = 'podButton1Selected podBtnPassword';
          this.context.activeTab = 'pass';
        }
      }
      this.clearMessage();
      document.getElementById(elemId).style.display = 'block';
   }
    widget.prototype.editProfile = function(form, callback) {
      if (this.validateEditProfile(form)) {
        var request = new dmpod.UpdateUserRequest(form.elements['EditProfileDisplayName'].value);
        request.site = form.elements['EditProfileSite'].value;
        request.bio = form.elements['EditProfileBio'].value;
        this.sendRequests(request, function(response) {
          response = response.Responses[0];
          if (response.isError) {
            alert('Error updating profile:\n' + response.message);
          } else {
            this.postMessage('Your profile has been updated.');
            this.context.profileDataHasBeenAltered = true;
            document.getElementById(this.context.viewDisplayNameId).innerHTML = form.elements['EditProfileDisplayName'].value;
            document.getElementById(this.context.viewSiteId).innerHTML = form.elements['EditProfileSite'].value;
            this.context.loggedInUser.site = form.elements['EditProfileSite'].value;
            document.getElementById(this.context.viewBioId).innerHTML = form.elements['EditProfileBio'].value;
            this.context.loggedInUser.bio = form.elements['EditProfileBio'].value;
            if (callback) {
              callback();
            }
          }
        });
      }
    };
    widget.prototype.validateEditProfile = function(form) {
      var valid = true;
      var id = form.name.replace(/^[^_]+_/, '');
      var editProfileSiteError = document.getElementById(this.context.editProfileSiteError);
      var value = form.elements['EditProfileSite'].value;
      if (value.length && !/^https?:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_~%&\?\/.=]+$/i.test(value)) {
        this.help.showError(this.context.editProfileSiteError, 'Use "http://www.yoursite.com" as your website format.');
        valid = false;
      } else {
        this.help.hideError(this.context.editProfileSiteError);
      }
      var value = form.elements['EditProfileDisplayName'].value;
      if (!value.length) {
        this.help.showError(this.context.editProfileDisplayNameError, 'Please provide a valid name.');
        valid = false;
      } else if (/[<>]/.test(value)) {
        this.help.showError(this.context.editProfileDisplayNameError, '"<" and ">" characters are not allowed.');
        valid = false;
      } else {
        this.help.hideError(this.context.editProfileDisplayNameError);
      }
      var value = form.elements['EditProfileBio'].value;
      if (/[<>]/.test(value)) {
        this.help.showError(this.context.editProfileBioError, '"<" and ">" characters are not allowed.');
        valid = false;
      } else {
        this.help.hideError(this.context.editProfileBioError);
      }
      return valid;
    };
    widget.prototype.changePassword = function(form) {
      if (this.validateChangePassword(form)) {
        var request = new dmpod.ChangePasswordRequest(
          new dmpod.UserKey(form.elements['EditProfileUserKey'].value)
          ,form.elements['EditProfileOldPassword'].value
          ,form.elements['EditProfileNewPassword'].value
        );
        this.sendRequests(request, function(response) {
          response = response.Responses[0];
          if (response.isError) {
            if (response.message == 'newPassword cannot be null or empty') {
              this.help.showError(this.context.editNewPasswordError, 'Password can not be blank.');
            } else {
              this.help.showError(this.context.editCurrentPasswordError, 'Your password is not valid.');
            }
          } else {
            this.postMessage('Your password has been changed.');
            form.elements['EditProfileOldPassword'].value = '';
            form.elements['EditProfileNewPassword'].value = '';
            form.elements['EditProfilePasswordConfirmation'].value = '';
          }
        });
      }
    };
    widget.prototype.validateChangePassword = function(form) {
      var valid = true;
      var id = form.name.replace(/^[^_]+_/, '');
      if (form.elements['EditProfileOldPassword'].value.length < 6) {
        this.help.showError(this.context.editCurrentPasswordError, 'Password must be at least 6 characters.');
        valid = false;
      } else {
        this.help.hideError(this.context.editCurrentPasswordError);
      }
      if (form.elements['EditProfileNewPassword'].value.length < 6) {
        this.help.showError(this.context.editNewPasswordError, 'Password must be at least 6 characters.');
        valid = false;
      } else if (/[<>]/.test(form.elements['EditProfileNewPassword'].value)) {
        this.help.showError(this.context.editNewPasswordError, '"<" and ">" characters are not allowed.');
        valid = false;
      } else {
        this.help.hideError(this.context.editNewPasswordError);
      }
      if (form.elements['EditProfileNewPassword'].value != form.elements['EditProfilePasswordConfirmation'].value) {
        this.help.showError(this.context.editNewPasswordConfirmError, 'Passwords do not match');
        valid = false;
      } else {
        this.help.hideError(this.context.editNewPasswordConfirmError);
      }
      return valid;
    };
    widget.prototype.resetProfile = function () {
      this.hideProfile();
      if (this.context.user.isOwner) {
        this.showContent(this.context.viewContentId);
      }
    }
    widget.prototype.clearMessage = function() {
      var messageBox = document.getElementById(this.context.messageBoxId);
      messageBox.style.display = 'none';
    }
    widget.prototype.postMessage = function(msg) {
      var messageBox = document.getElementById(this.context.messageBoxId);
      messageBox.innerHTML = msg;
      messageBox.style.display = 'block';
    }

})();

(function(){
  var widget = function() {};
  window['PluckItLoginWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// Login Widget\r\n{/eval}\r\n\r\n<div id="PluckLogin" class="podSignupWidget"\>\r\n  <div class="podRoundedContainer podGlobal {if showLoginOnly} podLoginOnly {/if}"\>\r\n    <a name="topOfLogin"\></a\>\r\n    {if user.isAnonymous}\r\n    <div class="podRoundedContainer"\>\r\n      <div class="podBgTL"\><div class="podBgTR"\></div\></div\>\r\n      <div class="podContent"\>\r\n        {if !showLoginOnly}\r\n        <div class="podPageTitle"\><span class="podSignUpTitle"\>Sign Up / </span\>Login</div\>\r\n        {/if}\r\n        <div class="podContentBlock"\>\r\n          <div class="podFLC"\>\r\n            {if !showLoginOnly}\r\n            <div class="podSignup" id="PluckRegisterForm_${divSuffix}"\>\r\n              <div class="podSectionTitle"\>${signupTitleText} &nbsp; \r\n                <span class="podNote"\>\r\n                  * Required Fields\r\n                </span\>\r\n              </div\>\r\n              <form class="podForm" name="PluckRegisterForm" action="javascript:WIDGETINSTANCE.register(document.forms[\'PluckRegisterForm\']);"\>\r\n                <div class="podAlert" id="RegisterError" style="display:none"\></div\>\r\n                <div class="podFormField"\>\r\n                  <label\>Your Email <span class="podNote"\>*</span\></label\>\r\n                  <input type="text" class="podFormInputText" name="Email" onKeyPress="return WIDGETINSTANCE.help.submitEnter(this,event)" /\>\r\n                  <div class="podErrorMessage" id="RegisterEmailError" style="display: none"\></div\>\r\n                </div\>\r\n                <div class="podFormField"\>\r\n                  <label\>Your Name <span class="podNote"\>*</span\></label\>\r\n                  <input type="text" class="podFormInputText" name="Username" onKeyPress="return WIDGETINSTANCE.help.submitEnter(this,event)" /\>\r\n                  <div class="podErrorMessage" id="RegisterUsernameError" style="display: none"\></div\>\r\n                </div\>\r\n                <div class="podFormField"\>\r\n                  <label\>Password <span class="podNote"\>*</span\></label\>\r\n                  <input type="password" class="podFormInputText" name="Password" onKeyPress="return WIDGETINSTANCE.help.submitEnter(this,event)" /\>\r\n                  <div class="podErrorMessage" id="RegisterPasswordError" style="display: none"\></div\>\r\n                </div\>\r\n                <div class="podFormField"\>\r\n                  <label\>Confirm Password <span class="podNote"\>*</span\></label\>\r\n                  <input type="password" class="podFormInputText" name="PasswordConfirm" onKeyPress="return WIDGETINSTANCE.help.submitEnter(this,event)" /\>\r\n                  <div class="podErrorMessage" id="RegisterPasswordConfirmError" style="display: none"\></div\>\r\n                </div\>\r\n                <div class="podFormField"\>\r\n                  <label\>Your Birthday <span class="podNote"\>*</span\></label\>\r\n                  <div class="podBirtdateContainer"\>\r\n                    <select name="BirthMonth" onchange="WIDGETINSTANCE.setDays()"\>\r\n                      <option value="0"\>01</option\>\r\n                      <option value="1"\>02</option\>\r\n                      <option value="2"\>03</option\>\r\n                      <option value="3"\>04</option\>\r\n                      <option value="4"\>05</option\>\r\n                      <option value="5"\>06</option\>\r\n                      <option value="6"\>07</option\>\r\n                      <option value="7"\>08</option\>\r\n                      <option value="8"\>09</option\>\r\n                      <option value="9"\>10</option\>\r\n                      <option value="10"\>11</option\>\r\n                      <option value="11"\>12</option\>\r\n                    </select\> /\r\n                    <select name="BirthDay"\>\r\n                      <option value="1"\>01</option\>\r\n                      <option value="2"\>02</option\>\r\n                      <option value="3"\>03</option\>\r\n                      <option value="4"\>04</option\>\r\n                      <option value="5"\>05</option\>\r\n                      <option value="6"\>06</option\>\r\n                      <option value="7"\>07</option\>\r\n                      <option value="8"\>08</option\>\r\n                      <option value="9"\>09</option\>\r\n                      <option value="10"\>10</option\>\r\n                      <option value="11"\>11</option\>\r\n                      <option value="12"\>12</option\>\r\n                      <option value="13"\>13</option\>\r\n                      <option value="14"\>14</option\>\r\n                      <option value="15"\>15</option\>\r\n                      <option value="16"\>16</option\>\r\n                      <option value="17"\>17</option\>\r\n                      <option value="18"\>18</option\>\r\n                      <option value="19"\>19</option\>\r\n                      <option value="20"\>20</option\>\r\n                      <option value="21"\>21</option\>\r\n                      <option value="22"\>22</option\>\r\n                      <option value="23"\>23</option\>\r\n                      <option value="24"\>24</option\>\r\n                      <option value="25"\>25</option\>\r\n                      <option value="26"\>26</option\>\r\n                      <option value="27"\>27</option\>\r\n                      <option value="28"\>28</option\>\r\n                      <option value="29"\>29</option\>\r\n                      <option value="30"\>30</option\>\r\n                      <option value="31"\>31</option\>\r\n                    </select\> /\r\n                    <select name="BirthYear" onchange="WIDGETINSTANCE.setDays()"\>${yearOptions}</select\>\r\n                  </div\>\r\n                  <div class="podErrorMessage" id="PluckBirtdateError" style="display: none"\></div\>\r\n                </div\>\r\n                <div class="podFormField"\>\r\n                  <div class="podRegisterCheckbox"\><input type="checkbox" name="RegisterTOS" /\>I agree to the Pluck <a href="http://ondemand.pluck.com/end-user-terms-of-use.aspx" target="termsofuse"\>terms of use</a\> and <a href="http://ondemand.pluck.com/end-user-privacy-policy.aspx" target="privacypolicy"\>privacy policy</a\>.&nbsp;<span class="podNote"\>*</span\></div\>\r\n                  <div class="podErrorMessage" id="RegisterTOSError" style="display: none"\></div\>\r\n                </div\>\r\n                <p class="podSignupInstructions"\>By posting a comment, you are establishing an account with the Pluck on Demand network of websites. Your comment may appear across the network.</p\>\r\n                <div class="podFormButtons"\>\r\n                  <a href="javascript:;" onclick="javascript:WIDGETINSTANCE.register(document.forms[\'PluckRegisterForm\']);"\r\n                    class="podButton1 podBtnSignup"\><span class="podButton1_Right"\>${signupButtonText}</span\></a\>\r\n                </div\>\r\n              </form\>\r\n            </div\>\r\n            <div class="podLine"\></div\>\r\n            {/if}\r\n            <div class="podLogin"\>\r\n              {if !showLoginOnly}\r\n              <div class="podSectionTitle"\>${loginTitleText}</div\>\r\n              {/if}\r\n              <form class="podForm" name="PluckLoginForm" action="javascript:WIDGETINSTANCE.login(document.forms[\'PluckLoginForm\']);"\>\r\n                <div class="podAlert" id="LoginError" style="display:none"\></div\>\r\n                <div class="podMessage" id="PluckMessage" style="display:none"\></div\>\r\n                <div class="podFormField"\>\r\n                  <label\>Email</label\>\r\n                  <input type="text" class="podFormInputText" name="Email" onKeyPress="return WIDGETINSTANCE.help.submitEnter(this,event)" /\>\r\n                  <div class="podErrorMessage" id="LoginEmailError" style="display: none"\></div\>\r\n                </div\>\r\n                <div class="podFormField"\>\r\n                  <label\>Password</label\>\r\n                  <input type="password" class="podFormInputText" name="Password" onKeyPress="return WIDGETINSTANCE.help.submitEnter(this,event)" /\>\r\n                  <div class="podErrorMessage" id="LoginPasswordError" style="display: none"\></div\>\r\n                </div\>\r\n                <div class="podFormButtons"\>\r\n                  <a href="javascript:;" onclick="javascript:WIDGETINSTANCE.login(document.forms[\'PluckLoginForm\']);" \r\n                    class="podButton1 podBtnSignup"\><span class="podButton1_Right"\>${loginButtonText}</span\></a\>\r\n                  <a id="${podForgotPasswordLink}" class="podButtonCancel" \r\n                    href="javascript:WIDGETINSTANCE.resetPassword(document.forms[\'PluckLoginForm\'])" \>forgot password?</a\>\r\n                  <div id="${podForgotPasswordLinkWaiting}" class="podWaiting" style="display: none;"\>Creating new password ...</div\>\r\n                </div\>\r\n              </form\>\r\n            </div\>\r\n          </div\>\r\n        </div\>\r\n      </div\>\r\n      <div class="podBgBL"\><div class="podBgBR"\></div\></div\>\r\n    </div\>\r\n    {else}\r\n    <div class="podLoggedInUser"\>You are logged in as ${profileUsername}. <a href="javascript:WIDGETINSTANCE.logout();"\>Logout</a\>.</div\>\r\n    {/if}\r\n  </div\>\r\n</div\>\r\n\r\n'; 
  widget.prototype.preloadImageUrls = []; 
    widget.prototype.addChildWidgets = function() { 
    }
    widget.prototype.postInit = function() {
      this.context.podForgotPasswordLink = 'podForgotPasswordLink_' + this.divSuffix;
      this.context.podForgotPasswordLinkWaiting = 'podForgotPasswordLinkWaiting_' + this.divSuffix;
      this.context.signupTitleText = 'Want to sign up?';
      this.context.signupButtonText = 'Sign Up Now';
      this.context.loginTitleText = 'Already have an account?';
      this.context.loginButtonText = 'Log In Now';
      if (this.instanceName == 'smartLoginSignup') {
        this.context.showLoginOnly = true;
      } else {
        this.context.showLoginOnly = false;
      }
    }
    widget.prototype.addRequests = function() {
        var request = new dmpod.GetUserRequest('');
        this.addRequest(request);
        var date = new Date(), lastYear = date.getFullYear() - 110, collection = [];
        for (var i = date.getFullYear(); i > lastYear; i--) {
            if(i == date.getFullYear() - 30) {
                collection.push('<option value="' + i + '"  selected>' + i + '</option>');
            }else {
                collection.push('<option value="' + i + '">' + i + '</option>');            
            }
        }
        this.context.yearOptions = collection.join('\n');
    }
    widget.prototype.buildContextFromResponses = function(responses) {
      var errorMessage = this.help.getErrorMessageFromResponses(responses);
      if (errorMessage.length > 0) {
        this.setErrorText(errorMessage);
      } else {
        this.context.user = responses[0].user;
        if (this.context.user.userKey.key == 'anonymous') {
          this.context.user.isAnonymous = true;
        } else {
          this.context.user.isAnonymous = false;
        }
        if (this.context.options.profileWidget.showProfile == 'true') {
          var profileUsername = this.createWidget(null, 'PluckItProfileWidget', 'profileUsername', this.divSuffix, {'showUsername':'true', 'showProfile':'true'});
          profileUsername.setUsers({ loggedInUser: responses[0].user, targetUser: responses[0].user, recentActivity: true });
          this.context.profileUsername = profileUsername.processTemplate();
        } else {
          this.context.profileUsername = this.context.user.name;
        }
        this.context.divSuffix = this.divSuffix;
      }
    }
  widget.prototype.setLoginCallback = function(callback) {
     this.loginCallback = callback;
  }
  widget.prototype.setSignupCallback = function(callback) {
     this.signupCallback = callback;
  }
  widget.prototype.setLogoutCallback = function(callback) {
     this.logoutCallback = callback;
  }
  widget.prototype.logout = function(callback) {
    this.service.setUserAuthToken(null);
    if (typeof(this.logoutCallback) !== 'undefined') {
      this.logoutCallback();
    } else {
      this.execute(callback);
    }
  }
  widget.prototype.login = function(form, callback) {
    if (this.validateLogin(form)) {
      var request = new dmpod.GetLoginTokenRequest();
      request.userEmail = form.elements['Email'].value;
      request.password = form.elements['Password'].value;
      this.sendRequests([request], function(response) {
        var response = response.Responses[0];
        if (response.isError) {
          if (response.message == 'This account has been locked due to too many failed login attempts.') {
            this.help.showError('LoginError', response.message);
          } else {
            this.help.showError('LoginError', 'The email/password provided are not valid.');
          }
        } else {
          this.service.setUserAuthToken(response.loginToken);
          if (typeof(this.loginCallback) !== 'undefined') {
            this.loginCallback();
          } else {
            this.execute(callback);
          }
        }
      });
    }
  }
  widget.prototype.validateLogin = function(form) {
    this.help.hideError('LoginError');
    this.hideMessage();
    var isValid = true;
    if (!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(form.elements['Email'].value)) {
      this.help.showError('LoginEmailError', 'Please provide a valid email address.');
      isValid = false;
    } else {
      this.help.hideError('LoginEmailError');
    }
    if (form.elements['Password'].value.length < 6) {
      this.help.showError('LoginPasswordError', 'Password must be at least 6 characters.');
      isValid = false;
    } else if (/[<>]/.test(form.elements['Password'].value)) {
        this.help.showError('LoginPasswordError', '"<" and ">" characters are not allowed.');
        valid = false;
    } else {
      this.help.hideError('LoginPasswordError');
    }
    if (!isValid) {
      this.help.showError('LoginError', 'Please correct the issues noted.');
    }
    return isValid;
  }
  widget.prototype.resetPassword = function(form, callback) {
    if (this.validateResetPassword(form)) {
      var request = new dmpod.ResetPasswordRequest();
      request.userEmail = form.elements['Email'].value;
      if (document.getElementById(this.context.podForgotPasswordLink) && document.getElementById(this.context.podForgotPasswordLinkWaiting)) {
        document.getElementById(this.context.podForgotPasswordLink).style.display = 'none';
        document.getElementById(this.context.podForgotPasswordLinkWaiting).style.display = 'block';
      }
      this.sendRequests([request], function(response) {
        if (document.getElementById(this.context.podForgotPasswordLink) && document.getElementById(this.context.podForgotPasswordLinkWaiting)) {
          document.getElementById(this.context.podForgotPasswordLink).style.display = 'block';
          document.getElementById(this.context.podForgotPasswordLinkWaiting).style.display = 'none';
        }
        if (response.Responses[0].isError) {
          if (response.Responses[0].message == 'Missing or invalid email\r\nParameter name: userEmail') {
            this.help.showError('LoginError', 'Please provide your email address.');
            this.help.showError('LoginEmailError', 'The email provided cannot be found.');
          } else {
            alert(response.Responses[0].message);
          }
        } else {
          this.postMessage('Your password has been reset. Shortly, you will receive your new password at your email address: ' + request.userEmail);
          if (typeof(callback) !== 'undefined') {
            callback();
          }
        }
      });
    }
  }
  widget.prototype.validateResetPassword = function(form) {
    this.help.hideError('LoginError');
    this.hideMessage();
    var isValid = true;
    if (!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(form.elements['Email'].value)) {
      this.help.showError('LoginEmailError', 'To reset your password, we need your valid email address. A password is not required.');
      isValid = false;
    } else {
      this.help.hideError('LoginEmailError');
    }
    if (!isValid) {
      this.help.showError('LoginError', 'Please provide your email address.');
    }
    this.help.hideError('LoginPasswordError');
    return isValid;
  }
  widget.prototype.register = function(form, callback) {
    if (this.validateRegistration(form)) {
      var displayName = form.elements['Username'].value
        ,email = form.elements['Email'].value
        ,password = form.elements['Password'].value
        ,birthdate = new Date(form.elements['BirthYear'].value, form.elements['BirthMonth'].value, form.elements['BirthDay'].value).getTime()
      var request = new dmpod.RegisterUserRequest(displayName, email, password);
      request.birthdate = birthdate;
      this.sendRequests([request], function(response) {
        if (response.Responses[0].isError) {
          alert('Error registering: \n' + response.Responses[0].message);
        } else {
          this.login(form, callback);
          if (typeof(this.signupCallback) !== 'undefined') {
            this.signupCallback();
          } else {
            this.execute(callback);
          }
        }
      });
    }
  }
  widget.prototype.validateRegistration = function(form) {
      var isValid = true;
      var birthdate = new Date(parseInt(form.elements['BirthYear'].value), parseInt(form.elements['BirthMonth'].value), parseInt(form.elements['BirthDay'].value));
      var now = new Date();
      var legaldate = new Date(now.getFullYear() -13, now.getMonth(), now.getDate());
      if (this.service.getCookieValue('UATY') != undefined || birthdate >= legaldate) {
          this.service.setCookieValue("UATY", "true", 1);
          this.help.showError('RegisterError', 'We are sorry but you did not qualify to register.');
          return false;
      }
      if (!form.elements['Username'].value.length) {
        this.help.showError('RegisterUsernameError', 'Please provide a valid name for your account.');
        isValid = false;
      } else if (/[<>]/.test(form.elements['Username'].value)) {
        this.help.showError('RegisterUsernameError', '"<" and ">" characters are not allowed.');
        isValid = false;
      } else {
        this.help.hideError('RegisterUsernameError');
      }
      if (!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(form.elements['Email'].value)) {
        this.help.showError('RegisterEmailError', 'Please provide a valid email address.');
        isValid = false;
      } else {
        this.help.hideError('RegisterEmailError');
      }
      if (form.elements['Password'].value.length < 6) {
        this.help.showError('RegisterPasswordError', 'Password must be at least 6 characters.');
        isValid = false;
      } else if (/[<>]/.test(form.elements['Password'].value)) {
        this.help.showError('RegisterPasswordError', '"<" and ">" characters are not allowed.');
        isValid = false;
      } else {
        this.help.hideError('RegisterPasswordError');
      }
      if (form.elements['Password'].value != form.elements['PasswordConfirm'].value) {
        this.help.showError('RegisterPasswordConfirmError', 'Passwords do not match.');
        isValid = false;
      } else {
        this.help.hideError('RegisterPasswordConfirmError');
      }
      if (!form.elements['RegisterTOS'].checked) {
        this.help.showError('RegisterTOSError', 'You must agree to the terms of use and privacy policy to register.');
        isValid = false;
      } else {
        this.help.hideError('RegisterTOSError');
      }
      if (!isValid) {
        this.help.showError('RegisterError', 'Please correct the issues noted.');
      }
      return isValid;
    }
  widget.prototype.setDays = function() {
      var form = document.forms['PluckRegisterForm'], lastDay
          ,selectedDay = form.elements['BirthDay'].value
          ,selectedMonth = form.elements['BirthMonth'].value
          ,selectedYear = form.elements['BirthYear'].value;
      if (selectedMonth == '0' ||  // Jan
          selectedMonth == '2' ||  // Mar
          selectedMonth == '4' ||  // May
          selectedMonth == '6' ||  // Jul
          selectedMonth == '7' ||  // Aug
          selectedMonth == '9' ||  // Oct
          selectedMonth == '11'    // Dec
      ) {
          lastDay = 31;
      } else if (
          selectedMonth == '3' ||  // Apr
          selectedMonth == '5' ||  // Jun
          selectedMonth == '8' ||  // Sep
          selectedMonth == '10'    // Nov
      ) {
          lastDay = 30;
      } else {
          if (parseInt(selectedYear) % 4 == 0) {
              lastDay = 29;   // Feb, leap year
          } else {
              lastDay = 28;   // Feb, not leap year
          }
      }
      var select = form.elements['BirthDay'];
      select.innerHTML = '';
      for (var day = 1; day <= lastDay; day++) {
        var option = document.createElement('option');
        option.value = day;
        if (day < 10) {
          option.innerHTML = '0' + day;
        } else {
          option.innerHTML = day;
        }
        if (day == selectedDay)
            option.selected = true;
        select.appendChild(option);
      }
    }
  widget.prototype.showForm = function() {
    this.help.displayElement('PluckRegisterTeaser_' + this.divSuffix, 'none');
    this.help.displayElement('PluckRegisterForm_' + this.divSuffix, 'block')
  }
  widget.prototype.postMessage = function(msg) {
    var messageBox = document.getElementById('PluckMessage');
    if (messageBox) {
      messageBox.innerHTML = msg;
      messageBox.style.display = 'block';
    } else {
      alert(msg);
    }
  }
  widget.prototype.hideMessage = function() {
    var messageBox = document.getElementById('PluckMessage');
    if (messageBox) {
      messageBox.innerHTML = '';
      messageBox.style.display = 'none';
    }
  }

})();

(function(){
  var widget = function() {};
  window['PluckItAbuseReportWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// Abuse Report Widget\r\n{/eval}\r\n<div class="podAbuseReportStats"\>\r\n  <table class="podAbuseReportReports" cellspacing="0"\>\r\n    <tr\>\r\n      <th class="podAbuseReportReason"\>Total Abuse Reports</th\>\r\n      <th class="podAbuseReportCount"\>${abuseReport.abuseReportTotalCount}</th\>\r\n    </tr\>\r\n    {for detail in abuseReport.abuseReportDetail}\r\n    <tr\>\r\n      <td class="podAbuseReportReason"\>${detail.abuseReason}</td\>\r\n      <td class="podAbuseReportCount"\>${detail.abuseReportCount}</td\>\r\n    </tr\>\r\n    {/for}\r\n  </table\>\r\n  <div\>\r\n    {for reporter in abuseReport.abuseReporters}\r\n      {if reporter_index == 0}Reported by: {else}, {/if}\r\n      ${reporter.name}\r\n    {/for}\r\n  </div\>\r\n</div\>\r\n'; 
  widget.prototype.preloadImageUrls = []; 
    widget.prototype.postInit = function() {
      this.context.abuseReport = {
        abuseReportTotalCount: 'Unknown'
      } 
      if (this.optionSpecified('commentId')) {
        this.context.targetId = this.context.options.commentId;
      } else {
        this.context.targetId = false;
      }
    }
    widget.prototype.addRequests = function() {
      if (this.context.targetId) {
        var request = new dmpod.GetAbuseReportRequest(new dmpod.BaseKey(this.context.targetId, 'CommentKey'), this.context.options.maxReportersPerReport);
        this.addRequest(request);
      }
    }
    widget.prototype.setAbuseReport = function(abuseReport) {
      this.context.abuseReport = abuseReport;
    }
    widget.prototype.buildContextFromResponses = function(responses) {
      if (responses[0].isError) {
        this.setErrorText(responses[0].message);
      } else {
        this.setAbuseReport(responses[0].abuseReport);
      }
    }

})();

(function(){
  var widget = function() {};
  window['PluckItCommentWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// Comment Widget\r\n{/eval}\r\n\r\n<a name="PluckCommentList"\></a\>\r\n<div class="podCommentWidget podGlobal"\>\r\n  <div class="podSectionTitle podIconComments"\>${commentPage.totalNumberOfComments} Comments</div\>\r\n  <div class="podAlert" id="${pluckCommentErrorId}" style="display:none"\></div\>\r\n  <div class="podCommentList" id="${pluckCommentListId}"\>\r\n    <div class="podComment" id="${pluckCommentLoadingId}" style="display: none"\>\r\n      <div\>&nbsp;</div\>\r\n      <div class="podRoundedContainer2"\>\r\n        <div class="podBgTL"\><div class="podBgTR"\></div\></div\>\r\n        <div class="podContent"\><div class="podWaiting"\>Loading ...</div\></div\>\r\n        <div class="podBgBL"\><div class="podBgBR"\></div\></div\>\r\n      </div\>\r\n    </div\>\r\n    {for comment in commentPage.comments}\r\n    <div class="podComment"\>\r\n      <div class="podAvatar"\>\r\n        ${comment.userProfile}\r\n      </div\>\r\n      <div class="podRoundedContainer2"\>\r\n        <div class="podBgTL"\><div class="podBgTR"\></div\></div\>\r\n        <div class="podContent"\>\r\n          <div id="recommendComment_${comment.recommendCommentUniqueString}"\>${comment.recommendComment}</div\>\r\n          <span class="podHeadline"\>${comment.profileUsername}</span\> \r\n          <span class="podCallout"\>${comment.postedAtTime|showPrettyDate} at ${comment.postedAtTime|showPrettyTime}</span\>\r\n          <p\>${comment.body}</p\>\r\n          <div class="podCommentAdmin podFLC"\>\r\n           {if user.canModerate}\r\n            <div class="podCommentAbuseAdmin"\>\r\n                <a class="podButton2" href="javascript:WIDGETINSTANCE.deleteComment(\'${comment.commentKey.key}\');"\><span class="podButton2_Right"\>Delete Comment</span\></a\>\r\n                {if comment.reactionSummary.abuseReportCount == \'0\'}\r\n                <span class="podCommentAbuseInfo"\>No abuse currently reported</span\>\r\n                {else}\r\n                  <a class="podButton2" \r\n                  href="javascript:WIDGETINSTANCE.toggleAbuseReport(\'PluckCommentAbuseReportStats_${comment_index}_${divSuffix}\');"\><span class="podButton2_Right"\>${comment.reactionSummary.abuseReportCount} Abuse Reports</span\></a\>\r\n                  <a class="podButton2" href="javascript:WIDGETINSTANCE.clearAbuse(\'${comment.commentKey.key}\');"\><span class="podButton2_Right"\>Clear Abuse</span\></a\>\r\n                {/if}\r\n            </div\>\r\n            {/if}\r\n            {if options.showAbuse == \'true\'}\r\n              <div id="${comment.reportAbuseId}" class="podReportAbuse" \>${comment.reportAbuse}</div\>\r\n            {/if}\r\n          </div\>\r\n          <div class="podCommentAbuseReportStats" \r\n            id="PluckCommentAbuseReportStats_${comment_index}_${divSuffix}" style="display: none"\>\r\n            <!-- Abuse Report Stats --\>\r\n          </div\>\r\n        </div\>\r\n        <div class="podBgBL"\><div class="podBgBR"\></div\></div\>\r\n      </div\>\r\n    </div\>\r\n    {/for}\r\n  </div\>\r\n  \r\n  {if commentPage.totalNumberOfComments \> 0}\r\n  <div class="podPaginiation podFLC"\>\r\n    {if commentPage.onPage != "0"}\r\n    <a class="podPaginiationPrevious" href="#PluckCommentList" onclick="javascript:WIDGETINSTANCE.showPage(${commentPage.onPage}-1);"\>&laquo; Newer comments</a\>\r\n    {/if}\r\n    <span class="podPaginiationCount"\>${commentPage.firstItemNumber} - ${commentPage.lastItemNumber} of ${commentPage.totalNumberOfComments} comments</span\>\r\n    {if commentPage.onPage != commentPage.lastPage}\r\n    <a class="podPaginiationNext" href="#PluckCommentList" onclick="javascript:WIDGETINSTANCE.showPage(${commentPage.onPage}+1);"\>Older comments &raquo;</a\>\r\n    {/if}\r\n  </div\>\r\n  {else}\r\n  <br /\>\r\n  {/if}\r\n\r\n  <a name="PluckCommentForm"\></a\>\r\n  <div class="podCommentAdd podRoundedContainer"\>\r\n    <div class="podBgTL"\><div class="podBgTR"\></div\></div\>\r\n    <div class="podContent"\>\r\n      <div class="podHeadline"\>\r\n        Your Comment\r\n        {if !user.isAnonymous}\r\n        &nbsp;<span class="podCallout"\>(You are logged in as ${profileUsername}. <a href="javascript:WIDGETINSTANCE.logout();"\>Logout</a\>.)</span\>\r\n        {/if}\r\n      </div\>\r\n      <div class="podContentBlock"\>\r\n        <form action="javascript:WIDGETINSTANCE.comment(document.forms[\'PluckCommentForm\']);" name="PluckCommentForm" class="podCommentForm"\>\r\n          <textarea name="commentBody" class="podCommentArea"\></textarea\>\r\n          <input type="hidden" name="articleId" value="${options.articleId}" /\>\r\n        </form\>\r\n      </div\>\r\n      {if user.isAnonymous}\r\n      <div id="loginSignup"\>${loginSignup}</div\>\r\n      {else}\r\n      <div class="podFLC"\>\r\n        <a href="javascript:;" onclick="javascript:WIDGETINSTANCE.comment(document.forms[\'PluckCommentForm\']);" \r\n          class="podButton1 podBtnPostComment"\><span class="podButton1_Right"\>Post my comment</span\></a\>\r\n      </div\>\r\n      {/if}\r\n    </div\>\r\n    <div class="podBgBL"\><div class="podBgBR"\></div\></div\>\r\n  </div\>\r\n  \r\n  ${pluckFooter}\r\n  \r\n</div\>\r\n\r\n'; 
  widget.prototype.preloadImageUrls = []; 
    widget.prototype.addChildWidgets = function() { 
      if ((this.parent != null) && ((this.optionSpecified('showComments') != 'true'))) {
        this.dontShowThisWidget = true;
        this.autoRender = false;
        return;
      }
      this.addChildWidget('PluckItLoginWidget', 'loginSignup');
      this.addChildWidget('PluckItRecommendWidget', 'recommendComment');
      this.addChildWidget('PluckItFooterWidget','pluckFooter');
    }
    widget.prototype.postInit = function() {
      if (this.dontShowThisWidget) {
        return;
      }
      this.child['loginSignup'].context.signupTitleText = 'Join the conversation';
      this.child['loginSignup'].context.signupButtonText = 'Post my comment';
      this.child['loginSignup'].context.loginTitleText = 'Done this before?';
      this.child['loginSignup'].context.loginButtonText = 'Post my comment';
      var my = this;
      this.child['loginSignup'].setLoginCallback(function() { 
        my.comment(document.forms['PluckCommentForm']);
      });
      this.child['loginSignup'].setLogoutCallback(function() { 
        my.execute(); 
      });
      this.context.pluckCommentListId = 'PluckCommentList_' + this.divSuffix;
      this.context.pluckCommentErrorId = 'PluckCommentError_' + this.divSuffix;
      this.context.pluckCommentLoadingId = 'PluckCommentLoading_' + this.divSuffix;
      this.key = new dmpod.PublisherContentKey(this.help.convertUrlToPublisherKeyString(document.location.href));
      if (this.optionSpecified('publisherContentId')) {
        this.key = new dmpod.PublisherContentKey(this.optionSpecified('publisherContentId'));
      } else if (this.optionSpecified('articleId')) {
        this.key = new dmpod.ArticleKey(this.optionSpecified('articleId'));
      } else if (this.help.getPrefixedQueryParam('articleId')) {
        this.key = new dmpod.ArticleKey(this.help.getPrefixedQueryParam('articleId'));
      }
    }
    widget.prototype.addRequests = function() {
      if (this.dontShowThisWidget) {
        return;
      }
        var request = new dmpod.GetUserRequest('');
        this.addRequest(request);
        request = new dmpod.GetCommentPageRequest(this.key
            ,this.context.options.commentNumberPerPage
            ,this.context.options.commentOnPage
            ,this.context.options.commentSort);
        this.addRequest(request);
        request = new dmpod.GetCustomerRequest();
        this.addRequest(request);
    }
    widget.prototype.buildContextFromResponses = function(responses) {
      var errorMessage = this.help.getErrorMessageFromResponses(responses);
      if (errorMessage.length > 0) {
        this.setErrorText(errorMessage);
      } else {
        this.context.user = responses[0].user;
        if (this.context.user.userKey.key == 'anonymous') {
          this.context.user.isAnonymous = true;
        } else {
          this.context.user.isAnonymous = false;
        }
        this.context.customer = responses[2].customer;
        this.context.user.canModerate = false;
        if (this.context.user.userSecurityRole == 'PluckAdmin') {
          this.context.user.canModerate = true;
        }
        if (this.context.user.userSecurityRole == 'CustomerAdmin' && this.context.customer.userContentMode == 'Local') {
          this.context.user.canModerate = true;
        }
        this.context.commentPage = responses[1].commentPage;
        var commentPage = this.context.commentPage;
        this.context.commentPage.firstItemNumber = (commentPage.onPage * commentPage.numberPerPage) + 1;
        if (commentPage.totalNumberOfComments == 0) {
          this.context.commentPage.firstItemNumber = 0;
        }
        this.context.commentPage.lastItemNumber = (commentPage.onPage * commentPage.numberPerPage) + commentPage.numberPerPage;
        if (this.context.commentPage.lastItemNumber > commentPage.totalNumberOfComments) {
          this.context.commentPage.lastItemNumber = commentPage.totalNumberOfComments;
        }
        this.context.commentPage.lastPage = Math.max(0, Math.ceil(commentPage.totalNumberOfComments/commentPage.numberPerPage)-1);
        if (!this.optionSpecified('showAvatar')) {
          this.context.options.showAvatar = 'true';
        }
       if (!this.optionSpecified('showProfile')) {
          this.context.options.showProfile = 'true';
        }
        if (this.context.options.profileWidget.showProfile == 'true') {
          var profileUsername = this.createWidget(null, 'PluckItProfileWidget', 'profileUsername', this.divSuffix, {'showUsername':'true', 'showProfile':'true'});
          profileUsername.setUsers({ loggedInUser: responses[0].user, targetUser: responses[0].user, recentActivity: false });
          this.context.profileUsername = profileUsername.processTemplate();
        } else {
          this.context.profileUsername = this.context.user.name;
        } 
        this.context.divSuffix = this.divSuffix;
        var uniqueString = this.divSuffix + '_' +  this.service.uniqueID() + '_' ;
        this.abuseReportElementIds = new Array();
        this.abuseReportRequests = new Array();
        var j = 0;
        var commenterProfiles = new Array();
        var activityRequests = new Array();
        for (var i = 0, comments = responses[1].commentPage.comments, comment, profile, profileUsername; comment = comments[i]; i++) {
          if (this.optionSpecified('showRecommendations') == 'true') {
            comment.recommendCommentUniqueString = uniqueString + i;
            recommendComment = this.createWidget(null, 'PluckItRecommendWidget', 'recommendComment', comment.recommendCommentUniqueString, {commentId: comment.commentKey.key});
            recommendComment.setTemplateVars(comment.reactionSummary);
            comment.recommendComment = recommendComment.processTemplate();
          } else {
            comment.recommendComment = '';
          }
          if (this.optionSpecified('showProfile') == 'true') {
            profileUsername = this.createWidget(null, 'PluckItProfileWidget', 'profileUsername', uniqueString + '_' + i, {showProfile: this.optionSpecified('showProfile'), showUsername: 'true', articlePageUrl: this.optionSpecified('articlePageUrl'), showAbuse: (this.optionSpecified('showAbuse') || 'true')});
            profileUsername.setUsers({ loggedInUser: responses[0].user, targetUser: comment.author, recentActivity: false });
            comment.profileUsername = profileUsername.processTemplate();
            activityRequests.push(new dmpod.UserRecentActivityRequest(new dmpod.UserKey(comment.author.userKey.key)));
          } else {
            comment.profileUsername = comment.author.name;
          }
          commenterProfiles.push(profileUsername);
          if (this.optionSpecified('showAvatar') == 'true') {
            comment.userProfile = '<img src="' + comment.author.avatarPhotoUrl + '" alt="' + comment.author.name + '" class="podAvatarSmall"/>';
            if (this.optionSpecified('showProfile') == 'true') {
              comment.userProfile = '<a class="podAvatarSmallBg" href="javascript:;" onclick="javascript:window[\'profileUsername_' + uniqueString + '_' + i + '\'].showProfile(-75,10);">'
                + comment.userProfile + '</a>';
            } else {
              comment.userProfile = '<div class="podAvatarSmallBg">'
                + comment.userProfile + '</div>';
            }
          } else {
            comment.userProfile = '<!-- No avatar. -->';
          }
          comment.reportAbuseId = 'podReportAbuse_' + this.divSuffix + comment.commentKey.key;
          var userHasReportedAbuseValue = 'false';
          if (comment.reactionSummary.userHasReportedAbuse) {
            userHasReportedAbuseValue = 'true';
          }
          var reportAbuse = this.createWidget(null, 'PluckItReportAbuseWidget', 'reportAbuse', comment.reportAbuseId, {reactionTargetId: comment.commentKey.key, reactionTargetType: 'commentKey', userHasReportedAbuse: userHasReportedAbuseValue });
          reportAbuse.onAbuseDisplay = function() { this.context.abuseVisible = true; };
          reportAbuse.onAbuseHide = function() { this.context.abuseVisible = false; };
          comment.reportAbuse = reportAbuse.processTemplate();
          if (comment.reactionSummary.abuseReportCount > 0 && this.context.user.canModerate) {
            var request = new dmpod.GetAbuseReportRequest(new dmpod.BaseKey(comment.commentKey.key, 'CommentKey'), '5');
            this.abuseReportRequests.push(request);
            this.abuseReportElementIds[j++] = 'PluckCommentAbuseReportStats_'+i+'_'+this.divSuffix;
          }
        }
        if (this.optionSpecified('showProfile') == 'true') {
          this.sendRequests(activityRequests, function(response) {
            responses = response.Responses;
            for (var i = 0; i < responses.length; i++) {
              var response = responses[i];
              if (response.isError) {
                alert('fail: ' + response.message);
              }
              else {
                commenterProfiles[i].displayActivity(response);
              }
            }
          });
        }
      }
      var helper = this.help;
      this.help.externalCallback = (function(widget) { 
        return function() {
          widget.execute();
          helper.externalCallback = null;
        };
      })(this);
    }
    widget.prototype.postRender = function() {
      if (this.abuseReportElementIds.length > 0 && this.context.user.canModerate) {
        this.sendRequests(this.abuseReportRequests, function(response) {
          var responses = response.Responses;
          for (var i=0; i<responses.length; i++) {
            var response = responses[i];
            if (response.isError) {
              alert('fail: ' + response.message);
            } else {
              var abuseReportWidget = this.createWidget(null, 'PluckItAbuseReportWidget', 'abuseReportWidget', this.divSuffix, {});
              abuseReportWidget.setAbuseReport(response.abuseReport);
              document.getElementById(this.abuseReportElementIds[i]).innerHTML = abuseReportWidget.processTemplate();
            }
          }
        }); 
      }
    }
    widget.prototype.comment = function(form) {
      if (form.elements['commentBody'].value == '') {
        this.execute();
      } else {
        document.location.href = this.help.addAnchor(document.location.href, 'PluckCommentList');
        document.getElementById(this.context.pluckCommentLoadingId).style.display = 'block';
        var commentBody = this.help.cleanInput(form.elements['commentBody'].value);
        var request = new dmpod.CommentOnRequest(this.key, commentBody);
        this.sendRequests(request, function(response) {
          response = response.Responses[0];
          if (response.isError) {
            if (response.message == 'Blocked by flood control') {
              document.getElementById(this.context.pluckCommentErrorId).innerHTML = 'To keep this site spam-free, comments may not be submitted more frequently than once every 30 seconds. Please wait a few more seconds before resubmitting your comment. Thanks.';
              document.getElementById(this.context.pluckCommentErrorId).style.display = 'block';
              document.getElementById(this.context.pluckCommentLoadingId).style.display = 'none';
            } else if (response.message == 'User is not authorized to perform this action') {
            } else {
              alert('fail: ' + response.message);
            }
          } else {
            this.execute();
          }
        });
      }
    }
    widget.prototype.reportAbuse = function(form) {
        var request = new dmpod.ReportAbuseOnRequest(new dmpod.CommentKey(form.elements['commentKey'].value), form.elements['abuseReason'].value);
        this.sendRequests(request, function(response) {
	        response = response.Responses[0];
	        if (response.isError) {
	          alert('fail: ' + response.message);
	        } else {
	          this.execute();
	        }
	  });
    }
    widget.prototype.deleteComment = function(key, callback) {
      var deleteConfirm = window.confirm('Are you sure you want to delete this comment?');
      if (deleteConfirm) {
        var request = new dmpod.DeleteContentActionRequest(new dmpod.CommentKey(key));
        this.sendRequests(request, function(response) {
          response = response.Responses[0];
          if (response.isError) {
            alert('fail: ' + response.message);
          } else {
            this.execute(callback);
          }
        });
      } 
    }
    widget.prototype.clearAbuse = function(key) {
      if (window.confirm('Are you sure you want to remove abuse from this item?')) {
        var request = new dmpod.ClearAbuseReportRequest(new dmpod.CommentKey(key));
        this.sendRequests(request, function(response) {
          response = response.Responses[0];
          if (response.isError) {
            alert('fail: ' + response.message);
          } else {
            this.execute();
          }
        });
      } 
    }
    widget.prototype.showPage = function(onPage, callback) {
        this.context.options.commentOnPage = onPage;
        this.execute(callback);
    }
    widget.prototype.toggleAbuseReport = function(abuseReportId) {
      if (document.getElementById(abuseReportId).style.display == 'block') {
        this.help.displayElement(abuseReportId, 'none'); 
      } else {
        this.help.displayElement(abuseReportId, 'block'); 
      }
    }
    widget.prototype.logout = function(callback) {
      this.child['loginSignup'].logout(callback);
    }

})();

(function(){
  var widget = function() {};
  window['PluckItArticleWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// Article Widget\r\n{/eval}\r\n\r\n<div id="podArticleWidget_preloadHtml" style="display:none"\>\r\n  <div class="podArticleWidget"\>\r\n    <div class="podArticleInfo"\>\r\n      <div class="podPageTitle"\>${articleTitle}</div\>\r\n    </div\>\r\n    <div class="podLoadingMessage podGlobal"\>\r\n      <div class="podContent"\>\r\n        <div class="podWaitingMedium"\>Loading ...</div\>\r\n      </div\>\r\n    </div\>\r\n  </div\>\r\n</div\>\r\n\r\n<div class="podArticleWidget"\>\r\n  <div class="podArticleInfo podFLC"\>\r\n    {if (article.mediaType != \'Video\') }\r\n    <img class="podArticleThumbnail" src="${article.thumbnailUrl}" alt="${article.title}" /\>\r\n    {/if}\r\n    <div class="podPageTitle"\>${article.title}</div\>\r\n    {if (article.mediaType != \'Video\') }\r\n    <span class="podCallout"\>${article.byline}</span\>\r\n    {/if}\r\n  </div\>\r\n\r\n  {if (article.mediaType == \'Video\') }\r\n  <div class="podArticleVideo"\>\r\n    <div class="podMediaPlayer"\>\r\n      ${article.mediaPlayerHtml}\r\n    </div\>\r\n  </div\>\r\n  {/if}\r\n\r\n  <div\>\r\n    {if ((options.articleLength == \'summary\') || (article.mediaType == \'Video\'))}\r\n      {if (konteraAds)}<div class="KonaBody"\>{/if}\r\n      ${article.summary}\r\n      {if (konteraAds)}</div\>{/if} \r\n      {if (article.mediaType != \'Video\')}\r\n        <a href="${articlePageUrl}" class="podReadMore"\>Read More &raquo;</a\>\r\n      {/if}\r\n    {else}\r\n      <div class="podAd300x250"\>\r\n        ${adSrc300x250}\r\n      </div\>\r\n      {if (konteraAds)}<div class="KonaBody"\>{/if}\r\n      ${article.content}\r\n      {if (konteraAds)}</div\>{/if}\r\n    {/if}\r\n  </div\>\r\n  \r\n  <div class="podArticleAttribution"\>${article.footerAttribution}</div\>\r\n  \r\n  <div id="relatedTags"\>\r\n    ${relatedTags}\r\n  </div\>\r\n\r\n  {if (article.mediaType != \'Video\') }\r\n  {if options.adWidth == \'narrow\'}\r\n  <div class="podAd300x250b"\>\r\n    ${adSrc300x250b}\r\n  </div\>\r\n  {else}\r\n  <div class="podAd728x90"\>\r\n    ${adSrc728x90}\r\n  </div\>\r\n  {/if}\r\n  {/if}\r\n  {if options.showComments != \'false\' || options.showRecommendations != \'false\' || user.canBlockArticles || customer.publisherNetwork != \'eNom\'}\r\n  <div class="podArticleUtils podGlobal podFLC"\>\r\n  {/if}\r\n    {if options.showComments != \'false\'}\r\n    {if options.showReadCommentsLink != \'false\'}\r\n    <a href="#PluckComment" class="podIconComments"\>Read Comments</a\>\r\n    {/if}\r\n    <a href="#PluckCommentForm" class="podIconAddComments"\>Add Comment</a\>\r\n    {/if}\r\n    {if options.showRecommendations != \'false\'}\r\n    <div id="recommendArticle"\>\r\n      ${recommendArticle}\r\n    </div\>\r\n    {/if}\r\n    {if user.canBlockArticles}\r\n    <div id="${podBlockArticleButtonId}" class="podButton2"\>\r\n      <a href="javascript:WIDGETINSTANCE.blockArticle(\'${article.id}\');"\><span class="podButton2_Right"\>Block Article</span\></a\>\r\n    </div\>\r\n    <div id="${podBlockArticleMessageId}" class="podMessage" style="display: none"\>Article blocked.</div\>\r\n    {/if}\r\n    {if customer.publisherNetwork != \'eNom\'}\r\n    <a href="http://ondemand.pluck.com/" class="podPluck" target="podPluckOnDemand"\><img class="podLogo" \r\n      src="http://cdn-docs.pluckit.pluck.com/assets/v1/images/pluck_white_distro.gif?apiKey=00000000-0000-0000-0000-000000000000&vn=7034" alt="Powered by Pluck" width="72" height="26" /\></a\>\r\n    {/if}\r\n  {if options.showComments == \'true\' || options.showRecommendations == \'true\' || user.canBlockArticles == \'true\' || customer.publisherNetwork != \'eNom\'}\r\n  </div\>\r\n  {/if}\r\n</div\>\r\n{if showLegalAndPrivacyLink }\r\n<a class="podLegalAndPrivacyLink" href="http://ondemand.pluck.com/legal.aspx{if customer.publisherNetwork == \'eNom\'}?partner=enom{/if}" target="termsofuse"\>{if customer.publisherNetwork != \'eNom\'}Pluck{/if} Legal and Privacy</a\>\r\n{/if}\r\n'; 
  widget.prototype.preloadImageUrls = []; 
    widget.prototype.addChildWidgets = function() {
      if (!this.optionSpecified('articleId')) {
        this.context.options.articleId = this.help.getPrefixedQueryParam("articleId");
      }
      if (!this.optionSpecified('articleId')) {
        this.dontShowThisWidget = true;
        this.autoRender = false;
        return;
      }
      if (this.context.options.relatedTags.showRelatedTags == 'true') {
        this.addChildWidget('PluckItRelatedTagsWidget','relatedTags');
      } else {
        this.context.relatedTags = '';
      }
      if (this.context.options.recommendArticle.showRecommendations == 'true') {
        this.addChildWidget('PluckItRecommendWidget','recommendArticle');
      } else {
        this.context.recommendArticle = '';
      }
    }
    widget.prototype.postInit = function() {
      if (this.dontShowThisWidget) {
        return;
      }
      if (this.parent == null) {
        this.context.showLegalAndPrivacyLink = true;
      } else {
        this.context.showLegalAndPrivacyLink = false;
      }
      this.context.podBlockArticleButtonId = 'podBlockArticleButtonId_'+ this.divSuffix;
      this.context.podBlockArticleMessageId = 'podBlockArticleMessageId_'+ this.divSuffix;
    }
    widget.prototype.addRequests = function() {
      if (this.dontShowThisWidget) {
        return;
      }
      var request = new dmpod.GetArticleRequest(this.context.options.articleId);
      this.addRequest(request);
      var request = new dmpod.GetUserRequest('');
      this.addRequest(request);
      request = new dmpod.GetCustomerRequest();
      this.addRequest(request);
      var adList;
      if (this.optionSpecified('adWidth') == 'narrow') {
        adList = new Array(new dmpod.AdDescription(300,250), new dmpod.AdDescription(300,250));
      } else {
        adList = new Array(new dmpod.AdDescription(300,250), new dmpod.AdDescription(728,90));
      }
      var advertRequest = new dmpod.GetAdsForArticleRequest(this.context.options.articleId, adList);
      this.addRequest(advertRequest);
    }
    widget.prototype.buildContextFromResponses = function(responses) {
      var errorMessage = this.help.getErrorMessageFromResponses(responses);
      if (errorMessage.length > 0) {
        this.setErrorText(errorMessage);
      } else {
        this.context.article = responses[0].article;
        article = this.context.article;
        this.context.customer = responses[2].customer;
        var byline = '';
        if (article.sourceLogoUrl != '') {
          byline += '<img src="'+article.sourceLogoUrl+'" alt="'+article.sourceName+'" class="podArticlePublisherLogo" />';
        } else {
          byline += article.author;
        }
        if (article.sourceName == 'BlogBurst.com' && article.url != '') {
          byline = '<a target="PluckPublisher_'+article.publisherId+'" href="'+article.url+'">' + byline + '</a>';
        } else if (article.sourceLogoUrl != '' && article.sourceUrl != '') {
          byline = '<a target="PluckPublisher_'+article.publisherId+'" href="'+article.sourceUrl+'">' + byline + '</a>';
        }
        this.context.article.byline = byline;
        var footerAttribution = '';
        footerAttribution += article.title;
        if (article.url != '') {
          footerAttribution = '<a target="PluckPublisher_'+article.publisherId+'" href="'+article.url+'">' + footerAttribution + '</a>';
        }
        if (article.sourceName == 'BlogBurst.com') {
          footerAttribution += ' syndicated by <a target="PluckPublisher_'+article.publisherId+'" href="http://www.blogburst.com/">BlogBurst</a>.';
        } else {
          if (article.mediaType == 'Text') {
            footerAttribution += ' article by ';
          } else {
            footerAttribution += ' video by '
          }
          footerAttribution += article.attributionFooter;
        }
        this.context.article.footerAttribution = footerAttribution;
        this.context.user = responses[1].user;
        this.context.user.canModerate = false;
        this.context.user.canBlockArticles = false;
        if (this.context.user.userSecurityRole == 'PluckAdmin') {
          this.context.user.canModerate = true;
          this.context.user.canBlockArticles = true;
        }
        if (this.context.user.userSecurityRole == 'CustomerAdmin') {
          this.context.user.canBlockArticles = true;
          if (responses[2].customer.userContentMode == 'Local') {
            this.context.user.canModerate = true;
          }
        }
        if (!responses[2].customer.socialMediaEnabled) {
          this.context.options.showComments = 'false';
          this.context.options.showRecommendations = 'false';
        }
        this.context.konteraAds = responses[2].customer.inlineTextAdsAllowed && (responses[2].customer.customerType == 'RevenueShare') && article.sourceAllowsInlineTextAds;
        this.context.articlePageUrl = this.help.setBaseUrl(this.optionSpecified('articlePageUrl'), responses[2].customer.widgetLandingPageUrl);
        this.context.articlePageUrl = this.help.addPrefixedQueryParam(this.context.articlePageUrl, 'articleId', this.context.article.id);
        this.context.adSrc300x250 = responses[3].advertisements[0].source;
        this.context.adSrc300x250b = responses[3].advertisements[1].source;
        this.context.adSrc728x90 = responses[3].advertisements[1].source;
      }
    }
    widget.prototype.blockArticle = function(key, callback) {
      var blockConfirm = window.confirm('Are you sure you want to block this article?');
      if (blockConfirm) {
        var request = new dmpod.BlockArticleRequest(new dmpod.ArticleKey(key));
        this.sendRequests(request, function(response) {
          response = response.Responses[0];
          if (response.isError) {
            alert('fail: ' + response.message);
          } else {
            this.help.swapElements(this.context.podBlockArticleButtonId, this.context.podBlockArticleMessageId);
            if (callback) {
              callback();
            }
          }
        });
      } 
    }
    widget.prototype.getPreloadHtml = function() {
      var preloadHtml = '';
      if (this.optionSpecified('articleId')) {
        var tempTemplate = document.createElement('DIV');
        tempTemplate.innerHTML = this.template;
        var tempDivs = tempTemplate.getElementsByTagName('DIV');
        for (var i=0; i<tempDivs.length; i++) {
          if (tempDivs[i].id == 'podArticleWidget_preloadHtml') {
            preloadHtml = tempDivs[i].innerHTML;
            break;
          }
        }
        this.context.articleTitle = this.help.getPrefixedQueryParam('title');
        if (this.context.articleTitle == null) {
          this.context.articleTitle = '&nbsp;';
        } else {
          this.context.articleTitle = this.context.articleTitle.replace(/_/g, ' ');
        }
        preloadHtml = PodTrimPath.parseTemplate(preloadHtml).process(this.context, { throwExceptions: true });
      }
      return preloadHtml;
    }

})();

(function(){
  var widget = function() {};
  window['PluckItUserDiscoveryWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// Pluck User Discovery Widget\r\n{/eval}\r\n<div class="podRecentCommentersWidget podDiscoveryWidget podRoundedContainer2 podContainerHeader podGlobal"\>\r\n  <div class="podBgTL"\><div class="podBgTR podSectionTitle"\>${sectionTitle}</div\></div\>\r\n  <div class="podContent"\>\r\n    {if showTabs}\r\n    <div class="podTabs podHorizontalList podFLC"\>\r\n      {if options.showRecentRecommendersTab == "true"}\r\n      <div class="pod${tabCount}Tab podTab{if currentTab == \'RecentRecommenders\'} podSelected{/if}"\>\r\n        <a class="podHeadline" href="javascript:WIDGETINSTANCE.discoverUsers(\'RecentRecommenders\');"\>Recommenders</a\>\r\n      </div\>\r\n      {/if}\r\n      {if options.showRecentCommentersTab == "true"}\r\n      <div class="pod${tabCount}Tab podTab{if currentTab == \'RecentCommenters\'} podSelected{/if}"\>\r\n        <a class="podHeadline" href="javascript:WIDGETINSTANCE.discoverUsers(\'RecentCommenters\');"\>Commenters</a\>\r\n      </div\>\r\n      {/if}\r\n    </div\>\r\n    {/if}\r\n    <div class="podItems podHorizontalList podFLC"\>\r\n      {for user in users}\r\n      <div class="podItem"\>\r\n        ${user.avatar}\r\n      </div\>\r\n      {/for}\r\n    </div\>\r\n    ${pluckFooter}\r\n  </div\>\r\n  <div class="podBgBL"\><div class="podBgBR"\></div\></div\>\r\n</div\>\r\n'; 
  widget.prototype.preloadImageUrls = []; 
  widget.prototype.addChildWidgets = function() {
    if ((this.parent != null) && (this.optionSpecified('showUserDiscovery') != 'true')) {
      this.dontShowThisWidget = true;
      this.autoRender = false;
      return;
    }
    this.addChildWidget('PluckItFooterWidget','pluckFooter');
  }
  widget.prototype.postInit = function() { 
    if (this.dontShowThisWidget) {
      return;
    }
    if (this.optionSpecified('showProfile') == 'false') {
      this.context.showProfile = 'false';
    } else {
      this.context.showProfile = 'true';
    }
    this.context.sectionTitle = 'User Activity';
    this.context.tabCount = '0';
    if (this.optionSpecified('showRecentCommentersTab') == 'true') {
      this.context.tabCount++;
    }
    if (this.optionSpecified('showRecentRecommendersTab') == 'true') {
      this.context.tabCount++;
    }
    if (this.context.tabCount > 1) {
      this.context.showTabs = true;
    } else {
      this.context.showTabs = false;
    }
    if (typeof this.context.currentTab === 'undefined') {
      this.context.currentTab = this.optionSpecified('defaultTab');
    }
  };
  widget.prototype.addRequests = function() {
    if (this.dontShowThisWidget) {
      return;
    }
    var discoveryActivity;
    switch(this.context.currentTab) {
      case 'RecentRecommenders':
        discoveryActivity = 'RecentlyAddedRecommendation';
        if (!this.context.showTabs) {
          this.context.sectionTitle = "Recent Recommenders";
        }
        break;
      case 'RecentCommenters':
        discoveryActivity = 'RecentlyAddedComment';
        if (!this.context.showTabs) {
          this.context.sectionTitle = 'Recent Commenters';
        }
        break; 
      default:
        discoveryActivity = 'RecentlyAddedComment';
        if (!this.context.showTabs) {
          this.context.sectionTitle = 'Recent Commenters';
        }
        break;
    };
    var request = new dmpod.GetUserRequest('');
    this.addRequest(request);
    request = new dmpod.DiscoverUsersRequest(discoveryActivity, this.context.options.age);
    request.maxResults = this.context.options.numberOfUsers;
    this.addRequest(request);
  }
    widget.prototype.buildContextFromResponses = function(responses) {
      var errorMessage = this.help.getErrorMessageFromResponses(responses);
      if (errorMessage.length > 0) {
        this.setErrorText(errorMessage);
      } else {
        this.context.users = responses[1].users;
        var uniqueString = this.divSuffix + '_' +  this.service.uniqueID() + '_' ;
        var discoveryProfiles = new Array();
        var activityRequests = new Array();
        for (var i = 0, profile; i < this.context.users.length; i++) {
          profile = this.createWidget(null, 'PluckItProfileWidget', 'profile', uniqueString + i, {'showProfile': this.optionSpecified('showProfile'), 'showAvatar' : 'true', 'showUsername' : 'false', showAbuse: 'true'});
          profile.setUsers({ loggedInUser: responses[0].user, targetUser: this.context.users[i], recentActivity: false });
          this.context.users[i].avatar = profile.processTemplate();
          if (this.optionSpecified('showProfile') == 'true') {
            activityRequests.push(new dmpod.UserRecentActivityRequest(new dmpod.UserKey(this.context.users[i].userKey.key)));
          }
          discoveryProfiles.push(profile);
        }
        if (this.optionSpecified('showProfile') == 'true') {
          this.sendRequests(activityRequests, function(response) {
            responses = response.Responses;
            for (var i = 0; i < responses.length; i++) {
              var response = responses[i];
              if (response.isError) {
                alert('fail: ' + response.message);
              }
              else {
                discoveryProfiles[i].displayActivity(response);
              }
            }
          });
        }
      }
    }
  widget.prototype.discoverUsers = function(currentTab) {
    this.context.currentTab = currentTab;
    this.execute();
  }

})();

(function(){
  var widget = function() {};
  window['PluckItArticlePageWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// Article Page Widget - One Column\r\n{/eval}\r\n\r\n<div class="podArticlePageWidget"\>\r\n  <div class="podPage"\>\r\n  {if options.articleId == \'\'}\r\n    <div id="relatedArticlesOnly"\>${relatedArticlesOnly}</div\>\r\n  {else}\r\n    <div id="featuredArticle"\>${featuredArticle}</div\>\r\n    <div id="articleComments"\>${articleComments}</div\>\r\n    <hr\>\r\n    <div id="relatedArticles"\>${relatedArticles}</div\>\r\n  {/if}\r\n  </div\>\r\n</div\>\r\n'; 
  widget.prototype.preloadImageUrls = []; 
  widget.prototype.layouts = []; 
  widget.prototype.layouts['multiColumn'] = '{eval}\r\n// Article Page Widget - Multi-Column\r\n{/eval}\r\n\r\n<div class="podArticlePageWidget"\>\r\n  <div class="podPage podFLC"\>\r\n  {if options.articleId == \'\'}\r\n    <div id="relatedArticlesOnly"\>${relatedArticlesOnly}</div\>\r\n  {else}\r\n    <div class="podMainContainer"\>\r\n      <div class="podMain"\>\r\n        <div id="featuredArticle"\>${featuredArticle}</div\>\r\n        <div id="articleComments"\>\r\n          ${articleComments}\r\n        </div\>\r\n      </div\>\r\n    </div\>\r\n    <div class="podRight"\>\r\n      <div id="relatedArticles"\>${relatedArticles}</div\> \r\n      {if userDiscovery != \'\'}\r\n      <hr\>\r\n      {/if}\r\n      ${userDiscovery}\r\n    </div\>\r\n  {/if}\r\n  </div\>\r\n</div\>\r\n'; 
  widget.prototype.layouts['oneColumn'] = '{eval}\r\n// Article Page Widget - One Column\r\n{/eval}\r\n\r\n<div class="podArticlePageWidget"\>\r\n  <div class="podPage"\>\r\n  {if options.articleId == \'\'}\r\n    <div id="relatedArticlesOnly"\>${relatedArticlesOnly}</div\>\r\n  {else}\r\n    <div id="featuredArticle"\>${featuredArticle}</div\>\r\n    <div id="articleComments"\>${articleComments}</div\>\r\n    <hr\>\r\n    <div id="relatedArticles"\>${relatedArticles}</div\>\r\n  {/if}\r\n  </div\>\r\n</div\>\r\n'; 
  widget.prototype.layouts['splitArticles'] = '{eval}\r\n// Article Page Widget - Split Articles\r\n{/eval}\r\n\r\n<div class="podArticlePageWidget"\>\r\n  <div class="podPage"\>\r\n  {if options.articleId == \'\'}\r\n    <div id="relatedArticlesOnly"\>${relatedArticlesOnly}</div\>\r\n  {else}\r\n    <div id="featuredArticle"\>${featuredArticle}</div\>\r\n    <div id="articleComments"\>${articleComments}</div\>\r\n    <div class="podFLC"\>\r\n      <div class="podLeftHalf"\>\r\n      <div id="relatedTextArticles"\>${relatedTextArticles}</div\>\r\n      </div\>\r\n      <div class="podRightHalf"\>\r\n      <div id="relatedVideoArticles"\>${relatedVideoArticles}</div\>\r\n      </div\>\r\n    </div\>\r\n    ${pluckFooter}\r\n  {/if}\r\n  </div\>\r\n</div\>'; 
  widget.prototype.addChildWidgets = function() { 
    if (!this.optionSpecified('articleId')) {
      this.context.options.articleId = this.help.getPrefixedQueryParam('articleId');
      if (!this.optionSpecified('articleId')) {
        this.context.options.articleId =  '';
      }
    } 
    if (this.context.options.articleId == '') {
      this.addChildWidget('PluckItRelatedContentWidget','relatedArticlesOnly');
    } else {
      if (this.optionSpecified('layout') == 'splitArticles') {
        this.context.options.relatedTextArticles.contentType = 'Text';
        this.addChildWidget('PluckItRelatedContentWidget','relatedTextArticles');
        this.context.options.relatedVideoArticles.contentType = 'Video';
        this.addChildWidget('PluckItRelatedContentWidget','relatedVideoArticles');
      } else {
        this.addChildWidget('PluckItRelatedContentWidget','relatedArticles');
      }
      this.addChildWidget('PluckItArticleWidget','featuredArticle');
      if (this.context.options.articleComments.showComments == 'true') {
        this.context.options.articleComments.pluckFooter.showLogo = 'false';
        this.context.options.articleComments.pluckFooter.showLegalPrivacyLink = 'true';
        this.addChildWidget('PluckItCommentWidget','articleComments');
      } else {
        this.context.articleComments = '<!-- no comments requested -->';
      }
      if (this.optionSpecified('layout') == 'multiColumn') {
        this.context.options.userDiscovery.pluckFooter.showFooter = 'false';
        this.addChildWidget('PluckItUserDiscoveryWidget','userDiscovery');
      }
      if (this.optionSpecified('layout') == 'splitArticles') {
        this.context.options.relatedTextArticles.pluckFooter.showFooter = 'false';
        this.context.options.relatedVideoArticles.pluckFooter.showFooter = 'false';
        this.context.options.articleComments.pluckFooter.showFooter = 'false';
        this.context.options.pluckFooter.showLegalPrivacyLink = 'true';
        this.context.options.pluckFooter.showLogo = 'false';
        this.addChildWidget('PluckItFooterWidget','pluckFooter');
      } else if (this.optionSpecified('layout') == 'multiColumn') {
        this.context.options.relatedArticles.pluckFooter.showFooter = 'false';
      } else { // oneColumn 
        this.context.options.articleComments.pluckFooter.showFooter = 'false';
        this.context.options.relatedArticles.pluckFooter.showLegalPrivacyLink = 'true';
      }
    }
  }
  widget.prototype.postInit = function() {
    var my = this;
    if (this.child['articleComments'] != null) {
      this.child['articleComments'].child['loginSignup'].setLoginCallback(function() { 
        my.child['featuredArticle'].execute(); 
        my.child['articleComments'].comment(document.forms['PluckCommentForm']);
      });
      this.child['articleComments'].child['loginSignup'].setLogoutCallback(function() { 
        my.child['featuredArticle'].execute(); 
        my.child['articleComments'].execute(); 
      });
    }
  }
  widget.prototype.getPreloadHtml = function() {
    var html = '';
    if (this.child.featuredArticle) {
      html = this.child.featuredArticle.getPreloadHtml();
    }
    return html;
  }
  widget.prototype.addRequests = function() {
    request = new dmpod.GetCustomerRequest();
    this.addRequest(request);
  }
  widget.prototype.buildContextFromResponses = function(responses) {
    var errorMessage = this.help.getErrorMessageFromResponses(responses);
    if (errorMessage.length > 0) {
      this.setErrorText(errorMessage);
    } else {
      this.context.customer = responses[0].customer;
    }
  }

})();

(function(){
  var widget = function() {};
  window['PluckItContentWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// Content Widget\r\n{/eval}\r\n\r\n<div class="podContentWidget"\>\r\n  ${htmlContent}\r\n</div\>\r\n'; 
  widget.prototype.preloadImageUrls = []; 
    widget.prototype.postInit = function() {
      this.autoRender = false;
      if (this.optionSpecified('cssUrl')) {
        this.help.addWidgetStylesheet(this.optionSpecified('cssUrl'), true);
      }
      var contentStyles = 'http://ondemand.pluck.com/content/' + this.optionSpecified('contentPath') + 'styles.css';
      this.help.addWidgetStylesheet(contentStyles, true);
      this.context.landingPageForm = '<!-- No landing page form required -->';
      this.context.exceptionLandingPageForm = '<!-- No exception landing page form required. -->';
    }
    widget.prototype.addRequests = function() {
      if (this.dontShowThisWidget) {
        return;
      }
      request = new dmpod.GetApiKeysRequest();
      this.addRequest(request);
    }
    widget.prototype.buildContextFromResponses = function(responses) {
      var errorMessage = this.help.getErrorMessageFromResponses(responses);
      if (errorMessage.length > 0) {
        this.setErrorText(errorMessage);
      } else {
        this.context.apiKey = responses[0].associatedApiKeys[0];
        if (!this.context.apiKey) {
          this.context.apiKey = '00000000-0000-0000-0000-000000000000';
        }
        this.service.changeApiKey(this.context.apiKey);
        var requests = [];
        var request = new dmpod.GetUserRequest('');
        requests.push(request);
        var contentPathAndFile = this.optionSpecified('contentPath') + this.optionSpecified('contentFile');
        request = new dmpod.GetExternalUrlContentRequest('OnDemandContent', contentPathAndFile);
        requests.push(request);
        contentPathAndFile = this.optionSpecified('contentPath') + 'styles.css';
        request = new dmpod.GetExternalUrlContentRequest('OnDemandContent', contentPathAndFile);
        requests.push(request);
        this.sendRequests(requests, function(response) {
          var errorMessage = this.help.getErrorMessageFromResponses(response.Responses);
            if (errorMessage.length > 0) {
            this.setErrorText(errorMessage);
          } else {
            this.htmlContent = response.Responses[1].content;
            this.context.user = response.Responses[0].user;
            if ((this.optionSpecified('loginRequired') == 'true')) {
              if ((this.context.user.userKey.key == 'anonymous')) {
                this.displayContent('You must be logged in to view this.');
                return;
              }
            }
            if ((this.optionSpecified('adminRequired') == 'true')) {
              if ((this.context.user.userSecurityRole != 'PluckAdmin') && (this.context.user.userSecurityRole != 'CustomerAdmin')) {
                this.displayContent('You must be logged in as an administrator to view this.');
                return;
              }
            }
            if ((this.context.user.userSecurityRole != 'PluckAdmin') && (this.context.user.userSecurityRole != 'CustomerAdmin')) {
              this.getPage();
            } else {
              var requests = [];
              var request = new dmpod.GetCustomerRequest();
              requests.push(request);
              request = new dmpod.GetCustomerLandingPageUrlsRequest();
              requests.push(request);
              request = new dmpod.GetEnabledDomainsForCustomerRequest();
              requests.push(request);
              this.sendRequests(requests, function(response) {
                var errorMessage = this.help.getErrorMessageFromResponses(response.Responses);
                if (errorMessage.length > 0) {
                  this.setErrorText(errorMessage);
                } else {
                  this.context.customer = response.Responses[0].customer;
                  this.context.customerLandingPageUrls = response.Responses[1];
                  this.context.enabledDomains = response.Responses[2].enabledDomains;
                  this.context.landingPageForm = '\
                  <form action="javascript:window[\'' + this.divId + '\'].saveUrl(document.forms.podSaveLandingPageUrl.url.value, \'*\');" \
                    name="podSaveLandingPageUrl"> \
                    <input type="text" name="url" value="' + this.context.customerLandingPageUrls.defaultWidgetLandingPageUrl + '" /> \
                    <input type="submit" value="Save" /> \
                  </form>';
                  if (this.context.enabledDomains.length > 0) {
                    var domainOptions = [];
                    for (var i=0; i<this.context.enabledDomains.length; i++) {
                      domainOptions += '<option value="' + this.context.enabledDomains[i] + '">' + this.context.enabledDomains[i] + '</option>';
                    }
                    this.context.exceptionLandingPageForm = '\
                    <form action="javascript:window[\'' + this.divId + '\'].saveUrl(document.forms.podSaveExceptionLandingPageUrl.url.value, document.forms.podSaveExceptionLandingPageUrl.forDomain.value);" \
                      name="podSaveExceptionLandingPageUrl"> \
                      <select name="forDomain" onChange="javascript:window[\'' + this.divId + '\'].showCurrentUrl(document.forms.podSaveExceptionLandingPageUrl.url, document.forms.podSaveExceptionLandingPageUrl.forDomain.selectedIndex);"> \
                        ' + domainOptions + ' \
                      </select> \
                      <input type="text" name="url" value="' + this.lookUpUrl(this.context.enabledDomains[0]) + '" /> \
                      <input type="submit" value="Save" /> \
                    </form>';
                  } else {
                    this.context.exceptionLandingPageForm = '<!-- Exception form not needed -->';
                  }
                  this.getPage();
                }
              });
            }
          }
        });
      }
    }
    widget.prototype.showCurrentUrl = function(url, index) {
      url.value = this.lookUpUrl(this.context.enabledDomains[index]);
    }
    widget.prototype.lookUpUrl = function(domain) {
      var domainUrlLookup = this.context.customerLandingPageUrls.domainWidgetLandingPageUrls;
      url = '';
      for (var i=0; i<domainUrlLookup.length; i++) {
        if (domainUrlLookup[i].key == domain) {
          url = domainUrlLookup[i].data;
        }
      }
      return url;
    }
    widget.prototype.getPage = function() {
      var tmpl = PodTrimPath.parseTemplate(this.htmlContent);
      if (tmpl != null) {
        var flags = {};
        flags.throwExceptions = true;
        try {
          html = tmpl.process(this.context, flags);
        } catch (ex) {
          html = this.help.makeErrorSpan('[' + this.classname + ':' + this.instanceName +'] ' + ex.name + ': ' + ex.message);
        }
      } else {
        html = this.help.makeErrorSpan('[' + this.classname + ':' + this.instanceName + '] parseTemplate returned null');
      }
      this.displayContent(html);
      var elem = document.createElement('DIV');
      html = html.replace(/<script/g, '<RUBY');
      html = html.replace(/script>/g, 'RUBY>');
      elem.innerHTML = html;
      var scripts = elem.getElementsByTagName('RUBY');
      for (var i=0; i<scripts.length; i++) {
        eval(scripts[i].innerHTML);
      }
    }
    widget.prototype.displayContent = function(htmlContent) {
      this.context.htmlContent = htmlContent;
      this.processTemplates();
      this.render();
    }
    widget.prototype.saveUrl = function(widgetLandingPageUrl, forDomain, callback) {
      this.service.changeApiKey(this.context.apiKey);
      widgetLandingPageUrl = this.help.eatBlanks(widgetLandingPageUrl);
      var successMessage;
      var request = {};
      if (widgetLandingPageUrl == '') {
        request = new dmpod.ClearCustomerLandingPageUrlRequest();
        successMessage = 'The URL for ' + forDomain + ' has been removed.';
      } else {
        request = new dmpod.UpdateCustomerLandingPageUrlRequest();
        request.widgetLandingPageUrl = widgetLandingPageUrl;
        if (forDomain == '*') {
          successMessage = 'The URL has been updated to: \n\n' + widgetLandingPageUrl;
        } else {
          successMessage = 'The URL for ' + forDomain + ' has been updated to: \n\n' + widgetLandingPageUrl;
        }
      }
      request.forDomain = forDomain;
      this.sendRequests(request, function(response) {
        response = response.Responses[0];
        if (response.isError) {
          alert('fail: ' + response.message);
        } else {
          alert(successMessage);
          if (typeof(callback) !== 'undefined') {
            callback();
          }
        }
      });
    }

})();

(function(){
  var widget = function() {};
  window['PluckItPublisherDomainListWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// Publisher Domain List Widget\r\n{/eval}\r\n\r\n<div class="podPublisherDomainListWidget podGlobal podFLC"\>\r\n  <div class="podBasicList"\>\r\n    {for domain in enabledDomains} \r\n      <div class="podItem podFLC" \r\n        onmouseover="javascript:WIDGETINSTANCE.shineRemoveLink(\'${podListItemLinkId}_${domain_index}\');" \r\n        onmouseout="javascript:WIDGETINSTANCE.dimRemoveLink(\'${podListItemLinkId}_${domain_index}\');"\>\r\n        <span class="podDomain"\>${domain}</span\> \r\n        <a class="podDim" id="${podListItemLinkId}_${domain_index}" href="javascript:WIDGETINSTANCE.removeDomain(\'${domain}\');"\>Remove</a\>\r\n      </div\>\r\n    {/for}\r\n  </div\>\r\n  <div class="podFormField"\>\r\n    <input class="podFormInputText" id="${podAddDomainInputId}" type="text" /\>\r\n  </div\>\r\n  <a class="podButton2" onclick="javascript:WIDGETINSTANCE.addDomain(document.getElementById(\'${podAddDomainInputId}\').value)"\><span class="podButton2_Right"\>Add Domain</span\></a\>\r\n</div\>\r\n'; 
  widget.prototype.preloadImageUrls = []; 
    widget.prototype.postInit = function() {
      this.autoRender = false;
      if (this.optionSpecified('showPublisherDomainList') == 'false') {
        this.dontShowThisWidget = true;
        return;
      }
      this.context.podListItemLinkId = this.help.createUniqueId('podListItemLinkId');
      this.context.podAddDomainInputId = this.help.createUniqueId('podAddDomainInputId');
    }
    widget.prototype.addRequests = function() {
      if (this.dontShowThisWidget) {
        return;
      }
      var request = new dmpod.GetApiKeysRequest();
      this.addRequest(request);
      var request = new dmpod.GetUserRequest();
      this.addRequest(request);
   }
    widget.prototype.buildContextFromResponses = function(responses) {
      var errorMessage = this.help.getErrorMessageFromResponses(responses);
      if (errorMessage.length > 0) {
        this.setErrorText(errorMessage);
      } else {
        if (responses[1].user.userKey.key == 'anonymous') {
          this.autoRender = false;
          return;
        }
        this.context.apiKey = responses[0].associatedApiKeys[0];
        if (!this.context.apiKey) {
          this.context.apiKey = '00000000-0000-0000-0000-000000000000';
        }
        this.service.changeApiKey(this.context.apiKey);
        var request = new dmpod.GetEnabledDomainsForCustomerRequest();
        var requests = [];
        requests.push(request);
        this.sendRequests(request, function(response) {
          response = response.Responses[0];
          if (response.isError) {
            alert('fail: ' + response.message);
          } else {
            this.context.enabledDomains = response.enabledDomains;
            this.processTemplates();
            this.render();
          }
        });
      }
    }
    widget.prototype.addDomain = function(domain, callback) {
      var request = new dmpod.EnableDomainForCustomerRequest();
      request.domain = this.help.eatBlanks(domain);
      request.notify = true;
      this.sendRequests(request, function(response) {
          response = response.Responses[0];
          if (response.isError) {
            alert('fail: ' + response.message);
          } else {
            this.execute();
            if (this.parent && this.parent.classname == 'PluckItPublisherAccountWidget') {
              this.parent.addToDomainList(domain);
            }
            if (typeof(callback) !== 'undefined') {
              callback();
            }
          }
      });
    }
    widget.prototype.removeDomain = function(domain, callback) {
      var request = new dmpod.DisableDomainForCustomerRequest();
      request.domain = this.help.eatBlanks(domain);
      this.sendRequests(request, function(response) {
          response = response.Responses[0];
          if (response.isError) {
            alert('fail: ' + response.message);
          } else {
            this.execute();
            if (this.parent && this.parent.classname == 'PluckItPublisherAccountWidget') {
              this.parent.removeFromDomainList(domain);
            }
            if (typeof(callback) !== 'undefined') {
              callback();
            }
          }
      });
    }
    widget.prototype.shineRemoveLink = function(linkId) {
      document.getElementById(linkId).className = 'podShine';
    }
    widget.prototype.dimRemoveLink = function(linkId) {
      document.getElementById(linkId).className = 'podDim';
    }

})();

(function(){
  var widget = function() {};
  window['PluckItPublisherAccountWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// Publisher Account Widget\r\n{/eval}\r\n\r\n<div class="podPublisherAccountWidget podGlobal podFLC"\>\r\n  {if user.isAnonymous && options.partnerMode != \'enom\'}\r\n  <form action="javascript:WIDGETINSTANCE.register(document.forms.signUpForm);" class="podForm" name="signUpForm"\>\r\n    <div class="podSiteSignupWidget"\>\r\n      <div class="podSectionTitle"\>Pluck On Demand Sign Up</div\>\r\n      <div class="podNote"\>* Required Fields</div\>\r\n      <div class="podAlert" id="SiteSignupError" style="display:none"\></div\>\r\n      <div class="podFormField"\>\r\n        <label\>Display Name <span class="podNote"\>*</span\></label\>\r\n        <input type="text" class="podFormInputText" name="DisplayName"/\>\r\n        <div class="podErrorMessage" id="RegisterDisplayNameError" style="display:none"\></div\>\r\n      </div\>\r\n      <div class="podFormField"\>\r\n        <label\>Email <span class="podNote"\>*</span\></label\>\r\n        <input type="text" class="podFormInputText" name="Username"/\>\r\n        <div class="podErrorMessage" id="RegisterUsernameError" style="display:none"\></div\>\r\n      </div\>\r\n      <div class="podFormField"\>\r\n        <label\>Password <span class="podNote"\>*</span\></label\>\r\n        <input type="password" class="podFormInputText" name="Password"/\>\r\n        <div class="podErrorMessage" id="RegisterPasswordError" style="display:none"\></div\>\r\n      </div\>\r\n      <div class="podFormField"\>\r\n        <label\>Confirm Password <span class="podNote"\>*</span\></label\>\r\n        <input type="password" class="podFormInputText" name="PasswordConfirmation"/\>\r\n        <div class="podErrorMessage" id="RegisterPasswordConfirmationError" style="display:none"\></div\>\r\n      </div\>\r\n      <div class="podFormField"\>\r\n        <label\>Your Birthday <span class="podNote"\>*</span\></label\>\r\n        <div class=""\>\r\n          <select name="BirthMonth" onchange="WIDGETINSTANCE.setDays()"\>\r\n            <option value="0"\>01</option\>\r\n            <option value="1"\>02</option\>\r\n            <option value="2"\>03</option\>\r\n            <option value="3"\>04</option\>\r\n            <option value="4"\>05</option\>\r\n            <option value="5"\>06</option\>\r\n            <option value="6"\>07</option\>\r\n            <option value="7"\>08</option\>\r\n            <option value="8"\>09</option\>\r\n            <option value="9"\>10</option\>\r\n            <option value="10"\>11</option\>\r\n            <option value="11"\>12</option\>\r\n          </select\> /\r\n          <select name="BirthDay"\>\r\n            <option value="1"\>01</option\>\r\n            <option value="2"\>02</option\>\r\n            <option value="3"\>03</option\>\r\n            <option value="4"\>04</option\>\r\n            <option value="5"\>05</option\>\r\n            <option value="6"\>06</option\>\r\n            <option value="7"\>07</option\>\r\n            <option value="8"\>08</option\>\r\n            <option value="9"\>09</option\>\r\n            <option value="10"\>10</option\>\r\n            <option value="11"\>11</option\>\r\n            <option value="12"\>12</option\>\r\n            <option value="13"\>13</option\>\r\n            <option value="14"\>14</option\>\r\n            <option value="15"\>15</option\>\r\n            <option value="16"\>16</option\>\r\n            <option value="17"\>17</option\>\r\n            <option value="18"\>18</option\>\r\n            <option value="19"\>19</option\>\r\n            <option value="20"\>20</option\>\r\n            <option value="21"\>21</option\>\r\n            <option value="22"\>22</option\>\r\n            <option value="23"\>23</option\>\r\n            <option value="24"\>24</option\>\r\n            <option value="25"\>25</option\>\r\n            <option value="26"\>26</option\>\r\n            <option value="27"\>27</option\>\r\n            <option value="28"\>28</option\>\r\n            <option value="29"\>29</option\>\r\n            <option value="30"\>30</option\>\r\n            <option value="31"\>31</option\>\r\n          </select\> /\r\n          <select name="BirthYear" onchange="WIDGETINSTANCE.setDays()"\>${yearOptions}</select\>\r\n        </div\>\r\n        <div class="podErrorMessage" id="PluckBirtdateError" style="display:none"\></div\>\r\n      </div\>\r\n      <div class="podFormField"\>\r\n        <label\>Your Site\'s Domain Name <span class="podNote"\>*</span\></label\>\r\n        <input type="text" class="podFormInputText" name="PrimaryDomain"/\>\r\n        <div class="podErrorMessage" id="RegisterPrimaryDomainError" style="display:none"\></div\>\r\n        <div class="podFormHelp"\>example: domainnameonly.com</div\>\r\n      </div\>\r\n      <div class="podFormField" style="display:none"\>\r\n        <label\>Enter a rating for your site</label\>\r\n        <ul class="podHorizontalList podFLC formInputCheckboxList"\>\r\n          <li\><input type="radio" class="podFormInputCheckbox" checked="checked" name="Rating" value="G" /\> <label\>G</label\></li\>\r\n          <li\><input type="radio" class="podFormInputCheckbox" name="Rating" value="PG" /\> <label\>PG</label\></li\>\r\n          <li\><input type="radio" class="podFormInputCheckbox" name="Rating" value="PG-13" /\> <label\>PG-13</label\></li\>\r\n          <li\><input type="radio" class="podFormInputCheckbox" name="Rating" value="R" /\> <label\>R</label\></li\>\r\n        </ul\>\r\n      </div\>\r\n      <div class="podFormField" style="display:none"\>\r\n        <label\>Display comments and recommendations from other<br/\>sites in the Pluck On Demand network. <a href="#" onclick="javascript:window.open(\'${options.networkWhatsThisUrl}\',\'\',\'\');" class="ex"\>What\'s this?</a\></label\>\r\n        <ul class="podHorizontalList podFLC formInputCheckboxList"\>\r\n          <li\><input type="radio" class="podFormInputCheckbox" name="ContentMode" checked="checked" value="Network" /\> <label\>Yes</label\></li\>\r\n          <li\><input type="radio" class="podFormInputCheckbox" name="ContentMode" value="Local" /\> <label\>No</label\></li\>\r\n        </ul\>\r\n      </div\>\r\n      <div class="podFormField" style="display:none"\>\r\n        <label\>Display in-text advertising from Kontera?</label\>\r\n        <ul class="podHorizontalList podFLC formInputCheckboxList"\>\r\n          <li\><input type="radio" class="podFormInputCheckbox" name="InlineTextAdsAllowed" checked="checked" value="true" /\> <label\>Yes</label\></li\>\r\n          <li\><input type="radio" class="podFormInputCheckbox" name="InlineTextAdsAllowed" value="false" /\> <label\>No</label\></li\>\r\n        </ul\>\r\n      </div\>\r\n      <div class="podFormField"\>\r\n        <label\>Word Verification</label\>  \r\n        <input type="text" class="podFormInputText" name="WordVerification"/\>\r\n        <div class="podFormHelp"\>Enter the text exactly as it appears in the picture, including capital or lowercase letters.</div\>\r\n        <img class="podCaptchaImage" id="PluckCaptchaImage" src="${captchaUrl}"/\>\r\n      </div\>\r\n      <div class="podErrorMessage" id="WordVerificationError" style="display:none"\></div\>\r\n      <div class="podFormField"\>\r\n        <input type="checkbox" name="RegisterTOS" class="podFormInputCheckbox"/\>I have read, understood, and agree to the Pluck <a href="#" onclick="javascript:window.open(\'${options.termsOfServiceUrl}\',\'\',\'\');"\>Terms of Use</a\> and <a href="#" onclick="javascript:window.open(\'${options.privacyPolicyUrl}\',\'\',\'\');"\>Privacy Policy</a\> for Pluck On Demand.&nbsp;<span class="podNote"\>*</span\>\r\n        <div class="podErrorMessage" id="RegisterTOSError" style="display:none"\></div\>\r\n      </div\>\r\n      <div class="podFormButtons"\>\r\n        <a class="podButton1" href="javascript:document.forms.signUpForm.submit()" id="${podPublisherAccountRegisterButtonId}"\><span class="podButton1_Right"\>Submit</span\></a\>\r\n        <span class="podButton1Selected" id="${podPublisherAccountRegisterWaitingId}" style="display:none;"\><span class="podButton1_Right"\><span class="podButton1_Waiting"\>Loading ...</span\></span\></span\>\r\n        <a href="javascript:document.location=\'${options.successPageUrl}\'"  class="podButtonCancel"\>Cancel</a\>\r\n      </div\>\r\n      <div class="podFooterNote"\>\r\n        * By signing up you will be able to add Pluck On Demand widgets to your site. \r\n        The widgets will run without advertising until your website is approved. \r\n        Upon approval, ads will automatically start to appear within your widgets.\r\n      </div\>\r\n    </div\>\r\n  </form\>\r\n\r\n{else}\r\n  {if !thisIsAPublisher}\r\n    {if options.partnerMode != \'enom\'}\r\n  <div class="podLoggedInUser"\>You are not a registered Publisher. <a href="javascript:WIDGETINSTANCE.logout();"\>Logout</a\></div\>\r\n    {/if}\r\n  {else}\r\n  \r\n  <form action="javascript:WIDGETINSTANCE.updateAccount(document.forms.editAccountForm)" class="podForm" name="editAccountForm"\>\r\n    <div class="podSiteSignupWidget"\>\r\n      <div class="podSection"\>\r\n        {if isEnomUser}\r\n        <div class="podSectionTitle"\>Account Information</div\>\r\n        <div class="podAlert" id="EditAccountError" style="display:none"\></div\>\r\n        <div class="podFormDescription"\>The information below was provided by your service provider. For \r\n          information on how to modify or update your account or billing settings, \r\n          please reference the FAQs.</div\>\r\n        <div class="podFormField"\>\r\n          <label\>Password</label\>\r\n          <div class="podFormDescription"\>To reset your password, please log into your RichContent \r\n            control panel at your service provider.</div\>\r\n          <input type="hidden" class="podFormInputText" name="DisplayName"/\>\r\n          <input type="hidden" class="podFormInputText" name="Password"/\>\r\n          <input type="hidden" class="podFormInputText" name="NewPassword"/\>\r\n          <input type="hidden" class="podFormInputText" name="NewPasswordConfirmation"/\>\r\n        </div\>\r\n        <div class="podFormField"\>\r\n          <label\>Account Domains</label\>\r\n          <div class="podFormDescription"\>Manage or add new domains through your service provider, reference the FAQs to learn more.</div\>\r\n          <textarea class="podDomainList" name="EnabledDomainsReadOnly" readonly="readonly"\></textarea\>\r\n        </div\>\r\n        {else}\r\n        <div class="podSectionTitle"\>Account Settings</div\>\r\n        <div class="podNote"\>* Required Fields</div\>\r\n        <div class="podAlert" id="EditAccountError" style="display:none"\></div\>\r\n        <div class="podFormField"\>\r\n          <label\>Display Name <span class="podNote"\>*</span\></label\>\r\n          <input type="text" class="podFormInputText" name="DisplayName"/\>\r\n          <div class="podErrorMessage" id="EditAccountDisplayNameError" style="display:none"\></div\>\r\n        </div\>\r\n        <div class="podFormField"\>\r\n          <label\>Current Password</label\>\r\n          <input type="password" class="podFormInputText" name="Password"/\>\r\n          <div class="podErrorMessage" id="EditAccountPasswordError" style="display:none"\></div\>\r\n        </div\>\r\n        <div class="podFormField"\>\r\n          <label\>New Password</label\>\r\n          <input type="password" class="podFormInputText" name="NewPassword"/\>\r\n          <div class="podErrorMessage" id="EditAccountNewPasswordError" style="display:none"\></div\>\r\n        </div\>\r\n        <div class="podFormField"}\>\r\n          <label\>Confirm New Password</label\>\r\n          <input type="password" class="podFormInputText" name="NewPasswordConfirmation"/\>\r\n          <div class="podErrorMessage" id="EditAccountNewPasswordConfirmationError" style="display:none"\></div\>\r\n        </div\>\r\n        {/if}\r\n        <div class="podFormField" style="display:none"\>\r\n          <label\>Domain <span class="podNote"\>*</span\></label\>\r\n          <input type="text" class="podFormInputText" name="PrimaryDomain"/\>\r\n          <div class="podErrorMessage" id="EditAccountPrimaryDomainError" style="display:none"\></div\>\r\n        </div\>\r\n      </div\>\r\n      <div class="podSection"\>\r\n        <div class="podSectionTitle"\>Widget Settings</div\>\r\n        <div class="podFormDescription"\>By updating the settings below, the \r\n        content displayed on your site will be modified accordingly.</div\> \r\n        <div class="podFormField podCategories" {if isEnomUser}style="display: none"{/if}\>\r\n          <label\>Categories</label\>\r\n          <select name="Category0"\>${categoryOptions}</select\>\r\n          <select name="Category1"\>${categoryOptions}</select\>\r\n          <select name="Category2"\>${categoryOptions}</select\>\r\n          <div class="podErrorMessage" id="EditAccountCategoryError" style="display:none"\></div\>\r\n        </div\>\r\n        {if !isEnomUser && customer.customerType == \'RevenueShare\'}\r\n        <div class="podFormField"\>\r\n          <label\>Enabled Domains</label\>\r\n          <div id="domainList"\>${domainList}</div\>\r\n        </div\>\r\n        {/if}\r\n        <div class="podFormField podLandingPageUrlField"\>\r\n          <label\>Landing Page URL</label\>\r\n          <div class="podFormDescription"\>\r\n          Displays the full articles &mdash; Our systems need to know where to send your users when they click on a related content link. \r\n          This page will show full articles, videos and topic pages.\r\n          </div\>\r\n          <div id="EditAccountLandingPageUrlMultiMode" style="display: none"\>\r\n            <div class="podFormInputCheckboxList podFLC"\>\r\n              <div class="podItem"\><input type="radio" class="podFormInputCheckbox" \r\n                name="LandingPageUrlMode" \r\n                onClick="javascript:WIDGETINSTANCE.help.displayElement(\'${podLandingPageUrlExceptionFormId}\', \'none\');WIDGETINSTANCE.help.swapElements(\'${podLandingPageLabelAltId}\', \'${podLandingPageLabelId}\');"\r\n                value="All domains" /\> <label\>All domains</label\></div\>\r\n              <div class="podItem"\><input type="radio" class="podFormInputCheckbox" \r\n                name="LandingPageUrlMode" \r\n                onClick="javascript:WIDGETINSTANCE.help.displayElement(\'${podLandingPageUrlExceptionFormId}\', \'block\');WIDGETINSTANCE.help.swapElements(\'${podLandingPageLabelId}\', \'${podLandingPageLabelAltId}\');"\r\n                value="Define per domain" /\> <label\>Define per domain</label\></div\>\r\n            </div\>\r\n            <div id="${podLandingPageUrlExceptionFormId}" style="display: none"\>\r\n              <div class="podFormDescription"\>Define a specific URL per domain.</div\>\r\n              <select id="${podExceptionDomainId}" name="ExceptionDomain" \r\n                onChange="javascript:WIDGETINSTANCE.showCurrentUrl(this.form.ExceptionLandingUrl, this.form.ExceptionDomain.selectedIndex);"\>\r\n              </select\>\r\n              <input type="text" class="podFormInputText" name="ExceptionLandingUrl" \r\n                onChange="javascript:WIDGETINSTANCE.updateDomainExceptionUrl(this.form.ExceptionLandingUrl, this.form.ExceptionDomain.selectedIndex);"/\>\r\n              <div class="podErrorMessage" id="EditAccountLandingUrlError" style="display:none"\></div\>\r\n            </div\>\r\n          </div\>\r\n          <div class="podFormDescription" id="${podLandingPageLabelId}" style="display: none"\>Applies to all domains in your account.</div\>\r\n          <div class="podFormDescription" id="${podLandingPageLabelAltId}" style="display: none"\>Applies to all other domains in your account not specified above.</div\>\r\n          <input type="text" class="podFormInputText" style="width: 200px; margin-bottom: 10px;" name="LandingUrl"/\>\r\n          <span class="podExample" style="font-style: italic;"\>A relative path is recommended*</span\>\r\n          <div class="podErrorMessage" id="EditAccountLandingUrlError" style="display:none"\></div\>\r\n          <div class="podExample"\>\r\n            * A relative path is the portion of the URL after the domain name. The absolute path is the entire URL.\r\n          </div\>\r\n          <table class="podExample"\>\r\n            <tr\>\r\n              <td\>Example: </td\>\r\n              <td\>http://www.example.com/pages/landing.html</td\>\r\n            </tr\>\r\n            <tr\>\r\n              <td\>Absolute path: </td\>\r\n              <td\>http://www.example.com/pages/landing.html</td\>\r\n            </tr\>\r\n            <tr\>\r\n              <td\>Relative path: </td\>\r\n              <td\>/pages/landing.html (recommended, especially for multiple domains that have the same relative path)</td\>\r\n            </tr\>\r\n          </table\>\r\n        </div\>\r\n        {if isEnomUser}\r\n        <input type="hidden" name="Platform"/\>\r\n        <input type="hidden" name="OtherPlatform" /\>\r\n        <input type="hidden" name="InlineTextAdsAllowed"/\>\r\n        {else}\r\n        <div class="podFormField"\>\r\n          <label\>Platform</label\>\r\n          <select name="Platform" onchange="javascript:WIDGETINSTANCE.syncFormElements(this.form.Platform, this.form.OtherPlatform, \'other\');"\>\r\n            <option value=""\>Select...</option\>\r\n            <option value="WordPress.com"\>WordPress.com</option\>\r\n            <option value="WordPress Install"\>WordPress Install</option\>\r\n            <option value="Blogger"\>Blogger</option\>\r\n            <option value="Ning"\>Ning</option\>\r\n            <option value="Blogsome"\>Blogsome</option\>\r\n            <option value="Drupal"\>Drupal</option\>\r\n            <option value="Squarespace"\>Squarespace</option\>\r\n            <option value="Tumblr"\>Tumblr</option\>\r\n            <option value="TypePad"\>TypePad</option\>\r\n            <option value="Wikispaces"\>Wikispaces</option\>\r\n            <option value="Joomla"\>Joomla</option\>\r\n            <option value="other"\>Other</option\>\r\n          </select\>\r\n          <input type="text" name="OtherPlatform" class="podFormInputText" style="display: none"/\>\r\n          <div class="podErrorMessage" id="EditAccountPlatformError" style="display:none"\></div\>\r\n        </div\>\r\n        <div class="podFormField" {if (options.partnerMode == \'kontera\')} style="display:none" {/if}\>\r\n          <label\>Display in-text advertising from Kontera?</label\>\r\n          <div class="podFormInputCheckboxList podFLC"\>\r\n            <div class="podItem"\><input type="radio" class="podFormInputCheckbox" name="InlineTextAdsAllowed" checked="checked" value="true" /\> <label\>Yes</label\></div\>\r\n            <div class="podItem"\><input type="radio" class="podFormInputCheckbox" name="InlineTextAdsAllowed" value="false" /\> <label\>No</label\></div\>\r\n          </div\>\r\n        </div\>\r\n        {/if}\r\n        <div class="podFormField"\>\r\n          <label\>Your account rating</label\>\r\n          <div class="podFormDescription"\>\r\n          Limit content by MPAA ratings &mdash; G = no profanity or innuendo; PG/PG-13 = varied innuendo and slang allowed; R = all content allowed.\r\n          </div\>\r\n          <div class="podFormInputCheckboxList podFLC"\>\r\n            <div class="podItem"\><input type="radio" class="podFormInputCheckbox" checked="checked" name="Rating" value="G" /\> <label\>G</label\></div\>\r\n            <div class="podItem"\><input type="radio" class="podFormInputCheckbox" name="Rating" value="PG" /\> <label\>PG</label\></div\>\r\n            <div class="podItem"\><input type="radio" class="podFormInputCheckbox" name="Rating" value="PG-13" /\> <label\>PG-13</label\></div\>\r\n            <div class="podItem"\><input type="radio" class="podFormInputCheckbox" name="Rating" value="R" /\> <label\>R</label\></div\>\r\n          </div\>\r\n        </div\>\r\n      </div\>\r\n      <div class="podFormButtons podFLC"\>\r\n        <a class="podButton1" href="javascript:document.forms.editAccountForm.submit()" id="${podPublisherAccountUpdateButtonId}"\><span class="podButton1_Right"\>Submit</span\></a\>\r\n        <span class="podButton1Selected" id="${podPublisherAccountUpdateWaitingId}" style="display:none;"\><span class="podButton1_Right"\><span class="podButton1_Waiting"\>Loading ...</span\></span\></span\>\r\n        <a href="javascript:document.location=\'${options.successPageUrl}\'" class="podButtonCancel"\>Cancel</a\>\r\n      </div\>\r\n    </div\>\r\n  </form\>\r\n    {/if}\r\n  {/if}\r\n</div\>\r\n\r\n'; 
  widget.prototype.preloadImageUrls = []; 
widget.prototype.addChildWidgets = function() {
  this.addChildWidget('PluckItPublisherDomainListWidget', 'domainList');
}
widget.prototype.postInit = function() {
  this.context.podPublisherAccountRegisterButtonId = this.help.createUniqueId('podPublisherAccountRegisterButtonId');
  this.context.podPublisherAccountRegisterWaitingId = this.help.createUniqueId('podPublisherAccountRegisterWaitingId');
  this.context.podPublisherAccountUpdateButtonId = this.help.createUniqueId('podPublisherAccountUpdateButtonId');
  this.context.podPublisherAccountUpdateWaitingId = this.help.createUniqueId('podPublisherAccountUpdateWaitingId');
  this.context.podLandingPageUrlExceptionFormId = this.help.createUniqueId('podLandingPageUrlExceptionFormId');
  this.context.podLandingPageLabelId = this.help.createUniqueId('podLandingPageLabelId');
  this.context.podLandingPageLabelAltId = this.help.createUniqueId('podLandingPageLabelAltId');
  this.context.podExceptionDomainId = this.help.createUniqueId('podExceptionDomainId');
}
widget.prototype.addRequests = function() {
  var request = new dmpod.GetUserRequest('');
  this.addRequest(request);
  request = new dmpod.GetCaptchaInfoRequest();
  request.width = 250;
  request.height = 50;
  this.addRequest(request);
  var request = new dmpod.GetContentCategoriesRequest();
  this.addRequest(request);
  request = new dmpod.VerifyUsersPublisherNetworkRequest('eNom');
  this.addRequest(request);
  var date = new Date(), lastYear = date.getFullYear() - 110, collection = [];
  for (var i = date.getFullYear(); i > lastYear; i--) {
    if (i == date.getFullYear() - 30) {
        collection.push('<option value="' + i + '"  selected>' + i + '</option>');
    } else {
        collection.push('<option value="' + i + '">' + i + '</option>');            
    }
  }
  this.context.yearOptions = collection.join('\n');
  this.customer = { domain: '', enabledState: 'disabled' };
}
widget.prototype.setNewCaptcha = function() {
  var request = new dmpod.GetCaptchaInfoRequest();
  request.width = 250;
  request.height = 50;
  this.sendRequests([request], function(response) {
     if (!response.Responses[0].isError) {
       this.context.captchaId = response.Responses[0].id;
       this.context.captchaUrl = response.Responses[0].url;
       if (document.location.toString().match(/https/i)) {
         this.context.captchaUrl = this.context.captchaUrl.replace(/http/i, 'https');
       }
       document.getElementById('PluckCaptchaImage').src = this.context.captchaUrl;
    }
  });
}
widget.prototype.buildContextFromResponses = function(responses) {
  this.autoRender = true;
  var errorMessage = this.help.getErrorMessageFromResponses(responses);
  if (errorMessage.length > 0) {
    if (errorMessage.indexOf('has been disabled')) {
      alert('Error: Account Disabled: ' + errorMessage);
      this.autoRender = false;
    } else {
      this.setErrorText(errorMessage);
    }
  } else {
    var cats = responses[2].categories;
    this.context.categoryOptions = '<option value="0">Select...</option>';
    for (var i=0; i < cats.length; i++) {
      this.context.categoryOptions += '<option value="' + cats[i].id + '">' + cats[i].name + '</option>';
    }
    this.context.captchaId = responses[1].id;
    this.context.captchaUrl = responses[1].url;
    if (document.location.toString().match(/https/i)) {
      this.context.captchaUrl = this.context.captchaUrl.replace(/http/i, 'https');
    }
    this.context.isEnomUser = responses[3].isMember;
    this.context.user = responses[0].user;
    this.context.thisIsAPublisher = false;
    if (this.context.user.userKey.key == 'anonymous') {
      this.context.user.isAnonymous = true;
    } else {
      this.autoRender = false;
      this.context.user.isAnonymous = false;
      var request = new dmpod.GetApiKeysRequest();
      this.sendRequests([request], function(response) {
        response = response.Responses[0];
        if (response.isError) {
          alert('Account lookup error: \n' + response.message);
          return;
        }
        if (response.associatedApiKeys.length == 0) {
          if (typeof(this.notPublisherChecked) !== 'undefined') {
            this.context.thisIsAPublisher = false;
            this.processTemplates();
            this.render();
          } else {
            this.logout();
          }
          return;
        } else {
          this.context.thisIsAPublisher = true;
        }
        this.service.changeApiKey(response.associatedApiKeys[0]);
        this.sendRequests([new dmpod.GetCustomerRequest()], function(responses) {
          response = responses.Responses[0];
          if (response.isError) {
            alert(response.message);
          } else {
            this.customer = response.customer;
            this.context.customer = this.customer;
            this.processTemplates();
            this.render();
            this.loadAccountInfo();
            this.loadLandingPageInfo();
          }
        });
      });
    }
  }
}
widget.prototype.logout = function() {
  this.service.setUserAuthToken(null);
  this.execute();
}
widget.prototype.callLogin = function(username,password,callback) {
  var request = new dmpod.GetLoginTokenRequest();
  request.userEmail = username;
  request.password = password;
  this.sendRequests([request], function(response) {
    if (response.Responses[0].isError) {
      if (/Error: invalid userEmail.password/.test(response.Responses[0].message)) {
        response.Responses[0].message = 'Error: The password entered is not correct.';
      }
      this.help.showError('SiteSignupError', response.Responses[0].message);
      scroll(0,0);
    } else {
      this.service.setUserAuthToken(response.Responses[0].loginToken);
    }
    if (callback !== 'undefined') {
      callback(!response.Responses[0].isError);
    }
  });
}
widget.prototype.resetPassword = function(email) {
  var request = new dmpod.ResetPasswordRequest();
  request.userEmail = email;
  this.sendRequests([request], function(response) {
    if (response.Responses[0].isError) {
      alert(response.Responses[0].message);
    } else {
      this.help.alert('Your password has been reset.  Shortly, you will receive your new password at your email address: '+email);
    }
  });
}
widget.prototype.updateAccount = function(form) {
  if (!this.validateEditAccountForm(form)) {
    return;
  }
  this.help.swapElements(this.context.podPublisherAccountUpdateButtonId, this.context.podPublisherAccountUpdateWaitingId);
  if (this.customer.publisherNetwork == 'Kontera') {
    this.customer.inlineTextAdsAllowed = true;
  } else {
    for (i=0; i<form.elements['InlineTextAdsAllowed'].length; i++) {
      if (form.InlineTextAdsAllowed[i].checked) {
        this.customer.inlineTextAdsAllowed = form.InlineTextAdsAllowed[i].value == 'true';
        break;
      }
    }
  }
  this.customer.domain = this.help.extractDomain(form.PrimaryDomain.value);
  this.customer.widgetLandingPageUrl = form.LandingUrl.value;
  this.customer.exceptionDomain = form.ExceptionDomain.value;
  this.customer.exceptionLandingUrl = form.ExceptionLandingUrl.value;
  this.customer.platform = this.help.eatBlanks(form.OtherPlatform.value);
  var requests = [];
  requests.push(new dmpod.UpdateUserRequest(this.help.eatBlanks(form.DisplayName.value)));
  if (form.Password.value > '' && form.NewPassword.value > '') {
    var request = new dmpod.ChangePasswordRequest();
    request.userKey = this.context.user.userKey;
    request.userEmail = unescape(this.service.getUserAuthToken()).match(/&e=([^&]+)/)[1];
    request.oldPassword = form.Password.value;
    request.newPassword = form.NewPassword.value;
    requests.push(request);
  }
  this.sendRequests(requests,function(responses) {
    var errorMessage = this.help.getErrorMessageFromResponses(responses);
    if (errorMessage.length > 0) {
      this.help.swapElements(this.context.podPublisherAccountUpdateWaitingId, this.context.podPublisherAccountUpdateButtonId);
      alert(response.message);
      this.setErrorText(errorMessage);
    } else {
      this.context.user.name = this.help.eatBlanks(form.DisplayName.value);
      this.setAdNetworkDetails(form);
      this.updateAdNetworkDetails();
    }
  });
}
widget.prototype.register = function(form) {
  if (!this.validateRegisterForm(form)) {
    return;
  }
  this.help.swapElements(this.context.podPublisherAccountRegisterButtonId, this.context.podPublisherAccountRegisterWaitingId);
  this.context.displayName = form.elements['DisplayName'].value;
  this.context.email = form.elements['Username'].value;
  this.context.password = form.elements['Password'].value;
  this.customer.domain = this.help.extractDomain(form.elements['PrimaryDomain'].value);
  this.context.birthdate = new Date(form.elements['BirthYear'].value, form.elements['BirthMonth'].value, form.elements['BirthDay'].value).getTime();
  for (i=0; i<form.elements['ContentMode'].length; i++) {
    if (form.ContentMode[i].checked) {
      this.customer.userContentMode = form.ContentMode[i].value;
      break;
    }
  }
  this.customer.publisherNetwork = 'None';
  if (this.optionSpecified('partnerMode') == 'kontera') {
    this.customer.publisherNetwork = 'Kontera';
    this.customer.inlineTextAdsAllowed = true;
  } else {
    for (i=0; i<form.elements['InlineTextAdsAllowed'].length; i++) {
      if (form.InlineTextAdsAllowed[i].checked) {
        this.customer.inlineTextAdsAllowed = form.InlineTextAdsAllowed[i].value == 'true';
        break;
      }
    }
  }
  this.context.captchaText = form.elements['WordVerification'].value;
  var request = new dmpod.RegisterUserRequest(this.context.displayName, this.context.email, this.context.password);
  request.birthdate = this.context.birthdate;
  this.sendRequests([request], function(response) {
    response = response.Responses[0];
    var my = this;
    if (response.isError) {
      var message = response.message;
      this.callLogin(this.context.email,this.context.password,function(success) {
        if (success) {
          my.createCustomerAccount(form,response.userKey);
        } else {
        }
      });
    } else {
      this.callLogin(this.context.email,this.context.password,function(success) {
        if (success) {
          my.createCustomerAccount(form,response.userKey);
        }
      });
    };
  });
}
widget.prototype.validateEditAccountForm = function(form) {
  this.help.hideError('EditAccountError');
  var isValid = true;
  if (form.elements['NewPassword'].value > '') {
    if (form.elements['NewPasswordConfirmation'].value > '') {
      if (form.elements['Password'].value > '') {
      } else {
        this.help.showError('EditAccountPasswordError', 'To change you password, you must also fill in the current password.');
        isValid = false;
      }
    } else if (form.elements['Password'].value > '') {
      this.help.showError('EditAccountNewPasswordConfirmationError','To change your password, you must also enter the confirmation of your new password.');
      isValid = false;
    } else {
      this.help.showError('EditAccountNewPasswordError', 'To change your password, you must also enter your current password and the confirmation of your new password.');
      isValid = false;
    }
  }
  if (!isValid) {
    this.help.showError('EditAccountError', 'Please correct the issues noted.');
  }
  return isValid;
}
widget.prototype.validateRegisterForm = function(form) {
  this.help.hideError('SiteSignupError');
  var isValid = true;
  if (!form.elements['DisplayName'].value.length) {
    this.help.showError('RegisterDisplayNameError', 'Input a valid display name');
    isValid = false;
  }
  else
    this.help.hideError('RegisterDisplayNameError');
  if (!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(form.elements['Username'].value)) {
    this.help.showError('RegisterUsernameError', 'Input a valid e-mail address');
    isValid = false;
  }
  else
    this.help.hideError('RegisterUsernameError');
  if (!this.help.extractDomain(form.elements['PrimaryDomain'].value).length) {
    this.help.showError('RegisterPrimaryDomainError', 'Enter your site\'s primary domain');
    isValid = false;
  }
  else
    this.help.hideError('RegisterPrimaryDomainError');
  if (form.elements['Password'].value.length < 6) {
    this.help.showError('RegisterPasswordError', 'Password must be at least 6 characters');
    isValid = false;
  }
  else
    this.help.hideError('RegisterPasswordError');
  if (form.elements['Password'].value != form.elements['PasswordConfirmation'].value) {
    this.help.showError('RegisterPasswordConfirmationError', 'Passwords do not match');
    isValid = false;
  }
  else
    this.help.hideError('RegisterPasswordConfirmationError');
  var birthdate = new Date(parseInt(form.elements['BirthYear'].value), parseInt(form.elements['BirthMonth'].value), parseInt(form.elements['BirthDay'].value));
  var now = new Date();
  var legaldate = new Date(now.getFullYear() -13, now.getMonth(), now.getDate());
  if (this.service.getCookieValue('UATY') != undefined || birthdate >= legaldate) {
      this.service.setCookieValue('UATY', 'true', 1);
      this.help.showError('PluckBirtdateError', 'We are sorry but you did not qualify to register.');
      isValid = false;
  }
  else
    this.help.hideError('PluckBirtdateError');
  if (form.elements['Password'].value != form.elements['PasswordConfirmation'].value) {
    this.help.showError('RegisterPasswordConfirmationError', 'Passwords do not match');
    isValid = false;
  }
  else
    this.help.hideError('RegisterPasswordConfirmationError');
  if (!form.elements['RegisterTOS'].checked) {
    this.help.showError('RegisterTOSError', 'You must agree to the Terms of Use to register');
    isValid = false;
  }
  else
    this.help.hideError('RegisterTOSError');
  if (!form.elements['WordVerification'].value.length) {
    this.help.showError('WordVerificationError', 'You must enter the text/numbers that you see within the image');
    isValid = false;
  }
  else
    this.help.hideError('WordVerificationError');
  if (!isValid) {
    this.help.showError('SiteSignupError', 'Please correct the issues noted.');
  }
  return isValid;
}
widget.prototype.setDays = function() {
  var form = document.forms['signUpForm'], lastDay
      ,selectedMonth = form.elements['BirthMonth'].value
      ,selectedYear = form.elements['BirthYear'].value;
  if (selectedMonth == '0' ||  // Jan
      selectedMonth == '2' ||  // Mar
      selectedMonth == '4' ||  // May
      selectedMonth == '6' ||  // Jul
      selectedMonth == '7' ||  // Aug
      selectedMonth == '9' ||  // Oct
      selectedMonth == '11'    // Dec
  ) {
      lastDay = 31;
  } else if (
      selectedMonth == '3' ||  // Apr
      selectedMonth == '5' ||  // Jun
      selectedMonth == '8' ||  // Sep
      selectedMonth == '10'    // Nov
  ) {
      lastDay = 30;
  } else {
      if (parseInt(selectedYear) % 4 == 0) {
          lastDay = 29;   // Feb, leap year
      } else {
          lastDay = 28;   // Feb, not leap year
      }
  }
  var select = form.elements['BirthDay'];
  select.innerHTML = '';
  for (var i = 1; i <= lastDay; i++) {
    var option = document.createElement('option');
    option.value = i;
    option.innerHTML = i;
    select.appendChild(option);
  }
}
widget.prototype.createCustomerAccount = function(form,userKey) {
  var request = new dmpod.GenerateNewCustomerKeyRequest();
  this.sendRequests([request,new dmpod.GetUserRequest()], function(response) {
    if (response.Responses[1].isError) {
      alert('Error registering: \n' + response.Responses[1].message);
      this.help.swapElements(this.context.podPublisherAccountRegisterWaitingId, this.context.podPublisherAccountRegisterButtonId);
      return;
    }
    this.context.user = response.Responses[1].user;
    response = response.Responses[0];
    if (response.isError) {
      alert('Error registering: \n' + response.message);
      this.help.swapElements(this.context.podPublisherAccountRegisterWaitingId, this.context.podPublisherAccountRegisterButtonId);
      return;
    }
    var savedApiKey = this.service.apiKey;
    this.service.changeApiKey(response.customerKey);
    request = new dmpod.RegisterUsersCustomerAccountRequest();
    request.publisherNetwork = this.customer.publisherNetwork;
    request.inlineTextAdsAllowed = this.customer.inlineTextAdsAllowed;
    request.apiKey = response.customerKey;
    request.domain = this.customer.domain;
    if (this.optionSpecified('customerType')) {
      request.customerType = this.context.options['customerType'];
    } else {
      request.customerType = 'RevenueShare';
    }
    request.userContentMode = this.customer.userContentMode;
    request.mpaaRating = this.getMPAARating(form);
    request.captchaId = this.context.captchaId;
    request.captchaText = this.context.captchaText;
    this.sendRequests([request, new dmpod.GetCustomerRequest()], function(responses) {
      response = responses.Responses[0];
      if (response.isError) {
        alert('Error registering: \n' + response.message);
        this.help.swapElements(this.context.podPublisherAccountRegisterWaitingId, this.context.podPublisherAccountRegisterButtonId);
        this.service.changeApiKey(savedApiKey);
        this.setNewCaptcha();
        return;
      }
      this.customer = responses.Responses[1].customer;
      this.context.customer = this.customer;
      this.postUpdateAdNetworkDetails();
    });
  });
}
widget.prototype._loadAccountInfoResponse = function(response) {
  var form = document.forms['editAccountForm'];
  if (typeof(form) === 'undefined') {
     this.setTimeout(function() { this._loadAccountInfoResponse(response); },200);
     return;
  }
  this.setFormField(form,'DisplayName',this.context.user.name);
  this.setFormField(form,'Password','');
  this.setFormField(form,'NewPassword','');
  this.setFormField(form,'NewPasswordConfirmation','');
  this.setFormField(form,'PrimaryDomain',this.customer.domain);
  this.setFormField(form, 'Platform', this.customer.platform);
  this.setFormField(form, 'OtherPlatform', this.customer.platform);
  if (form.Platform.value != form.OtherPlatform.value) {
    var savedOption = document.createElement('OPTION');
    savedOption.value = this.customer.platform;
    savedOption.innerHTML = this.customer.platform;
    savedOption.selected = 'selected';
    form.Platform.appendChild(savedOption);
  }
  if (response.isError) {
    var details = new dmpod.AdNetworkDetails();
    details.channelIds = [0,0,0];
    details.contentSources = null;
    details.businessName = this.customer.domain;
    details.mpaaRating = 'G';
    this.context.adNetworkDetails = details;
  } else {
    this.context.adNetworkDetails = response.adNetworkDetails;
  }
  for (var i=0; i<this.context.adNetworkDetails.channelIds.length; i++) {
    this.setFormField(form, 'Category'+i, this.context.adNetworkDetails.channelIds[i]);
  }
  var ratingGroup = form.elements['Rating'];
  for (i=0; i<ratingGroup.length; i++) {
    form.Rating[i].checked = (form.Rating[i].value == this.context.adNetworkDetails.mpaaRating);
  }
  for (i=0; i<form.elements['InlineTextAdsAllowed'].length; i++) {
    if (form.InlineTextAdsAllowed[i].value == 'true') {
      form.InlineTextAdsAllowed[i].checked = this.customer.inlineTextAdsAllowed;
    } else {
      form.InlineTextAdsAllowed[i].checked = !this.customer.inlineTextAdsAllowed;
    }
  }
  if (document.getElementById('domainList_' + this.divSuffix)) {
    document.getElementById('domainList_' + this.divSuffix).innerHTML = this.child.domainList.content;
  }
}
widget.prototype.loadAccountInfo = function() {
  this.sendRequests([new dmpod.GetAdNetworksRequest()], function(response) {
    this._loadAccountInfoResponse(response.Responses[0]);
  });
}
widget.prototype._loadLandingPageInfoResponse = function(response) {
  var errorMessage = this.help.getErrorMessageFromResponses(response.Responses);
  if (errorMessage.length > 0) {
    this.setErrorText(errorMessage);
  } else {
    this.context.customerLandingPageUrls = response.Responses[0];
    this.context.enabledDomains = response.Responses[1].enabledDomains;
    var form = document.forms['editAccountForm'];
    if (typeof(form) === 'undefined') {
       this.setTimeout(function() { this._loadLandingPageInfoResponse(response); },200);
       return;
    }
    this.setFormField(form, 'LandingUrl', this.context.customerLandingPageUrls.defaultWidgetLandingPageUrl);
    var enabledDomains = '';
    for (var i=0; i<this.context.enabledDomains.length; i++) {
      enabledDomains += this.context.enabledDomains[i];
      if (i < this.context.enabledDomains.length-1) {
        enabledDomains += '\n';
      }
    }
    this.setFormField(form, 'EnabledDomainsReadOnly', enabledDomains);
    if (this.context.enabledDomains.length > 0) {
      var domainOptions = [];
      for (var i=0; i<this.context.enabledDomains.length; i++) {
        domainOption = document.createElement('OPTION');
        domainOption.value = this.context.enabledDomains[i];
        domainOption.text = this.context.enabledDomains[i];
        form.ExceptionDomain.options.add(domainOption);
      }
      this.setFormField(form, 'ExceptionLandingUrl', this.lookUpUrl(this.context.enabledDomains[0]));
    }
    if (this.context.enabledDomains.length > 1) {
      this.help.displayElement('EditAccountLandingPageUrlMultiMode', 'block');
    } else {
      this.help.displayElement('EditAccountLandingPageUrlMultiMode', 'none');
    }
    if (this.context.customerLandingPageUrls.domainWidgetLandingPageUrls.length > 0) {
      form['LandingPageUrlMode'][1].checked = 'checked';
      this.help.displayElement(this.context.podLandingPageUrlExceptionFormId, 'block');
      this.help.displayElement(this.context.podLandingPageLabelAltId, 'block');
    } else {
      form['LandingPageUrlMode'][0].checked = 'checked';
      this.help.displayElement(this.context.podLandingPageUrlExceptionFormId, 'none');
      this.help.displayElement(this.context.podLandingPageLabelId, 'block');
    }
  }
}
widget.prototype.updateDomainExceptionUrl = function(url, index) {
  var domain = document.getElementById(this.context.podExceptionDomainId).value;
  var urls = this.context.customerLandingPageUrls.domainWidgetLandingPageUrls;
  var foundIt = false;
  for (var i=0; i<urls.length; i++) {
    if (urls[i].key == domain) {
      urls[i].data = url.value;
      foundIt = true;
      return;
    }
  }
  if (!foundIt) {
    urls.push({ key: domain, data: url.value });
  }
}
widget.prototype.showCurrentUrl = function(url, index) {
  url.value = this.lookUpUrl(this.context.enabledDomains[index]);
}
widget.prototype.lookUpUrl = function(domain) {
  var domainUrlLookup = this.context.customerLandingPageUrls.domainWidgetLandingPageUrls;
  url = '';
  for (var i=0; i<domainUrlLookup.length; i++) {
    if (domainUrlLookup[i].key == domain) {
      url = domainUrlLookup[i].data;
    }
  }
  return url;
}
widget.prototype.loadLandingPageInfo = function() {
  var requests = [];
  var request = new dmpod.GetCustomerLandingPageUrlsRequest();
  requests.push(request);
  request = new dmpod.GetEnabledDomainsForCustomerRequest();
  requests.push(request);
  this.sendRequests(requests, function(responses) {
    this._loadLandingPageInfoResponse(responses);
  });
}
widget.prototype.updateAdNetworkDetails = function() {
  var requests = [];
  var details = this.context.adNetworkDetails;
  if (typeof(details) !== 'undefined') {
    var request = {}
    request = new dmpod.UpdateCustomerRequest();
    request.domain = this.customer.domain;
    request.enabledState = this.customer.enabledState;
    requests.push(request);
    request = new dmpod.UpdateAdNetworksRequest(['RightMedia'],details);
    requests.push(request);
    request = new dmpod.UpdateCustomerAdDetailsRequest(this.customer.inlineTextAdsAllowed);
    requests.push(request);
    request = new dmpod.UpdateCustomerDeploymentDetailsRequest();
    request.widgetLandingPageUrl = this.customer.widgetLandingPageUrl;
    request.platform = this.customer.platform;
    requests.push(request);
    urls = this.context.customerLandingPageUrls.domainWidgetLandingPageUrls;
    for (var i=0; i<urls.length; i++) {
      if (urls[i].data == '') {
        request = new dmpod.ClearCustomerLandingPageUrlRequest();
      } else {
        request = new dmpod.UpdateCustomerLandingPageUrlRequest();
        request.widgetLandingPageUrl = urls[i].data;
      }
      request.forDomain = urls[i].key;
      requests.push(request);
    }
    this.sendRequests(requests, function(responses) {
      var responses = responses.Responses;
      var errorMessages = [
        'Error updating customer details',
        'Error updating ad network details',
        'Error updating in-text advertising',
        'Error updating deployment details'
      ]
      for (var i=0; i<=3; i++) {
        if (responses[i].isError) {
          this.help.swapElements(this.context.podPublisherAccountUpdateWaitingId, this.context.podPublisherAccountUpdateButtonId);
          alert(errorMessages[i] + ': \n' + responses[i].message);
          return;
        }
      }
      this.postUpdateAdNetworkDetails();
    });
  }
}
widget.prototype.postUpdateAdNetworkDetails = function() {
  if (this.optionSpecified('successPageUrl')) {
    document.location = this.context.options.successPageUrl;
  } else {
    this.context.thisIsAPublisher = true;
    this.processTemplates();
    this.render();
    this.loadAccountInfo();
    this.loadLandingPageInfo();
    alert('Your information has been saved.');
  }
}
widget.prototype.setAdNetworkDetails = function(form) {
  var details = this.context.adNetworkDetails;
  if (details == null) {
    details = new dmpod.AdNetworkDetails();
  }
  var channelIdRawValues = [form.Category0.value, form.Category1.value, form.Category2.value];
  details.channelIds = [];
  for (var i=0; i<channelIdRawValues.length; i++) {
    if (channelIdRawValues[i] != '0') {
      details.channelIds.push(parseFloat(channelIdRawValues[i]));
    }
  }
  details.contentSources = null;
  details.businessName = this.customer.domain;
  details.mpaaRating = this.getMPAARating(form);
  this.context.adNetworkDetails = details;
}
widget.prototype.setFormField = function(form, field, value) {
  if (form.elements[field]) {
    if (typeof(value) !== 'undefined' && value != null) {
      form.elements[field].value = value;
    } else {
      form.elements[field].value = '';
    }
  }
}    
widget.prototype.getMPAARating = function(form) {
  var ratingGroup = form.elements['Rating'];
  for (i=0; i<ratingGroup.length; i++) {
    if (form.Rating[i].checked) {
      return form.Rating[i].value;
      break;
    }
  }
  return 'G';
}    
widget.prototype.syncFormElements = function(elem1, elem2, specialValue) {
  if (elem1.value == specialValue) {
    elem2.value = '';
    elem2.style.display = 'block';
  } else {
    elem2.style.display = 'none';
    elem2.value = elem1.value;
  }
}    
widget.prototype.addToDomainList = function(domain) {
  domain = this.help.eatBlanks(domain);
  var domainSelect = document.getElementById(this.context.podExceptionDomainId);
  for (var i=0; i<domainSelect.options.length; i++) {
    if (domain == domainSelect.options[i].value) {
      return;
    }
  }
  var option = document.createElement('OPTION');
  option.value = domain;
  option.text = domain;
  domainSelect.appendChild(option);
}
widget.prototype.removeFromDomainList = function(domain) {
  domain = this.help.eatBlanks(domain);
  var domainSelect = document.getElementById(this.context.podExceptionDomainId);
  for (var i=0; i<domainSelect.options.length; i++) {
    if (domain == domainSelect.options[i].value) {
      domainSelect.removeChild(domainSelect.options[i]);
    }
  }
}

})();

(function(){
  var widget = function() {};
  window['PluckItPublisherReportWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// Publisher Report Widget\r\n{/eval}\r\n\r\n<div class="podPublisherReportWidget podGlobal podFLC"\>\r\n  <div class="podSectionTitle"\>Monthly Reports</div\>\r\n  <form action="javascript:WIDGETINSTANCE.getReport(document.forms.${podPublisherReportFormName});" name="${podPublisherReportFormName}" class="podForm podFLC"\>\r\n    <div class="podFormField"\>\r\n      <label\>Month</label\>\r\n      <select id="${podReportMonthId}"\>\r\n        ${monthOptions}\r\n      </select\>\r\n    </div\>\r\n    \r\n    <div class="podFormField"\>\r\n      <label\>Year</label\>\r\n      <select id="${podReportYearId}"\>\r\n        ${yearOptions}\r\n      </select\>\r\n    </div\>\r\n    \r\n    <div class="podFormField"\>\r\n      <label\>Site</label\>\r\n      <select id="podApiKey"\>\r\n      {for record in customerSearchRecords} \r\n        <option value="${record.apiKey}"\>${record.customerDomain}</option\>\r\n      {/for}\r\n      </select\>\r\n    </div\>\r\n    \r\n    <div class="podFormButtons"\>\r\n      <a class="podButton1" id="${podReportGetReportButtonId}" href="javascript:;" onclick="javascript:document.forms.${podPublisherReportFormName}.submit()"\><span class="podButton1_Right"\>Get Report</span\></a\>\r\n      <span class="podButton1Selected" id="${podReportGetReportWaitingId}" style="display:none;"\><span class="podButton1_Right"\><span class="podButton1_Waiting"\>Loading ...</span\></span\></span\>\r\n    </div\>\r\n  </form\>\r\n  \r\n  <div id="${podReportDataTableId}" class="podDataTable"\>\r\n  </div\>\r\n  \r\n  <div class="podRawDataButtons podFLC"\>\r\n    <a class="podButton1" href="javascript:WIDGETINSTANCE.viewRawData();" id="${podViewRawDataId}" \r\n      style="display: none"\><span class="podButton1_Right"\>View Raw Data</span\></a\>\r\n    <a class="podButton1" href="javascript:WIDGETINSTANCE.hideRawData();"id="${podHideRawDataId}" \r\n      style="display: none"\><span class="podButton1_Right"\>Hide Raw Data</span\></a\>\r\n  </div\>\r\n  \r\n  <div class="podRawData"  id="${podReportRawDataId}"style="display:none" \>\r\n    <textarea id="${podReportRawDataTextareaId}"\></textarea\>\r\n  </div\>\r\n</div\>\r\n\r\n'; 
  widget.prototype.preloadImageUrls = []; 
widget.prototype.postInit = function() {
  this.context.podReportMonthId = this.help.createUniqueId('podReportMonthId');
  this.context.podReportYearId = this.help.createUniqueId('podReportYearId');
  this.context.podReportGetReportButtonId = this.help.createUniqueId('podReportGetReportButtonId');
  this.context.podReportGetReportWaitingId = this.help.createUniqueId('podReportGetReportWaitingId');
  this.context.podReportDataTableId = this.help.createUniqueId('podReportDataTableId');
  this.context.podReportRawDataId = this.help.createUniqueId('podReportRawDataId');
  this.context.podReportRawDataTextareaId = this.help.createUniqueId('podReportRawDataTextareaId');
  this.context.podViewRawDataId = this.help.createUniqueId('podViewRawDataId');
  this.context.podHideRawDataId = this.help.createUniqueId('podHideRawDataId');
  this.context.podPublisherReportFormName = this.help.createUniqueId('podPublisherReportFormName');
  var monthNames = ['January','February','March','April','May','June','July','August','September','October','November','December'];
  var now = new Date();
  var selectedMonth = now.getMonth();
  var firstYear = 2008
  var latestYear = now.getFullYear();
  var selectedYear = latestYear;
  selectedMonth--;
  if (selectedMonth < 0) {
    selectedMonth = 11;
    selectedYear--;
  }
  this.context.monthOptions = '';
  for (var i=0; i<=11; i++) {
    this.context.monthOptions += '<option value="'+ (i+1) +'" ';
    if (selectedMonth == i) {
      this.context.monthOptions += 'selected="selected"';
    }
    this.context.monthOptions += '>'+monthNames[i]+'</option>';
  }
  this.context.yearOptions = '';
  for (var i=latestYear; i>=firstYear; i--) {
    this.context.yearOptions += '<option value="'+i+'" ';
    if (selectedYear == i) {
      this.context.yearOptions += 'selected="selected"';
    }
    this.context.yearOptions += '>'+i+'</option>';
  }
}
widget.prototype.addRequests = function() {
  var request = new dmpod.GetAssociatedCustomersRequest();
  this.addRequest(request);
}
widget.prototype.buildContextFromResponses = function(responses) {
  if (responses[0].isError) {
    this.autoRender = false;
    alert(responses[0].message);
    this.setErrorText(responses[0].message);
  }
  else {
    this.context.customerSearchRecords = responses[0].customerSearchRecords;
  }
}
widget.prototype.getReport = function() {
  this.help.swapElements(this.context.podReportGetReportButtonId, this.context.podReportGetReportWaitingId);
  this.month = document.getElementById(this.context.podReportMonthId).value;
  this.year = document.getElementById(this.context.podReportYearId).value;
  this.apiKey = document.getElementById('podApiKey').value;
  this.displayRevenue = true;
  for (var i=0; i<this.context.customerSearchRecords.length; i++) {
    if (this.context.customerSearchRecords[i].apiKey == this.apiKey) {
      if (this.context.customerSearchRecords[i].customerType != 'RevenueShare') {
        this.displayRevenue = false;
      }
      break;
    }
  }
  if (this.year == 2008 && this.month < 8) {
    alert('Sorry, no data is available prior to August, 2008.');
    this.help.swapElements(this.context.podReportGetReportWaitingId, this.context.podReportGetReportButtonId);
    return;
  }
  request = new dmpod.GetPublisherMonthlyReportRequest(this.month, this.year, this.apiKey);
  this.sendRequests(request, function(response) {
    this.help.swapElements(this.context.podReportGetReportWaitingId, this.context.podReportGetReportButtonId);
    response = response.Responses[0];
    if (response.isError) {
      alert('fail: ' + response.message);
    } else {
      this.renderReport(response.report);
    }
  });
}
widget.prototype.renderReport = function(report) {
  this.report = report;
  var csv = '"Date","Full Page Content Views"';
  if (this.displayRevenue) {
    csv += ',"Total Revenue"';
  }
  csv += '\n';
  var table = '<table width="100%">';
  var totalPageViews = 0;
  table += '<thead><th class="text" scope="col">&nbsp;Date</th><th class="text" scope="col" align="left">&nbsp;Full Page Content Views</th>';
  if (this.displayRevenue) {
    var totalTotalAdRevenue = 0;
    table += '<th class="text" scope="col" align="left">&nbsp;Total Revenue</th>';
  }
  table += '</tr></thead>';
  table += '<tbody>';
  for (var i=0; i<this.report.dailyReports.length; i++) {
    table += '<tr><th class="text" scope="row">'+this.month + "/" + this.report.dailyReports[i].day+'</th>';
    csv += this.month + "/" + this.report.dailyReports[i].day+',';
    table += '<td class="text">&nbsp;'+this.report.dailyReports[i].pageViews+'</td>';
    csv += this.report.dailyReports[i].pageViews;
    totalPageViews += this.report.dailyReports[i].pageViews;
    if (this.displayRevenue) {
      table += '<td class="text">&nbsp;$'+this.report.dailyReports[i].totalAdRevenue.toFixed(3)+'</td>';
      csv += ',' + this.report.dailyReports[i].totalAdRevenue.toFixed(3);
      totalTotalAdRevenue += this.report.dailyReports[i].totalAdRevenue;
    }
    table += '</tr>';
    csv += '\n';
  }
  table += '<tr><th class="text" scope="row">TOTAL</th>';
  csv += 'TOTAL,';
  table += '<td class="text">&nbsp;'+totalPageViews+'</td>';
  csv += totalPageViews;
  if (this.displayRevenue) {
    table += '<td class="text">&nbsp;$'+totalTotalAdRevenue.toFixed(2)+'</td></tr>';
    csv += ',' + totalTotalAdRevenue.toFixed(2);
  }
  csv += '\n';
  table += '</tbody></table>';
  document.getElementById(this.context.podReportDataTableId).innerHTML = table;
  document.getElementById(this.context.podReportRawDataTextareaId).value = csv;
  this.help.displayElement(this.context.podViewRawDataId, 'block');
}
widget.prototype.generateViewsXml = function(report) {
  var prexml = "<graph caption='Full Page Content Views' subcaption='For the month of " + this.month + "/" + this.year + "' divlinecolor='F47E00' numdivlines='4' showAreaBorder='1' areaBorderColor='000000' numberPrefix='' showNames='1' numVDivLines='29' vDivLineAlpha='30' formatNumberScale='1' rotateNames='1' decimalPrecision='0'>";
  var max = 0;  
  var xml = "<categories>";
  for (var i=0; i<report.dailyReports.length; i++) {
    xml += "<category name='"+ this.month + "/" + report.dailyReports[i].day+"'/>";
  }
  xml += "</categories>";
  xml += "<dataset seriesname='Full Page Content Views' color='AA33AA' showValues='0' areaAlpha='50' showAreaBorder='1' areaBorderThickness='2' areaBorderColor='006600'>";
  for (var i=0; i<report.dailyReports.length; i++) {
    xml += "<set value='"+(report.dailyReports[i].pageViews)+"'/>";
    max += report.dailyReports[i].pageViews;
  }
  if (max > 0) {
    xml = prexml + xml + "</dataset></graph>";
  } else {
    xml = prexml + "</graph>";
  }
  return xml;
}
widget.prototype.generateRevenueXml = function(report) {
  var prexml = "<graph caption='Revenue' subcaption='For the month of " + this.month + "/" + this.year + "' divlinecolor='F47E00' numdivlines='4' showAreaBorder='1' areaBorderColor='000000' numberPrefix='$' showNames='1' numVDivLines='29' vDivLineAlpha='30' formatNumberScale='1' rotateNames='1' decimalPrecision='2'>";
  var max = 0;
  var xml = "<categories>";
  for (var i=0; i<report.dailyReports.length; i++) {
    xml += "<category name='"+ this.month + "/" + report.dailyReports[i].day+"'/>";
  }
  xml += "</categories>";
  xml += "<dataset seriesname='Total Ad Revenue' color='AA33AA' showValues='0' areaAlpha='50' showAreaBorder='1' areaBorderThickness='2' areaBorderColor='006600'>";
  for (var i=0; i<report.dailyReports.length; i++) {
    xml += "<set value='"+report.dailyReports[i].totalAdRevenue+"'/>";
    max += report.dailyReports[i].totalAdRevenue;
  }
  if (max > 0) {
    xml = prexml + xml + "</dataset></graph>";
  } else {
    xml = prexml + "</graph>";
  }
  return xml;
}
widget.prototype.viewRawData = function() {
  this.help.displayElement(this.context.podReportRawDataId, 'block'); 
  this.help.swapElements(this.context.podViewRawDataId, this.context.podHideRawDataId);
}
widget.prototype.hideRawData = function() {
  this.help.displayElement(this.context.podReportRawDataId, 'none'); 
  this.help.swapElements(this.context.podHideRawDataId, this.context.podViewRawDataId);
}

})();

(function(){
  var widget = function() {};
  window['PluckItRelatedAdLinksWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// Related Ad Links Widget\r\n{/eval}\r\n\r\n{if contentMatched || options.showSearchBox == \'true\'}\r\n<div class="podRelatedAdLinksWidget podGlobal"\>\r\n  {if searchTerm}\r\n  <div class="podPage podFLC"\>\r\n    <div class="podMainContainer"\>\r\n      <div class="podMain"\>\r\n        <div class="podPageTitle"\>${options.relatedAdPageLabel} ${searchTerm}</div\>\r\n        <div class="podSectionTitle"\>${options.relatedAdPageSublabel}</div\>\r\n        {for ad in ads}\r\n          <div class="podRelatedAd"\>\r\n            <a class="podRelatedAdTitle" href="${ad.clickUrl}" \r\n            {if options.relatedAdLinkNewWindow == \'true\'} target="_blank" {/if}\r\n            \>${ad.title}</a\>\r\n            <a class="podRelatedAdTextLink" href="${ad.clickUrl}" \r\n            {if options.relatedAdLinkNewWindow == \'true\'} target="_blank" {/if}\r\n            \><div class="podRelatedAdText"\>${ad.description}</div\></a\>\r\n            <a class="podRelatedAdUrl" href="${ad.clickUrl}" \r\n            {if options.relatedAdLinkNewWindow == \'true\'} target="_blank" {/if}\r\n            \>${ad.displayUrl}</a\>\r\n          </div\>\r\n        {/for}\r\n      </div\>\r\n    </div\>\r\n    <div class="podRight"\>\r\n    {/if}\r\n    \r\n    {if options.showRelatedSearches == \'true\'}\r\n      <div class="podSectionTitle"\>\r\n        {if searchTerm}\r\n        ${options.pageRelatedAdLinksLabel}\r\n        {else}\r\n        ${options.relatedAdLinksLabel}\r\n        {/if}\r\n      </div\>\r\n      <div class="podRelatedAdWords"\>\r\n      {for link in links}\r\n        <a class="podRelatedAdWord" href="javascript:WIDGETINSTANCE.searchTermClicked(\'${link.searchTerm}\');"\>${link.searchTerm}</a\>\r\n      {/for}\r\n      </div\>\r\n    {/if}\r\n    {if options.showSearchBox == \'true\'}\r\n      <div class="podSearchWidget podGlobal"\>\r\n        <div class="podContent podFLC"\>\r\n          <div class="podContentAll"\>\r\n            <div class="podContentBlock"\>\r\n              <form action="javascript:WIDGETINSTANCE.searchTermSearched(document.forms[\'${podRelatedSearchFormName}\'].searchTerm.value);" \r\n                name="${podRelatedSearchFormName}" class="podSearchForm"\>\r\n                <input type="text" name="searchTerm" class="podCommentArea" value="" /\><!-- ${searchTerm} --\>\r\n              </form\>\r\n            </div\>\r\n          </div\>\r\n          <a href="javascript:;" onclick="javascript:WIDGETINSTANCE.searchTermSearched(document.forms[\'${podRelatedSearchFormName}\'].searchTerm.value);" \r\n            class="podButton1"\><span class="podButton1_Right"\>Search</span\></a\>\r\n        </div\>\r\n      </div\>\r\n    {/if}\r\n\r\n    {if searchTerm}\r\n    </div\>\r\n  </div\>\r\n  {/if}\r\n</div\>\r\n{/if}\r\n'; 
  widget.prototype.preloadImageUrls = []; 
  widget.prototype.addChildWidgets = function() {
    if (this.optionSpecified('showRelatedAdLinksWidget') == 'false') {
      this.dontShowThisWidget = true;
      this.autoRender = false;
      return;
    }
  }
  widget.prototype.postInit = function() {
    if (this.dontShowThisWidget) {
      return;
    }
    this.context.podRelatedSearchFormName = 'podRelatedSearchFormName_' + this.divSuffix;
  }
  widget.prototype.addRequests = function() {
    if (this.dontShowThisWidget) {
      return;
    }
    var request = new dmpod.GetCustomerRequest();
    this.addRequest(request);
    if (this.optionSpecified('showRelatedSearches') == 'false' && !this.help.getPrefixedQueryParam('searchTerm')) {
      this.context.contentMatched = false;
      this.context.searchTerm = null;
      return;
    }
    var url = document.location.toString();
    url = url.replace(/PLUCK[_A-Za-z0-9]+=[^&]*&{0,1}/g,'').replace(/&$/,'').replace(/\?$/,'');
    request = new dmpod.GetRelatedAdLinksRequest(url);
    request.sessionId = this.sessionId = this.help.getPrefixedQueryParam('sessionId') || '';
    request.searchTerm = this.context.searchTerm = this.help.getPrefixedQueryParam('searchTerm') || '';
    request.searchToken = this.searchToken = this.help.getPrefixedQueryParam('searchToken') || '';
    request.searchLinkType = this.searchLinkType = this.help.getPrefixedQueryParam('searchLinkType') || '';
    request.searchLinkRank = this.searchLinkRank = this.help.getPrefixedQueryParam('searchLinkRank') || '';
    request.lastPageType = this.lastPageType = this.help.getPrefixedQueryParam('lastPageType') || '';
    request.numberOfSearchLinks = this.context.options.numberOfSearchLinks;
    request.numberOfResultLinks = this.context.options.numberOfResultLinks;
    request.tagsProvider = this.context.options.tagsProvider;
    request.matchMethod = this.context.options.matchMethod;
    request.articlesTaken = this.context.options.articlesTaken;
    request.articlesThreshold = this.context.options.articlesThreshold;
    this.addRequest(request);
  };
  widget.prototype.buildContextFromResponses = function(responses) {
    this.context.ads = [];
    this.context.links = [];
    if (responses[0].isError) {
      this.setErrorText(responses[0].message);
      return;
    } else {
      this.customer = responses[0].customer;
      if (this.optionSpecified('linkResultsPageUrl')) {
        this.linkResultsPageUrl = this.help.ensureHostUrl(this.context.options.linkResultsPageUrl, true);
      } else if (this.customer.widgetLandingPageUrl) {
        this.linkResultsPageUrl = this.customer.widgetLandingPageUrl;
      } else if (this.parent && this.parent.classname == 'PluckItSmartWidget') {
        this.linkResultsPageUrl = document.location.toString();
      }
    }
    if (responses.length > 1) {
      if (responses[1].isError) {
        this.setErrorText(responses[1].message);
        return;
      } else {
        this.context.savedLinks = [].concat(responses[1].searchLinks);
        this.context.links = responses[1].searchLinks;
        if (this.context.links.length > 0) {
          this.context.contentMatched = true;
        } else {
          this.context.contentMatched = false;
        }
        this.context.ads = responses[1].resultLinks;
        this.sessionId = responses[1].sessionId;
        this.lastPageType = responses[1].lastPageType;
        this.splitRenderResults({'data':'links','results':responses[1].searchLinks});
      }
    }
  };
  widget.prototype.searchTermClicked = function(searchTerm) {
    if (this.linkResultsPageUrl) {
      for (var i=0; i<this.context.savedLinks.length; i++) {
        var link = this.context.savedLinks[i];
        if (link.searchTerm == searchTerm) {
          var url = this.help.addPrefixedQueryParam(this.linkResultsPageUrl, 'searchTerm', escape(link.searchTerm));
          url = this.help.addPrefixedQueryParam(url, 'whichPage', 'relatedAdLinks');
          url = this.help.addPrefixedQueryParam(url, 'searchToken', escape(link.searchToken));
          url = this.help.addPrefixedQueryParam(url, 'searchLinkType', escape(link.searchLinkType));
          url = this.help.addPrefixedQueryParam(url, 'searchLinkRank', escape(link.searchLinkRank));
          url = this.help.addPrefixedQueryParam(url, 'sessionId', escape(this.sessionId));
          url = this.help.addPrefixedQueryParam(url, 'lastPageType', escape(this.lastPageType));
          document.location = url;
          return;
        }
      }
    } else {
      alert('No URL has been specified to show the results.');
    }
  };
  widget.prototype.searchTermSearched = function(searchTerm) {
    if (this.linkResultsPageUrl) {
      var url = this.help.addPrefixedQueryParam(this.linkResultsPageUrl, 'searchTerm', escape(searchTerm));
      url = this.help.addPrefixedQueryParam(url, 'whichPage', 'relatedAdLinks');
      if (this.sessionId) {
        url = this.help.addPrefixedQueryParam(url, 'sessionId', escape(this.sessionId));
      }
      if (this.lastPageType) {
        url = this.help.addPrefixedQueryParam(url, 'lastPageType', escape(this.lastPageType));
      }
      document.location = url;
    } else {
      alert('No URL has been specified to show the results.');
    }
  };
  widget.prototype.goToUrl = function(url) {
      document.location = url;
  }

})();

(function(){
  var widget = function() {};
  window['PluckItLatestCommentsWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// Latest Comment Widget\r\n{/eval}\r\n\r\n<div class="podLatestCommentWidget podCommentWidget podGlobal"\>\r\n  <div class="podSectionTitle podIconComments"\>Latest Comments</div\>\r\n  <div class="podCommentList"\>\r\n    {for comment in collectedComments}\r\n    <div class="podComment"\r\n      id="PluckLatestComments_${comment_index}_${divSuffix}" {if comment_index != 0}style="display: none;"{/if}\>\r\n      <div class="podAvatar"\>\r\n        <span class="podAvatarSmallBg"\>\r\n          <img src="${comment.author.avatarPhotoUrl}" class="podAvatarSmall" alt="${comment.author.name}" /\>\r\n        </span\>\r\n      </div\>\r\n      <div class="podRoundedContainer2"\>\r\n\r\n        <div class="podBgTL"\><div class="podBgTR"\></div\></div\>\r\n        <div class="podContent"\>\r\n          <span class="podHeadline"\>${comment.author.name}</span\>\r\n          <span class="podCallout"\>${comment.postedAtTime|showPrettyDate} at ${comment.postedAtTime|showPrettyTime}</span\>\r\n\r\n          <p\>${comment.shortBody}</p\>\t\r\n          <div class="podArticle"\>\r\n             <span class="podCallout"\>Article</span\> <a href="${comment.articleUrl}"\>${comment.articleTitle}</a\>\r\n          </div\>\r\n        </div\>\r\n        <div class="podBgBL"\><div class="podBgBR"\></div\></div\>\r\n      </div\>\r\n    </div\>\r\n    {/for}\r\n  </div\>\r\n</div\>\r\n'; 
  widget.prototype.preloadImageUrls = []; 
    widget.prototype.postInit = function() {
      this.autoRender = false;
      if ((this.parent != null) && (this.optionSpecified('showLatestComments') != 'true')) {
        this.dontShowThisWidget = true;
        return;
      }
      this.setEventEnabled("onCompleted", false);
    }
    widget.prototype.addRequests = function() {
      if (this.dontShowThisWidget) {
        return;
      }
      request = new dmpod.GetCustomerRequest();
      this.addRequest(request);
      var request = new dmpod.DiscoverArticlesRequest('RecentlyWasCommented', 15);
      this.addRequest(request);
    }
    widget.prototype.buildContextFromResponses = function(responses) {
      var errorMessage = this.help.getErrorMessageFromResponses(responses);
      if (errorMessage.length > 0) {
        this.autoRender = true;
        this.setErrorText(errorMessage);
      } else {
        this.context.articlePageUrl = this.help.setBaseUrl(this.optionSpecified('articlePageUrl'), responses[0].customer.widgetLandingPageUrl);
        this.context.articles = responses[1].articles;
        var articles = this.context.articles;
        var commentRequests = [];
        for (var i = 0, article; i < articles.length, article=articles[i]; i++) {
          var commentRequest = new dmpod.GetCommentPageRequest(new dmpod.ArticleKey(article.key.key)
              ,1
              ,0
              ,'TimeStampDescending');   
          commentRequests.push(commentRequest); 
        }
        this.context.commentPageLength = 0;
          this.sendRequests(commentRequests, function(response) {
                var collectedComments = [];
                var collectedCommentIndex = 0;
                for( var j = 0, commentResponse; j < response.Responses.length, commentResponse = response.Responses[j]; j++) {
                    for( var k = 0, comment; k < commentResponse.commentPage.comments.length, comment = commentResponse.commentPage.comments[k]; k++ ) {
                        comment.articleTitle = articles[j].title;
                        comment.articleId = articles[j].key.key;
                        comment.articleMediaType = articles[j].mediaType;
                        comment.articleUrl = this.context.options.articlePageUrl;
                        comment.articleUrl = this.help.addPrefixedQueryParam(comment.articleUrl, 'articleId', comment.articleId);
                        comment.articleUrl = this.help.addPrefixedQueryParam(comment.articleUrl, 'title', comment.articleTitle);
                        comment.articleUrl = this.help.addPrefixedQueryParam(comment.articleUrl, 'mediaType', comment.articleMediaType);
                        collectedComments.push(comment); 
                        collectedCommentIndex++;
                    }
                }
                this.context.collectedComments = collectedComments;
                this.context.commentIndex = 0;
                this.context.commentPageLength = collectedComments.length;
                this.context.rotationSpeed = 5000;
                this.context.divSuffix = this.divSuffix;
                  for (var i = 0, comments = collectedComments, comment; comment = comments[i]; i++) {
                    var maxLength = 100;
                    if (comment.body.length > maxLength) {
                      comment.shortBody = comment.body.substring(0,maxLength) + '<a href="articleLink">...</a>';
                    } else {
                      comment.shortBody = comment.body;
                    }
                  }
               this.processTemplates();
               this.setEventEnabled("onCompleted", true);
               this.render();
              this.setTimeout(function() { this.rotateComment(); }, this.context.rotationSpeed);
        });
      }
    }
    widget.prototype.rotateComment = function() {
      var opacitySteps = 20;
      var opacityIntervals = 3;
      var opacityPower = 0.5;
      if (this.context.commentPageLength != 0 ) {
          var oldElement = document.getElementById('PluckLatestComments_' + this.context.commentIndex + '_' + this.divSuffix);
          this.context.commentIndex++;
          if (this.context.commentIndex == this.context.commentPageLength) {
            this.context.commentIndex = 0;
          }
          var newElement = document.getElementById('PluckLatestComments_' + this.context.commentIndex + '_' + this.divSuffix);     
          this.help.changeOpacity(oldElement, 100, 0, opacitySteps, opacityIntervals, opacityPower);
          newElement.style.opacity = 0;
          newElement.style.filter = 'alpha(opacity=0);';
          newElement.style.display = 'block';
          this.help.changeOpacity(newElement, 0, 100, opacitySteps, opacityIntervals, opacityPower);
      }
      this.setTimeout(function() { this.rotateComment(); }, this.context.rotationSpeed); 
    }

})();

(function(){
  var widget = function() {};
  window['PluckItPublisherRelatedLinksWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// Publisher Related Links Widget\r\n{/eval}\r\n{if contentMatched}\r\n<div class="podPublisherRelatedLinks podWidget"\>\r\n  {if options.showTitle == \'true\'}\r\n  <div class="podSectionTitle"\>${options.stringPublisherRelatedLinksTitle}</div\>\r\n  {/if}\r\n  <div class="podMessage podGlobal" id="${messageBoxId}" style="display:none"\></div\>\r\n  <div class="podAlert podGlobal" id="${alertBoxId}" style="display:none"\></div\>\r\n  {if options.showThumbnail == \'true\'}\r\n    <div class="podBasicList"\>\r\n      {for relatedLink in relatedLinks}\r\n      <div class="podArticleSummary2" id="${relatedLinkId}_${relatedLink_index}"\>\r\n        <div class="podArticleInfo podFLC"\>\r\n          <a title="Article: ${relatedLink.title}" href="${relatedLink.url}" class="podThumbnail"\>\r\n            <div class="podFaviconWrapper"\>\r\n              <div class="podFaviconBackground"\>\r\n                <img id="${faviconId}${relatedLink_index}" src="${faviconSrc}" alt="${relatedLink.title}" class="podFavicon" /\>\r\n              </div\>\r\n            </div\>\r\n          </a\>\r\n          <div class="podInfoText"\>\r\n            <a class="podHeadline" title="Article: ${relatedLink.title}" href="${relatedLink.url}"\>${relatedLink.title}</a\>\r\n            {if options.linkSource == \'MyContent\'}\r\n              <span class="podSelfReference"\>${options.stringPublisherRelatedLinksSelfReference}</span\>\r\n            {/if}\r\n            {if user.canBlockLinks}\r\n            <span class="podInlineAdmin"\>\r\n              <span id="${blockLinkId}_${relatedLink_index}"\>\r\n              - <a href="javascript:WIDGETINSTANCE.blockLink(\'${relatedLink_index}\');"\>Block&nbsp;link</a\>\r\n              </span\>\r\n            </span\>\r\n            {/if}\r\n            <div id="${waitingId}_${relatedLink_index}" class="podInlineAdmin podWaiting podSelfReference" style="display:none"\>Blocking ...</div\>\r\n          </div\>\r\n        </div\>\r\n      </div\>\r\n      {/for}\r\n    </div\>\r\n  {else}\r\n  <ul\>\r\n    {for relatedLink in relatedLinks}\r\n    <li class="podFLC"\>\r\n      <div class="podPublisherRelatedLink" id="${relatedLinkId}_${relatedLink_index}"\>\r\n        <a class="podHeadline" href="${relatedLink.url}"\>${relatedLink.title}</a\>\r\n        {if options.linkSource == \'MyContent\'}\r\n          ${options.stringPublisherRelatedLinksSelfReference}\r\n        {/if}\r\n        {if user.canBlockLinks}\r\n        <span class="podInlineAdmin"\>\r\n          <span id="${blockLinkId}_${relatedLink_index}"\>\r\n          - <a href="javascript:WIDGETINSTANCE.blockLink(\'${relatedLink_index}\');"\>Block&nbsp;link</a\>\r\n          </span\>\r\n        </span\>\r\n        {/if}\r\n      </div\>\r\n      <div id="${waitingId}_${relatedLink_index}" class="podInlineAdmin podWaiting" style="display:none"\>Blocking ...</div\>\r\n    </li\>\r\n    {/for}\r\n  </ul\>\r\n  {/if}\r\n</div\>\r\n{else}\r\n<!-- No Content Found --\>\r\n{/if}\r\n\r\n\r\n\r\n\r\n\r\n'; 
  widget.prototype.preloadImageUrls = []; 
    widget.prototype.postInit = function() {
      if (this.optionSpecified('showPublisherRelatedLinks') == 'false' || this.optionSpecified('numberOfPublisherLinks') == 0) {
        this.dontShowThisWidget = true;
        this.autoRender = false;
        return;
      }
      this.autoRender = false;
      this.context.alertBoxId = 'podAlertBoxId_'+this.divSuffix;
      this.context.blockLinkId = 'podBlockLinkId_'+this.divSuffix;
      this.context.messageBoxId = 'podMessageBoxId_'+this.divSuffix;
      this.context.relatedLinkId = 'podRelatedLinkId_'+this.divSuffix;
      this.context.waitingId = 'podWaitingId_'+this.divSuffix;
      this.context.faviconId = 'podFaviconId_'+this.divSuffix+'_';
      this.context.faviconSrc = 'http://cdn-docs.pluckit.pluck.com/assets/v1/images/icons/world.gif?apiKey=00000000-0000-0000-0000-000000000000&vn=7034';
      this.context.message = '';
    }
    widget.prototype.addRequests = function() {
      if (this.dontShowThisWidget) {
        return;
      }
      request = new dmpod.GetUserRequest();
      this.addRequest(request);
      var linkSource = 'All';
      if (this.optionSpecified('linkSource')) {
        linkSource = this.optionSpecified('linkSource')
      }
      if (!this.optionSpecified('articleId') && !this.optionSpecified('tag') && !this.optionSpecified('text') && !this.optionSpecified('url')) {
        if (!(this.context.options.articleId = this.help.getPrefixedQueryParam('articleId'))) {
          if (!(this.context.options.tag = this.help.getPrefixedQueryParam('tag'))) {
            this.context.options.url = this.help.getPrefixedQueryParam('url');
          }
        }
      }
      var request;
      if (this.optionSpecified('articleId')) {
        request = new dmpod.GetPublisherLinksRelatedToArticleRequest(linkSource, this.context.options.articleId);
      } else if (optionTag = this.optionSpecified('tag')) {
        request = new dmpod.GetPublisherLinksRelatedToTagRequest(linkSource, optionTag);
      } else if (optionTextId = this.optionSpecified('textId')) {
        var names = optionTextId.split(/,/g);
        var data = [];
        for (var i = 0, elem; i < names.length; i++) {
          if (elem = document.getElementById(names[i])) {
            data.push(elem.innerHTML);
          }
        }
        request = new dmpod.GetPublisherLinksRelatedToTextRequest(linkSource, data.join('\n'));
      } else if (optionTextClass = this.optionSpecified('textClass')) {
        var names = optionTextClass.split(/,/g);
        var data = [];
        for (var i = 0; i < names.length; i++) {
          for (var j = 0, elems = this.help.getElementsByClassName(names[i]); j < elems.length; j++) {
            data.push(elems[j].innerHTML);
          }
        }
        request = new dmpod.GetPublisherLinksRelatedToTextRequest(linkSource, data.join('\n'));
      } else if (optionTextKeywords = this.optionSpecified('textKeywords')) {
        request = new dmpod.GetPublisherLinksRelatedToTextRequest(linkSource, optionTextKeywords);
      } else {
        this.context.options.url = this.help.ensureHostUrl(this.context.options.url, false);
        request = new dmpod.GetPublisherLinksRelatedToUrlRequest(linkSource, this.context.options.url);
      }
      request.maxResults = this.optionSpecified('numberOfPublisherLinks');
      if (this.optionSpecified('excludeFromDomains')) {
        request.excludeFromDomains = this.optionSpecified('excludeFromDomains').split(',');
      }
      this.deferredRequest = request;
      this.addRequest(request);
    };
    widget.prototype.buildContextFromResponses = function(responses) {
      var errorMessage = this.help.getErrorMessageFromResponses(responses);
      if (errorMessage.length > 0) {
        this.setErrorText(errorMessage);
      } else {
        this.context.user = responses[0].user;
        if (this.context.user.userSecurityRole == 'PluckAdmin') {
          this.context.user.canBlockLinks = true;
        } else if (this.context.user.userSecurityRole == 'CustomerAdmin') {
          this.context.user.canBlockLinks = true;
        } else {
          this.context.user.canBlockLinks = false;
        }
        var linksResponse = responses[1];
        if (linksResponse.relatedLinks.length > 0) {
          this.setRelatedLinks(linksResponse);
        } else {
          this.getRelatedLinks(5);
        }
      }
    };
    widget.prototype.postRender = function(responses) {
      this.isOnATopicPage = false;
      if (this.parent) {
        this.isOnATopicPage = (this.parent.classname == 'PluckItTopicPageWidget');
      }
      if (this.isOnATopicPage && this.context.relatedLinks.length > 0) {
        document.getElementById(this.parent.context.podTopicPageRelatedArticlesTitleId).style.display = 'block';
      }
      if (this.context.message.length > 0) {
        this.help.showMessage(this.context.messageBoxId, this.context.message);
      }
      if (this.optionSpecified('showThumbnail') == 'true') {
        var my = this;
        this.getFaviconSrc(function(src) {
          if (src) {
            for (var i=0; i<my.context.relatedLinks.length; i++) {
              document.getElementById(my.context.faviconId+i).src = src;
            }
          }
        });
      }
    }
    widget.prototype.getRelatedLinks = function(retry, callback) {
      retry--;
      if (retry < 1) {
        if (callback) {
          callback();
        }
        return;
      }
      this.sendRequests(this.deferredRequest, function(responses) {
        var errorMessage = this.help.getErrorMessageFromResponses(responses);
        var responses = responses.Responses[0];
        if (errorMessage.length > 0) {
          this.setErrorText(errorMessage);
        } else if (responses.relatedLinks.length == 0) {
          this.setTimeout(function(){
            this.getRelatedLinks(retry, callback);
          }, 2000);
        } else {
          this.setRelatedLinks(responses, callback);
        }
      });
    }
    widget.prototype.setRelatedLinks = function(response, callback) {
      this.context.relatedLinks = response.relatedLinks;
      this.context.contentMatched = response.contentMatched;
      this.processTemplates();
      this.setEventEnabled('onCompleted', true);
      this.render(callback);
    }
    widget.prototype.blockLink = function(linkIndex, callback) {
      var keyString = this.context.relatedLinks[linkIndex].key;
      var title = this.context.relatedLinks[linkIndex].title;
      var blockLinkId = this.context.blockLinkId + '_' + linkIndex;
      var relatedLinkId = this.context.relatedLinkId + '_' + linkIndex;
      var waitingId = this.context.waitingId + '_' + linkIndex;
      var blockConfirm = window.confirm('Are you sure you want to block this link?');
      if (blockConfirm) {
        this.help.swapElements(blockLinkId, waitingId);
        var request = new dmpod.BlockPublisherLinkRequest(keyString);
        this.sendRequests(request, function(response) {
          response = response.Responses[0];
          if (response.isError) {
            this.help.swapElements(waitingId, blockLinkId, true);
            this.help.showError(this.context.alertBoxId, response.message);
          } else {
            this.help.showError(this.context.messageBoxId, 'The link "' + title + '" will be removed within one hour.');
            document.getElementById(relatedLinkId).className += ' podDisabled';
            document.getElementById(waitingId).style.display = 'none';
            if (typeof(callback) !== 'undefined') {
              callback();
            }
          }
        });
      } 
    }
    widget.prototype.getFaviconSrc = function(callback) {
      function getFaviconPath() {
        var path;
        var links = document.getElementsByTagName('LINK');
        for (var i=0; i<links.length; i++) {
          if (links[i].rel.toLowerCase() == 'icon') {
            path = links[i].href;
            break;
          }
        }
        return path;
      }
      function openDocument(url, callback) {
        if (window.XMLHttpRequest) {
          req = new XMLHttpRequest();
        } else if (window.ActiveXObject) {
          req = new ActiveXObject("Microsoft.XMLHTTP");
        }
        if (req != undefined) {
          req.onreadystatechange = function() {
            callback(req);
          };
          req.open('GET', url, true);
          req.send('');
        }
      }
      var localPath = 'favicon.ico';
      openDocument(localPath, function(req) {
        if (req.readyState == 4) { // only if req is "loaded"
          if (req.status == 200) { // only if "OK"
            callback(localPath);
          } else {
            var rootPath = '/favicon.ico';
            openDocument(rootPath, function(req) {
              if (req.readyState == 4) { // only if req is "loaded"
                if (req.status == 200) { // only if "OK"
                  callback(rootPath);
                } else {
                  var linkPath = getFaviconPath();
                  if (linkPath) {
                    openDocument(linkPath, function(req) {
                      if (req.readyState == 4) { // only if req is "loaded"
                        if (req.status == 200) { // only if "OK"
                          callback(linkPath);
                        }
                      }
                    });
                  }
                }
              }
            });
          }
        }
      });
    }

})();

(function(){
  var widget = function() {};
  window['PluckItSearchWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// Search Widget\r\n{/eval}\r\n\r\n<div class="podSearchWidget podGlobal"\>\r\n  <div class="podRoundedContainer"\>\r\n    <div class="podBgTL"\><div class="podBgTR"\></div\></div\>\r\n    <div class="podContent podFLC"\>\r\n      <div class="podContentAll"\>\r\n        <div class="podContentBlock"\>\r\n          <form action="javascript:WIDGETINSTANCE.doSearch(document.forms[\'${podSearchFormName}\']);" name="${podSearchFormName}" class="podSearchForm"\>\r\n            <input type="text" name="searchTag" class="podCommentArea" value="${searchTag}" /\>\r\n          </form\>\r\n        </div\>\r\n      </div\>\r\n      <a href="javascript:;" onclick="javascript:WIDGETINSTANCE.doSearch(document.forms[\'${podSearchFormName}\']);" \r\n        class="podButton1"\><span class="podButton1_Right"\>Search</span\></a\>\r\n    </div\>\r\n    <div class="podBgBL"\><div class="podBgBR"\></div\></div\>\r\n  </div\>\r\n</div\>\r\n\r\n'; 
  widget.prototype.preloadImageUrls = []; 
    widget.prototype.addChildWidgets = function() { 
      if (this.optionSpecified('showSearch') != 'true') {
        this.dontShowThisWidget = true;
        this.autoRender = false;
        return;
      }
    }
    widget.prototype.postInit = function() {
      if (this.dontShowThisWidget) {
        return;
      }
      this.context.podSearchFormName = 'podSearchFormName_' + this.divSuffix;
      this.context.searchTag = this.help.getPrefixedQueryParam('tag')
    }
    widget.prototype.addRequests = function() {
      if (this.dontShowThisWidget) {
        return;
      }
    }
    widget.prototype.doSearch = function(form) {
      document.location = this.help.addPrefixedQueryParam(document.location.href, 'tag', escape(form.searchTag.value));
    }

})();

(function(){
  var widget = function() {};
  window['PluckItTopicPageWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// Topic Page Widget - One Column\r\n{/eval}\r\n\r\n<div class="podTopicPageWidget"\>\r\n  <div class="podPage podFLC"\>\r\n    <div class="podLayoutOneColumn"\>\r\n      <div class="podMainContainer"\>\r\n        <div class="podMain"\>\r\n          <div class="podPageTitle"\>${stringTopicPagePageTitle}</div\>\r\n          <div class="podArticleSummary3" id="${podFeaturedArticleId}" style="display: none"\>\r\n            <div class="podArticleInfo podFLC"\>\r\n              <a id="${podFeaturedArticleImgLinkId}" class="podThumbnail" href="" title=""\>\r\n                <img id="${podFeaturedArticleImgId}" class="podArticleThumbnail" src="" alt="" /\>\r\n              </a\>\r\n              <a id="${podFeaturedArticleTitleId}" class="podHeadline" href="" title=""\></a\>\r\n              <p\>\r\n                {if (konteraAds)}<span class="KonaBody"\>{/if}\r\n                <span id="${podFeaturedArticleSummaryId}"\></span\>\r\n                {if (konteraAds)}</span\>{/if} \r\n                <a id="${podFeaturedArticleReadMoreId}" class="podReadMore" href="" \>Read More &raquo;</a\>\r\n              </p\>\r\n            </div\>\r\n          </div\>\r\n          <div id="relatedTags"\>${relatedTags}</div\>\r\n          <div id="${podTopicPageRelatedArticlesTitleId}" class="podSectionTitle" style="display:none"\>${options.stringTopicPagePageTitleText}</div\>\r\n          <div id="publisherRelatedLinks"\>${publisherRelatedLinks}</div\>\r\n          <div id="relatedArticles"\>${relatedArticles}</div\>\r\n          <div id="searchWidget"\>${searchWidget}</div\>\r\n          ${pluckFooter}\r\n        </div\>\r\n      </div\>\r\n      <div class="podRight"\>\r\n        <div class="podAd300x250"\>${adSrc300x250}</div\>\r\n        <div id="videoThumbstrip"\>${videoThumbstrip}</div\>\r\n        <div class="podAd300x250"\>${adSrc300x250b}</div\>\r\n      </div\>\r\n    </div\>\r\n  </div\>\r\n</div\>\r\n'; 
  widget.prototype.preloadImageUrls = []; 
  widget.prototype.layouts = []; 
  widget.prototype.layouts['multiColumn'] = '{eval}\r\n// Topic Page Widget - Multi-Column\r\n{/eval}\r\n\r\n<div class="podTopicPageWidget"\>\r\n  <div class="podPage podFLC"\>\r\n    <div class="podMainContainer"\>\r\n      <div class="podMain"\>\r\n        {if options.relatedTags.tag != null}\r\n        <div class="podPageTitle"\>${options.relatedTags.tag}</div\>\r\n        <div class="podSectionTitle"\>${stringTopicPagePageTitle}</div\>\r\n        <hr /\>\r\n          {if options.relatedTags.showRelatedTags == \'true\'}\r\n        <div id="relatedTags"\>${relatedTags}</div\>\r\n          {/if}\r\n        {/if}\r\n        <div id="relatedArticles"\>${relatedArticles}</div\>\r\n        <div class="podAd300x250b"\>${adSrc300x250b}</div\>\r\n        ${pluckFooter}\r\n      </div\>\r\n    </div\>\r\n    <div class="podRight"\>\r\n      <div class="podAd300x250"\>${adSrc300x250}</div\>\r\n      <div id="latestComments"\>${latestComments}</div\>\r\n      {if userDiscovery != \'\'}\r\n      <hr /\>\r\n      {/if}\r\n      <div id="userDiscovery"\>${userDiscovery}</div\>\r\n    </div\>\r\n  </div\>\r\n</div\>\r\n'; 
  widget.prototype.layouts['oneColumn'] = '{eval}\r\n// Topic Page Widget - One Column\r\n{/eval}\r\n\r\n<div class="podTopicPageWidget"\>\r\n  <div class="podPage podFLC"\>\r\n    <div class="podLayoutOneColumn"\>\r\n      <div class="podMainContainer"\>\r\n        <div class="podMain"\>\r\n          <div class="podPageTitle"\>${stringTopicPagePageTitle}</div\>\r\n          <div class="podArticleSummary3" id="${podFeaturedArticleId}" style="display: none"\>\r\n            <div class="podArticleInfo podFLC"\>\r\n              <a id="${podFeaturedArticleImgLinkId}" class="podThumbnail" href="" title=""\>\r\n                <img id="${podFeaturedArticleImgId}" class="podArticleThumbnail" src="" alt="" /\>\r\n              </a\>\r\n              <a id="${podFeaturedArticleTitleId}" class="podHeadline" href="" title=""\></a\>\r\n              <p\>\r\n                {if (konteraAds)}<span class="KonaBody"\>{/if}\r\n                <span id="${podFeaturedArticleSummaryId}"\></span\>\r\n                {if (konteraAds)}</span\>{/if} \r\n                <a id="${podFeaturedArticleReadMoreId}" class="podReadMore" href="" \>Read More &raquo;</a\>\r\n              </p\>\r\n            </div\>\r\n          </div\>\r\n          <div id="relatedTags"\>${relatedTags}</div\>\r\n          <div id="${podTopicPageRelatedArticlesTitleId}" class="podSectionTitle" style="display:none"\>${options.stringTopicPagePageTitleText}</div\>\r\n          <div id="publisherRelatedLinks"\>${publisherRelatedLinks}</div\>\r\n          <div id="relatedArticles"\>${relatedArticles}</div\>\r\n          <div id="searchWidget"\>${searchWidget}</div\>\r\n          ${pluckFooter}\r\n        </div\>\r\n      </div\>\r\n      <div class="podRight"\>\r\n        <div class="podAd300x250"\>${adSrc300x250}</div\>\r\n        <div id="videoThumbstrip"\>${videoThumbstrip}</div\>\r\n        <div class="podAd300x250"\>${adSrc300x250b}</div\>\r\n      </div\>\r\n    </div\>\r\n  </div\>\r\n</div\>\r\n'; 
  widget.prototype.layouts['oneColumnNoAds'] = '{eval}\r\n// Topic Page Widget - One Column No Ads\r\n{/eval}\r\n\r\n<div class="podTopicPageWidget"\>\r\n  <div class="podPage podFLC"\>\r\n    <div class="podLayoutOneColumn"\>\r\n      <div class="podNoAds"\>\r\n        <div class="podMain"\>\r\n          <div class="podPageTitle"\>${stringTopicPagePageTitle}</div\>\r\n          <div class="podArticleSummary3" id="${podFeaturedArticleId}" style="display: none"\>\r\n            <div class="podArticleInfo podFLC"\>\r\n              <a id="${podFeaturedArticleImgLinkId}" class="podThumbnail" href="" title=""\>\r\n                <img id="${podFeaturedArticleImgId}" class="podArticleThumbnail" src="" alt="" /\>\r\n              </a\>\r\n              <a id="${podFeaturedArticleTitleId}" class="podHeadline" href="" title=""\></a\>\r\n              <p\>\r\n                {if (konteraAds)}<span class="KonaBody"\>{/if}\r\n                <span id="${podFeaturedArticleSummaryId}"\></span\>\r\n                {if (konteraAds)}</span\>{/if} \r\n                <a id="${podFeaturedArticleReadMoreId}" class="podReadMore" href="" \>Read More &raquo;</a\>\r\n              </p\>\r\n            </div\>\r\n          </div\>\r\n          <div id="relatedTags"\>${relatedTags}</div\>\r\n          <div class="podMainContainer"\>\r\n            <div id="${podTopicPageRelatedArticlesTitleId}" class="podSectionTitle" style="display:none"\>${options.stringTopicPagePageTitleText}</div\>\r\n            <div id="publisherRelatedLinks"\>${publisherRelatedLinks}</div\>\r\n            <div id="relatedArticles"\>${relatedArticles}</div\>\r\n            <div id="searchWidget"\>${searchWidget}</div\>\r\n            ${pluckFooter}\r\n          </div\>\r\n        </div\>\r\n        <div class="podRight"\>\r\n          <div id="videoThumbstrip"\>${videoThumbstrip}</div\>\r\n        </div\>\r\n      </div\>\r\n    </div\>\r\n  </div\>\r\n</div\>\r\n'; 
    widget.prototype.addChildWidgets = function() {
      this.tag = this.context.options.relatedTags.tag;
      if (!this.tag) {
        this.tag = this.help.getPrefixedQueryParam('tag');
        if (!this.tag) {
          this.dontShowThisWidget = true;
          return;
        }
      }
      if (this.optionSpecified('layout') != 'multiColumn') {
        this.context.options.relatedArticles.showRelatedContentAd = 'true';
      }
      this.context.options.relatedArticles.pluckFooter.showFooter = 'false';
      if (this.optionSpecified('layout') != 'multiColumn') {
        this.context.options.relatedArticles.contentType = 'text';
        this.context.options.relatedArticles.layout = 'thumbTitleSummary';
        this.context.options.relatedArticles.showTitle = 'false';
      }
      this.addChildWidget('PluckItRelatedContentWidget','relatedArticles');
      if (this.optionSpecified('layout') != 'multiColumn') {
        this.context.options.relatedTags.showBottomBorder = 'false';
      }
      this.addChildWidget('PluckItRelatedTagsWidget','relatedTags');
      if (this.optionSpecified('layout') == 'multiColumn') {
        this.addChildWidget('PluckItLatestCommentsWidget','latestComments');
        this.context.options.userDiscovery.pluckFooter.showFooter = 'false';
        this.addChildWidget('PluckItUserDiscoveryWidget','userDiscovery');
      } else {
        this.context.options.videoThumbstrip.contentType = 'video';
        this.context.options.videoThumbstrip.layout = 'videoThumbstrip';
        this.context.options.videoThumbstrip.maxResults = this.optionSpecified('numberOfRelatedVideos');
        this.context.options.videoThumbstrip.pluckFooter.showFooter = 'false';
        this.addChildWidget('PluckItRelatedContentWidget','videoThumbstrip');
        this.context.options.publisherRelatedLinks.showThumbnail = 'true';
        this.addChildWidget('PluckItPublisherRelatedLinksWidget','publisherRelatedLinks');
        this.addChildWidget('PluckItSearchWidget','searchWidget');
      }
      this.addChildWidget('PluckItFooterWidget','pluckFooter');
    }
    widget.prototype.postInit = function() {
      if (!this.tag) {
        this.setErrorText('This widget requires a tag in order to function. No tag was provided.');
        return;
      }
      this.child['relatedArticles'].context.konaMarker = 'KonaBody';
      this.context.podFeaturedArticleId = 'podFeaturedArticleId_' + this.divSuffix;
      this.context.podFeaturedArticleImgId = 'podFeaturedArticleImgId_' + this.divSuffix;
      this.context.podFeaturedArticleImgLinkId = 'podFeaturedArticleImgLinkId_' + this.divSuffix;
      this.context.podFeaturedArticleTitleId = 'podFeaturedArticleTitleId_' + this.divSuffix;
      this.context.podFeaturedArticleSummaryId = 'podFeaturedArticleSummaryId_' + this.divSuffix;
      this.context.podFeaturedArticleReadMoreId = 'podFeaturedArticleReadMoreId_' + this.divSuffix;
      this.context.podTopicPageRelatedArticlesTitleId = 'podTopicPageRelatedArticlesTitleId_' + this.divSuffix;
      this.context.stringTopicPagePageTitle = this.context.options.stringTopicPagePageTitle.replace(/%1/g, this.tag);
    }
    widget.prototype.addRequests = function() {
      if (this.dontShowThisWidget) {
        return;
      }
      this.addRequest(new dmpod.GetCustomerRequest());
      this.adProviders = ['AdSense'];
      if ((this.optionSpecified('maxResults') > 2) || this.optionSpecified('layout') == 'multiColumn') {
        this.adProviders.push('RightMedia');
      }
      for (var i=0; i<this.adProviders.length; i++) {
        var adDescription = new dmpod.AdDescription(300,250);
        adDescription.provider = this.adProviders[i];
        var request = new dmpod.GetAdsRequest(new Array(adDescription));
        var keyword = this.context.options.relatedTags.tag;
        if (keyword == '') {
          keyword = this.help.getPrefixedQueryParam('tag');
        }
        request.keywords = new Array(keyword);
        request.adContext = 'RelatedArticleForTag';
        this.addRequest(request);
      }
    }
    widget.prototype.buildContextFromResponses = function(responses) {
      this.context.featuredArticle = {
        title: '',
        thumbnailUrl: '',
        summary: ''
      }
      if (responses[0].isError) {
        this.setErrorText(responses[0].message);
      } else {
        this.child['relatedArticles'].context.konteraAds = responses[0].customer.inlineTextAdsAllowed && (responses[0].customer.customerType == 'RevenueShare');
        if (this.optionSpecified('layout') == 'oneColumn' && responses[0].customer.customerType == 'Subscription') {
          this.context.options.layout = 'oneColumnNoAds';
          this.template = this.layouts.oneColumnNoAds;
        }
      }
      if (responses[1].isError) {
        this.setErrorText(responses[1].message);
      } else {
        this.context.adSrc300x250b = responses[1].advertisements[0].source;
      }
      if (this.adProviders.length > 1) {
        if (responses[2].isError) {
          this.setErrorText(responses[2].message);
        } else {
          this.context.adSrc300x250 = responses[2].advertisements[0].source;
        }
      }
    }

})();

(function(){
  var widget = function() {};
  window['PluckItSmartWidget'] = widget;
  widget.prototype = new dmpod.widget(); 
  widget.prototype.template = '{eval}\r\n// Smart Widget\r\n{/eval}\r\n\r\n<div class="podSmartWidget"\>\r\n  {if enableMenu}\r\n  <div class="podAdminMenu podGlobal" id="${podAdminMenuId}"\>\r\n    <span class="podAdminMenuUsername"\>Hello, {if customer.publisherNetwork == \'eNom\'} Administrator{else} ${profileWidget}{/if}!</span\> \r\n    <a class="{if options.whichPage == \'adminHomePage\'}podSelected{/if}" href="${adminHomePageLink}"\>Home</a\> |\r\n    {if customer.customerType == \'RevenueShare\'}\r\n    <a class="{if options.whichPage == \'publisherReport\'}podSelected{/if}" href="${publisherReportLink}"\>View Reports</a\> |\r\n    {/if}\r\n    <a class="{if options.whichPage == \'contentWidget\'}podSelected{/if}" href="${contentWidgetLink}"\>Setup</a\> | \r\n    <a class="{if options.whichPage == \'publisherAccount\'}podSelected{/if}" href="${publisherAccountLink}"\>Account Settings</a\> | \r\n    <a class="{if options.whichPage == \'wizardFaq\'}podSelected{/if}" href="${wizardFaqLink}"\>Help</a\> | \r\n    <a href="/"\>Return to My Site</a\> | \r\n    <a href="javascript:WIDGETINSTANCE.logout();"\>Logout</a\>\r\n  </div\>\r\n  {/if}\r\n  {if options.whichPage == \'adminHomePage\'}\r\n  {if enableMenu}\r\n  <div class="podAdminHome podGlobal podFLC"\>\r\n    <div class="podRoundedContainer"\>\r\n      <div class="podBgTL"\><div class="podBgTR"\></div\></div\>\r\n      <div class="podContent"\>\r\n      <div class="podPageTitle"\>Admin Home</div\>\r\n        <div class="podContentBlock"\>\r\n          <div class="podBasicList "\>\r\n            {if customer.customerType == \'RevenueShare\'}\r\n            <div class="podItem"\>\r\n              <a href="${publisherReportLink}" class="podButton1"\><span class="podButton1_Right"\>View Reports</span\></a\>\r\n              <span class="podCallout"\>Track your progress every month.</span\>\r\n            </div\>\r\n            {/if}\r\n            <div class="podItem"\>\r\n              <a href="${contentWidgetLink}" class="podButton1"\><span class="podButton1_Right"\>Setup</span\></a\>\r\n              <span class="podCallout"\>Copy-and-paste new widgets into your site.</span\>\r\n            </div\>\r\n            <div class="podItem"\>\r\n              <a href="${publisherAccountLink}" class="podButton1"\><span class="podButton1_Right"\>Account Settings</span\></a\>\r\n              <span class="podCallout"\>{if customer.publisherNetwork == \'eNom\'}Review and change your account settings.{else}Change your password and other account settings.{/if}</span\>\r\n            </div\>\r\n            <div class="podItem"\>\r\n              <a href="${wizardFaqLink}" class="podButton1"\><span class="podButton1_Right"\>Help</span\></a\>\r\n              <span class="podCallout"\>Learn how to customize and troubleshoot your widgets.</span\>\r\n            </div\>\r\n            <div class="podItem"\>\r\n              <a href="/" class="podButton1"\><span class="podButton1_Right"\>Return to My Site</span\></a\>\r\n              <span class="podCallout"\>Browse and remove content currently on my site.</span\>\r\n            </div\>\r\n            <div class="podItem"\>\r\n              <a href="javascript:WIDGETINSTANCE.logout();" class="podButton1"\><span class="podButton1_Right"\>Logout</span\></a\>\r\n              <span class="podCallout"\>Good-bye!</span\>\r\n            </div\>\r\n          </div\>\r\n        </div\>\r\n      </div\>\r\n      <div class="podBgBL"\><div class="podBgBR"\></div\></div\>\r\n    </div\>\r\n  </div\>\r\n  {else}\r\n  <div class="podGlobal podFLC"\>\r\n    <div class="podAlert"\>You are not an authorized administrator for this site.</div\>\r\n    <p\><div id="smartLoginSignup"\>${smartLoginSignup}</div\></p\>\r\n  </div\>\r\n  {/if}\r\n  <div id="footerWidget"\>${footerWidget}</div\>\r\n  {elseif options.whichPage == \'contentWidget\'}\r\n  <div id="contentWidget"\>${contentWidget}</div\>\r\n  <div id="footerWidget"\>${footerWidget}</div\>\r\n  {elseif options.whichPage == \'loginSignup\'}\r\n  <div id="smartLoginSignup"\>${smartLoginSignup}</div\>\r\n  {elseif options.whichPage == \'relatedAdLinks\'}\r\n  <div id="relatedAdLinks"\>${relatedAdLinks}</div\>\r\n  {elseif options.whichPage == \'publisherAccount\'}\r\n  <div id="publisherAccount"\>${publisherAccount}</div\>\r\n  <div id="footerWidget"\>${footerWidget}</div\>\r\n  {elseif options.whichPage == \'publisherReport\'}\r\n  <div id="publisherReport"\>${publisherReport}</div\>\r\n  <div id="footerWidget"\>${footerWidget}</div\>\r\n  {elseif options.whichPage == \'topicPage\'}\r\n  <div id="topicPage"\>${topicPage}</div\>\r\n  {elseif options.whichPage == \'wizardFaq\'}\r\n  <div id="wizardFaq"\>${wizardFaq}</div\>\r\n  {else}\r\n  <div id="articlePage"\>${articlePage}</div\>\r\n  {/if}\r\n</div\>\r\n'; 
  widget.prototype.preloadImageUrls = ["icons/article.gif","icons/comments.gif","icons/video.gif","pluck_white_distro.gif","button2.gif","button2_right.gif","icons/comments_add.gif","spinner_medium.gif","icons/recommend_down.gif","icons/recommend_down_on.gif","icons/recommend_up.gif","icons/recommend_up_on.gif","avatar_small_bg.gif","comment_arrow.gif","icons/abuse.gif","spinner.gif","button1.gif","button1_right.gif","rounded_container_bl.gif","rounded_container_br.gif","rounded_container_tl.gif","rounded_container_tr.gif","avatar_medium_bg.gif","button1_selected.gif","button1_selected_right.gif","icons/close.png","pluck_lightgrey.gif","spinner_large.gif","container_header_tl.gif","container_header_tr.gif","rounded_container2_bl.gif","rounded_container2_br.gif","rounded_container2_tl.gif","rounded_container2_tr.gif","icons/world.gif","default_article_thumbnail.gif"]; 
  widget.prototype.addChildWidgets = function() {
    if (!this.optionSpecified('whichPage')) {
      this.context.options.whichPage = this.help.getPrefixedQueryParam('whichPage');
    }
    if (!this.optionSpecified('tag')) {
      this.context.options.tag = this.help.getPrefixedQueryParam('tag');
    }
    if (this.context.options.whichPage == 'adminHomePage') {
    } else if (this.context.options.whichPage == 'contentWidget') {
      this.addChildWidget('PluckItContentWidget', 'contentWidget');
    } else if (this.context.options.whichPage == 'loginSignup') {
    } else if (this.context.options.whichPage == 'publisherAccount') {
      this.addChildWidget('PluckItPublisherAccountWidget', 'publisherAccount');
    } else if (this.context.options.whichPage == 'publisherReport') {
      this.addChildWidget('PluckItPublisherReportWidget', 'publisherReport');
    } else if (this.context.options.whichPage == 'relatedAdLinks') {
      this.addChildWidget('PluckItRelatedAdLinksWidget', 'relatedAdLinks');
    } else if (this.context.options.whichPage == 'topicPage') {
      this.addChildWidget('PluckItTopicPageWidget', 'topicPage');
      this.child['topicPage'].child['relatedTags'].context.options.tag = this.context.options.tag;
    } else if (this.context.options.whichPage == 'wizardFaq') {
      this.addChildWidget('PluckItContentWidget', 'wizardFaq');
    } else {
      this.addChildWidget('PluckItArticlePageWidget', 'articlePage');
    }
    this.addChildWidget('PluckItLoginWidget', 'smartLoginSignup');
    this.child['smartLoginSignup'].setLoginCallback(function() { 
      document.location = this.help.addPrefixedQueryParam(document.location.href, 'whichPage', 'adminHomePage');
    });
    this.addChildWidget('PluckItFooterWidget', 'footerWidget');
    this.addChildWidget('PluckItProfileWidget', 'profileWidget');
  }
  widget.prototype.getPreloadHtml = function() {
    var html = '';
    if (this.child.articlePage && this.child.articlePage.child.featuredArticle) {
      html = this.child.articlePage.child.featuredArticle.getPreloadHtml();
    }
    return html;
  }
  widget.prototype.addRequests = function() {
    var request = new dmpod.GetUserRequest();
    this.addRequest(request);
    request = new dmpod.GetCustomerRequest();
    this.addRequest(request);
  }
  widget.prototype.buildContextFromResponses = function(responses) {
    var errorMessage = this.help.getErrorMessageFromResponses(responses);
    if (errorMessage.length > 0) {
      this.setErrorText(errorMessage);
    } else {
      this.context.enableMenu = (responses[0].user.userSecurityRole == 'CustomerAdmin') || (responses[0].user.userSecurityRole == 'PluckAdmin');
      if (this.context.enableMenu) {
        this.context.user = responses[0].user;
        this.context.podAdminMenuId = 'podAdminMenu_' + this.divSuffix;
        this.context.adminHomePageLink = this.help.addPrefixedQueryParam(document.location.href, 'whichPage', 'adminHomePage');
        this.context.contentWidgetLink = this.help.addPrefixedQueryParam(document.location.href, 'whichPage', 'contentWidget');
        this.context.wizardFaqLink = this.help.addPrefixedQueryParam(document.location.href, 'whichPage', 'wizardFaq');
        this.context.publisherAccountLink = this.help.addPrefixedQueryParam(document.location.href, 'whichPage', 'publisherAccount');
        this.context.publisherReportLink = this.help.addPrefixedQueryParam(document.location.href, 'whichPage', 'publisherReport');
      }
      this.context.customer = responses[1].customer;
    }
  };
  widget.prototype.logout = function() {  
    var my = this;
    this.child['smartLoginSignup'].logout(function() {
      document.location = my.help.addPrefixedQueryParam(document.location.href, 'whichPage', 'loginSignup');
    });
  }

})();

dmpod.widget.runWidget('PluckItSmartWidget');

document.writeln('<scr'+'ipt type="text/javascript" src="http://pluckit.demandmedia.com/InlineTextAds?apikey='+PLUCKIT_APIKEY+'"><'+'/'+'scr'+'ipt>');
