function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

// offers.js


function Offers() {

   var i=0;

   offers = new Array();
   
//offers[i++] = new mapping("National",  "Cox Communications", "$25 Prepaid MasterCard Gift Card", "", "AFM0217");
//offers[i++] = new mapping("National",  "Cox Communications", "$100 Best Buy Offer", "", "COX2736_a");
//offers[i++] = new mapping("Las Vegas",  "Cox Communications", "$25 Value American Express Pre-Paid Card", "", "TCL0106_a");

//offers[i++] = new mapping("San Diego",  "Cox Communications", "Jan - Mar 09 $25 Fill It Up Card", "", "COX3022");

//offers[i++] = new mapping("San Diego",  "Cox Communications", "Jul - Dec 08 $25 Fill It Up Card", "", "COX2515_b");

//offers[i++] = new mapping("San Diego",  "Cox Communications", "Q2 2008 $25 Best Buy Gift Card", "", "COX2022-07_b");






//offers[i++] = new mapping("Orange County",  "Cox Communications", "Jan - Mar 09 $25 Fill It Up Card", "", "COX3021");
// 4/1/08 BB #COX2516-08 
//offers[i++] = new mapping("Orange County",  "Cox Communications", "Jul - Dec 08 $25 Fill It Up Card", "", "COX2516_b");

// 4/1/08 BB #COX2211-08 
//offers[i++] = new mapping("Orange County",  "Cox Communications", "Q2 2008 $25 Best Buy Gift Card", "", "COX2211_b");

//offers[i++] = new mapping("Las Vegas",  "Cox Communications", "Cox Las Vegas Gas Card", "", "TCL0226_c");

 

//offers[i++] = new mapping("National",  "Other", "$50 Best Buy Gift Card", "", "AFM0203");
offers[i++] = new mapping("$25 Cash Back",  "Other", "$25 Cash Back", "", "ORG4185");
//offers[i++] = new mapping("AllConnect",  "Other", "AllConnect Gift with Purchase", "", "MAR4013");
offers[i++] = new mapping("Allconnect",  "Other", "Jan '10 - Mar '10 $25 Target GiftCard", "", "AFM4035");
//offers[i++] = new mapping("Starz Big HD Gift With Purchase",  "Other", "$25 PrePaid MasterCard Gift Card", "", "BRD0529");
//offers[i++] = new mapping("Head Case DVD Offer",  "Other", "$50 prepaid MasterCard gift card", "", "AFM0224");
//offers[i++] = new mapping("Hollywood Residental DVD offer",  "Other", "$50 Prepaid MasterCard Gift Card", "", "AFM0225");
//offers[i++] = new mapping("White Fence",  "Other", "July '09 - Sept '09 $50 Gas Card", "", "AFM0235");
offers[i++] = new mapping("White Fence",  "Other", "Oct '09 - Dec '09 $50 Gas Gard", "", "AFM4022");
offers[i++] = new mapping("Allconnect",  "Other", "July '09 - Sept '09 $25 Target GiftCard", "", "AFM0233");
offers[i++] = new mapping("Allconnect",  "Other", "Oct '09 - Dec '09 $25 Target GiftCard", "", "AFM4020");
//offers[i++] = new mapping("Fan Up With Starz Sweepstakes",  "Other", "Fan Up With Starz Sweepstakes", "", "WEB4033");

offers[i++] = new mapping("Wehco Video Inc.",  "Other", "Sept. Upgrade Campaign - $10 Rebate", "", "AFM4021");
//offers[i++] = new mapping("White Fence",  "Other", "White Fence Gift with Purchase", "", "AFM4021");
offers[i++] = new mapping("White Fence",  "Other", "Jan '10 - Mar '10 $50 Gas Card", "", "AFM4036");


// 4/16/09 BB #DTV0938-08 
// offers[i++] = new mapping("National",  "DirecTV", "$25 Prepaid MasterCard Gift Card", "", "DTV1073");
//offers[i++] = new mapping("Any",  "DirecTV", "Aug- Oct $25 Best Buy Gift Card", "", "DTV0938_a");






//offers[i++] = new mapping("Marianas/Guam ",  "MCV Broadband", "Gas Card ", "", "NAT0760");











// CQ#5335
if (offers.sort) offers.sort(byProviderRegion);


   // Removed offers
   var i=0;

   removed_offers = new Array();

   removed_offers[i++] = new mapping("FL - Gainesville - Ocala", "Cox Communications",      "Target",                           "50801", "target_gift_cert_gains_50801");
   removed_offers[i++] = new mapping("FL - Gainesville - Ocala", "Cox Communications",      "Target",                           "50802", "target_gift_cert_gains_50802");
   removed_offers[i++] = new mapping("GA - Middle Georgia",      "Cox Communications",      "Target",                           "10",    "target_macon_005");
   removed_offers[i++] = new mapping("GA - Middle Georgia",      "Cox Communications",      "Target",                           "20",    "target_macon_001");
   removed_offers[i++] = new mapping("GA - Middle Georgia",      "Cox Communications",      "Target",                           "30",    "target_macon_003");
   removed_offers[i++] = new mapping("GA - Middle Georgia",      "Cox Communications",      "Target",                           "40",    "target_macon_003");
   removed_offers[i++] = new mapping("CA - Bakersfield",         "Cox Communications",      "Target",                           "",      "target_bakersfield");
   removed_offers[i++] = new mapping("CA - Santa Barbara",       "Cox Communications",      "Target",                           "",      "target_bakersfield");
   removed_offers[i++] = new mapping("FL - Gainesville - Ocala", "Cox Communications",      "Target",                           "80103", "target_gains_80103");
   removed_offers[i++] = new mapping("CA - Orange County",       "Cox Communications",      "Best Buy",                         "1001",  "target_orange_1001");
   removed_offers[i++] = new mapping("VA - Fairfax",             "Cox Communications",      "Target",                           "",      "target_nova");
   removed_offers[i++] = new mapping("RI - New England",         "Cox Communications",      "Target",                           "90023", "target_ne_90023");
   removed_offers[i++] = new mapping("CT - New England",         "Cox Communications",      "Target",                           "90023", "target_ne_90023");
   removed_offers[i++] = new mapping("GA - Middle Georgia",      "Cox Communications",      "Target",                           "70",    "target_macon_015");      // 10/02/03
   removed_offers[i++] = new mapping("AR - Arkansas",            "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("AZ - Phoenix",             "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("AZ - Tucson",              "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("CA - Bakersfield",         "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("CA - Humboldt",            "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("CA - Orange County",       "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("CA - Palos Verdes",        "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("CA - San Diego",           "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("CA - Santa Barbara",       "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("CT - New England",         "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("FL - Gainesville - Ocala", "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("FL - Gulf Coast",          "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");  // 9/23/03
   removed_offers[i++] = new mapping("GA - Middle Georgia",      "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("NC - North Carolina",      "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("NE - Omaha",               "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("NM - New Mexico",          "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("NV - Las Vegas",           "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("OH - Cleveland",           "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("OK - Oklahoma City",       "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("OK - Oklahoma",            "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("OK - Tulsa",               "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("RI - New England",         "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("TX - Greater Texas",       "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("TX - West Texas",          "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("VA - Fairfax",             "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("VA - Fredericksburg",      "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("VA - Hampton Roads",       "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("ID - Idaho",               "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");  // 9/23/03
   removed_offers[i++] = new mapping("KS - Kansas",              "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");  // 9/23/03
   removed_offers[i++] = new mapping("LA - Baton Rouge Area",    "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");  // 9/23/03
   removed_offers[i++] = new mapping("LA - Greater Louisiana",   "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");  // 9/23/03
   removed_offers[i++] = new mapping("LA - New Orleans",         "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");  // 9/23/03
   removed_offers[i++] = new mapping("MO - Missouri",            "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");  // 9/23/03
   removed_offers[i++] = new mapping("MS - Mississippi",         "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");  // 9/23/03
   removed_offers[i++] = new mapping("VA - Roanoke",             "Cox Communications",      "Target",                           "",      "target_roanoke_014");
   removed_offers[i++] = new mapping("VA - Roanoke",             "Cox Communications",      "Chili's, On the Border, MacGrill", "",      "new_restaurant_offer");
   removed_offers[i++] = new mapping("AZ - Phoenix",            "Cox Communications",       "Best Buy",                         "",      "best_buy_phoenix");  
   removed_offers[i++] = new mapping("AZ - Tucson",             "Cox Communications",       "Best Buy",                         "",      "best_buy_tucson");  
   removed_offers[i++] = new mapping("CA - Bakersfield",         "Cox Communications", "De-Stress Sweepstakes Official Rules", "", "cox_destress"); 
   removed_offers[i++] = new mapping("CA - Orange County",       "Cox Communications", "De-Stress Sweepstakes Official Rules", "", "cox_destress"); 
   removed_offers[i++] = new mapping("CA - San Diego",           "Cox Communications", "De-Stress Sweepstakes Official Rules", "", "cox_destress"); 
   removed_offers[i++] = new mapping("CA - Santa Barbara",       "Cox Communications", "De-Stress Sweepstakes Official Rules", "", "cox_destress"); 
   removed_offers[i++] = new mapping("CT - New England",         "Cox Communications", "De-Stress Sweepstakes Official Rules", "", "cox_destress"); 
   removed_offers[i++] = new mapping("FL - Gainesville - Ocala", "Cox Communications", "De-Stress Sweepstakes Official Rules", "", "cox_destress"); 
   removed_offers[i++] = new mapping("FL - Gulf Coast",          "Cox Communications", "De-Stress Sweepstakes Official Rules", "", "cox_destress"); 
   removed_offers[i++] = new mapping("GA - Middle Georgia",      "Cox Communications", "De-Stress Sweepstakes Official Rules", "", "cox_destress"); 
   removed_offers[i++] = new mapping("KS - Kansas",              "Cox Communications", "De-Stress Sweepstakes Official Rules", "", "cox_destress"); 
   removed_offers[i++] = new mapping("LA - Baton Rouge",         "Cox Communications", "De-Stress Sweepstakes Official Rules", "", "cox_destress"); 
   removed_offers[i++] = new mapping("LA - New Orleans",         "Cox Communications", "De-Stress Sweepstakes Official Rules", "", "cox_destress"); 
   removed_offers[i++] = new mapping("NC - North Carolina",      "Cox Communications", "De-Stress Sweepstakes Official Rules", "", "cox_destress"); 
   removed_offers[i++] = new mapping("NE - Omaha",               "Cox Communications", "De-Stress Sweepstakes Official Rules", "", "cox_destress"); 
   removed_offers[i++] = new mapping("OH - Cleveland",           "Cox Communications", "De-Stress Sweepstakes Official Rules", "", "cox_destress"); 
   removed_offers[i++] = new mapping("RI - New England",         "Cox Communications", "De-Stress Sweepstakes Official Rules", "", "cox_destress"); 
   removed_offers[i++] = new mapping("TX - West Texas",          "Cox Communications", "De-Stress Sweepstakes Official Rules", "", "cox_destress"); 
   removed_offers[i++] = new mapping("VA - Fairfax",             "Cox Communications", "De-Stress Sweepstakes Official Rules", "", "cox_destress"); 
   removed_offers[i++] = new mapping("VA - Fredericksburg",      "Cox Communications", "De-Stress Sweepstakes Official Rules", "", "cox_destress"); 
   removed_offers[i++] = new mapping("VA - Roanoke",             "Cox Communications", "De-Stress Sweepstakes Official Rules", "", "cox_destress");  
   removed_offers[i++] = new mapping("NC - North Carolina",      "Cox Communications",      "Target", 							"",      "target_nc");				// 1/16/04 -- manually added - jfukuda
   removed_offers[i++] = new mapping("Florida",                  "Adelphia",                "Adelphia Rebate",                  "",      "target_adelphia");
   removed_offers[i++] = new mapping("Georgia",                  "Adelphia",                "Adelphia Rebate",                  "",      "target_adelphia");
   removed_offers[i++] = new mapping("North Carolina",           "Adelphia",                "Adelphia Rebate",                  "",      "target_adelphia");
   removed_offers[i++] = new mapping("South Carolina",           "Adelphia",                "Adelphia Rebate",                  "",      "target_adelphia");
   removed_offers[i++] = new mapping("Mississippi",              "Adelphia",                "Adelphia Rebate",                  "",      "target_adelphia");
   removed_offers[i++] = new mapping("Alabama",                  "Adelphia",                "Adelphia Rebate",                  "",      "target_adelphia");
   removed_offers[i++] = new mapping("TX - San Antonio",         "Time Warner Cable",       "Target",                           "",      "Time_Warner_San_Antonio");  // 11/25/03
   removed_offers[i++] = new mapping("OH - Columbus",            "Time Warner Cable",       "Best Buy",                         "",      "Time_Warner_Columbus");  // 11/25/03 
removed_offers[i++] = new mapping("Atlanta, GA",             "Comcast Cable",            "Starz Rebate",                     "",      "starz_rebate"); 
removed_offers[i++] = new mapping("", "Pegasus", "", "", ""); 
//offers[i++] = new mapping("", "De-Stress Sweepstakes Official Rules", "", "", ""); 
removed_offers[i++] = new mapping("Naples/Ft. Meyers, FL", "Comcast Cable", "Starz Rebate", "", "starz_rebate_fl"); 
removed_offers[i++] = new mapping("Philadelphia, PA",      "Comcast Cable", "Starz Rebate", "", "starz_rebate_pa"); 

// 2/16/05 WG #7869
removed_offers[i++] = new mapping("Bakersfield",       "Cox Communications", "Sweepstakes Official Rules", "", "sor_b");
removed_offers[i++] = new mapping("Baton Rouge",       "Cox Communications", "Sweepstakes Official Rules", "", "sor_br");
removed_offers[i++] = new mapping("Gainesville",       "Cox Communications", "Sweepstakes Official Rules", "", "sor_g");
removed_offers[i++] = new mapping("Las Vegas",         "Cox Communications", "Sweepstakes Official Rules", "", "sor_lv");
removed_offers[i++] = new mapping("Macon",             "Cox Communications", "Sweepstakes Official Rules", "", "sor_m");
removed_offers[i++] = new mapping("New England",       "Cox Communications", "Sweepstakes Official Rules", "", "sor_ne");
removed_offers[i++] = new mapping("New Orleans",       "Cox Communications", "Sweepstakes Official Rules", "", "sor_no");

// WG 2/28/05 7921 - removed
removed_offers[i++] = new mapping("Colorado",       "Comcast", "Free Preview", "", "fp_c");
removed_offers[i++] = new mapping("Pennsylvania",   "Comcast", "Free Preview", "", "fp_p");
removed_offers[i++] = new mapping("Tennessee",      "Comcast", "Free Preview", "", "fp_t");
removed_offers[i++] = new mapping("Oregon",         "Comcast", "Free Preview", "", "fp_o");
removed_offers[i++] = new mapping("Kentucky",       "Comcast", "Free Preview", "", "fp_k");
removed_offers[i++] = new mapping("South Carolina", "Comcast", "Free Preview", "", "fp_sc");
removed_offers[i++] = new mapping("Florida",        "Comcast", "Free Preview", "", "fp_f");
removed_offers[i++] = new mapping("Georgia",        "Comcast", "Free Preview", "", "fp_g");
removed_offers[i++] = new mapping("Maryland",       "Comcast", "Maryland State Fair", "", "mc_msf");
removed_offers[i++] = new mapping("TX - Austin",    "Time Warner Cable", "Best Buy", "", "tw_austin");  
removed_offers[i++] = new mapping("",               "WOW! Internet and Cable", "", "", "");

// WG 3/15/05 7922 - WG 10/20/04 cq6592
removed_offers[i++] = new mapping("Maryland", "Comcast", "Maryland Loyalty", "", "mc_ml");

// WG 3/24/05 7924 - WG 11/4/04 cq6825
removed_offers[i++] = new mapping("National", "Adelphia", "Visa Gift Card", "", "an_vgc");

//CQ#5335
   if (offers.sort) removed_offers.sort(byProviderRegion);
//   if (offers.sort) removed_offers.sort(byRegion);

}


// scripts.js

// updated 1/16/2004 to add new coupon for target_nc - jfukuda

Offers();


function mapping(region, provider, rebate, code, coupon) {
  this.region   = region;
  this.provider = provider;
  this.rebate   = rebate;
  this.code     = code;
  this.coupon   = coupon;
}

//CQ#5335 - replace byRegion
// Sort the offers by Provider, then by Region
function byProviderRegion(a, b) {
  var aid = a.region;
  var bid = b.region;
  var apid = a.provider;
  var bpid = b.provider;
  if ( apid < bpid ) return -1;
  if ( apid > bpid ) return  1;
  if ( apid == bpid) {
     if ( aid < bid ) return -1;
     if ( aid > bid ) return  1;
  }   
  return 0;
}


//// Sort the offers by region
//function byRegion(a, b) {
//  var aid = a.region;
//  var bid = b.region;
//  if ( aid < bid ) return -1;
//  if ( aid > bid ) return  1;
//  return 0;
//}


// Get the coupon or popup or none
function submitRegionAndProvider(region, provider) {

   var lb_exists=false;
   
   // Loop thru all offer mappings
   for (var i=0 ; i < offers.length; i++) {

      // Check if this region/provider pair exist as a mapping (have a coupon)
      if (offers[i].region==region && offers[i].provider==provider) {

         // Remember the mapping exists
         lb_exists=true;

         // Check if this mapping requires no rebate or code. If none are required, return it's coupon.
         if (offers[i].rebate=="" && offers[i].code=="") return (offers[i].coupon);

      }

   }  // for i

   // Check if no mapping exists for this region/provider pair. If none exist, return "NONE".
   if (lb_exists==false) return ("NONE");

   // Probably requires a rebate and/or code
   return ("GET_REBATE_AND_OR_CODE");


}

// Display the current rebate in the drop down?
function displayRebate(rebate, region, provider) {

   // alert('displayRebate: ' + rebate + "|" + region + "|" + provider);

   // Loop thru all offer mappings
   for (var i=0 ; i < offers.length; i++) {

      // Check if this region/provider/rebate/code exist as a mapping (have a coupon)
      if (offers[i].region==region && offers[i].provider==provider && offers[i].rebate==rebate) return 'true';

   }  // for i

   return 'false';

}

// Get the coupon name given all info
function getCouponNameByRegionProviderRebateCode(region, provider, rebate, code) {

   // alert('getCouponNameByRegionProviderRebateCode: ' + region + "|" + provider + "|" + rebate + "|" + code + "]");

   // Loop thru all offer mappings
   for (var i=0 ; i < offers.length; i++) {

      // Check if this region/provider/rebate/code exist as a mapping (have a coupon) AND THE CODE IS ANY
      if (offers[i].region==region && offers[i].provider==provider && offers[i].rebate==rebate && offers[i].code=="") return (offers[i].coupon);

      // Check if this region/provider/rebate/code exist as a mapping (have a coupon)
      if (offers[i].region==region && offers[i].provider==provider && offers[i].rebate==rebate && offers[i].code==code) return (offers[i].coupon);

   }  // for i

   // Loop thru all REMOVED offer mappings
   for (var i=0 ; i < removed_offers.length; i++) {

      // Check if this region/provider/rebate/code exist as a mapping (have a coupon) AND THE CODE IS ANY
      if (removed_offers[i].region==region && removed_offers[i].provider==provider && removed_offers[i].rebate==rebate && removed_offers[i].code=="") return 'REMOVED';

      // Check if this region/provider/rebate/code exist as a mapping (have a coupon)
      if (removed_offers[i].region==region && removed_offers[i].provider==provider && removed_offers[i].rebate==rebate && removed_offers[i].code==code) return 'REMOVED';

   }  // for i

   return ('NONE');
}

// Get the html coupon page given the coupon name
function GetCouponPageByCouponName(coupon_name) {

   // May 9, 2003
   if (coupon_name == 'target_gift_cert_gains_50801') return('006');
   if (coupon_name == 'target_gift_cert_gains_50802') return('002');

   // May 14, 2003
   if (coupon_name == 'target_macon_001')  return('001');
   if (coupon_name == 'target_macon2_001') return('001');
   if (coupon_name == 'target_macon_003')  return('003');
   if (coupon_name == 'target_macon_004')  return('004');
   if (coupon_name == 'target_macon_005')  return('005');
   if (coupon_name == 'target_macon2_005') return('005');
   
   // June 2, 2003
   if (coupon_name == 'target_santa_barbara') return('007');
   
   // June 4, 2003
   if (coupon_name == 'target_bakersfield') return('007');
    
   // July 9, 2003
   if (coupon_name == 'target_nova') return('008');
   
   // July 25, 2003
   if (coupon_name == 'target_gains_80103') return('009');
   
   // August 13, 2003
   if (coupon_name == 'target_orange_1001') return('011');
   
   // August 14, 2003
   if (coupon_name == 'target_ne_90023') return('010');
   
   // September 3, 2003
   if (coupon_name == 'target_adelphia') return('012');
   
   // September 17, 2003
   if (coupon_name == 'new_restaurant_offer') return('013');
   
   // September 23, 2003
   if (coupon_name == 'target_roanoke_014') return('014');
   if (coupon_name == 'target_macon_015')   return('015');
   
   // November 25, 2003
   if (coupon_name == 'Time_Warner_San_Antonio') return('017');
   if (coupon_name == 'Time_Warner_Columbus')    return('018');
   
   // December 8, 2003
   if (coupon_name == 'best_buy_phoenix') return('016');
   if (coupon_name == 'best_buy_tucson')  return('019');
   
   // December 12, 2003
   if (coupon_name == 'starz_rebate') return('020');

   // January 16, 2004
   if (coupon_name == 'target_nc') return ('021');
   
   // February 25, 2004
   if (coupon_name == 'starz_rebate_fl') return('020');
   if (coupon_name == 'starz_rebate_pa') return('020');
   
   // February 25, 2004
   if (coupon_name == 'cox_destress') return('023');
   
   // April 13, 2004
   if (coupon_name == 'tw_austin') return('024');
   
   // July 6, 2004
   if (coupon_name == 'cc_25') return('026');

   // July 30, 2004 cq 6120
   if (coupon_name == 'starz_20_comcast') return('027');

   // September 24, 2004 cq 6398
   if (coupon_name == 'sor_br')  return('028');
   if (coupon_name == 'sor_g')   return('028');
   if (coupon_name == 'sor_lv')  return('028');
   if (coupon_name == 'sor_m')   return('028');
   if (coupon_name == 'sor_ne')  return('028');
   if (coupon_name == 'sor_no')  return('028');
   if (coupon_name == 'sor_nv')  return('028');
   if (coupon_name == 'sor_oc')  return('028');
   if (coupon_name == 'sor_pc')  return('028');
   if (coupon_name == 'sor_p')   return('028');
   if (coupon_name == 'sor_r')   return('028');
   if (coupon_name == 'sor_sd')  return('028');
   if (coupon_name == 'sor_t')   return('028');
   if (coupon_name == 'sor_wt')  return('028');	   
   if (coupon_name == 'sor_sb')  return('028');
   if (coupon_name == 'sor_b')   return('028');

   // WG 10/20/04 cq6592
   if (coupon_name == 'mc_msf')  return('027');
   if (coupon_name == 'mc_ml')   return('029');

   // WG 10/27/04 cq6658
   if (coupon_name == 'fp_p')   return('030');
   if (coupon_name == 'fp_t')   return('030');
   if (coupon_name == 'fp_o')   return('030');
   if (coupon_name == 'fp_k')   return('030');
   if (coupon_name == 'fp_sc')  return('030');
   if (coupon_name == 'fp_c')   return('030');
   if (coupon_name == 'fp_f')   return('030');
   if (coupon_name == 'fp_g')   return('030');

   // WG 11/4/04 cq6825
   if (coupon_name == 'an_vgc') return('031');

   // WG 11/24/04 cq7162
   //if (coupon_name == 'dn_n_15') return('032');

   // WG 01/24/05 cq7586
   if (coupon_name == 'c_p_25') return('033');
   if (coupon_name == 'c_t_25') return('033');

   // WG 02/18/05 cq7876
   if (coupon_name == 'sor2_br')  return('028');
   if (coupon_name == 'sor2_cc')  return('028');
   if (coupon_name == 'sor2_lv')  return('028');
   if (coupon_name == 'sor2_m')   return('028');
   if (coupon_name == 'sor2_ne')  return('028');
   if (coupon_name == 'sor2_no')  return('028');
   if (coupon_name == 'sor2_nv')  return('028');
   if (coupon_name == 'sor2_o')   return('028');
   if (coupon_name == 'sor2_oc')  return('028');
   if (coupon_name == 'sor2_hr')  return('028');

//   2/8/07 BB #DTV0550-07
//   if (coupon_name == 'c_p_251q') return('033');
//   if (coupon_name == 'c_t_251q') return('033');
   if (coupon_name == 'COX0853_p') return('034');
   if (coupon_name == 'COX0853_t') return('035');
   if (coupon_name == 'COX0910_p') return('050');
   if (coupon_name == 'COX0910_t') return('051');
   if (coupon_name == 'COX0990_v') return('052');
   if (coupon_name == 'COX0990_t') return('053');
   if (coupon_name == 'DTV0938_a') return('086');
   if (coupon_name == 'COX0991_v') return('055');
   if (coupon_name == 'COX0991_t') return('056');
   // if (coupon_name == 'ECO0421_c') return('057');
   // if (coupon_name == 'ECO0444_c') return('058');
   if (coupon_name == 'COX1198_t') return('059');
   if (coupon_name == 'DTV0550_f') return('060');  
   if (coupon_name == 'DTV0557_c') return('061');
   if (coupon_name == 'COX1305_t') return('062');
   if (coupon_name == 'DTV0587_v') return('063');
   if (coupon_name == 'COX1422_v') return('064');
   // 6/7/07 BB #AFM0158-07
   if (coupon_name == 'AFM0158_e')  return('065');
   if (coupon_name == 'COX1549_t') return('066');
   if (coupon_name == 'TCL0106_a') return('067');
    if (coupon_name == 'DTV0674_t') return('068');
	if (coupon_name == 'COX1676_t') return('069');
	if (coupon_name == 'COX1677_t') return('070');
	//if (coupon_name == 'COX1714_t') return('071');
	if (coupon_name == 'COX2037_t') return('075');
	// 9/25/07 BB #TCL0116-07
	// if (coupon_name == 'TCL0116_c') return('072');
	if (coupon_name == 'ECO0616_e') return('073');
	// if (coupon_name == 'NAT0638_c') return('074');
	if (coupon_name == 'COX2022-07_b') return('076');
	// if (coupon_name == 'TCL0152_t') return('077');
	if (coupon_name == 'COX2142_t') return('078');
	if (coupon_name == 'COX2211_b') return('079');
	// if (coupon_name == 'COX2226_b') return('080');
	if (coupon_name == 'COX2516_b') return('081');
	if (coupon_name == 'COX2515_b') return('082');
	if (coupon_name == 'TCL0226_c') return('083');
	if (coupon_name == 'WEB0928_t') return('084');
	if (coupon_name == 'WEB0929_r') return('085');
	if (coupon_name == 'COX2736_a') return('087');
	if (coupon_name == 'AFM0192_b') return('088');	
	if (coupon_name == 'AFM0193_w') return('089');
	if (coupon_name == 'NAT0760') return('090');
    if (coupon_name == 'COX3021') return('0107');
    if (coupon_name == 'COX3022') return('092');
	
    //if (coupon_name == 'AFM0199') return('093');	
    if (coupon_name == 'AFM0202') return('094');	
	if (coupon_name == 'AFM0202-2') return('098');	
	if (coupon_name == 'AFM0203') return('094');
	if (coupon_name == 'AFM0201') return('095');
	if (coupon_name == 'AFM0199') return('096');
	// if (coupon_name == 'DTV1073') return('097');
	if (coupon_name == 'AFM0217') return('099');
	if (coupon_name == 'AFM0218') return('0100');
	if (coupon_name == 'AFM0220') return('0101');
	if (coupon_name == 'AFM0224') return('0102');
	if (coupon_name == 'AFM0225') return('0103');
	if (coupon_name == 'BRD0529') return('0104');
	if (coupon_name == 'AFM0233') return('0105');
	//if (coupon_name == 'AFM0235') return('0106');
	if (coupon_name == 'WEB4033') return('0108');
	if (coupon_name == 'AFM4020') return('0109');
	if (coupon_name == 'AFM4021') return('0110');
	if (coupon_name == 'AFM4022') return('0111');
	if (coupon_name == 'ORG4185') return('0112');
	if (coupon_name == 'MAR4013') return('0113');
	if (coupon_name == 'AFM4035') return('0114');
	if (coupon_name == 'AFM4036') return('0115');
	
	



   // 7/5/06 BB #WEB0235-06
   // if (coupon_name == 'tw_t_vgc')  return('036');
   // if (coupon_name == 'bn_m_bbgc') return('037');

   // Update 12/9/05 BB #ADL0159
   // if (coupon_name == 'ADL0159_o') return('038');
   // if (coupon_name == 'ADL0159_v') return('038');

   // 7/5/06 BB #WEB0235-06
   // if (coupon_name == 'a_visa_o2') return('039');
   // if (coupon_name == 'a_visa_v2') return('039');

   // 7/5/06 BB #WEB0235-06
   // if (coupon_name == 'bn_visa_i') return('040');

   // 11/14/05 BB #eco0176
   // if (coupon_name == 'eco0176') return('041'); 

   // 7/5/06 BB #WEB0235-06 
   // if (coupon_name == 'ADL0159') return('042');    
   
   // 3/6/06 BB #COX0608-06  
   // if (coupon_name == 'c_p_253q') return('043');
   // if (coupon_name == 'c_t_253q') return('044');
   
   // 7/5/06 BB #WEB0235-06
   // if (coupon_name == 'a_visa_adl0151') return('045');
   
    // 01/09/06 BB #ADL0162-06
//   if (coupon_name == 'a_visa_adl0161') return('047');


   // 3/6/06 BB #NCP0149-06
   //if (coupon_name == 'comcast_ncp0149') return('048');
  // if (coupon_name == 'timewarner_ncp0149') return('049');
   

   

   return('NONE');

}















// JavaScript Document

function MM_setTextOfLayer(objName,x,newText) { //v4.01
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}



function getText(service) {
	var t = "";
	for(var r = 0; r < service.length; r++) {
		t += service[r];
	}
	return "<table border=0 cellspacing=0 cellpadding=1 width=100%>" + t + "</table>";
}

function getServiceDD(){
	var t = "";
	for(var j = 0; j < serviceDesc.length; j++) {
		if(serviceCode[j] != "sod") {
			t += "<option value='" + serviceCode[j] + "'>" + serviceDesc[j] + "</option>";
		}
	}
	document.writeln(t);
}




function openCoupon(href) {
  openCenteredWindow(href, 'coops', 600, 400, 'yes', 'yes');
}




function HideAllLayers() {
   MM_showHideLayers_starzoffers('LayerRegion1', '', 'hide');
   MM_showHideLayers_starzoffers('LayerRegion2', '', 'hide');
   MM_showHideLayers_starzoffers('LayerRebate1', '', 'hide');
   MM_showHideLayers_starzoffers('LayerRebate2', '', 'hide');
   MM_showHideLayers_starzoffers('LayerCode1',   '', 'hide');
   MM_showHideLayers_starzoffers('LayerCode2',   '', 'hide');
   MM_showHideLayers_starzoffers('LayerSubmit',  '', 'hide');
}  // HideAllLayers()



function PopulateProviders() {
<!--

   // Loop thru all providers
   var ls_providers = new Array();
   var ll_count     = 0;
   var ll_item      = 1;

   // Wipe and add the first option
   document.entryForm.as_provider.options.length = 0;
   document.entryForm.as_provider.options[0]=new Option("------ Select One ------", "");

   for (var i=0 ; i < offers.length ; i++) {

      var ls_provider = offers[i].provider;

      if (ls_provider=="") continue;

      // Check if this provider is under the current provider
      if (offers[i].provider != ls_provider) continue;

      // Check if this provider already has been added
      var lb_exists = false;
      for (var j=0 ; j < ll_count ; j++) {
         if ( ls_provider == ls_providers[j] ) lb_exists = true;
      }

      if (lb_exists == false) {
         document.entryForm.as_provider.options[ll_item]=new Option(ls_provider, ls_provider);
         ll_item++;
         ls_providers[ll_count] = ls_provider;
         ll_count ++;
      }
   }
}  // PopulateProviders()

function PopulateRegions() {

   // Hide layers (region, rebate, code, submit)
   HideAllLayers();

   var as_provider = MM_findObj('as_provider');
   var ls_provider = as_provider.value ;

   if (ls_provider == "") return ;

//KK - add on 4/27/04 - CQ#5335
if (ls_provider == 'WOW! Internet and Cable') document.location = '025.html';

//TJP - add on 7/30/04 - CQ#6120
//if (ls_provider == 'Comcast') document.location = '027.html';


// If ls_provider is Pegasus, display the terms and conditions - 4587
if (ls_provider == 'Pegasus') document.location = '022.html';
//if (ls_provider == 'De-Stress Sweepstakes Official Rules') document.location = '023.html';

   // Loop thru all regions
   var ls_regions = new Array();
   var ll_count   = 0;
   var ll_item    = 1;

   // Wipe and add the first option
   document.entryForm.as_region.options.length   = 0;
   document.entryForm.as_region.options[0]       = new Option();
   document.entryForm.as_region.options[0].text  = "------ Select One ------";
   document.entryForm.as_region.options[0].value = "";

   for (var i=0 ; i < offers.length ; i++) {

      var ls_region = offers[i].region;

      if (ls_region=="") continue;

      // Check if this region is under the current provider
      if (offers[i].provider != ls_provider) continue;

      // Check if this region already has been added
      var lb_exists = false;
      for (var j=0 ; j < ll_count ; j++) {
         if ( ls_region == ls_regions[j] ) lb_exists = true;
      }

      if (lb_exists == false) {
         document.entryForm.as_region.options[ll_item]=new Option(ls_region, ls_region);
         ll_item++;
         ls_regions[ll_count] = ls_region;
         ll_count ++;
      }
   }

   // Check if no items were entered
   if (ll_count > 0) {
      // Show the region dropdown
      MM_showHideLayers_starzoffers('LayerRegion1', '', 'show');
      MM_showHideLayers_starzoffers('LayerRegion2', '', 'show');
   }
   if (ll_count == 1) {
      document.entryForm.as_region.options[1].selected = true;
      PopulateRebates();
      ShowSubmit();
   }

}  // PopulateRegions()

function PopulateRebates() {

   // Hide rebates, code and submit
   MM_showHideLayers_starzoffers('LayerRebate1', '', 'hide');
   MM_showHideLayers_starzoffers('LayerRebate2', '', 'hide');
   MM_showHideLayers_starzoffers('LayerCode1',   '', 'hide');
   MM_showHideLayers_starzoffers('LayerCode2',   '', 'hide');
   MM_showHideLayers_starzoffers('LayerSubmit',  '', 'hide');

   var as_provider = MM_findObj('as_provider');
   var as_region   = MM_findObj('as_region');
   var ls_provider = as_provider.value ;
   var ls_region   = as_region.value ;
   if (ls_provider == "") return ;
   if (ls_region   == "") return ;

   // Loop thru all rebates
   var ls_rebates = new Array();
   var ll_count   = 0;
   var ll_item    = 1;

   // Wipe and add the first option
   document.entryForm.as_rebate.options.length = 0;
   document.entryForm.as_rebate.options[0]=new Option("------ Select One ------", "");

   for (var i=0 ; i < offers.length ; i++) {

      var ls_rebate = offers[i].rebate;

      if (ls_rebate=="") continue;

      // Check if this rebate is under the current provider and region
      if (offers[i].provider != ls_provider || offers[i].region != ls_region) continue;

      // Check if this rebate already has been added
      var lb_exists = false;
      for (var j=0 ; j < ll_count ; j++) {
         if ( ls_rebate == ls_rebates[j] ) lb_exists = true;
      }

      if (lb_exists == false) {
         document.entryForm.as_rebate.options[ll_item]=new Option(ls_rebate, ls_rebate);
         ll_item++;
         ls_rebates[ll_count] = ls_rebate;
         ll_count ++;
      }
   }

   // Check if no items were entered
   if (ll_count > 0) {
      // Show the rebate dropdown
      MM_showHideLayers_starzoffers('LayerRebate1', '', 'show');
      MM_showHideLayers_starzoffers('LayerRebate2', '', 'show');
   }
   if (ll_count == 1) {
      document.entryForm.as_rebate.options[1].selected = true;
      ShowSubmit();
   }

}  // PopulateRebates()

function ShowCodeAndSubmit() {

   // Hide code and submit
   MM_showHideLayers_starzoffers('LayerCode1',   '', 'hide');
   MM_showHideLayers_starzoffers('LayerCode2',   '', 'hide');
   MM_showHideLayers_starzoffers('LayerSubmit',  '', 'hide');

   var as_provider = MM_findObj('as_provider');
   var as_region   = MM_findObj('as_region');
   var as_rebate   = MM_findObj('as_rebate');
   var ls_provider = as_provider.value ;
   var ls_region   = as_region.value ;
   var ls_rebate   = as_rebate.value ;
   if (ls_provider == "") return ;
   if (ls_region   == "") return ;
   if (ls_rebate   == "") return ;

   var lb_code=false;
   for (var i=0 ; i < offers.length ; i++) {
      if (offers[i].provider==ls_provider && offers[i].region==ls_region && offers[i].rebate==ls_rebate && offers[i].code != "") {
         lb_code=true;
         break;
      }
   }

   if (lb_code==true) {
      // Show the code field
      MM_showHideLayers_starzoffers('LayerCode1',  '', 'show');
      MM_showHideLayers_starzoffers('LayerCode2',  '', 'show');
   }

   // Show the submit button
   ShowSubmit();

}  // ShowCodeAndSubmit()

function ShowSubmit() {
   // Show the submit button
   MM_showHideLayers_starzoffers('LayerSubmit', '', 'show');
}  // ShowSubmit()

function MM_validateForm2() {

   // Get the fields
   var as_provider = MM_findObj('as_provider');
   var as_region   = MM_findObj('as_region');
   var as_rebate   = MM_findObj('as_rebate');
   var as_code     = MM_findObj('as_offer_code');
   var ls_provider = as_provider.value ;
   var ls_region   = as_region.value ;
   var ls_rebate   = as_rebate.value ;
   var ls_code     = as_code.value ;
   var ls_coupon   = '';
   var ls_retval   = '';

   var ls_retval = getCouponNameByRegionProviderRebateCode(ls_region, ls_provider, ls_rebate, ls_code) ;
   //alert(ls_retval);

   if (ls_retval == 'NONE' || ls_retval == '') {

      alert("You have entered an invalid offer code. Please re-enter your code.");
      document.MM_returnValue = false;

   } else if (ls_retval == 'REMOVED') {

      alert("The Promotion Code you have entered has expired and is no longer available.");
      document.MM_returnValue = false;

   } else {

      // Success
      document.MM_returnValue = false ;

      var ls_coupon_page = '' ;
      ls_coupon_page = GetCouponPageByCouponName(ls_retval);
      openCoupon('coupons/' + ls_coupon_page + '.html');

      return '' ;
      exit ;

   }

}  // MM_validateForm2()






function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function MM_showHideLayers_starzoffers() { //v6.0

  var i,p,v,obj,args=MM_showHideLayers_starzoffers.arguments;

  for (i=0; i<(args.length-2); i+=3) {
    if ( (obj=MM_findObj(args[i])) != null ) {
      v=args[i+2];
      if (obj.style) {
        obj=obj.style;
        v=(v=='show')?'visible':(v=='hide')?'hidden':v ;
      }

//alert(this.LayerRegion1);

      if (v=='hidden') {
        //if (args[0]=='LayerRegion1' && this.LayerRegion1!=undefined) this.LayerRegion1.style.color = 'gray';
        //if (args[0]=='LayerRebate1' && this.LayerRebate1!=undefined) this.LayerRebate1.style.color = 'gray';
        if (args[0]=='LayerCode1') document.getElementById('LayerCode1').style.display = "none";
        //if (args[0]=='LayerCode1'   && this.LayerCode1!=undefined)   this.LayerCode1.style.color   = 'gray';
        if (args[0]=='LayerRegion2') document.entryForm.as_region.disabled     = true;
        if (args[0]=='LayerRebate2') document.entryForm.as_rebate.disabled     = true;
        if (args[0]=='LayerCode2')   obj.visibility=v;
        //if (args[0]=='LayerCode2')   document.entryForm.as_offer_code.disabled = true;
        if (args[0]=='LayerSubmit')  document.entryForm.Submit.disabled        = true;

      } else {

        obj.visibility=v;
        //if (args[0]=='LayerRegion1' && this.LayerRegion1!=undefined) this.LayerRegion1.style.color = 'black';
        //if (args[0]=='LayerRebate1' && this.LayerRebate1!=undefined) this.LayerRebate1.style.color = 'black';
        if (args[0]=='LayerCode1') document.getElementById('LayerCode1').style.display = "block";
        //if (args[0]=='LayerCode1'   && this.LayerCode1!=undefined)   this.LayerCode1.style.color = 'black';
        if (args[0]=='LayerRegion2') document.entryForm.as_region.disabled     = false;
        if (args[0]=='LayerRebate2') document.entryForm.as_rebate.disabled     = false;
        //if (args[0]=='LayerCode2')   document.entryForm.as_offer_code.disabled = false;
        if (args[0]=='LayerSubmit')  document.entryForm.Submit.disabled        = false;
      }

    }
  }  // for

}  // MM_showHideLayers_starzoffers



