﻿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(),
  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 
	{
      $('.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 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.";
    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.";
    navimg.atmCopy[3] = "<h3>KEYWORD SEARCH:</h3> Use a keyword search to find your own bank's ATMs, so you can make a deposit or avoid transaction fees.";
    navimg.atmCopy[4] = "<h3>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>Surcharge Free</li><li>Deposit Sharing</li></ul>";
    navimg.atmCopy[5] = "<h3>ATM DETAILS PAGE:</h3> You can share ATM locations with others via SMS, plus find driving directions and a map to your selected ATM 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";

    // 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);
    });
  }
}