﻿var pgHost = (typeof (pgHost) == "undefined") || (pgHost.indexOf("xywidgets.com") > -1) ? (location.hostname == "localhost" ? "" : "http://www.uplication.com/") : pgHost;
var upStatsHost = location.hostname == "localhost" ? "http://localhost/up_stats/" : (pgHost.indexOf("si-sv3109.com") > -1 ? "http://upstats.si-sv3109.com/" : "http://ustats.uplication.com/");
var pgShowBtn = typeof (pgShowBtn) == "undefined" ? true : pgShowBtn;
var pgWidth = typeof (pgWidth) == "undefined" ? 400 : pgWidth;
var pgHeight = typeof (pgHeight) == "undefined" ? 300 : pgHeight;
var pgBorderWidth = typeof (pgBorderWidth) == "undefined" ? 0 : pgBorderWidth;
var pgWidgetType = typeof (pgWidgetType) == "undefined" ? "printGreen" : pgWidgetType;
var pgWebsiteId = typeof (pgWebsiteId) == "undefined" ? -1 : pgWebsiteId;
var pgRefId = typeof (pgRefId) == "undefined" ? 0 : pgRefId;
var pgColor = typeof (pgColor) == "undefined" ? "#047300" : pgColor;
var pgDeltaY = typeof (pgDeltaY) == "undefined" ? 0 : pgDeltaY;
var pgDefer = typeof (pgDefer) == "undefined" ? 0 : pgDefer;
var pgWidgetParams = typeof (pgWidgetParams) == "undefined" ? "" : pgWidgetParams;
var pgCountViewStats = typeof (pgCountViewStats) == "undefined" ? 1 : pgCountViewStats;
var pgCoverImg = typeof (pgCoverImg) == "undefined" ? null : pgCoverImg;
var pgCoverImgUrl = typeof (pgCoverImgUrl) == "undefined" ? "" : pgCoverImgUrl;
var pgCultureCode = typeof (pgCultureCode) == "undefined" ? "en-US" : pgCultureCode;
var pgNonIEButton = typeof (pgNonIEButton) == "undefined" || pgWebsiteId.toString() == "28805849" ? 0 : pgNonIEButton;
var pgX = typeof (pgX) == "undefined" ? (document.all ? "482px" : "500px") : pgX;
var pgCoverMapAreas = typeof (pgCoverMapAreas) == "undefined" ? [] : pgCoverMapAreas;
var pgCoverMapImg = typeof (pgCoverMapImg) == "undefined" ? null : pgCoverMapImg;
var pgIframeSrc = typeof (pgIframeSrc) == "undefined" ? (pgWebsiteId.toString() == '11787744' ? pgHost + "JavaScripts/Campaigns/ganet.htm" : null) : pgIframeSrc;
var pgShowDefaultBg = typeof (pgShowDefaultBg) == "undefined" ? true : pgShowDefaultBg;
var pgNonIEButtonImageSrc = typeof (pgNonIEButtonImageSrc) == "undefined" ? pgHost + "widgets/printgreen/" + (pgWebsiteId.toString() == '11787744' ? "printGreenBtn.jpg" : "printgreenbutton.png") : pgNonIEButtonImageSrc;
var pgDomain = typeof (pgDomain) == "undefined" ? (pgWebsiteId.toString() == '11787744' ? "delawareonline.com" : null) : pgDomain;

function pgGetCompleteUrl(url) { return url ? (url.indexOf("http://") == 0 || url.indexOf("https://") == 0 ? url : (location.hostname == "localhost" ? url : pgHost + url)) : pgHost; }
function pgCloseWindowLabel() { return pgCultureCode == "he-IL" ? "סגור חלון" : (pgCultureCode == "es-US" ? "cerrar" : (pgCultureCode == "ru-RU" ? "Закрыть окно" : "Close Window")); }
function pgCloseWindowLabelWidth() { return pgCultureCode == "he-IL" ? 50 : (pgCultureCode == "es-US" ? 40 : (pgCultureCode == "ru-RU" ? 80 : 80)); }
function pgGetColor() { if (pgWebsiteId.toString() == "269016") return "#909090"; if (pgWebsiteId.toString() == "18353425") return "#ffffff"; return pgColor; }
function pgGetDeltaY() { if (pgWebsiteId.toString() == "847662") return 100; return pgDeltaY; }
function pgGetCoverImg() {
  return "<a href='" + pgCoverImgUrl + "' target='_blank' onclick='parent.pgInsertAdImpression(this.href);'><img src='" + pgCoverImg + "' style='border:none;' /></a>";
}
function pgGetCoverMapLinks() {
  var us = pgCoverMapAreas;
  if (!us) return "";
  var s = "";
  for (var i = 0; i < us.length; i++) {
    s += "<area onclick=\"parent.pgInsertAdImpression(this.href);\" shape=\"" + us[i].shape + "\" coords=\"" + us[i].coords + "\" target=\"" + us[i].target + "\" href=\"" + us[i].href + "\" alt=\"" + us[i].alt + "\" />";
  }
  return s;
}
function pgGetCoverMap() {
  return "<img src=\"" + pgHost + pgCoverMapImg.src + "\" alt=\"" + pgCoverMapImg.alt + "\" usemap=\"#pgCoverMap\" style=\"" + pgCoverMapImg.style + "\" />" +
    "<map name=\"pgCoverMap\">" + pgGetCoverMapLinks() + "</map>";
}
function pgGetIframeSrc() {
  if (pgIframeSrc) {
    return pgGetCompleteUrl(pgIframeSrc);
  }
  else {
    return pgHost + "PreLaunchWidget.aspx?ac=1&css=body&r=" + pgRefId + "&wb=" + pgWebsiteId + "&webid=" + pgWebsiteId + "&wt=" + pgWidgetType + "&wps=" + escape(pgWidgetParams) + "&cc=" + pgCultureCode + "&ci=" + (pgCountViewStats ? "1" : "0") + "&url=" + encodeURIComponent(location.href);
  }
}
function pgGetIframe() {
  return "<iframe src='" + pgGetIframeSrc() + "' scrolling='no' frameborder='0' width='100%' height='100%' " + (document.all ? "allowtransparency='true'" : "") + "></iframe>";
}
function pgGetBodyStyle() {
  var s = "style='border:solid " + pgBorderWidth + "px " + pgGetColor() + "; text-align: center; background-repeat:no-repeat; background-color:transparent;";
  if (pgShowDefaultBg) s += " background-image:url(" + pgHost + "images/printgreen/emptymessage" + pgWidth + "x" + pgHeight + ".gif); width:" + pgWidth + "px; height:" + pgHeight + "px;";
  s += "'";
  return s;
}
function pgAppendPrintGreen() {
  if (!document.body) return;
  if (document.all && pgDomain != null) {
    var src = 'javascript:document.write("<!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>' +
    '<html><head><style type=text/css>html,body{margin:0px; padding:0px; height: 100%; overflow: visible; font-family:Arial;}</style>' +
    '<style type=text/css media=print>html,body,iframe{display:none;visibility:hidden;}</style></head>' +
    '<body ' + pgGetBodyStyle() + '>' + (pgCoverMapImg != null ? pgGetCoverMap() : (pgCoverImg != null ? pgGetCoverImg() : pgGetIframe())) +
    '<a href=javascript: onclick=\'parent.closePrintGreen(); return false;\' style=\'position:absolute; top:5px; left:' + (pgWidth - pgCloseWindowLabelWidth()) + 'px; color:' + pgGetColor() + '; font-size:10px;\'>' + pgCloseWindowLabel() + '</a></body></html>");' +
    'try{document.domain="' + pgDomain + '";}catch(e){}' +
    'document.close();';
    ifrPrintGreen.src = src;
    document.body.appendChild(ifrPrintGreen);
  }
  else {
    document.body.appendChild(ifrPrintGreen);
    var d = ifrPrintGreen.contentWindow.document;
    d.open();
    d.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" +
    "<html>" +
    "<style type='text/css'>html, body {margin:0px; padding:0px; height: 100%; overflow: visible; font-family:Arial;}</style>" +
    "<style type=text/css media=print>html,body,iframe{display:none;visibility:hidden;}</style>" +
    "<body " + pgGetBodyStyle() + ">");
    if (pgCoverMapImg != null) d.write(pgGetCoverMap());
    else if (pgCoverImg != null) d.write(pgGetCoverImg());
    else d.write(pgGetIframe());
    d.write("<a href='javascript:' onclick='parent.closePrintGreen(); return false;' style='position:absolute; top:5px; left:" + (pgWidth - pgCloseWindowLabelWidth()) + "px; color:" + pgGetColor() + "; font-size:10px;'>" + pgCloseWindowLabel() + "</a></body></html>");
    d.close();
  }
}
function pgMediaPrintLink() {
  if (!document.body) return;
  var lnk = document.createElement("link");
  lnk.type = "text/css";
  lnk.rel = "stylesheet";
  lnk.href = pgHost + "styles/PrintGreenMediaPrint.css";
  lnk.media = "print";
  document.body.appendChild(lnk);
}
function enablePrintGreen() {
  if (typeof (ifrPrintGreen) != "undefined") closePrintGreen();
  else pgMediaPrintLink();
  ifrPrintGreen = document.createElement("iframe");
  ifrPrintGreen.id = "ifrPrintGreen";
  ifrPrintGreen.width = pgWidth;
  ifrPrintGreen.height = pgHeight;
  ifrPrintGreen.scrolling = "no";
  ifrPrintGreen.frameBorder = 0;
  ifrPrintGreen.style.zIndex = 100;
  ifrPrintGreen.style.position = "absolute";
  if (navigator.browserLanguage == "he") ifrPrintGreen.style.right = pgX;
  else ifrPrintGreen.style.left = pgX;
  ifrPrintGreen.style.top = (12 + pgGetDeltaY() + document.documentElement.scrollTop + document.body.scrollTop) + "px";
  if (document.all) ifrPrintGreen.allowTransparency = true;
  if (pgIframeSrc != null) {
    setTimeout(pgAppendPrintGreen, 1); // prevent printing problem
    if (pgCountViewStats) pgInsertEngagement();
  }
  else if (pgCoverMapImg != null || pgCoverImg != null) {
    setTimeout(pgAppendPrintGreen, 1); // prevent printing problem
    if (pgCountViewStats) pgInsertEngagement();
  }
  else pgAppendPrintGreen();
}
function closePrintGreen() {
  if (ifrPrintGreen) {
    document.body.removeChild(ifrPrintGreen);
    ifrPrintGreen = null;
  }
}
function pgGetNonIEButton() {
  return "<img src='" + pgGetCompleteUrl(pgNonIEButtonImageSrc) + "' alt='PrintGreen' style='border:none; cursor:pointer;' onclick='enablePrintGreen(); setTimeout(window.print, 3500);' />";
}
function pgActivateWidget() {
  if (document.all) { if (document.body) document.body.onbeforeprint = enablePrintGreen; }
  else if (pgNonIEButton) { document.write(pgGetNonIEButton()); }
}

function pgButtonImageHtml() {
  return "<img src='" + pgHost + "images/printgreen/PrintGreenButton2.png' style='border:0px;' />";
}
function pgCreateEngagement() {
  var s = document.createElement("script");
  s.src = upStatsHost + "default.aspx?m=engagement&at=5&wt=45&cid=-1&webid=" + pgWebsiteId;
  s.type = "text/javascript";
  return s;
}
function pgInsertEngagement() {
  if (!document.body) return;
  var s = pgCreateEngagement();
  document.body.appendChild(s);
}
function pgCreateView() {
  var s = "<script type='text/javascript' src='";
  s += upStatsHost + "default.aspx?m=view&wt=45&webid=" + pgWebsiteId;
  s += "'></script>";
  return s;
}
function pgInsertView() {
  var s = pgCreateView();
  document.write(s);
}
function pgCreateAdImpression(adurl) {
  var s = document.createElement("script");
  s.src = upStatsHost + "default.aspx?m=engagement&at=6&wt=45&cid=-1&webid=" + pgWebsiteId + "&url=" + encodeURIComponent(adurl);
  s.type = "text/javascript";
  return s;
}
function pgInsertAdImpression(adurl) {
  if (!document.body) return;
  var s = pgCreateAdImpression(adurl);
  document.body.appendChild(s);
}

pgActivateWidget();
if (pgShowBtn) document.write("<a href='" + pgHost + "'>" + pgButtonImageHtml() + "</a>");
if (pgCountViewStats) pgInsertView();
