// JavaScript Document
function get(url)
{
	
	$.ajax({
		url:url,
		dataType:'xml',
		success:xmlSucc,
		error:xmlError
	});
}

function xmlSucc(data, status)
{
	
	xmlData = data;
	parseX();
}

function xmlError()
{
	xmlReady = false;
	init();
	
}


function parseX()
{
	dat = xmlData;
	
	$(dat).find("slideshow").each(function(){
		
		imagePath  = $(this).attr('imgPath');
		clockText  = $(this).attr('clockText');	
		clockStart = $(this).attr('clockStart');
		clockEnds  = $(this).attr('clockEnd');
		
		
		$(this).find("Slide").each(function(){
			photoList.push($(this).attr('url'));
		});
		
		$(this).find("Slide").each(function(){
			// looking for the title
			$(this).find("title").each(function(){
				title.push($(this).text());	
			});
			// looking for the subtitle
			$(this).find("subtitle").each(function(){
				subTitle.push($(this).text());	
			});		
			// looking for the body of the tours
			$(this).find("body").each(function(){
				bodyText.push($(this).text());	
			});
			// looking for the priceWas of the tours
			$(this).find("priceWas").each(function(){
				priceWas.push($(this).text());	
			});
			// lookinf or the priceNow of the tours
			$(this).find("priceNow").each(function(){
				priceNow.push($(this).text());	
			});
			// getting the priceCTa of the tours
			$(this).find("priceCTA").each(function(){
				priceCTA.push($(this).text());	
			});
			
			// get the link of the current description
			$(this).find("Link").each(function(){
				if($(this).attr('txt') == 'Learn More')
				{
					$(this).find("url").each(function(){
						learnMoreUrl.push($(this).text());	
					});
				}
				else
				{
					$(this).find("url").each(function(){
						descriptionUrl.push($(this).text());	
					});	
				}
			});
			
			// gettig the resmarks id
			$(this).find("ResmarkID").each(function(){
				resmarkID.push($(this).text());	
			});
			
			$(this).find("DaysAvailable").each(function() {
				daysAvailable.push($(this).text());
			});
			
		});
		
	});	
	
	xmlReady = true;
	init();
	
}
