$(document).ready(function() {
	var names = new Array()
	var short_names = new Array()
	var images = new Array()
	var descriptions = new Array()
	var ids = new Array()
	var lengths = new Array()
	var sp_ids = new Array()
	var sp_names = new Array()
	var sp_images = new Array()
	var sp_active = new Array()
	var which
  $.ajax({
		type: "GET",
		url: "assets/xml/tourstoxml.php",
		dataType: "xml",
		success: function(xml) {
			$(xml).find('name').each(function(){
 				names.push($(this).text())
			});
			$(xml).find('short_name').each(function(){
 				short_names.push($(this).text())
			});
			$(xml).find('image').each(function(){
 				images.push($(this).text())
			});
			$(xml).find('short_description').each(function(){
 				descriptions.push($(this).text())
			});
			$(xml).find('id').each(function(){
 				ids.push($(this).text())
			});
			$(xml).find('length').each(function(){
 				lengths.push($(this).text())
			});
			$.each(ids, function(intIndex, objValue) {
				if(intIndex == 0) {
					$("#tour-preview-menu").html("<li><a href='tours.php?tour=" + short_names[intIndex] + "'>" + names[intIndex] + "</a></li>")
				} else {
					$("#tour-preview-menu").append("<li><a href='tours.php?tour=" + short_names[intIndex] + "'>" + names[intIndex] + "</a></li>")
				}
			});
			$.each("#tour-preview-menu>li", function(intIndex, objValue) {
					$("#tour-preview-menu>li>a:eq(" + intIndex + ")").bind("mouseenter",function() {
					if($("#tour-preview").css("background")!="url('assets/images/tour-preview-bg.png')") {
						$("#tour-preview").css("background","url('assets/images/tour-preview-bg.png')");
					}
					$("#tour-preview > img").attr("src","assets/images/tour-images/" + images[[intIndex]]);
					$("#tour-preview > #name").text(names[[intIndex]]);
					$("#tour-preview > #description").text(descriptions[[intIndex]]);
					$("#tour-preview > #length").text(lengths[[intIndex]]);
					$("#tour-preview > #link").html("<a href='tours.php?tour=" + short_names[intIndex] + "'><img src='assets/images/morebtn-trans.png' alt='MORE >' /></a>");
				});
			});
			$("#tour-preview-menu > li:first").addClass("first")
			$("#tour-preview-menu > li:last").addClass("last")
		}
	});
});