/* SELECTS URL HASHMAP */
var offerArray = new Array();

offerArray['SeeAllHome'] = "http://www.americanexpressofferzone.com/selects/adtracking.aspx?adtrack=Travel_Auction_Selects_HomePage_3_16_2006";

offerArray['offer1'] = 'http://www.americanexpressofferzone.com/selects/OfferDetail.aspx?oid=48694&cntry=us&lang=en&issuer=MLMC';
offerArray['offer2'] = 'http://www.americanexpressofferzone.com/selects/OfferDetail.aspx?oid=49006&cntry=us&lang=en&issuer=MLMC';
offerArray['offer3'] = 'http://www.americanexpressofferzone.com/selects/OfferDetail.aspx?oid=50299&cntry=us&lang=en&issuer=MLMC';
offerArray['offer4'] = 'http://www.americanexpressofferzone.com/selects/OfferDetail.aspx?oid=50075&cntry=us&lang=en&issuer=MLMC';
offerArray['offer5'] = 'http://www.americanexpressofferzone.com/selects/OfferDetail.aspx?cntry=us&lang=en&issuer=MLMC&oid=53650';
offerArray['offer6'] = 'http://www.americanexpressofferzone.com/selects/OfferDetail.aspx?oid=48612&cntry=us&lang=en&issuer=MLMC';
offerArray['offer7'] = 'http://www.americanexpressofferzone.com/selects/OfferDetail.aspx?oid=26668&cntry=us&lang=en&issuer=MLMC';
offerArray['offer8'] = 'http://www.americanexpressofferzone.com/selects/OfferDetail.aspx?oid=45978&cntry=us&lang=en&issuer=MLMC';
offerArray['offer9'] = 'http://www.americanexpressofferzone.com/selects/OfferDetail.aspx?oid=48917&cntry=us&lang=en&issuer=MLMC';
offerArray['offer10'] = 'http://www.americanexpressofferzone.com/selects/OfferDetail.aspx?oid=53846&cntry=us&lang=en&issuer=MLMC';
offerArray['offer11'] = 'http://www.americanexpressofferzone.com/selects/OfferDetail.aspx?oid=50215&cntry=us&lang=en&issuer=MLMC'; /* can we delete? dupe, probably not used - pdowning */
offerArray['offer12'] = 'http://www.americanexpressofferzone.com/selects/OfferDetail.aspx?oid=48917&cntry=us&lang=en&issuer=MLMC';
offerArray['offer13'] = 'http://offers.amexnetwork.com/selects/us/grid?categoryPath=/amexnetwork/category/Shopping&issuerName=us_amexnetworkdefault&offerId=bba4ab985955a110VgnVCM2000001b45640aRCRD'; // more - Brookstone
offerArray['offer14'] = 'http://www.americanexpressofferzone.com/selects/OfferDetail.aspx?oid=48917&searchtype=keyword&countrycd=us&searchfor=preferred%20golf';
offerArray['offer15'] = 'http://www.americanexpressofferzone.com/selects/OfferDetail.aspx?oid=53543&searchtype=keyword&countrycd=us&searchfor=skymall';
offerArray['offer16'] = 'http://www.americanexpressofferzone.com/selects/OfferDetail.aspx?oid=53901&searchtype=keyword&countrycd=us&searchfor=delta';
offerArray['offer17'] = 'http://www.americanexpressofferzone.com/selects/OfferDetail.aspx?oid=51597&searchtype=keyword&countrycd=us&searchfor=hertz';
offerArray['offer18'] = 'http://www.americanexpressofferzone.com/selects/OfferDetail.aspx?oid=55580&searchtype=basic&ctgryid=221&countrycd=us&regid=0&ctlgid=0';
offerArray['offer19'] = 'http://www.americanexpressofferzone.com/selects/OfferDetail.aspx?oid=31858&searchtype=category&ctgryid=211&countrycd=us';
offerArray['offer20'] = 'http://www.americanexpressofferzone.com/selects/OfferDetail.aspx?oid=48508&searchtype=keyword&countrycd=us&searchfor=ross';
offerArray['offer21'] = 'http://www.americanexpressofferzone.com/selects/OfferDetail.aspx?oid=52506&searchtype=category&ctgryid=212&countrycd=us';
offerArray['offer22'] = 'http://www.americanexpressofferzone.com/selects/OfferDetail.aspx?oid=53349&searchtype=keyword&countrycd=us&searchfor=henry%20ford';
offerArray['offer23'] = 'http://offers.amexnetwork.com/selects/us/grid?categoryPath=/amexnetwork/category/Shopping&issuerName=us_amexnetworkdefault&offerId=d833ab985955a110VgnVCM2000001b45640aRCRD';  // Shopping - Virgin
offerArray['offer24'] = 'http://offers.amexnetwork.com/selects/us/grid?categoryPath=/amexnetwork/category/Shopping&issuerName=us_amexnetworkdefault&offerId=4917ab985955a110VgnVCM2000001b45640aRCRD';  // Shopping - Lord & Taylor
offerArray['offer25'] = 'http://offers.amexnetwork.com/selects/us/grid?issuerName=us_amexnetworkdefault&categoryPath=/amexnetwork/category/Shopping&offerId=033c76d03a55a110VgnVCM2000001b45640aRCRD';  // Shopping - Samsonite
offerArray['offer26'] = 'http://offers.amexnetwork.com/selects/us/grid?categoryPath=/amexnetwork/category/Travel&issuerName=us_amexnetworkdefault&locale=en-us&localCountryId=ccfb43b68d898110VgnVCM2000007cc6410aRCRD#popup::/OfferDetailController/loadOffer.do&&&localLocale=en-us&locale=en-us&categoryPath=/amexnetwork/category/Travel/Car_Rental_and_Services&localCountryId=ccfb43b68d898110VgnVCM2000007cc6410aRCRD&countryId=ccfb43b68d898110VgnVCM2000007cc6410aRCRD&issuerName=us_amexnetworkdefault&popup=true&offerId=2c8dab985955a110VgnVCM2000001b45640aRCRD'; // travel - Wyndham
offerArray['offer27'] = 'http://offers.amexnetwork.com/selects/us/grid?categoryPath=/amexnetwork/category/Travel&issuerName=us_amexnetworkdefault&locale=en-us&localCountryId=ccfb43b68d898110VgnVCM2000007cc6410aRCRD#popup::/OfferDetailController/loadOffer.do&&&localLocale=en-us&locale=en-us&categoryPath=/amexnetwork/category/Travel/Hotels_and_Resorts&localCountryId=ccfb43b68d898110VgnVCM2000007cc6410aRCRD&countryId=ccfb43b68d898110VgnVCM2000007cc6410aRCRD&issuerName=us_amexnetworkdefault&popup=true&offerId=5fa2733c1d55a110VgnVCM2000001b45640aRCRD'; // travel - Jetblue
offerArray['offer28'] = 'http://offers.amexnetwork.com/selects/us/grid?categoryPath=/amexnetwork/category/Travel&issuerName=us_amexnetworkdefault&locale=en-us&localCountryId=ccfb43b68d898110VgnVCM2000007cc6410aRCRD#popup::/OfferDetailController/loadOffer.do&&&localLocale=en-us&locale=en-us&categoryPath=/amexnetwork/category/Travel/Hotels_and_Resorts&localCountryId=ccfb43b68d898110VgnVCM2000007cc6410aRCRD&countryId=ccfb43b68d898110VgnVCM2000007cc6410aRCRD&issuerName=us_amexnetworkdefault&popup=true&offerId=2c5af7721b55a110VgnVCM2000001b45640aRCRD'; // travel - MGM Grand
offerArray['offer29'] = 'http://offers.amexnetwork.com/selects/us/grid?categoryPath=/amexnetwork/category/Shopping&issuerName=us_amexnetworkdefault&offerId=bde1ab985955a110VgnVCM2000001b45640aRCRD'; // more - Budget Truck Rental
offerArray['offer30'] = 'http://offers.amexnetwork.com/selects/us/grid?categoryPath=/amexnetwork/category/Shopping&issuerName=us_amexnetworkdefault&offerId=29a0ab985955a110VgnVCM2000001b45640aRCRD'; // more - Proflowers
offerArray['offer31'] = 'http://offers.amexnetwork.com/selects/us/grid?categoryPath=/amexnetwork/category/Entertainment&issuerName=us_amexnetworkdefault&offerId=23d2fd020c55a110VgnVCM2000001b45640aRCRD'; // Dining - Busch Parks
offerArray['offer32'] = 'http://offers.amexnetwork.com/selects/us/grid?issuerName=us_amexnetworkdefault&categoryPath=/amexnetwork/category/Dining&offerId=573b76d03a55a110VgnVCM2000001b45640aRCRD'; // Dining - Papa John's
offerArray['offer33'] = 'http://offers.amexnetwork.com/selects/us/grid?categoryPath=/amexnetwork/category/Entertainment&issuerName=us_amexnetworkdefault&offerId=5de3733c1d55a110VgnVCM2000001b45640aRCRD';  // Dining - Six Flags
offerArray['offer34'] = 'http://offers.amexnetwork.com/selects/ch/grid?categoryPath=/amexnetwork/category/Dining&locale=en-us&issuerName=us_amexnetworkdefault&cid=selects-ch-amexnetworkus-travelhub-main';  // travel - Visit Beijing
offerArray['offer35'] = 'http://offers.amexnetwork.com/selects/us/grid?categoryPath=/amexnetwork/category/Shopping&issuerName=us_amexnetworkdefault&cid=selects-us-amexnetwork-sitemap';  // Shopping Offers
offerArray['offer36'] = 'http://offers.amexnetwork.com/selects/us/grid?categoryPath=/amexnetwork/category/Travel&issuerName=us_amexnetworkdefault&cid=selects-us-amexnetwork-sitemap';  // Travel Offers
offerArray['offer37'] = 'http://offers.amexnetwork.com/selects/us/grid?categoryPath=/amexnetwork/category/Shopping&issuerName=us_amexnetworkdefault';  // Shopping - Evergreen
offerArray['offer38'] = 'http://offers.amexnetwork.com/selects/us/grid?categoryPath=/amexnetwork/category/Dining&issuerName=us_amexnetworkdefault&cid=selects-us-amexnetwork-sitemap';  // Dining Offers
offerArray['offer39'] = 'http://offers.amexnetwork.com/selects/us/grid?categoryPath=/amexnetwork/category/Entertainment&issuerName=us_amexnetworkdefault&cid=selects-us-amexnetworkus-sitemap';  // Entertainment Offers
offerArray['offer40'] = 'http://offers.amexnetwork.com/selects/ch/grid?categoryPath=/amexnetwork/category/Dining&locale=en-us&issuerName=us_amexnetworkdefault&cid=selects-ch-amexnetworkus-homepage-main';  // home - Visit Beijing


offerArray['showcase_travel_primaryhub'] = 'http://goingonce.amexnetwork.com/index.html?cid=go08summer-site-banner-networkhp-preview';
offerArray['showcase_travel_spotlight'] = 'http://www.americanexpressofferzone.com/selects/adtracking.aspx?adtrack=Universal_Orlando_Resorts_3_28_2008&cid=go08summer-site-banner-networkhp-network-travel';
/* END OF SELECTS URL HASHMAP */

function checkOffer() {
	var qs = new Querystring();
	var selects = qs.get("selects");

	var offerURL = offerArray[selects];

	if ((offerURL == null) && (window.location.search.length > 0))
		offerURL = 'http://www.americanexpressofferzone.com/selects/SearchHandler.aspx' + window.location.search;

	if (offerURL == null) {
		offerURL = offerArray['SeeAllHome'];
	}

	window.main.location.href = offerURL;

	return;
}

function gotoPage(selects) {
    window.location = "../selects/offers/index.html?selects=" + selects;
    return false;
}

function doFormAction() {
    var form = document.getElementById("frmSearch");
    //form.action = "http://www.americanexpressofferzone.com/selects/SearchHandler.aspx";

    // LOL funny hack
    YAHOO.util.Connect.setForm(form);
    var queryString = YAHOO.util.Connect._sFormData;
    var ctgryid = document.getElementById("ctgryid").value;
    if (ctgryid == 6 || ctgryid == 7 || ctgryid == 8) {
        queryString = queryString.replace(eval("/ctgryid=" + ctgryid + "/"), "ctgryid=0");
        queryString = queryString.replace(/ctlgid=&/, "ctlgid=" + ctgryid + "&");
    }

    //
    window.location.href = "/selects/offers/" + "?" + queryString;

    return false;
}

function extractsSelects(url) {
    var regexS = "[\\?&]" + "selects" + "=([^&#]*)";
    var regex = new RegExp(regexS);
    var results = regex.exec(url);
    if( results == null || results[1] == "")
        return null;
    else
        return results[1];
}

function omnitureTravelSearch() {
    omniture.SendBeacon("travel_link_search", {
       prop2: getSelectText("countrycd")
       /*prop3: getSelectText("regid"),
       prop4: getSelectText("ctgryid"),
       eVar1: getSelectText("countrycd"),
       eVar2: getSelectText("regid"),
       eVar3: getSelectText("ctgryid")*/
    });
}

function omnitureShoppingSearch() {
    omniture.SendBeacon("shopping_link_search", {
       prop2: getSelectText("countrycd")
       /*prop3: getSelectText("regid"),
       prop4: getSelectText("ctgryid"),
       eVar1: getSelectText("countrycd"),
       eVar2: getSelectText("regid"),
       eVar3: getSelectText("ctgryid")*/
    });
}

function omnitureDiningSearch() {
    omniture.SendBeacon("dining_link_search", {
       prop2: getSelectText("countrycd")
       /*prop3: getSelectText("regid"),
       prop4: getSelectText("ctgryid"),
       eVar1: getSelectText("countrycd"),
       eVar2: getSelectText("regid"),
       eVar3: getSelectText("ctgryid")*/
    });
}

function omnitureMoreSearch() {
    omniture.SendBeacon("more_link_search", {
       prop2: getSelectText("countrycd")
       /*prop3: getSelectText("regid"),
       prop4: getSelectText("ctgryid"),
       eVar1: getSelectText("countrycd"),
       eVar2: getSelectText("regid"),
       eVar3: getSelectText("ctgryid")*/
    });
}

function getSelectText(id) {
    var select = document.getElementById(id);
    return select.options[select.selectedIndex].text;
}
