// Navigation Controller
// Handles on/off states and displaying specific XML
$(document).ready(function() {
  //$('#letter-d .button').click(function() {  
  resetNavStates();    
  //$('#northamerica .button').click(function() {
  $('#northamerica .button').addClass('selected');
    $.get('/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/north_am.xml', function(data) {
      $('#content_shell').empty();
      $(data).find('content_item').each(function() {
        var $content_item = $(this);
        var html = '<div class="content_item_container">';
		var $image = $content_item.find('item_image');	
		var $alt = $content_item.find('item_name').text();
		html += '<div class="content_item_image"><img src="'+$image.attr('source')+'" alt="'+$alt+'" title="'+$alt+'"/></div>';
    html += '<div class="item_information">'
	    html += '<div class="item_name">'
		html += $content_item.find('item_name').text();
        html += '</div>';
		html += '<div class="item_location">'
		html += $content_item.find('item_location').text();
        html += '</div>';
		html += '<div class="item_description">'
		html += $content_item.find('item_description').text();
        html += '</div>';		
		html += '<div class="item_stay">'
		html += $content_item.find('item_stay').text();
        html += '</div>';
	html += '</div>';		
		// ADD CODE FOR 'BOOK NOW' BUTTON HERE!
		var $link = $content_item.find('item_link').text();
		html += '<div class="item_button"><a class="" href="'+$link+'"><img src="/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/book_now_button.gif" alt="Book Now" /></a></div>';		
		// ADD CODE FOR A CLEAR DIV TO BE RENDERED
		html += '<div class="clear" style="clear:both;"></div>'		
        html += '</div>';
        $('#content_shell').append($(html));
		
      });
    });
 // });
});


$(document).ready(function() {
    
  $('#northamerica .button').click(function() {
   resetNavStates(); 
  $('#northamerica .button').addClass('selected');
    $.get('/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/north_am.xml', function(data) {
      $('#content_shell').empty();
      $(data).find('content_item').each(function() {
        var $content_item = $(this);
        var html = '<div class="content_item_container">';
		var $image = $content_item.find('item_image');		
		var $alt = $content_item.find('item_name').text();
		html += '<div class="content_item_image"><img src="'+$image.attr('source')+'" alt="'+$alt+'" title="'+$alt+'"/></div>';
    html += '<div class="item_information">'
	    html += '<div class="item_name">'
		html += $content_item.find('item_name').text();
        html += '</div>';
		html += '<div class="item_location">'
		html += $content_item.find('item_location').text();
        html += '</div>';
		html += '<div class="item_description">'
		html += $content_item.find('item_description').text();
        html += '</div>';		
		html += '<div class="item_stay">'
		html += $content_item.find('item_stay').text();
        html += '</div>';
	html += '</div>';		
		var $link = $content_item.find('item_link').text();
		html += '<div class="item_button"><a class="" href="'+$link+'"><img src="/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/book_now_button.gif" alt="Book Now" /></a></div>';		
		html += '<div class="clear" style="clear:both;"></div>'		
        html += '</div>';
        $('#content_shell').append($(html));
		
      });
    });
  });
});

$(document).ready(function() {
  
  $('#asia .button').click(function() {
    resetNavStates();  
  $('#asia .button').addClass('selected');
    $.get('/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/asia.xml', function(data) {
      $('#content_shell').empty();
      $(data).find('content_item').each(function() {
        var $content_item = $(this);
        var html = '<div class="content_item_container">';
		var $image = $content_item.find('item_image');		
		var $alt = $content_item.find('item_name').text();
		html += '<div class="content_item_image"><img src="'+$image.attr('source')+'" alt="'+$alt+'" title="'+$alt+'"/></div>';
    html += '<div class="item_information">'
	    html += '<div class="item_name">'
		html += $content_item.find('item_name').text();
        html += '</div>';
		html += '<div class="item_location">'
		html += $content_item.find('item_location').text();
        html += '</div>';
		html += '<div class="item_description">'
		html += $content_item.find('item_description').text();
        html += '</div>';		
		html += '<div class="item_stay">'
		html += $content_item.find('item_stay').text();
        html += '</div>';
	html += '</div>';		
		var $link = $content_item.find('item_link').text();
		html += '<div class="item_button"><a class="" href="'+$link+'"><img src="/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/book_now_button.gif" alt="Book Now" /></a></div>';		
		html += '<div class="clear" style="clear:both;"></div>'		
        html += '</div>';
        $('#content_shell').append($(html));
		
      });
    });
 });
});



$(document).ready(function() {
  
  $('#europe .button').click(function() {
    resetNavStates();  
  $('#europe .button').addClass('selected');
    $.get('/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/europe.xml', function(data) {
      $('#content_shell').empty();
      $(data).find('content_item').each(function() {
        var $content_item = $(this);
        var html = '<div class="content_item_container">';
		var $image = $content_item.find('item_image');		
		var $alt = $content_item.find('item_name').text();
		html += '<div class="content_item_image"><img src="'+$image.attr('source')+'" alt="'+$alt+'" title="'+$alt+'"/></div>';
    html += '<div class="item_information">'
	    html += '<div class="item_name">'
		html += $content_item.find('item_name').text();
        html += '</div>';
		html += '<div class="item_location">'
		html += $content_item.find('item_location').text();
        html += '</div>';
		html += '<div class="item_description">'
		html += $content_item.find('item_description').text();
        html += '</div>';		
		html += '<div class="item_stay">'
		html += $content_item.find('item_stay').text();
        html += '</div>';
	html += '</div>';		
		var $link = $content_item.find('item_link').text();
		html += '<div class="item_button"><a class="" href="'+$link+'"><img src="/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/book_now_button.gif" alt="Book Now" /></a></div>';		
		html += '<div class="clear" style="clear:both;"></div>'		
        html += '</div>';
        $('#content_shell').append($(html));
		
      });
    });
 });
});





$(document).ready(function() {
  
  $('#latinamerica .button').click(function() {
    resetNavStates();  
  $('#latinamerica .button').addClass('selected');
    $.get('/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/latinamerica.xml', function(data) {
      $('#content_shell').empty();
      $(data).find('content_item').each(function() {
        var $content_item = $(this);
        var html = '<div class="content_item_container">';
		var $image = $content_item.find('item_image');		
		var $alt = $content_item.find('item_name').text();
		html += '<div class="content_item_image"><img src="'+$image.attr('source')+'" alt="'+$alt+'" title="'+$alt+'"/></div>';
    html += '<div class="item_information">'
	    html += '<div class="item_name">'
		html += $content_item.find('item_name').text();
        html += '</div>';
		html += '<div class="item_location">'
		html += $content_item.find('item_location').text();
        html += '</div>';
		html += '<div class="item_description">'
		html += $content_item.find('item_description').text();
        html += '</div>';		
		html += '<div class="item_stay">'
		html += $content_item.find('item_stay').text();
        html += '</div>';
	html += '</div>';		
		var $link = $content_item.find('item_link').text();
		html += '<div class="item_button"><a class="" href="'+$link+'"><img src="/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/book_now_button.gif" alt="Book Now" /></a></div>';		
		html += '<div class="clear" style="clear:both;"></div>'		
        html += '</div>';
        $('#content_shell').append($(html));
		
      });
    });
 });
});





$(document).ready(function() {
  
  $('#africa .button').click(function() {
    resetNavStates();  
  $('#africa .button').addClass('selected');
    $.get('/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/africa.xml', function(data) {
      $('#content_shell').empty();
      $(data).find('content_item').each(function() {
        var $content_item = $(this);
        var html = '<div class="content_item_container">';
		var $image = $content_item.find('item_image');		
		var $alt = $content_item.find('item_name').text();
		html += '<div class="content_item_image"><img src="'+$image.attr('source')+'" alt="'+$alt+'" title="'+$alt+'"/></div>';
    html += '<div class="item_information">'
	    html += '<div class="item_name">'
		html += $content_item.find('item_name').text();
        html += '</div>';
		html += '<div class="item_location">'
		html += $content_item.find('item_location').text();
        html += '</div>';
		html += '<div class="item_description">'
		html += $content_item.find('item_description').text();
        html += '</div>';		
		html += '<div class="item_stay">'
		html += $content_item.find('item_stay').text();
        html += '</div>';
	html += '</div>';		
		var $link = $content_item.find('item_link').text();
		html += '<div class="item_button"><a class="" href="'+$link+'"><img src="/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/book_now_button.gif" alt="Book Now" /></a></div>';		
		html += '<div class="clear" style="clear:both;"></div>'		
        html += '</div>';
        $('#content_shell').append($(html));
		
      });
    });
 });
});



function resetNavStates(){
	 $('.button').removeClass('selected');
}


function activate(id){					
	if(id == 'NorthAmerica'){
		if(document.getElementById) {
		var mainImg = document.getElementById('nav_na');
		var img1 = document.getElementById('nav_europe');
		var img2 = document.getElementById('nav_asia');	
		var img3 = document.getElementById('nav_latin');	
		var img4 = document.getElementById('nav_africa');
		
		mainImg.src =("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_na_on.jpg");
		img1.src = ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_europe_off.jpg");
		img2.src= ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_asia_off.jpg");
		img3.src= ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_latin_off.jpg");
		img4.src= ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_africa_off.jpg");				
		}
	}else if(id == 'Asia'){
		if(document.getElementById) {
		var mainImg = document.getElementById('nav_asia');
		var img1 = document.getElementById('nav_na');
		var img2 = document.getElementById('nav_europe');	
		var img3 = document.getElementById('nav_latin');	
		var img4 = document.getElementById('nav_africa');
		
		mainImg.src =("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_asia_on.jpg");
		img1.src = ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_na_off.jpg");
		img2.src= ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_europe_off.jpg");
		img3.src= ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_latin_off.jpg");
		img4.src= ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_africa_off.jpg");
		}
	}else if(id == 'Europe'){
		if(document.getElementById) {
		var mainImg = document.getElementById('nav_europe');
		var img1 = document.getElementById('nav_na');
		var img2 = document.getElementById('nav_asia');	
		var img3 = document.getElementById('nav_latin');	
		var img4 = document.getElementById('nav_africa');
		
		mainImg.src =("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_europe_on.jpg");
		img1.src = ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_na_off.jpg");
		img2.src= ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_asia_off.jpg");
		img3.src= ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_latin_off.jpg");
		img4.src= ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_africa_off.jpg");
		}
	}else if(id == 'LatinAmerica'){
		if(document.getElementById) {
		var mainImg = document.getElementById('nav_latin');
		var img1 = document.getElementById('nav_na');
		var img2 = document.getElementById('nav_asia');	
		var img3 = document.getElementById('nav_europe');	
		var img4 = document.getElementById('nav_africa');
		
		mainImg.src =("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_latin_on.jpg");
		img1.src = ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_na_off.jpg");
		img2.src= ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_asia_off.jpg");
		img3.src= ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_europe_off.jpg");
		img4.src= ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_africa_off.jpg");
		}
	}else if(id == 'Africa'){
		if(document.getElementById) {
		var mainImg = document.getElementById('nav_africa');
		var img1 = document.getElementById('nav_na');
		var img2 = document.getElementById('nav_asia');	
		var img3 = document.getElementById('nav_europe');	
		var img4 = document.getElementById('nav_latin');
		
		mainImg.src =("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_africa_on.jpg");
		img1.src = ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_na_off.jpg");
		img2.src= ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_asia_off.jpg");
		img3.src= ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_europe_off.jpg");
		img4.src= ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_latin_off.jpg");
		}
	}
	
	else{
		
		var default1 = document.getElementById('nav_na');
		var default2 = document.getElementById('nav_asia');
		var default3 = document.getElementById('nav_europe');
		var default4 = document.getElementById('nav_latin');
		var default5 = document.getElementById('nav_africa');
		default1.src = ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_na_off.jpg");
		default2.src= ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_asia_off.jpg");
		default3.src= ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_europe_off.jpg");
		default4.src= ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_latin_off.jpg");
		default5.src= ("/Media/Graphics/Microsites/Promotions/SI_RESORTS_OFFERS/nav_africa_off.jpg");
		
	}
	
	
}
