com.dowjones.utils.MarketingZone=function(){
  mktg_zone= new Array(); 
  var partners = new Array('yahoo', 'google', 'msn', 'other');
  this.mktgZone ="";

  this.init = function () {
    // full denial BOL
    mktg_zone["full_denial_bol"]="bol_fullfree";
    mktg_zone["full_denial_other_bol"]="bol_fullfree";
    mktg_zone["full_denial_yahoo_bol"]="yahoo_bolfullfree";
    mktg_zone["full_denial_google_bol"]="google_bolfullfree";
    mktg_zone["full_denial_msn_bol"]="msn_bolfullfree";
    
    // full denial others
    mktg_zone["full_denial_other"]="wsjexp_fullfree";
    mktg_zone["full_denial_yahoo"]="yahoo_wsjexpfullfree";
    mktg_zone["full_denial_google"]="google_wsjexpfullfree";
    mktg_zone["full_denial_msn"]="msn_wsjexpfullfree";
    
    // full
    mktg_zone["full_yahoo"]="yahoo_fullfree";
    mktg_zone["full_google"]="google_fullfree";
    mktg_zone["full_msn"]="msn_fullfree";
    mktg_zone["full_other"]="wsjfreezone";
    
    //preview denial BOL
    mktg_zone["denial_bol"]="bol_prev";
    mktg_zone["denial_other_bol"]="bol_prev";
    mktg_zone["denial_yahoo_bol"]="yahoo_bolprev";
    mktg_zone["denial_google_bol"]="google_bolprev";
    mktg_zone["denial_msn_bol"]="msn_bolprev";
    
    // preview denial others
    mktg_zone["denial_other"]="wsjexp_prev";
    mktg_zone["denial_yahoo"]="yahoo_wsjexpprev";
    mktg_zone["denial_google"]="google_wsjexpprev";
    mktg_zone["denial_msn"]="msn_wsjexpprev";
    
    // preview
    mktg_zone["yahoo"]="yahoo";
    mktg_zone["google"]="google";
    mktg_zone["msn"]="msn";
    mktg_zone["other"]="b2pfreezone";
  }
  
  this.getPartner = function(modparam) {
    var localMod="";
    // see if the mod is one of the partners (google, yahoo, msn) 
    if(modparam != null && modparam.length > 0) {  
      for (var i=0; i<(partners).length; i++) {
        if (modparam.indexOf(partners[i]) > -1 ) {
          localMod = partners[i];
          break;
        }
      }
    }
    //alert('partner=' + localMod);
    return ( (localMod==null || localMod.length<1) ? "other":localMod );
  }
  
  this.setZone = function(mod) {
    this.mktgZone=mktg_zone[mod];
    //alert('zone = ' + this.mktgZone);
  }

  this.getZone = function() {
  	this.setMktgZone();
    //alert('returning zone = ' + this.mktgZone);
    return this.mktgZone;
  }
  
  this.setMktgZone = function() {
    this.init();
    var localDenial = (typeof isDenial)=='undefined'?false:isDenial;
    var localFree = (typeof isFree)=='undefined'?false:isFree;
    var localTrial = (typeof isTrial)=='undefined'?false:isTrial;
  
    var modParam = GetArg("mod"); 
    // check if the mod is one of the partners (google, yahoo, msn) 
    var whichMod = this.getPartner(modParam); 
    
    var mod="";
    if (localDenial) {
      mod += "denial_";
      mod += whichMod; // denial_yahoo, denial_other
      // use laserAPI to check for Barron's product 
      var localLaserBOL=(typeof laserJ4J=='object')?laserJ4J.isLoggedIn('Barrons'):false;
      var user=(typeof laserJ4J=='object')?laserJ4J.getUser():null;
      var localLaserWSJ=(typeof laserJ4J=='object')?laserJ4J.isLoggedIn('WSJ'):false;
    
      if ( localLaserBOL ) {
        mod+="_bol";  //denial_yahoo_bol, denial_other_bol    
      }  
    } 
    else if ( user != null && ! localLaserBOL && ! localLaserWSJ) {
      mod+="denial_";
      mod+=whichMod;
    }
    else if (document.cookie.indexOf("reactivation=/myaccount/do/reactivate") != -1 ) {
      mod+="denial_";
      mod+=whichMod;
    } else {
      mod+=whichMod; //yahoo, other
    }
    
    if ( localFree || localTrial ) {
      mod="full_"+mod; //full_denial_yahoo, full_denial_yahoo_bol, full_yahoo
    }
    this.setZone(mod);
  }
}

