function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function popup(status,url) {
if(status != 0) {
if(popup != null) popup.focus();
else {
var popup = open(url, "Popup", 
"HEIGHT=600,WIDTH=600,Left=100,TOP=5,status=no,resizable=yes,scrollbars=yes,toolbar=no,directories=no,menubar=no,location=no");
popup_window = popup;
}
} else {
if(popup_window != null) popup_window.close();
}
}

function popupTax(status,url) {
if(status != 0) {
if(popup != null) popup.focus();
else {
var popup = open(url, "Popup", 
"HEIGHT=500,WIDTH=600,Left=100,TOP=5,status=no,resizable=yes,scrollbars=yes,toolbar=no,directories=no,menubar=no,location=no");
popup_window = popup;
}
} else {
if(popup_window != null) popup_window.close();
}
}

function run_state(){
   
	var set_option_vals = document.forms[0].group;
	var state_val_set = document.forms[0].state.value;
	var display = document.getElementById('set_options');
 
	if(state_val_set ==""){
		//display.innerHTML = "<select name='group' class='input'><option value=''></option></select>";
		return true;
	}
	   if(browser == "Netscape Navigator" || browser == "Mozilla Firefox"){
	   set_option_vals.options.length = 1;
	  }else{
	    set_option_vals.options.length = 0;
	  }
     
	if(state_val_set =="AZ"){
	 	set_option_vals.options[set_option_vals.options.length] = new Option('Phoenix','FAZ01');
		// set_option_vals.options[set_option_vals.options.length] = new Option('Tempe','FAZ02');
		// set_option_vals.options[set_option_vals.options.length] = new Option('Mesa - Stapley Dr.','FAZ04');
		// set_option_vals.options[set_option_vals.options.length] = new Option('Tucson (Oro Valley)','FAZ20');
	}else if(state_val_set =="CA"){
	   set_option_vals.options[set_option_vals.options.length] = new Option('Antioch','FCA20');
	   // set_option_vals.options[set_option_vals.options.length] = new Option('Chula Vista','FCA05');
	   // set_option_vals.options[set_option_vals.options.length] = new Option('Escondido','FCA06');
	   set_option_vals.options[set_option_vals.options.length] = new Option('Modesto','FCA30');
	   set_option_vals.options[set_option_vals.options.length] = new Option('San Diego - Fashion Valley','FCA01');
//	   set_option_vals.options[set_option_vals.options.length] = new Option('San Diego - Pacific Beach','FCA03');
	}else if(state_val_set =="CO"){
         set_option_vals.options[set_option_vals.options.length] = new Option('Denver','FCO01');
		 set_option_vals.options[set_option_vals.options.length] = new Option('Westminster','641');
	}else if(state_val_set =="CT"){
        set_option_vals.options[set_option_vals.options.length] = new Option('Danbury','452');
        //set_option_vals.options[set_option_vals.options.length] = new Option('Fairfield','453');
        //set_option_vals.options[set_option_vals.options.length] = new Option('Farmington','450');
        set_option_vals.options[set_option_vals.options.length] = new Option('Manchester','455');
        set_option_vals.options[set_option_vals.options.length] = new Option('Milford','454');
    }else if(state_val_set =="DC"){
        set_option_vals.options[set_option_vals.options.length] = new Option('Washington - Georgetown','FDC01');
        set_option_vals.options[set_option_vals.options.length] = new Option('Washington - Union Station','701');
    }else if(state_val_set =="DE"){
        set_option_vals.options[set_option_vals.options.length] = new Option('Dover','FDE01');
	}else if(state_val_set =="FL"){
		 set_option_vals.options[set_option_vals.options.length] = new Option('Cape Coral','FFL27');			
         set_option_vals.options[set_option_vals.options.length] = new Option('Daytona Beach','963');
         set_option_vals.options[set_option_vals.options.length] = new Option('Fort Myers','FFL25');
         set_option_vals.options[set_option_vals.options.length] = new Option('Kissimmee','964');
         set_option_vals.options[set_option_vals.options.length] = new Option('Lake Buena Vista','FFL02');
         set_option_vals.options[set_option_vals.options.length] = new Option('Lake Mary','967');
         set_option_vals.options[set_option_vals.options.length] = new Option('Melbourne (Viera)','974');
         set_option_vals.options[set_option_vals.options.length] = new Option('Merritt Island','973');
         set_option_vals.options[set_option_vals.options.length] = new Option('Naples','FFL26');
         //set_option_vals.options[set_option_vals.options.length] = new Option('Orlando - East Colonial Dr.','966');
         set_option_vals.options[set_option_vals.options.length] = new Option('Orlando - International Dr.','960');
         set_option_vals.options[set_option_vals.options.length] = new Option('Orlando - University Blvd.','969');
         set_option_vals.options[set_option_vals.options.length] = new Option('Winter Garden','972');
   }else if(state_val_set =="IL"){
          set_option_vals.options[set_option_vals.options.length] = new Option('Chicago - East Ohio (Pizzeria Uno)','761');
          set_option_vals.options[set_option_vals.options.length] = new Option('Chicago - North Wabash (Pizzeria Due)','762');
          set_option_vals.options[set_option_vals.options.length] = new Option('Crestwood','772');
          set_option_vals.options[set_option_vals.options.length] = new Option('Gurnee','768');
          // set_option_vals.options[set_option_vals.options.length] = new Option('Peoria','FIL05');
          set_option_vals.options[set_option_vals.options.length] = new Option('Schaumburg','767');
   }else if(state_val_set =="IN"){
         //set_option_vals.options[set_option_vals.options.length] = new Option('Fort Wayne - Clinton St','FIN10');
         //set_option_vals.options[set_option_vals.options.length] = new Option('Fort Wayne - Maysville Rd.','FIN11');
         set_option_vals.options[set_option_vals.options.length] = new Option('Indianapolis','FIN01');
         set_option_vals.options[set_option_vals.options.length] = new Option('Merrillville','FIN02');
         set_option_vals.options[set_option_vals.options.length] = new Option('Southport','791');
   //}else if(state_val_set =="KS"){
        //set_option_vals.options[set_option_vals.options.length] = new Option('Overland Park','FKS03');
   			//}else if(state_val_set =="KY"){
        // set_option_vals.options[set_option_vals.options.length] = new Option('Louisville','FKY02');
   }else if(state_val_set =="MA"){
        set_option_vals.options[set_option_vals.options.length] = new Option('Allston','204');
        set_option_vals.options[set_option_vals.options.length] = new Option('Attleboro','250');
        set_option_vals.options[set_option_vals.options.length] = new Option('Bellingham','236');
        set_option_vals.options[set_option_vals.options.length] = new Option('Boston - Boylston St.','201');
        set_option_vals.options[set_option_vals.options.length] = new Option('Boston - Huntington Ave.','218');
        set_option_vals.options[set_option_vals.options.length] = new Option('Boston - Kenmore Square','209');
        set_option_vals.options[set_option_vals.options.length] = new Option('Braintree','227');
        set_option_vals.options[set_option_vals.options.length] = new Option('Brockton','221');
        set_option_vals.options[set_option_vals.options.length] = new Option('Burlington','210');
        set_option_vals.options[set_option_vals.options.length] = new Option('Cambridge - Harvard Square','202');
        set_option_vals.options[set_option_vals.options.length] = new Option('Cambridge - Porter Square','215');
        //set_option_vals.options[set_option_vals.options.length] = new Option('Danvers','205');
        set_option_vals.options[set_option_vals.options.length] = new Option('Dedham','217');
        set_option_vals.options[set_option_vals.options.length] = new Option('Fairhaven','245');
        set_option_vals.options[set_option_vals.options.length] = new Option('Framingham','203');
        set_option_vals.options[set_option_vals.options.length] = new Option('Hanover','219');
        set_option_vals.options[set_option_vals.options.length] = new Option('Haverhill','242');
        set_option_vals.options[set_option_vals.options.length] = new Option('Holyoke','FMA01');
        set_option_vals.options[set_option_vals.options.length] = new Option('Hyannis','222');
        set_option_vals.options[set_option_vals.options.length] = new Option('Kingston','216');
        set_option_vals.options[set_option_vals.options.length] = new Option('Leominster','239');
        set_option_vals.options[set_option_vals.options.length] = new Option('Methuen','247');
        set_option_vals.options[set_option_vals.options.length] = new Option('Millbury','249');
        set_option_vals.options[set_option_vals.options.length] = new Option('Newton','226');
        set_option_vals.options[set_option_vals.options.length] = new Option('Plymouth','248');
        set_option_vals.options[set_option_vals.options.length] = new Option('Revere','224');
        set_option_vals.options[set_option_vals.options.length] = new Option('Springfield - Opposite Eastfield Mall','206');
        set_option_vals.options[set_option_vals.options.length] = new Option('Springfield - West Columbus Ave.','FMA07');
        set_option_vals.options[set_option_vals.options.length] = new Option('Sturbridge','241');
        set_option_vals.options[set_option_vals.options.length] = new Option('Swampscott','252');
        set_option_vals.options[set_option_vals.options.length] = new Option('Taunton','251');
        set_option_vals.options[set_option_vals.options.length] = new Option('Waltham','235');
        set_option_vals.options[set_option_vals.options.length] = new Option('Westborough','238');
        set_option_vals.options[set_option_vals.options.length] = new Option('Woburn','231');
        set_option_vals.options[set_option_vals.options.length] = new Option('Wrentham','246');
        set_option_vals.options[set_option_vals.options.length] = new Option('Worcester','FMA08');
        
    }else if(state_val_set =="MD"){
       set_option_vals.options[set_option_vals.options.length] = new Option('Baltimore','704');
       set_option_vals.options[set_option_vals.options.length] = new Option('Bel Air','714');
       set_option_vals.options[set_option_vals.options.length] = new Option('Bethesda','702');
       set_option_vals.options[set_option_vals.options.length] = new Option('Bowie','727');
       set_option_vals.options[set_option_vals.options.length] = new Option('Columbia','731');
       set_option_vals.options[set_option_vals.options.length] = new Option('Ellicott City','720');
       set_option_vals.options[set_option_vals.options.length] = new Option('Frederick','721');
       set_option_vals.options[set_option_vals.options.length] = new Option('Fruitland','FMD10');
       set_option_vals.options[set_option_vals.options.length] = new Option('Hagerstown','723');
       set_option_vals.options[set_option_vals.options.length] = new Option('Largo (Landover)','729');
       // set_option_vals.options[set_option_vals.options.length] = new Option('Waldorf','713');
       
   }else if(state_val_set =="ME"){
      set_option_vals.options[set_option_vals.options.length] = new Option('Bangor','831');
      set_option_vals.options[set_option_vals.options.length] = new Option('South Portland','830');
      
   }else if(state_val_set =="MI"){
      set_option_vals.options[set_option_vals.options.length] = new Option('Bay City','FMI30');
      set_option_vals.options[set_option_vals.options.length] = new Option('Birch Run','FMI03');
      //set_option_vals.options[set_option_vals.options.length] = new Option('Grand Rapids (East Beltline)','FMI16');
      //set_option_vals.options[set_option_vals.options.length] = new Option('Grand Rapids (Gaines Township)','FMI15');
      //set_option_vals.options[set_option_vals.options.length] = new Option('Northville','FMI20');
      set_option_vals.options[set_option_vals.options.length] = new Option('Sterling Heights','FMI04');
      // set_option_vals.options[set_option_vals.options.length] = new Option('Westland','FMI11');
      // set_option_vals.options[set_option_vals.options.length] = new Option('Woodhaven','FMI10');
      
  }else if(state_val_set =="MN"){
     //no stores?
 }else if(state_val_set =="MO"){
     set_option_vals.options[set_option_vals.options.length] = new Option('Chesterfield','752');
     //set_option_vals.options[set_option_vals.options.length] = new Option('Kansas City (Liberty)','FKS04');
     // set_option_vals.options[set_option_vals.options.length] = new Option('Kansas City - Country Club Plaza','FKS02');
     set_option_vals.options[set_option_vals.options.length] = new Option('Kirkwood','755');
 
 }else if(state_val_set =="NC"){
    set_option_vals.options[set_option_vals.options.length] = new Option('Charlotte','FNC26');
    //set_option_vals.options[set_option_vals.options.length] = new Option('Concord','740');
    //set_option_vals.options[set_option_vals.options.length] = new Option('High Point','FNC25');
    set_option_vals.options[set_option_vals.options.length] = new Option('Raleigh','FNC20');
    
 //}else if(state_val_set =="ND"){
   // set_option_vals.options[set_option_vals.options.length] = new Option('West Fargo','FND01');
    
 }else if(state_val_set =="NH"){
   set_option_vals.options[set_option_vals.options.length] = new Option('Concord','503');
   set_option_vals.options[set_option_vals.options.length] = new Option('Dover','506');
   set_option_vals.options[set_option_vals.options.length] = new Option('Keene','505');
   set_option_vals.options[set_option_vals.options.length] = new Option('Manchester','502');
   set_option_vals.options[set_option_vals.options.length] = new Option('Nashua - Amherst St.','507');
   set_option_vals.options[set_option_vals.options.length] = new Option('Nashua - Daniel Webster Hwy.','501');
   //set_option_vals.options[set_option_vals.options.length] = new Option('Newington','508');
   set_option_vals.options[set_option_vals.options.length] = new Option('Tilton','509');
   
 }else if(state_val_set =="NJ"){
     set_option_vals.options[set_option_vals.options.length] = new Option('Deptford','FNJ21');
     set_option_vals.options[set_option_vals.options.length] = new Option('Hamilton','FNJ22');
     set_option_vals.options[set_option_vals.options.length] = new Option('Jersey City','FNJ03');
     set_option_vals.options[set_option_vals.options.length] = new Option('Maple Shade','FNJ23');
     set_option_vals.options[set_option_vals.options.length] = new Option('Metuchen','603');
     // set_option_vals.options[set_option_vals.options.length] = new Option('Secaucus','FNJ01');
     // set_option_vals.options[set_option_vals.options.length] = new Option('South Plainfield','605');
     set_option_vals.options[set_option_vals.options.length] = new Option('Wayne','FNJ02');
     set_option_vals.options[set_option_vals.options.length] = new Option('Clifton','FNJ04');
      
}else if(state_val_set =="NM"){
    set_option_vals.options[set_option_vals.options.length] = new Option('Las Cruces','FNM01');
	
}else if(state_val_set =="NY"){
    set_option_vals.options[set_option_vals.options.length] = new Option('Albany','304');
    set_option_vals.options[set_option_vals.options.length] = new Option('Amherst','320');
    set_option_vals.options[set_option_vals.options.length] = new Option('Bayside','310');
    set_option_vals.options[set_option_vals.options.length] = new Option('Bronx (Parkchester)','FNY50');
    set_option_vals.options[set_option_vals.options.length] = new Option('Brooklyn (Bay Ridge)','312');
    set_option_vals.options[set_option_vals.options.length] = new Option('Central Valley (Woodbury Centre)','327');
    set_option_vals.options[set_option_vals.options.length] = new Option('Fayetteville','328');
    set_option_vals.options[set_option_vals.options.length] = new Option('Forest Hills','302');
    set_option_vals.options[set_option_vals.options.length] = new Option('Latham','321');
    set_option_vals.options[set_option_vals.options.length] = new Option('Liverpool (Clay)','329');
    set_option_vals.options[set_option_vals.options.length] = new Option('Long Island City (Astoria-Queens)','325');
    //set_option_vals.options[set_option_vals.options.length] = new Option('Lynbrook','305');
    //set_option_vals.options[set_option_vals.options.length] = new Option('Nesconset (Smithtown)','326');
    set_option_vals.options[set_option_vals.options.length] = new Option('New Hartford','330');
    //set_option_vals.options[set_option_vals.options.length] = new Option('NYC - 3rd Ave.','307');
    set_option_vals.options[set_option_vals.options.length] = new Option('NYC - 6th Ave.','301');
    set_option_vals.options[set_option_vals.options.length] = new Option('NYC - 86th St.','315');
    set_option_vals.options[set_option_vals.options.length] = new Option('NYC - Columbus Ave.','308');
    set_option_vals.options[set_option_vals.options.length] = new Option('NYC - Seaport','313');
    set_option_vals.options[set_option_vals.options.length] = new Option('Poughkeepsie','FNY12');
    set_option_vals.options[set_option_vals.options.length] = new Option('Queensbury','FNY22');
    //set_option_vals.options[set_option_vals.options.length] = new Option('Rochester (Greece)','324');
    set_option_vals.options[set_option_vals.options.length] = new Option('Rochester (Henrietta)','322');
    set_option_vals.options[set_option_vals.options.length] = new Option('Saratoga Springs','FNY20');
    set_option_vals.options[set_option_vals.options.length] = new Option('Syracuse','311');
    set_option_vals.options[set_option_vals.options.length] = new Option('Vestal','318');
    set_option_vals.options[set_option_vals.options.length] = new Option('Victor','323');
    set_option_vals.options[set_option_vals.options.length] = new Option('Wappingers Falls','FNY14');
    set_option_vals.options[set_option_vals.options.length] = new Option('Webster','331');
    set_option_vals.options[set_option_vals.options.length] = new Option('White Plains','FNY01');
    set_option_vals.options[set_option_vals.options.length] = new Option('Yonkers','319');
    
 }else if(state_val_set =="OH"){
	set_option_vals.options[set_option_vals.options.length] = new Option('Beechmont - Cincinnati','FOH42');
    set_option_vals.options[set_option_vals.options.length] = new Option('Dayton','FOH22');
    set_option_vals.options[set_option_vals.options.length] = new Option('Dublin','781');
    set_option_vals.options[set_option_vals.options.length] = new Option('Pickerington','783');
    set_option_vals.options[set_option_vals.options.length] = new Option('West Chester','FOH40');
    
 }else if(state_val_set =="PA"){
    set_option_vals.options[set_option_vals.options.length] = new Option('Altoona','FPA50');
    set_option_vals.options[set_option_vals.options.length] = new Option('Bensalem','FPA28');
    set_option_vals.options[set_option_vals.options.length] = new Option('Conshohocken (Plymouth Meeting)','FPA14');
    set_option_vals.options[set_option_vals.options.length] = new Option('Cranberry Township','FPA60');
    set_option_vals.options[set_option_vals.options.length] = new Option('Dickson City (Scranton)','FPA16');
    set_option_vals.options[set_option_vals.options.length] = new Option('Exton','FPA24');
    set_option_vals.options[set_option_vals.options.length] = new Option('Homestead','843');
    set_option_vals.options[set_option_vals.options.length] = new Option('Langhorne','FPA21');
    set_option_vals.options[set_option_vals.options.length] = new Option('North Wales','FPA26');
    set_option_vals.options[set_option_vals.options.length] = new Option('Philadelphia (Franklin Mills Mall)','841');
    set_option_vals.options[set_option_vals.options.length] = new Option('Warrington (Doylestown)','FPA23');
    // set_option_vals.options[set_option_vals.options.length] = new Option('Wilkes-Barre','FPA15');
    set_option_vals.options[set_option_vals.options.length] = new Option('Wyomissing','FPA34');
    
}else if(state_val_set =="PR"){
    set_option_vals.options[set_option_vals.options.length] = new Option('Bayamon','FPR03');
    set_option_vals.options[set_option_vals.options.length] = new Option('Carolina','FPR04');
    set_option_vals.options[set_option_vals.options.length] = new Option('Guaynabo','FPR02');
    set_option_vals.options[set_option_vals.options.length] = new Option('Mayaguez','FPR07');
    set_option_vals.options[set_option_vals.options.length] = new Option('San Juan (Condado)','FPR06');
    set_option_vals.options[set_option_vals.options.length] = new Option('Santurce','FPR01');
    
}else if(state_val_set =="RI"){
    set_option_vals.options[set_option_vals.options.length] = new Option('Providence','402');
    set_option_vals.options[set_option_vals.options.length] = new Option('Smithfield','403');
    set_option_vals.options[set_option_vals.options.length] = new Option('Warwick','401');
    
}else if(state_val_set =="SC"){
    set_option_vals.options[set_option_vals.options.length] = new Option('Lexington','FSC10');
    set_option_vals.options[set_option_vals.options.length] = new Option('Myrtle Beach','FSC05');

}else if(state_val_set =="TN"){
   set_option_vals.options[set_option_vals.options.length] = new Option('Maryville','851');

}else if(state_val_set =="TX"){
   set_option_vals.options[set_option_vals.options.length] = new Option('Fort Worth','FTX02');
   //set_option_vals.options[set_option_vals.options.length] = new Option('Laredo','FTX10');

}else if(state_val_set =="VA"){
   set_option_vals.options[set_option_vals.options.length] = new Option('Alexandria','722');
   set_option_vals.options[set_option_vals.options.length] = new Option('Chester','FVA02');
   //set_option_vals.options[set_option_vals.options.length] = new Option('Fairfax','705');
   set_option_vals.options[set_option_vals.options.length] = new Option('Falls Church (Merrifield)-Gate House Plaza','719');
   //set_option_vals.options[set_option_vals.options.length] = new Option('Falls Church - Seven Corners Center','718');
   set_option_vals.options[set_option_vals.options.length] = new Option('Fredericksburg','733');
   set_option_vals.options[set_option_vals.options.length] = new Option('Gainesville','732');
   set_option_vals.options[set_option_vals.options.length] = new Option('Manassas','725');
   set_option_vals.options[set_option_vals.options.length] = new Option('Midlothian','FVA01');
   set_option_vals.options[set_option_vals.options.length] = new Option('Norfolk','710');
   set_option_vals.options[set_option_vals.options.length] = new Option('Prince George','FVA04');
   set_option_vals.options[set_option_vals.options.length] = new Option('Reston','703');
   set_option_vals.options[set_option_vals.options.length] = new Option('Richmond Airport','FVA03');
   set_option_vals.options[set_option_vals.options.length] = new Option('Sterling','724');
   set_option_vals.options[set_option_vals.options.length] = new Option('Tabb','716');
   set_option_vals.options[set_option_vals.options.length] = new Option('Virginia Beach (Lynnhaven Mall)','730');
   set_option_vals.options[set_option_vals.options.length] = new Option('Williamsburg','715');
   set_option_vals.options[set_option_vals.options.length] = new Option('Woodbridge (Prince William County)','712');

}else if(state_val_set =="VT"){
   set_option_vals.options[set_option_vals.options.length] = new Option('South Burlington','810');
	
}else if(state_val_set =="WI"){
	 set_option_vals.options[set_option_vals.options.length] = new Option('Appleton','FWI11');
     set_option_vals.options[set_option_vals.options.length] = new Option('Elm Grove (Milwaukee)','FWI01');
     set_option_vals.options[set_option_vals.options.length] = new Option('Lake Delton','FWI10');
     set_option_vals.options[set_option_vals.options.length] = new Option('Madison - Crossroads Dr.','FWI04');
     set_option_vals.options[set_option_vals.options.length] = new Option('Madison - Mineral Point Rd.','FWI03');
     set_option_vals.options[set_option_vals.options.length] = new Option('Madison - West Gorham St.','FWI02');
     set_option_vals.options[set_option_vals.options.length] = new Option('Menomonee Falls','FWI05');
     
}else if(state_val_set =="WV"){
	set_option_vals.options[set_option_vals.options.length] = new Option('Huntington','FWV09');
} 

	if(set_option_vals !=""){
		//display.innerHTML = "<select name='group' class='form_full'><option value=''></option>" + set_option_vals + "</select>";//
		//document.forms[0].group.value=document.forms[0].store.value;
		
		document.forms[0].group.value = document.getElementById("store").value;
	}

}


function run_country(form1){
	var country_value = form1.country.value;
	var country_orig = form1.country_hidden.value;

	if(country_value == country_orig){
			return true;
	}
	form1.submit();
} 

function pre_select(form1){
//alert(form1.location.options[3].value);

		for (var r = 0; r < 50; r++){
		
			if (r < 51 && form1.group.options[r].value =='11864'){
				form1.group.selectedIndex = r;
				r = 51;//end loop
			}  
		}
}

function validateRegistration(whichForm) {
	var form1 = document.forms[0];
	var ErrorMsg = "";
	var msg = "";
	var errorFirstName = document.getElementById("label_firstName");
	var errorLastName = document.getElementById("label_lastName");
	/*var errorAddress = document.getElementById("label_address");
	var errorCity = document.getElementById("label_city");
	var errorState = document.getElementById("label_state");*/
	// var error13years = document.getElementById("label_birthday");
	var errorZipCode = document.getElementById("label_zipCode");
	var errorEmail = document.getElementById("label_email");
	var errorBirthday = document.getElementById("label_birthday");
	var errorPassword = document.getElementById("label_password");
	var errorLocation = document.getElementById("label_location");
	// var errorFrequency = document.getElementById("label_frequency");
	var errorTop = document.getElementById("label_error1");
	var errorBottom = document.getElementById("label_error2");
	var store = document.getElementById("store");
	//var store = document.forms[0].store;
	var store_name = document.getElementById("store_name");
	var optin = "true";
	if (form1._chkOptout){
		if (form1._chkOptout.checked){
			optin = "false";
		}
	}
	
	//var emailFilter=/^.+@.+\..{2,3}$/;
	//var emailFilter=/^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z_-])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$/;
	var emailFilter= /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;                                                                                                    
	
	var zipFilter = /^\d{5}([\-]\d{4})?$/;
	var young = 0;
	var no_reset = 2;
	var hey_ok = 1;
    var flag = "true";

	errorFirstName.className="regFieldName";
	errorLastName.className="regFieldName";
	/* errorAddress.className="regFieldName";
	errorCity.className="regFieldName";
	errorState.className="regFieldName";
	*/
	// error13years.className="regFieldName";
	errorZipCode.className="regFieldName";
	errorEmail.className="regFieldName";
	if(errorBirthday){
		errorBirthday.className="regFieldName";
	}
	errorPassword.className="regFieldName";
	errorLocation.className="regFieldName";
	// errorFrequency.className="fieldNames";
	
	if(form1._txtFirstName.value== "" && optin=="true") {
		//ErrorMsg += "\n First Name";
		errorFirstName.className="regFieldNameError";
		flag="false";
	}
	
	if( form1._txtLastName.value== "" && optin=="true") {
		//ErrorMsg += "\n Last Name";
		errorLastName.className="regFieldNameError";
		flag="false";
	}
		
	if(!(emailFilter.test(form1._txtEmail.value))){
		//ErrorMsg += "\n Email Address";
		errorEmail.className="regFieldNameError";
		flag="false";
	}
	
	  /* if(form1._txtAddress.value== "" && optin=="true") {
		errorAddress.className="regFieldNameError";
		flag="false";
	  }
	  
	   if(form1._txtCity.value== "" && optin=="true") {
		errorCity.className="regFieldNameError";
		flag="false";
	   } */
	   
	   /*
	   if(form1._ddlState.selectedIndex == "0" && optin=="true") {
		errorState.className="regFieldNameError";
		flag="false";
	   }*/
	   
	// Added on May 26, 2009
	/* if(form1._chkYears.vallue == "" && optin == "true"){
		error13years.className="regFieldNameError";
		flag="false";
	}*/
	   
	if (optin != "true"){
		//do not validate zip
	}
    else if(form1._txtPostalCode.value== "") {
		//ErrorMsg += "\n ZIP";
		errorZipCode.className="regFieldNameError";
		flag="false";
	}else if (!zipFilter.test(form1._txtPostalCode.value)){
		errorZipCode.className="regFieldNameError";
		flag="false";
	}

   /* if(form1._ddlYear && optin=="true"){
		if(form1._ddlYear.selectedIndex ==0 || form1._ddlMonth.selectedIndex ==0 || form1._ddlDay.selectedIndex ==0){
			errorBirthday.className="regFieldNameError";
			flag="false";
		}
   } */
    if(form1._ddlYear && optin=="true"){
		if(form1._ddlMonth.selectedIndex ==0 || form1._ddlDay.selectedIndex ==0){
			errorBirthday.className="regFieldNameError";
			flag="false";
		}
   } 
	if(form1._txtPassword.value==''){
		//ErrorMsg += "\n Password";
		errorPassword.className="regFieldNameError";
		flag="false";
	}
	
	/*
	if(form1._ddlFrequency.selectedIndex == "0") {
		errorFrequency.className="regFieldNameError";
		flag="false";
	} */
	
	
	if(form1.state.value== "") {
		//ErrorMsg += "\n Select a state under \"Which Uno do you usually visit?\"";
		errorLocation.className="regFieldNameError";
		hey_ok = 2;
		flag="false";
	}

   if(hey_ok == 1 && form1.group.value== "") {
	   //ErrorMsg += "\n Select a location under \"Which Uno do you usually visit?\"";
	   errorLocation.className="regFieldNameError";
	   flag="false";
	}

	if(flag=="false"){
		//errorTop.style.display = "block";
	    //errorBottom.style.display = "block";
	    errorTop.innerHTML = "Please fill in or correct the required fields indicated in red.";
	    errorBottom.innerHTML = "Please fill in or correct the required fields indicated in red.";

	}else if(flag=="true"){
		store.value = form1.group.value;
		store_name.value = form1.group.options[form1.group.selectedIndex].text;
		form1.submit();
	}
}


//begin new functions
function forgotPassword(state){
	var forgotPasswordText1 = document.getElementById("update_text");
	var forgotPasswordText2 = document.getElementById("password_text");
	var passwordField = document.getElementById("password_field_row");
	var forgotPasswordOn = document.getElementById("forgotPassword_text_on");
	var forgotPasswordOff = document.getElementById("forgotPassword_text_off");
	var forgotPasswordMsg = document.getElementById("forgotPassword_text_msg");
	var userEmail = document.getElementById("label_email_user");
	var userPassword = document.getElementById("label_password_user");
	var errorUser = document.getElementById("user_error");
	var errorUserText = document.getElementById("user_error_text");


	var mode = document.forms[0].mode;
	 
	userEmail.className="regFieldNameUser"; // turns off any error display
	userPassword.className="regFieldNameUser";
	errorUser.className  = "tableRowOff";
	errorUserText.innerHTML = "";

	 
	if(state == "on"){
		forgotPasswordText1.className="tableRowOff";
		passwordField.className="tableRowOff";
		forgotPasswordOn.className="tableRowOff";
		forgotPasswordText2.className="tableRowOn";
		forgotPasswordOff.className="tableRowOn";
		mode.value="password";
	}else{
		forgotPasswordText1.className="tableRowOn";
		passwordField.className="tableRowOn";
		forgotPasswordOn.className="tableRowOn";
		  
		forgotPasswordText2.className="tableRowOff";
		forgotPasswordOff.className="tableRowOff";
		forgotPasswordMsg.classname="tableRowOff"
		mode.value="update";
	}
}

function validateUser(){
	//var emailFilter=/^.+@.+\..{2,3}$/;
	//var emailFilter=/^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z_-])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$/;
	var emailFilter= /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	var userEmail = document.forms[0]._txtLoginEmail;
	var userPassword = document.forms[0]._txtLoginPassword;
	var mode = document.forms[0].mode;
	var errorUser = document.getElementById("user_error");
	var errorUserText = document.getElementById("user_error_text");
	var errorEmailUser = document.getElementById("label_email_user");
	var errorPasswordUser = document.getElementById("label_password_user");
	var forgotPasswordMsg = document.getElementById("forgotPassword_text_msg");
	 
	var flag1= "false";
	var flag2 = "false";
	errorEmailUser.className="regFieldNameUser";
	errorUser.className  = "tableRowOff";
	errorUserText.innerHTML = "";
   
	if(!(emailFilter.test(document.forms[0]._txtLoginEmail.value))){
		errorEmailUser.className="regFieldNameUserError";
		errorUserText.innerHTML += "Please enter a valid email address.<br/>";
		errorUser.className  = "tableRowOn";
		
	}else{
		flag1 = "true";
	}

	if(mode.value=="update" || mode.value=="unsubscribe" ){
		if(userPassword.value==""){
		errorPasswordUser.className="regFieldNameUserError";
		errorUser.className  = "tableRowOn";
		errorUserText.innerHTML += "Please enter a valid password.<br/>";
		}else {
			flag2 = "true";
		}
		
	}else {
		flag2 = "true";
	}

	if(flag1 == "true" && flag2 == "true"){
	 
		document.forms[0].submit();
		//forgotPassword('off');
		//forgotPasswordMsg.classname="tableRowOn";
		return true;
	}
	else
	{
		return false;
	}
}

function setMode(which){  //set the mode on the onfocus event of "email address" for the user update section or "first name" for registration

	var mode = document.forms[0].mode;
	if(which == "user" && mode.value != "password" && mode.value != "unsubscribe"){
		mode.value = "update";
	}
 
	if(which == 'register'){
		mode.value = "register";
	}
	
	if(which == 'unsubscribe'){
		var passwordField = document.getElementById("password_field_row");
		passwordField.className="tableRowOn";
		mode.value = "unsubscribe";
	}
}

function doSubmit(whichForm){
	var form = document.forms[0];
	var mode = document.forms[0].mode;
	var forgotPasswordMsg = document.getElementById("forgotPassword_text_msg");
	var userEmail = form._txtLoginEmail;
	var userPassword = form._txtLoginPassword;

	if(whichForm == "user"){
		setMode('user');
		if(mode.value == "password" || mode.value == "update" || mode.value == "unsubscribe"){
			return validateUser();
		}
	}else if(whichForm == "unsubscribe"){
		setMode('unsubscribe');
		validateUser();
		
	}else {
		//form.action="regconfirmation.aspx";
		mode.value="register";
		userEmail.value="";
		userPassword.value="";
		validateRegistration();
	}
}

function doSubmitReferrals(){
	var blnValidation = true;
	// var emailFilter=/^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z_-])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$/;
	var emailFilter= /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	var msgFilter  = /^[\s\S]{0,255}$/; 
	var name, email;
	var errorRow, errorCell;
	var form1 = document.forms[0];
	var myCount = 0;
	var referralMsg = document.getElementById("_referralMessage");
	var mode = document.forms[0].mode;
	
    for (var i = 1; i <=4; i++){
		name = document.getElementById("_txtName" + i);
		email = document.getElementById("_txtEmail" + i);
		errorRow = document.getElementById("referralErrorRow" + i);
		errorCell = document.getElementById("referralErrorCell" + i);
		
		errorRow.className = "tableRowOff";
		errorCell.innerHTML = "";
		
		if(name.value == "" && email.value==""){
			//do nothing
		}else if (name.value == "" || email.value=="") {
			errorRow.className = "tableRowOn";
			errorCell.innerHTML = "Please enter both name and email address";
			blnValidation = false;
		}else {
			if(!(emailFilter.test(email.value))){
				errorRow.className = "tableRowOn";
				errorCell.innerHTML = "Please enter a valid email address";
				blnValidation = false;
			}
			else {
				myCount = myCount +1;
			}
		}
	}
	
	//valdate referral message
	if (msgFilter.test(referralMsg.value)==false) {
		blnValidation = false;
		document.getElementById("referralErrorRow5").className = "tableRowOn";
		document.getElementById("referralErrorCell5").innerHTML = "The message can not exceed 255 characters";
	}
	
	if(blnValidation == true){
	
		if (myCount>0) {
			mode.value = "";
			form1.submit();
		}
		else {
			document.getElementById("referralErrorRow1").className = "tableRowOn";
			document.getElementById("referralErrorCell1").innerHTML = "Please enter at least one name and email address";
		}
	}
}

function showReason(){
	var reasonRow = document.getElementById("removeReasonRow");
	var reason = document.getElementById("_chkOptout");
	var otherReasonRow = document.getElementById('otherReasonRow');
	 
	if(reason.checked == 0){
		reasonRow.className = "tableRowOff";
		otherReasonRow.className = "tableRowOff";
	}else{
		reasonRow.className = "tableRowOn";
		otherReasonUpdate();
	}
}

function EnterSweepstakes(){
	var mode = document.forms[0].mode;
	var form1 = document.forms[0];
	mode.value = "sweepstakes";
	form1.submit();
}

function ToolSubmit(){

	var errorMsg = "";
	var msg = "You must enter valid entries in the following fields:\n\n";
	// var emailFilter=/^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z_-])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$/;
	var emailFilter= /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	var email;
	var form1 = document.forms[0];
	var myCount = 0;
	var hey_ok = 1;
	//var managerEmail = document.getElementById("manager_eemail");
	var store = document.getElementById("store");
	var store_name = document.getElementById("store_name");
	
    for (var i = 1; i <=10; i++){
		email = document.getElementById("_txtEmailAddr" + i);
		if(email.value != ""){
			if(!(emailFilter.test(email.value))){
				errorMsg = errorMsg + "Email address " + i +" is invalid\n";
			}
			else {
				myCount = myCount +1;
			}
		}
	}
	
	if(form1.state.value== "") {
		errorMsg += "Please select a state.\n";
		hey_ok = 2;
	}

	if(hey_ok == 1 && form1.group.value== "") {
	   errorMsg += "Please select a location.\n";
	}
	
	
	
	if (errorMsg!= ""){
		errorMsg = msg + errorMsg;
		alert(errorMsg);
	}
	else if (myCount==0){
		errorMsg = msg + "Please enter the Email Address of at least one person to refer.";
		alert(errorMsg);
		
	}else{
		store.value = form1.group.value;
		store_name.value = form1.group.options[form1.group.selectedIndex].text;
		form1.submit();
	}
}


function makeDaysOfMonth(){
  var i = 0;
  this[i++] = 0; // dummy
  this[i++] = 31;
  this[i++] = 29;
  this[i++] = 31;
  this[i++] = 30;
  this[i++] = 31;
  this[i++] = 30;
  this[i++] = 31;
  this[i++] = 31;
  this[i++] = 30;
  this[i++] = 31;
  this[i++] = 30;
  this[i  ] = 31;
  this.length = i;
}

function calcAge(dd, mm, yyyy){
  	var t, mon, day, year, DD, MM, YY, age;
  	var MTB = new makeDaysOfMonth();
  	YY   = parseInt(yyyy);	// year of birth (4 digits)
  	MM   = parseInt(mm);	// month of birth (1-12)
  	DD   = parseInt(dd);	// date of birth (1-31)

  	if (MTB[MM] < DD || DD < 1) return -1;
  	t = new Date();	// get current date
  	year = t.getFullYear();		// get year of current
  	mon  = t.getMonth() + 1;	// get month of current
  	day  = t.getDate();		// get date of current
  	if (MM == 2 && DD == 29){	// check leap year
    		if (!(((YY % 4 == 0) && (YY % 100 != 0)) || (YY % 400 == 0))){
      			return -1;
    		}
 	 }
  	age = year - YY;
  	if ((MM > mon) || (MM == mon && day < DD)) age --;

  	return age;
}

function openInstructions(){
  window.open('http://tools.89degrees.com/antispam/index.asp?app=unos','antispam','width=300,height=400,toolbar=no,menubar=no,scrollbars=no,resizable=yes,location=no,directories=no,status=no,titlebar=0,');
}

// for optin and profile update if user selects 'other' from list
function otherReason(){
obj = document.getElementById('_ddlOptoutReason');
reasonRow = document.getElementById('otherReasonRow');
if(obj.selectedIndex == 5){
 reasonRow.style.display='block';
}else{
 reasonRow.style.display='none';
}
}

function otherReasonUpdate(){
	obj = document.getElementById('_ddlReason');
	reasonRow = document.getElementById('otherReasonRow');
	if(obj.selectedIndex == 5){
		reasonRow.className = "tableRowOn";
	}else{
		reasonRow.className = "tableRowOff";
	}
}

