// Region cache object
function RegionObj(idx, val, url, regType, id) {
this.idx = idx;
this.val = val;
this.url = url;
this.regType = regType;
this.id = id;
this.getOptionText = function(selectedId, padSubRegion) {
var returnOption = "";
return returnOption;
}
}
var globalRegionList = new Array();
var count = 0;
globalRegionList[0]=new RegionObj(0, 'Alabama', 'alabama', 'region', '821');
globalRegionList[1]=new RegionObj(1, 'Alaska', 'alaska', 'region', '822');
globalRegionList[2]=new RegionObj(2, 'Colorado Springs', 'colorado_springs', 'region', '1688');
globalRegionList[3]=new RegionObj(3, 'All Regions', 'all_regions', 'region', '1953');
globalRegionList[4]=new RegionObj(4, 'Antigua & Barbuda', 'antigua_and_barbuda', 'region', '3262');
globalRegionList[5]=new RegionObj(5, 'British Virgin Islands', 'british_virgin_islands_3265', 'region', '3265');
globalRegionList[6]=new RegionObj(6, 'Dominican Republic', 'dominican_republic_3268', 'region', '3268');
globalRegionList[7]=new RegionObj(7, 'Jamaica', 'jamaica_3270', 'region', '3270');
globalRegionList[8]=new RegionObj(8, 'St Vincent & the Grenadines', 'st_vincent_and_grenadines', 'region', '3279');
globalRegionList[9]=new RegionObj(9, 'Curacao', 'curacao', 'region', '3281');
globalRegionList[10]=new RegionObj(10, 'All Others', 'all_others', 'region', '3188');
globalRegionList[11]=new RegionObj(11, 'Andros', 'andros', 'region', '3182');
globalRegionList[12]=new RegionObj(12, 'Arizona', 'arizona', 'region', '823');
globalRegionList[13]=new RegionObj(13, 'Arkansas', 'arkansas', 'region', '824');
globalRegionList[14]=new RegionObj(14, 'Atlanta', 'atlanta', 'region', '834');
globalRegionList[15]=new RegionObj(15, 'Berkshires & Western Massachusetts', 'berkshires_western_massachusetts', 'region', '1937');
globalRegionList[16]=new RegionObj(16, 'Big Island', 'big_island_3080', 'region', '3080');
globalRegionList[17]=new RegionObj(17, 'Boston', 'boston', 'region', '845');
globalRegionList[18]=new RegionObj(18, 'Berkshires & Western Massachusetts', 'berkshires_western_massachusetts', 'subregion', '1937');
globalRegionList[19]=new RegionObj(19, 'California', 'california', 'region', '1924');
globalRegionList[20]=new RegionObj(20, 'Northern California', 'northern_california', 'subregion', '825');
globalRegionList[21]=new RegionObj(21, 'California Central Coast', 'california_central_coast', 'subregion', '3364');
globalRegionList[22]=new RegionObj(22, 'California Wine Country', 'california_wine_country', 'subregion', '3542');
globalRegionList[23]=new RegionObj(23, 'San Francisco Bay Area', 'california_san_francisco', 'subregion', '3512');
globalRegionList[24]=new RegionObj(24, 'Southern California', 'southern_california', 'subregion', '827');
globalRegionList[25]=new RegionObj(25, 'Canada', 'canada', 'region', '828');
globalRegionList[26]=new RegionObj(26, 'Cape Cod & Islands', 'cape_cod_islands', 'region', '1940');
globalRegionList[27]=new RegionObj(27, 'Caribbean', 'caribbean', 'region', '3260');
globalRegionList[28]=new RegionObj(28, 'Mexican Caribbean', 'mexican_caribbean', 'subregion', '3282');
globalRegionList[29]=new RegionObj(29, 'British Virgin Islands', 'british_virgin_islands_3265', 'subregion', '3265');
globalRegionList[30]=new RegionObj(30, 'Dominican Republic', 'dominican_republic_3268', 'subregion', '3268');
globalRegionList[31]=new RegionObj(31, 'Jamaica', 'jamaica_3270', 'subregion', '3270');
globalRegionList[32]=new RegionObj(32, 'St Lucia', 'st_lucia_3275', 'subregion', '3275');
globalRegionList[33]=new RegionObj(33, 'St Vincent & the Grenadines', 'st_vincent_and_grenadines', 'subregion', '3279');
globalRegionList[34]=new RegionObj(34, 'Curacao', 'curacao', 'subregion', '3281');
globalRegionList[35]=new RegionObj(35, 'Antigua & Barbuda', 'antigua_and_barbuda', 'subregion', '3262');
globalRegionList[36]=new RegionObj(36, 'California Central Coast', 'california_central_coast', 'region', '3364');
globalRegionList[37]=new RegionObj(37, 'Cayman Islands', 'cayman_islands', 'region', '1267');
globalRegionList[38]=new RegionObj(38, 'Central New Jersey', 'central_new_jersey', 'region', '1943');
globalRegionList[39]=new RegionObj(39, 'Central, West Texas', 'central_west_texas', 'region', '871');
globalRegionList[40]=new RegionObj(40, 'Colorado', 'colorado', 'region', '829');
globalRegionList[41]=new RegionObj(41, 'Colorado Springs', 'colorado_springs', 'subregion', '1688');
globalRegionList[42]=new RegionObj(42, 'Denver Metro', 'denver_metro', 'subregion', '1687');
globalRegionList[43]=new RegionObj(43, 'Northern Colorado', 'northern_colorado', 'subregion', '1689');
globalRegionList[44]=new RegionObj(44, 'Colorado Mountains', 'colorado_mountains', 'subregion', '1691');
globalRegionList[45]=new RegionObj(45, 'Connecticut', 'connecticut', 'region', '830');
globalRegionList[46]=new RegionObj(46, 'Dallas, Ft. Worth, North Texas', 'dallas_ftworth', 'region', '872');
globalRegionList[47]=new RegionObj(47, 'Denver Metro', 'denver_metro', 'region', '1687');
globalRegionList[48]=new RegionObj(48, 'Delaware', 'delaware', 'region', '831');
globalRegionList[49]=new RegionObj(49, 'Exumas', 'exumas', 'region', '3181');
globalRegionList[50]=new RegionObj(50, 'Florida', 'florida', 'region', '832');
globalRegionList[51]=new RegionObj(51, 'Georgia', 'georgia', 'region', '833');
globalRegionList[52]=new RegionObj(52, 'Atlanta', 'atlanta', 'subregion', '834');
globalRegionList[53]=new RegionObj(53, 'Grand Bahama Island', 'grand_bahama_island', 'region', '3179');
globalRegionList[54]=new RegionObj(54, 'Hawaii', 'hawaii', 'region', '835');
globalRegionList[55]=new RegionObj(55, 'Oahu', 'oahu_3079', 'subregion', '3079');
globalRegionList[56]=new RegionObj(56, 'Maui, Lanai and Molokai', 'maui_lanai_molokai', 'subregion', '3383');
globalRegionList[57]=new RegionObj(57, 'Kauai', 'kauai', 'subregion', '3082');
globalRegionList[58]=new RegionObj(58, 'Big Island', 'big_island_3080', 'subregion', '3080');
globalRegionList[59]=new RegionObj(59, 'Northern Colorado', 'northern_colorado', 'region', '1689');
globalRegionList[60]=new RegionObj(60, 'Houston, East, South Texas', 'houston', 'region', '870');
globalRegionList[61]=new RegionObj(61, 'Idaho', 'idaho', 'region', '836');
globalRegionList[62]=new RegionObj(62, 'Illinois/Chicago', 'illinois_chicago', 'region', '837');
globalRegionList[63]=new RegionObj(63, 'Indiana', 'indiana', 'region', '838');
globalRegionList[64]=new RegionObj(64, 'Iowa', 'iowa', 'region', '839');
globalRegionList[65]=new RegionObj(65, 'Kansas', 'kansas', 'region', '840');
globalRegionList[66]=new RegionObj(66, 'Kauai', 'kauai', 'region', '3082');
globalRegionList[67]=new RegionObj(67, 'Kentucky', 'kentucky', 'region', '841');
globalRegionList[68]=new RegionObj(68, 'Long Island', 'long_island', 'region', '856');
globalRegionList[69]=new RegionObj(69, 'Louisiana', 'louisiana', 'region', '842');
globalRegionList[70]=new RegionObj(70, 'Maine', 'maine', 'region', '843');
globalRegionList[71]=new RegionObj(71, 'Maryland', 'maryland', 'region', '844');
globalRegionList[72]=new RegionObj(72, 'Maui, Lanai and Molokai', 'maui_lanai_molokai', 'region', '3383');
globalRegionList[73]=new RegionObj(73, 'Massachusetts', 'massachusetts', 'region', '1746');
globalRegionList[74]=new RegionObj(74, 'Boston', 'boston', 'subregion', '845');
globalRegionList[75]=new RegionObj(75, 'Cape Cod & Islands', 'cape_cod_islands', 'subregion', '1940');
globalRegionList[76]=new RegionObj(76, 'Berkshires & Western Massachusetts', 'berkshires_western_massachusetts', 'subregion', '1937');
globalRegionList[77]=new RegionObj(77, 'Michigan', 'michigan', 'region', '846');
globalRegionList[78]=new RegionObj(78, 'Minnesota', 'minnesota', 'region', '847');
globalRegionList[79]=new RegionObj(79, 'Mississippi', 'mississippi', 'region', '848');
globalRegionList[80]=new RegionObj(80, 'Missouri', 'missouri', 'region', '849');
globalRegionList[81]=new RegionObj(81, 'Colorado Mountains', 'colorado_mountains', 'region', '1691');
globalRegionList[82]=new RegionObj(82, 'Montana', 'montana', 'region', '850');
globalRegionList[83]=new RegionObj(83, 'Nebraska', 'nebraska', 'region', '851');
globalRegionList[84]=new RegionObj(84, 'Nevada', 'nevada', 'region', '852');
globalRegionList[85]=new RegionObj(85, 'Las Vegas', 'las_vegas_3368', 'subregion', '3368');
globalRegionList[86]=new RegionObj(86, 'New Hampshire', 'new_hampshire', 'region', '853');
globalRegionList[87]=new RegionObj(87, 'New Jersey Shore Points', 'shore_points', 'region', '1773');
globalRegionList[88]=new RegionObj(88, 'New Jersey', 'new_jersey', 'region', '1669');
globalRegionList[89]=new RegionObj(89, 'Central New Jersey', 'central_new_jersey', 'subregion', '1943');
globalRegionList[90]=new RegionObj(90, 'Northern New Jersey', 'northern_new_jersey', 'subregion', '1942');
globalRegionList[91]=new RegionObj(91, 'Southern New Jersey', 'southern_shore_new_jersey', 'subregion', '854');
globalRegionList[92]=new RegionObj(92, 'New Jersey Shore Points', 'shore_points', 'subregion', '1773');
globalRegionList[93]=new RegionObj(93, 'New Mexico', 'new_mexico', 'region', '855');
globalRegionList[94]=new RegionObj(94, 'New York', 'new_york', 'region', '1750');
globalRegionList[95]=new RegionObj(95, 'Long Island', 'long_island', 'subregion', '856');
globalRegionList[96]=new RegionObj(96, 'Upstate and Hudson Valley', 'upstate_hudson_valley', 'subregion', '3376');
globalRegionList[97]=new RegionObj(97, 'New York City & Metro Area', 'new_york_metro', 'subregion', '857');
globalRegionList[98]=new RegionObj(98, 'Westchester/Rockland', 'westchester_rockland', 'subregion', '858');
globalRegionList[99]=new RegionObj(99, 'New York City & Metro Area', 'new_york_metro', 'region', '857');
globalRegionList[100]=new RegionObj(100, 'North Carolina', 'north_carolina', 'region', '859');
globalRegionList[101]=new RegionObj(101, 'North Dakota', 'north_dakota', 'region', '860');
globalRegionList[102]=new RegionObj(102, 'Northeast Pennsylvania', 'northeast_pennsylvania', 'region', '1739');
globalRegionList[103]=new RegionObj(103, 'Western Pennsylvania', 'western_pennsylvania', 'region', '3540');
globalRegionList[104]=new RegionObj(104, 'Central Pennsylvania', 'central_pennsylvania', 'region', '3543');
globalRegionList[105]=new RegionObj(105, 'Northern California', 'northern_california', 'region', '825');
globalRegionList[106]=new RegionObj(106, 'Northern New Jersey', 'northern_new_jersey', 'region', '1942');
globalRegionList[107]=new RegionObj(107, 'Oahu', 'oahu_3079', 'region', '3079');
globalRegionList[108]=new RegionObj(108, 'Ohio', 'ohio', 'region', '861');
globalRegionList[109]=new RegionObj(109, 'Oklahoma', 'oklahoma', 'region', '862');
globalRegionList[110]=new RegionObj(110, 'Oregon', 'oregon', 'region', '863');
globalRegionList[111]=new RegionObj(111, 'Pennsylvania', 'pennsylvania', 'region', '1748');
globalRegionList[112]=new RegionObj(112, 'Northeast Pennsylvania', 'northeast_pennsylvania', 'subregion', '1739');
globalRegionList[113]=new RegionObj(113, 'Central Pennsylvania', 'central_pennsylvania', 'subregion', '3543');
globalRegionList[114]=new RegionObj(114, 'Western Pennsylvania', 'western_pennsylvania', 'subregion', '3540');
globalRegionList[115]=new RegionObj(115, 'Philadelphia', 'philadelphia', 'subregion', '865');
globalRegionList[116]=new RegionObj(116, 'Philadelphia', 'philadelphia', 'region', '865');
globalRegionList[117]=new RegionObj(117, 'Rhode Island', 'rhode_island', 'region', '866');
globalRegionList[118]=new RegionObj(118, 'South Carolina', 'south_carolina', 'region', '867');
globalRegionList[119]=new RegionObj(119, 'South Dakota', 'south_dakota', 'region', '868');
globalRegionList[120]=new RegionObj(120, 'Southern California', 'southern_california', 'region', '827');
globalRegionList[121]=new RegionObj(121, 'San Francisco Bay Area', 'california_san_francisco', 'region', '3512');
globalRegionList[122]=new RegionObj(122, 'Southern New Jersey', 'southern_shore_new_jersey', 'region', '854');
globalRegionList[123]=new RegionObj(123, 'Tennessee', 'tennessee', 'region', '869');
globalRegionList[124]=new RegionObj(124, 'The Islands of the Bahamas', 'islands_of_the_bahamas', 'region', '3178');
globalRegionList[125]=new RegionObj(125, 'Grand Bahama Island', 'grand_bahama_island', 'subregion', '3179');
globalRegionList[126]=new RegionObj(126, 'Nassau', 'nassau', 'subregion', '3180');
globalRegionList[127]=new RegionObj(127, 'All Others', 'all_others', 'subregion', '3188');
globalRegionList[128]=new RegionObj(128, 'Andros', 'andros', 'subregion', '3182');
globalRegionList[129]=new RegionObj(129, 'Exumas', 'exumas', 'subregion', '3181');
globalRegionList[130]=new RegionObj(130, 'Texas', 'texas', 'region', '1747');
globalRegionList[131]=new RegionObj(131, 'Central, West Texas', 'central_west_texas', 'subregion', '871');
globalRegionList[132]=new RegionObj(132, 'Dallas, Ft. Worth, North Texas', 'dallas_ftworth', 'subregion', '872');
globalRegionList[133]=new RegionObj(133, 'Houston, East, South Texas', 'houston', 'subregion', '870');
globalRegionList[134]=new RegionObj(134, 'Utah', 'utah', 'region', '873');
globalRegionList[135]=new RegionObj(135, 'Upstate and Hudson Valley', 'upstate_hudson_valley', 'region', '3376');
globalRegionList[136]=new RegionObj(136, 'Vermont', 'vermont', 'region', '874');
globalRegionList[137]=new RegionObj(137, 'Virginia', 'virginia', 'region', '875');
globalRegionList[138]=new RegionObj(138, 'Washington', 'washington_state', 'region', '877');
globalRegionList[139]=new RegionObj(139, 'Washington, D.C.', 'washington_dc', 'region', '876');
globalRegionList[140]=new RegionObj(140, 'West Virginia', 'west_virginia', 'region', '878');
globalRegionList[141]=new RegionObj(141, 'Westchester/Rockland', 'westchester_rockland', 'region', '858');
globalRegionList[142]=new RegionObj(142, 'Wisconsin', 'wisconsin', 'region', '879');
globalRegionList[143]=new RegionObj(143, 'Wyoming', 'wyoming', 'region', '880');
globalRegionList[144]=new RegionObj(144, 'Nassau', 'nassau', 'region', '3180');
// ******************************************
// Region Object
// ******************************************
function Region(){
var DEFAULT_HOME_LOCATION = 'N';
var DEFAULT_WEDDING_LOCATION = 'N';
var DEFAULT_COUNT = 0;
var DEFAULT_LAST_VISIT = 0;
var DEFAULT_OVERRIDE = 'N';
var idx = -1;
var name = 'national';
var link = 'national';
var homeLocation = DEFAULT_HOME_LOCATION;
var weddingLocation = DEFAULT_WEDDING_LOCATION;
var lastVisit = DEFAULT_LAST_VISIT;
var count = DEFAULT_COUNT;
var override = DEFAULT_OVERRIDE;
this.setIdx = setIdx;
this.setName = setName;
this.setLink = setLink;
this.setHomeLocation = setHomeLocation;
this.setWeddingLocation = setWeddingLocation;
this.setLastVisit = setLastVisit;
this.setCount = setCount;
this.setOverride = setOverride;
this.getIdx = getIdx;
this.getName = getName;
this.getLink = getLink;
this.getHomeLocation = getHomeLocation;
this.getWeddingLocation = getWeddingLocation;
this.getLastVisit = getLastVisit;
this.getCount = getCount;
this.getOverride = getOverride;
this.toString = toString;
this.isDefaultValue = isDefaultValue;
function setIdx(myIdx) {
idx = myIdx;
}
function setName(myName){
name = myName;
}
function setLink(myLink){
link = myLink;
}
function setHomeLocation(myHomeLocation){
homeLocation = myHomeLocation;
}
function setWeddingLocation(myWeddingLocation){
weddingLocation = myWeddingLocation;
}
function setLastVisit(myLastVisit){
lastVisit = myLastVisit;
}
function setCount(myCount){
count = myCount;
}
function setOverride(myOverride){
override = myOverride;
}
function getIdx() {
return idx;
}
function getName(){
return name;
}
function getLink(){
return link;
}
function getHomeLocation(){
return homeLocation;
}
function getWeddingLocation(){
return weddingLocation;
}
function getLastVisit(){
return lastVisit;
}
function getCount(){
return count;
}
function getOverride(){
return override;
}
function toString(){
return (idx + "|" + homeLocation + "|" + weddingLocation + "|" + count + "|" + lastVisit + "|" + override);
}
function isDefaultValue() {
if (homeLocation == DEFAULT_HOME_LOCATION && weddingLocation == DEFAULT_WEDDING_LOCATION && lastVisit == DEFAULT_LAST_VISIT && count == DEFAULT_COUNT && override == DEFAULT_OVERRIDE) {
return true;
} else {
return false;
}
}
}
/* ** END Region Object ** */
/* ****************************************** */
// RegionManager Object
// pduey: my dream, my vision, my hope is that the RegionManager object
// can be marshalled between the client and the server via DWR. Then, the server-side
// version of this object could be serialized and persisted in the User table. The server-side
// version would need to include versions of at least some of the methods here.
// the shortcut to that is to just persist the cookie itself on the server.
/* ****************************************** */
// ikk modified to singleton
sRegionManager = new function(){
var regionArray;
this.setRegionArray = setRegionArray;
this.getRegionArray = getRegionArray;
this.toString = toString;
this.findHomeLocation = findHomeLocation;
this.findWeddingLocation = findWeddingLocation;
this.findPopularLocation = findPopularLocation;
this.findLastVisit = findLastVisit;
this.findOverrideLocation = findOverrideLocation;
this.updateHomeLocation = updateHomeLocation;
this.updateWeddingLocation = updateWeddingLocation;
this.updateCount = updateCount;
this.updateLastVisit = updateLastVisit;
this.updateOverrideLocation = updateOverrideLocation;
this.findRelevantLocations = findRelevantLocations;
this.findSectionLocation = findSectionLocation;
function setRegionArray(myRegionArray){
regionArray = myRegionArray;
}
function getRegionArray(){
return regionArray;
}
// finders
function findHomeLocation(){
for(var i=0;i maxR.getLastVisit()){
maxR = r;
}
}
}
if (eval(maxR.getLastVisit()) && (maxR.getName()=='Western Slope'||maxR.getName()=='Greater Boulder')){
maxR.setLink("northern_colorado");
maxR.setName("Northern Colorado");
}
return maxR;
}
function findPopularLocation(){
var max = 0;
var maxR = new Region();
for(var i=0;iparseInt(max)){
maxR = r;
max = r.getCount();
}
}
return maxR;
}
function findOverrideLocation(){
for(var i=0;i -1) {
region.setIdx(thisIdx);
region.setName(globalRegionList[thisIdx].val);
region.setLink(globalRegionList[thisIdx].url);
region.setHomeLocation(regionSplit[1]);
region.setWeddingLocation(regionSplit[2]);
region.setCount(regionSplit[3]);
region.setLastVisit(regionSplit[4]);
region.setOverride(regionSplit[5]);
rmArray[rmArray.length] = region;
} else {
return sRegionManager;
}
}
sRegionManager.setRegionArray(rmArray);
}
return sRegionManager;
}
// ******************************************
// Localize Object
// ******************************************
sLocalize = new function(){
var me = this;
var thisRegionManager;
var topicMapping;
function setRegionManager(myRegionManager){
thisRegionManager = myRegionManager;
}
function getRegionManager(){
return thisRegionManager;
}
function setTopicMapping(myTopicMapping){
topicMapping = myTopicMapping;
}
function getTopicMapping(){
return topicMapping;
}
function selfUpdate(){
setCookie('localCookie', thisRegionManager.toString(),365);
}
this.setRegionManager = setRegionManager;
this.getRegionManager = getRegionManager;
this.setTopicMapping = setTopicMapping;
this.getTopicMapping = getTopicMapping;
this.selfUpdate = selfUpdate;
function init(){
setTopicMapping(new TopicMapping());
if (parsedLocalRegionManagerCookie == null) {
parsedLocalRegionManagerCookie = parseRegionManagerCookie('localCookie');
}
setRegionManager(parsedLocalRegionManagerCookie);
var reqRegion = getRegionFromUrl();
if ( reqRegion != null ){
thisRegionManager.updateCount(reqRegion);
thisRegionManager.updateLastVisit(reqRegion);
}
selfUpdate();
}
init();
}
// ** END Localization Object **
// ******************************************
// Cookie Tools
// ******************************************
/**
* Sets a Cookie with the given name and value.
*
* name Name of the cookie
* value Value of the cookie
* [expires] Expiration date of the cookie (default: end of current session)
* [path] Path where the cookie is valid (default: path of calling document)
* [domain] Domain where the cookie is valid
* (default: domain of calling document)
* [secure] Boolean value indicating if the cookie transmission requires a
* secure transmission
*/
function setCookie(name, value, expires, path, domain, secure) {
var today = new Date();
today.setTime( today.getTime() );
if ( expires ){
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );
path="/";
document.cookie= name + "=" + escape(value) +
((expires) ? "; expires=" + expires_date.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
/**
* Gets the value of the specified cookie.
*
* name Name of the desired cookie.
*
* Returns a string containing value of specified cookie,
* or null if cookie does not exist.
*/
function getCookie(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
} else {
begin += 2;
}
var end = document.cookie.indexOf(";", begin);
if (end == -1) {
end = dc.length;
}
return unescape(dc.substring(begin + prefix.length, end));
}
/**
* Deletes the specified cookie.
*
* name name of the cookie
* [path] path of the cookie (must be same as path used to create cookie)
* [domain] domain of the cookie (must be same as domain used to create cookie)
*/
function deleteCookie(name, path, domain) {
if (getCookie(name)) {
document.cookie = name + "=" +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}
// ** END Cookie t