function checkCookie(){
	var favorite = $.cookie('BBCountryURL');
	if (favorite != null) {
		  var url = favorite;
		  window.location.href = url;
	}
}

$(document).ready(function() {
  checkCookie();
   
  $("#regionList > ul > li > a").click(function(e) {
	  $('#content').removeClass().addClass($(this).attr("rel"));
	  $("#regionList > ul > li > a").removeClass();
	  $(this).addClass('selected');
	  $(".big-list").css("display","none");
	  $("#"+$(this).attr("rel")).css("display","inline");
	  Cufon.refresh('#regionList ul li');
	  e.preventDefault(); //Stop # from firing which causes the page to bounce back to the top of the page
  });
  
  $("#countryhovers > li > a").click(function(e) {
	  $('#content').removeClass().addClass($(this).attr("class"));
	  $(".big-list").css("display","none");
	  $("#"+$(this).attr("class")).css("display","inline");
	  $("#regionList > ul > li > a").removeClass();
	  $("#region_"+$(this).attr("class")).addClass('selected');
	  Cufon.refresh('#regionList ul li');
	  e.preventDefault(); //Stop # from firing which causes the page to bounce back to the top of the page
  });
  
  $(".sub-list li > a").click(function() {
	if ($('#remember-me').attr("checked")) {
		$.cookie('BBCountryURL', $(this).attr("href"), { expires: 30, path: '/', domain: '.blackberry.com'});
	}
  });
  
  Cufon.replace('#regionList ul li', {
		hover: true
  });
  Cufon.replace('#countryList ul li', {
		hover: true
  });
  Cufon.replace('p#findSite', {
		hover: true
  });
  
  // Fix to hide text while it renders
  $('#findSite').css('visibility','visible');
  $('#regionList').css('visibility','visible');
  
});




