BOOST.espanol = {
  
  init : function(){
    
    // will be some other selector, probably
     $('a.offToEng,input.offToEng').data('offToEng',true).click( BOOST.espanol.catchWithEnglishModal);
          
      $('table.comparison tbody tr:odd').addClass('even');
    
      // track coverage map clicks with omniture
      // this should go in omniture.js eventually
      $('#menu a[href*=coverage]').click(function(){
        var s=s_gi(s_account); 
        var destlink = 'http://plans.boostmobile.com/planhub.aspx?coverage';
        s.tl(destlink,'o', "Coverage map external link click");
      });
      
    
  }, // end of BOOST.espanol.init();
  
  
  
  
  catchWithEnglishModal : function(evt,link){
    if (typeof link != 'undefined') {
      BOOST.espanol.link = link;
    }
 	 BOOST.espanol.link =  BOOST.espanol.link || $(evt.target).attr('href') || $(evt.target).attr('link');    // fallback for non A tags.

  
  if (typeof evt != 'undefined'){
    
    // in case we're clickin on an IMG inside an A
    var parA = $(evt.target).parents('a');
    if (parA.length){
      BOOST.espanol.link =  BOOST.espanol.link || parA.attr('href') || parA.attr('link');    
    }
  }
  
	// check to see if the cookie is set.. if it already is, return true;
	if ($.cookie('continueToEng') == 'true'){
	  	    // if they hit OK, document.location.href on to their destination.		
return true;
	}
	
	//disable this for the locator page.
	if ($('#storeLocator').length) return true;
	
    $('<div id="modalWindow"></div>')
    .hide()
    .appendTo('body')
    .load('/_engwarning.html')
    .removeClass('hide')
    .dialog({
       width: '400px',
       height: '255px',
       resizable: false,
       overlay : { opacity : 0.7, background: '#111111'  },
       modal : true
      }).dialog('open').show();

    setTimeout(function(){
      BOOST.espanol.modalHookup();
    },200);

    return false;
  }, // end of BOOST.espanol.catchWithEnglishModal();
  
  
  
  modalHookup : function(){
    
    // hook up the checkbox for setting cookies    
    $('div.ui-dialog-container').click(function(e){
      
      // event delgation.
      if (!$(e.target).is('input.btnSubmit')) return;
      
  		if ($('#englishwarning :checkbox').is(':checked')){
  			$.cookie('continueToEng','true',{expires:1000});
  		}
	
	    // if they hit OK, document.location.href on to their destination.		
  		document.location  = BOOST.espanol.link; 
  		
  		e.stopPropagation(); e.preventDefault();
  		return false;
	  });
	
	
	
  }  // end of BOOST.espanol.modalHookup();
  
} // end of BOOST.espanol {}