function FDCPClient(){
this.cpServletPath="http://ivillage.cleanprint.net/cp/psj";
this.divid="2348";
this.refid="2361";
this.rt="i";
this.cpstatus=false;
this.ptstatus="y";
this.printSpecId=0;
this.fdDebug=false;
this.cpc=null;
this.blkwidth=0;
this.xpathLib="";
this.shost="";
this.hosted="customer";
this.templateTest=false;
this.insType="c";
this.escCom=function(st){
st=new st.constructor(st);
st=st.replace(/:/g,"::");
st=st.replace(/,/g,":,");
return st;
};
this.getSegment=function(){
var u=window.location.href;
var _3=new RegExp("http://(.*).ivillage.com");
var _4="ivillage";
var r=u.match(_3);
if(r!=null&&r.length>1&&r[1]!="www"){
_4=r[1];
}
var ss=document.getElementsByTagName("script");
var _7="other";
var _8="other";
var _9="other";
try{
var _a=new RegExp("(?:[&?;])(?:chan|f)=([^;]*)");
var _b=new RegExp("(?:sect|cont)=([^;]*)");
var _c=new RegExp("sub=([^;]*)");
for(var i=0;i<ss.length;i++){
if(ss[i].src.match(_a)!=null&&ss[i].src.indexOf("chan=ivillage")<0){
console.log(ss[i].src);
_7=ss[i].src.match(_a);
_8=ss[i].src.match(_b);
_9=ss[i].src.match(_c);
_7=_7==null?"other":_7[1];
_8=_8==null?"other":_8[1];
_9=_9==null?"other":_9[1];
break;
}
}
if(_7=="other"){
var _e=window.location.href;
var _a=new RegExp("http://([^.]*)[.][^.]*[.][^/]*");
var _f=_e.match(_a);
if(_f!=null){
_7=_f[1];
}
}
}
catch(e){
}
return _4+","+_7+","+_8+","+_9;
};
this.getPFF=function(){
var u=window.location.href;
if(u.indexOf(".print.")>0||u.indexOf("-p,">0)){
return "1";
}
return "0";
};
this.getVR=function(){
return {};
};
this.onPrint=function(){
};
this.getBlockThreshold=function(){
return 500;
};
this.getCfg=function(_11,_12){
if(this.cpc!=null&&typeof this.cpc[_11]!="undefined"){
return this.cpc[_11];
}
return _12;
};
this.getTHost=function(){
if(this.shost.length>0&&document.location.protocol=="https:"){
return this.shost;
}else{
return "ivillage.cleanprint.net";
}
};
this.getcpStat=function(){
return this.getCfg("cpStatus",this.cpstatus);
};
this.getptStat=function(){
return this.getCfg("ptStatus",this.ptstatus);
};
this.getDiv=function(){
return this.getCfg("divisionId",this.divid);
};
this.getTmpl=function(){
return this.getCfg("templateId",null);
};
this.getRfmt=function(){
return this.getCfg("templateId",this.refid);
};
this.getTPath=function(){
return this.getCfg("tPath",null);
};
this.getLPath=function(){
return this.getCfg("lPath",null);
};
this.getTO=function(){
return this.getCfg("timeout",10000);
};
this.getTemplateTest=function(){
return this.getCfg("templateTest",this.templateTest);
};
this.getXpathLib=function(){
return this.getCfg("xpathLib",this.xpathLib);
};
this.getFDDebug=function(){
return this.getCfg("fdDebug",this.fdDebug);
};
this.getRType=function(){
return this.rt;
};
}
function FormatDynamicsPT(_13){
this.clnt=_13;
this.pcol=document.location.protocol+"//";
this.cstr=_13.getTHost()+"/pt/t/";
this.dtstr=(new Date()).getTime();
this.div="&d="+this.clnt.getDiv();
this.ua="&a="+escape(navigator.appName+" "+navigator.userAgent);
this.seg="&s="+escape(this.clnt.getSegment());
this.ustr="&u="+escape(window.location.href);
this.pf="&p="+this.clnt.getPFF();
this.version="&q=1.1";
this.rtype="&rt="+this.clnt.getRType();
this.qstr=this.div+this.ua+this.seg+this.ustr+this.pf+this.version;
this.turl=this.pcol+this.cstr+this.dtstr+"?"+this.qstr;
this.pthosts="formatdynamics.com,cleanprint.net";
this.isPtCss=function(_14){
var _15=this.pthosts.split(",");
for(var i=0;i<_15.length;i++){
if(_14.indexOf(_15[i])!=-1){
return true;
}
}
return false;
};
this.changePrintStyleSheet=function(){
for(i=0;i<document.styleSheets.length;i++){
try{
var _17=document.styleSheets[i];
var _18=navigator.userAgent.toLowerCase();
if((navigator.appName.indexOf("Netscape")!=-1||_18.indexOf("firefox")!=-1||_18.indexOf("safari")!=-1)&&this.isPtCss(_17.cssRules[0].style.content)){
_17.cssRules[0].style.content="url("+this.turl+");";
return;
}else{
if(this.isPtCss(_17.cssRules[0].style.getPropertyValue("content"))){
if(navigator.appName.indexOf("Opera")!=-1){
_17.deleteRule(0);
}else{
if(navigator.appName.indexOf("Konqueror")==-1){
_17.cssRules[0].style.setProperty("content","url("+this.turl+")",null);
}
}
return;
}
}
}
catch(err){
}
}
try{
var _18=navigator.userAgent.toLowerCase();
if((navigator.appName.indexOf("Netscape")!=-1||_18.indexOf("firefox")!=-1||_18.indexOf("safari")!=-1)){
var s=document.createElement("style");
s.type="text/css";
s.rel="stylesheet";
s.media="print";
s.appendChild(document.createTextNode("body:before {content: url("+this.turl+")};"));
document.getElementsByTagName("head")[0].appendChild(s);
}
}
catch(err){
}
};
this.getFDImage=function(){
if(this.clnt.getRType()=="s"){
var hs=document.documentElement.getElementsByTagName("head");
var h=null;
if(hs&&hs.length>0){
h=hs[0];
var _1c=document.createElement("script");
_1c.type="text/javascript";
_1c.src=this.turl+"&rnd="+Math.random();
}
}else{
var _1d=new Image();
_1d.src=this.turl;
}
};
}
var formatDynamicsPT;
function loadHandler(){
formatDynamicsPT=new FormatDynamicsPT(new FDCPClient());
if(navigator.appName.indexOf("Microsoft")!=-1&&parseInt(navigator.appVersion)>=4&&navigator.userAgent.indexOf("Windows")!=-1){
window.attachEvent("onbeforeprint",function(){
formatDynamicsPT.getFDImage();
});
}else{
formatDynamicsPT.changePrintStyleSheet();
}
}
if(typeof window.addEventListener!="undefined"){
window.addEventListener("load",loadHandler,false);
}else{
if(typeof window.attachEvent!="undefined"){
window.attachEvent("onload",loadHandler);
}else{
if(window.onload!=null){
var oldOnload=window.onload;
window.onload=function(e){
oldOnload(e);
window[loadHandler]();
};
}else{
window.onload=loadHandler;
}
}
}

