﻿var navimg =
{
  iphoneImg: null,
  navNum: null,
  arrayLength: null,
  appImg: null,
  travelCopy: new Array(),
  travelAlt: new Array(),
  atmCopy: new Array(),
  atmAlt: new Array(),
  picksCopy: new Array(),
  picksAlt: new Array(),
  overwhelmCopy: new Array(),
  overwhelmAlt: new Array(),
  moneysendCopy: new Array(),
  moneysendAlt: new Array(),
  whichApp: '',
  
  changeImg: function(type) {
    if(type == 'prev') {
      //set increment
      if(navimg.appImg > 0) navimg.appImg--;
      //prev-button on/off state
      if(navimg.appImg == 0) {
        $("#app-prev").attr({ src: '../images/ico_prev_off.gif' });
        $("#app-prev").css({ 'cursor' : 'default' });
      } else {
        $("#app-prev").attr({ src: '../images/ico_prev_on.gif' })
          .css({ 'cursor' : 'pointer' })
          .siblings().attr({ src: '../images/ico_next_on.gif' })
          .css({ 'cursor' : 'pointer' });
      }
    }
    else {
      //set increment
      if(navimg.appImg < navimg.arrayLength) navimg.appImg++;
      //next-button on/off state
      if(navimg.appImg == navimg.arrayLength) {
        $("#app-next").attr({ src: '../images/ico_next_off.gif' });
        $("#app-next").css({ 'cursor' : 'default' });
      } else {
        $("#app-next").attr({ src: '../images/ico_next_on.gif' })
          .css({ 'cursor' : 'pointer' })
          .siblings().attr({ src: '../images/ico_prev_on.gif' })
          .css({ 'cursor' : 'pointer' });
      }
    }

    //change img src
    nextImg = navimg.iphoneImg.eq(navimg.appImg).attr('src');
    //set image src
    $("#current-image").attr({ src: nextImg });
    //set selected nav background to on-state and its siblings to off/state
    navimg.navNum.eq(navimg.appImg).css({ 'background-position' : '0 13px' })
    .siblings().css({ 'background-position' : '0 0' });
    //change 'about the app' copy
    if(navimg.whichApp == 'atm') 
	{
      $('.app-copy').html(navimg.atmCopy[navimg.appImg]);
      $("#current-image").attr({ alt: navimg.atmAlt[navimg.appImg] });
    } 
	else if(navimg.whichApp == 'travel') 
	{
      $('.app-copy').html(navimg.travelCopy[navimg.appImg]);
      $("#current-image").attr({ alt: navimg.travelAlt[navimg.appImg] });
    } 
        else if(navimg.whichApp == 'overwhelm') 
	{
      $('.app-copy').html(navimg.overwhelmCopy[navimg.appImg]);
      $("#current-image").attr({ alt: navimg.overwhelmAlt[navimg.appImg] });
    } 
	else if(navimg.whichApp == 'moneysend') 
	{
      $('.app-copy').html(navimg.moneysendCopy[navimg.appImg]);
      $("#current-image").attr({ alt: navimg.moneysendAlt[navimg.appImg] });
    } 
	else 
	{
      $('.app-copy').html(navimg.picksCopy[navimg.appImg]);
      $("#current-image").attr({ alt: navimg.picksAlt[navimg.appImg] });
    }
},

  //init
  init: function(app) {
    //set nav list background
    navimg.navNum = $('.subnav-num li');
    navimg.navNum.each(function(i){
      $(this).css({ 'background' : 'url(../images/subnav_'+(i+1)+'.gif)' });
    });
    // set first li to on-state
    navimg.navNum.eq(0).css({ 'background-position' : '0 13px' });
    //init iphone image vars
    navimg.iphoneImg = $('#iphone-img img');
    navimg.arrayLength = $('#iphone-img img').length;
    navimg.arrayLength -= 1;
    navimg.appImg = 0;
    //set application (atm/picks)
    navimg.whichApp = app;
    
    //add click event
    $("#app-prev").css({ 'cursor' : 'default' }); // set cursor on first page load
    $("#app-prev").bind('click',function() { navimg.changeImg('prev'); dynamic_fsCommand('RightBodyNav|Previous'); });
    $("#app-next").bind('click',function() { navimg.changeImg('next'); dynamic_fsCommand('RightBodyNav|Next'); });
	
	 // travelassist 'about the app' copy
    navimg.travelCopy[0] = "MasterCard Travel Assist makes it easy for you to stay organized while traveling.It keeps all your credit cards, passport, driver's license, tickets, itinerary, and any notes you have safe and secure. Just use your iPhone's camera to snap photos of your cards and documents to have them stored in one convenient place for easy access when you need it.";
    navimg.travelCopy[1] = "<h3>Home screen:</h3>Click \"Cards, Itineraries, Notes\" to manager your password-protected information.  Click \"Services\" to call the MasterCard Assistance Center, which can help you with any of your card-related needs from anywhere you are in the world. Long distance call charges may apply.";
    navimg.travelCopy[2] = "<h3>Password Entry:</h3> The Travel Assist app uses encryption security. Enter your password to access your cards and documentation. Your password can be up to 20 characters long and should include upper and lowercase letters, numbers and symbols.";
    navimg.travelCopy[3] = "<h3>Services:</h3> One-Tap Call to the MasterCard Assistance Center means that help is always available to you no matter where you are in the world. Long distance call charges may apply.";
    navimg.travelCopy[4] = "<h3>Help settings:</h3> To make your password more secure, use a mix of uppercase and lowercase letters, numbers, and symbols. We recommend you choose a password with strong password strength.";
    navimg.travelCopy[5] = "<h3>Cards:</h3> Use your iPhone’s camera to snap a photo of the front of your cards and itineraries and enter and store the details of those items in one handy place.";
    navimg.travelCopy[6] = "<h3>Wipe:</h3> For added protections, all information wipes after a series of incorrect login attempts.";
    
    // travelassist app alt text
    navimg.travelAlt[0] = "Priceless Picks Mobile App on the iPhone";
    navimg.travelAlt[1] = "Priceless Picks Mobile App, 2D Aerial View on the iPhone";
    navimg.travelAlt[2] = "Priceless Picks Mobile App, 3D Bird’s Eye View on the iPhone";
    navimg.travelAlt[3] = "Priceless Picks Mobile App, sorting by category view on the iPhone";
    navimg.travelAlt[4] = "Priceless Picks Mobile App, view of adding an Pick on the iPhone";
	
	
    // atm 'about the app' copy
navimg.atmCopy[0] = "The MasterCard ATM Hunter makes it fast and easy for you to locate the closest ATM and MasterCard®PayPass™ accepting merchants. And because the ATM Hunter is location aware, there's no need to input the address of your current location, no matter where in the world you are. With over a million ATMs worldwide, you're never far from a MasterCard, Maestro, or Cirrus ATM.";
navimg.atmCopy[1] = "<h3>Locate ATMs:</h3> Searching \"Nearby\" finds ATMs based on your current location. You can also search based on any address or airport location in the world. The PayPass™ feature works in the same way as the ATM locator. So you can find a store as quickly as you can pay using PayPass™.<br><br>";
navimg.atmCopy[2] = "<h3>RESULTS LIST:</h3> See the distance between your chosen location and the closest ATMs. Find out exactly where ATMs are located, whether it's a bank, gas station, supermarket, or another location. \"Network\" refers to the bank or financial institution that services a specific ATM location. You also have the option to filter and search within your results.<br><br>Use a keyword search to find your own bank\'s ATMs, so you can make a deposit or avoid transaction fees.";
navimg.atmCopy[3] = "<h3>ATM FILTERS:</h3> You can also filter your search results based on the following ATM features:<ul><li>Drive-through</li><li>24-Hour Service</li><li>Wheelchair Accessible</li><li>No Surcharge</li><li>Deposit Sharing</li><li>Bank ATM</li></ul>";
navimg.atmCopy[4] = "<h3>PayPass™  FILTERS:</h3> Additionally, you can filter your PayPass™ search results based on merchant categories:<ul><li>Apparel</li><li>Automotive</li><li>Convenience Stores</li><li>Fast-Food Restaurants</li><li>Transportation</li><li>And more</li></ul>";
navimg.atmCopy[5] = "<h3>DETAILS PAGE:</h3> You can share ATM and PayPass™ locations with others via SMS. Additionally you can find driving directions and a map to your selected ATM or PayPass™ acceptance location.";
navimg.atmCopy[6] = "<h3>FINANCIAL TIPS:</h3> Find helpful tips on how to be smarter with your money and safer at ATM locations with the click of a button.";
    // atm app alt text
    navimg.atmAlt[0] = "ATM Hunter Mobile App on the iPhone";
    navimg.atmAlt[1] = "ATM Hunter Mobile App, locate ATMs view on the iPhone";
    navimg.atmAlt[2] = "ATM Hunter Mobile App, results list view on the iPhone";
    navimg.atmAlt[3] = "ATM Hunter Mobile App, search by keyword view on the iPhone";
    navimg.atmAlt[4] = "ATM Hunter Mobile App, filter by ATM features view on the iPhone";
    navimg.atmAlt[5] = "ATM Hunter Mobile App, ATM details view on the iPhone";
    navimg.atmAlt[6] = "ATM Hunter Mobile App, financial tips view on the iPhone";

// overwhelm 'about the app' copy
    navimg.overwhelmCopy[0] = "With the MasterCard MarketPlace Overwhelming Offer app you have access to special discounted offers available to eligible MasterCard® cardholders anywhere and everywhere you go with your iPhone. Overwhelming Offers are deeply discounted, often valued at 50% off or more, available in limited quantity, and require a reservation. Reservations sell out fast, often in seconds! If you miss it, don't be upset, try again next time or take advantage of other offers from the participating merchants";
    navimg.overwhelmCopy[1] = "<h3>TODAY’S OO</h3> Overwhelming Offers are available on a first-come-first-serve basis at a specified time on Monday through Friday.  When the offer goes live, Tap on the \"Reserve\" button and enter the CAPTCHA code provided on the next screen to accept the Terms of Use for the OO. If you successfully reserve an OO, you will receive a confirmation email containing the OO details.<br><br><b>Note:</b> In order to reserve an Overwhelming Offer, you must link a MasterCard Credit, Debit or Prepaid card.";

    navimg.overwhelmCopy[2] = "<h3 style=\"text-transform:none;\">PAST OOs</h3> The Past OOs page provides you with details about past Overwhelming Offers that were previously available through MasterCard Marketplace. If you see an Overwhelming Offer that you like, check back frequently, new OOs are added every weekday.";

    navimg.overwhelmAlt[0] = "MasterCard MarketPlace Overwhelming Offers App on the iPhone";
    navimg.overwhelmAlt[1] = "MasterCard MarketPlace Overwhelming Offers App, today's oo view on the iPhone";
    navimg.overwhelmAlt[2] = "MasterCard MarketPlace Overwhelming Offers App, past oos view on the iPhone";

// moneysend 'about the app' copy
    navimg.moneysendCopy[0] = "MasterCard MoneySend&trade\; is a convenient way to transfer money from person to person in the U.S. using the power of your iPhone or BlackBerry.  Once you have the app installed and have established a MoneySend account all you need to know is the recipient&apos\;s mobile number.  And you can receive money from others just as fast. Use the MoneySend app to get emergency money to family members, pay friends with your mobile phone or even collect payments for your services.<br><br>Certain <a href=\"https://www.mastercardmoneysend.com/corporate/en_US/moneysend/msTerms.shtml\" style=\"text-decoration:underline;\" target=\"_blank\">terms and conditions</a> apply.";

    navimg.moneysendCopy[1] = "<h3>FUNDING SOURCES</h3>Accept credit or debit card payments from anyone for free.<br><br>Certain <a href=\"https://www.mastercardmoneysend.com/corporate/en_US/moneysend/msTerms.shtml\" style=\"text-decoration:underline;\" target=\"_blank\">terms and conditions</a> apply.";

    navimg.moneysendCopy[2] = "<h3>SEND MONEY</h3>Send money to friends and family members.  Sending <a href=\"https://www.mastercardmoneysend.com/corporate/en_US/moneysend/fees.shtml\">fees</a> apply.<br><br>Certain <a href=\"https://www.mastercardmoneysend.com/corporate/en_US/moneysend/msTerms.shtml\" style=\"text-decoration:underline;\" target=\"_blank\">terms and conditions</a> apply.";

    navimg.moneysendCopy[3] = "<h3>REQUEST MONEY</h3>MoneySend makes it easy for you to request money from people who owe you money and pay for informal goods and services. Simplify your business or non-profit collection effort using Request Funds&trade; feature.<br><br>Certain <a href=\"https://www.mastercardmoneysend.com/corporate/en_US/moneysend/msTerms.shtml\" style=\"text-decoration:underline;\" target=\"_blank\">terms and conditions</a> apply.";

    navimg.moneysendCopy[4] = "<h3>HOME</h3>View your MoneySend transaction history from your mobile phone.<br><br>Certain <a href=\"https://www.mastercardmoneysend.com/corporate/en_US/moneysend/msTerms.shtml\" style=\"text-decoration:underline;\" target=\"_blank\">terms and conditions</a> apply.";

    navimg.moneysendAlt[0] = "MasterCard MoneySend Mobile App on the iPhone";
    navimg.moneysendAlt[1] = "MasterCard MoneySend Mobile App, funding sources view on the iPhone";
    navimg.moneysendAlt[2] = "MasterCard MoneySend Mobile App, send money view on the iPhone";
    navimg.moneysendAlt[3] = "MasterCard MoneySend Mobile App, request money view on the iPhone";
    navimg.moneysendAlt[4] = "MasterCard MoneySend Mobile App, home view on the iPhone";
    

    // picks 'about the app' copy
    navimg.picksCopy[0] = "The world is full of priceless things. And we all have our favorites. We call them Priceless Picks. The application lets you discover thousands of user-recommended priceless experiences places, shops, and restaurants. Got one to share? You can add your own Picks right from your phone.";
    navimg.picksCopy[1] = "<h3>2D AERIAL VIEW:</h3> Toggling the 2D aerial view allows you to see the nearby Picks and quickly navigate to other areas of the map to explore all the Priceless Picks available.";
    navimg.picksCopy[2] = "<h3>3D BIRDS-EYE VIEW:</h3> Surrounds you with the Priceless Picks that are in your immediate area at any given time. Square bubbles represent sponsored content, and round bubbles show user generated picks.";
   navimg.picksCopy[3] = "<h3>CATEGORY FILTER:</h3> Filter nearby Picks by selecting any of five individual categories: Priceless, Dining, Shopping, Entertainment, and Other. You can choose to explore all 5 categories at once, a single category, or any combination of each based on your interests.";
    navimg.picksCopy[4] = "<h3>ADD A PICK:</h3> Use your current location to add your own Priceless Pick on the go. The simple Add a Pick process takes you step by step through adding your Pick to the map. You can add your Pick to any of the five categories: Priceless, Entertainment, Shopping Dining, or Other.";
    // picks app alt text
    navimg.picksAlt[0] = "Priceless Picks Mobile App on the iPhone";
    navimg.picksAlt[1] = "Priceless Picks Mobile App, 2D Aerial View on the iPhone";
    navimg.picksAlt[2] = "Priceless Picks Mobile App, 3D Bird’s Eye View on the iPhone";
    navimg.picksAlt[3] = "Priceless Picks Mobile App, sorting by category view on the iPhone";
    navimg.picksAlt[4] = "Priceless Picks Mobile App, view of adding an Pick on the iPhone";
  }
}

var apphover = 
{
  init: function(){
    //fade in overlays on mouseover
	
	$('#travel-off').hover(function(){
      if($.browser.msie) {
        $('#travel-on').fadeTo('normal', 1);
      } else {
        $('#travel-on').fadeTo('normal', 1);
      }
      $('#subhdr-travel').fadeTo('fast', 0);
      dynamic_fsCommand('TravelAssist|RollOver')
    },function(){
      if($.browser.msie) {
        $('#travel-on').fadeTo('normal', 0);
      } else {
    $('#travel-on').fadeTo('normal', 0); 
     }
     $('#subhdr-travel').fadeTo('fast', 1);
      
    });
		
    $('#picks-off').hover(function(){
      if($.browser.msie) {
        $('#picks-on').fadeTo('normal', 1);
        $('#travel-on').fadeTo('normal', 0);
        
      } else {
        $('#picks-on').fadeTo('normal', 1);
        $('#travel-on').fadeTo('normal', 0);
        
      }
      $('#subhdr-picks').fadeTo('fast', 0);
      dynamic_fsCommand('PricelessPicks|RollOver')
    },function(){
      if($.browser.msie) {
        $('#picks-on').fadeTo('normal', 0);
      } else{
      $('#picks-on').fadeTo('normal', 0);
    }
      $('#subhdr-picks').fadeTo('fast', 1);
    });
	
	
    $('#atm-off').hover(function(){
      if($.browser.msie) {	  
        $('#atm-on').fadeTo('normal', 1);
        $('#picks-on').fadeTo('normal', 0);
        $('#travel-on').fadeTo('normal', 0);
        
      } else {
        $('#atm-on').fadeTo('normal', 1);
        $('#picks-on').fadeTo('normal', 0);
        $('#travel-on').fadeTo('normal', 0);
        
        
      }
      $('#subhdr-atm').fadeTo('fast', 0);
      dynamic_fsCommand('ATMHunter|RollOver')
    },function() {
      if($.browser.msie) {
        $('#atm-on').fadeTo('normal', 0);
      } else {
        $('#atm-on').fadeTo('normal', 0);
      }
      $('#subhdr-atm').fadeTo('fast', 1);
    });
  }
}
