var names = [];

var feedbackRandom =[["feedback/feedback-01.jpg","Just to add a very big thanks to Ibiza MTB and Oliver in particular for a fantastic trip we had in Ibiza. The routes were varied from easy/beginner to quite technical,the scenery was stunning and the riding awesome if anyone is considering an Ibiza MTB holiday I have no hesitation in recommending Ibiza MTB and Oliver as a guide was great.","Adittya Mittal & Friends - England Sep/09"],["feedback/feedback-02.jpg"," did like the tours we road very much. Beautiful scenery, nice trails and a very comptent guide. I will come back!! Best Ralh Sigg","Ralh Sigg - Switzerland Aug/09"],["feedback/feedback-03.jpg","Estimado Oliver, solo para agradecerte de nuevo el grato viaje en bicicleta que tuve el jueves 13 de agosto, algo totalmente diferente a lo tipico de Ibiza, seguimo en contacto, quien sabe, a lo mejor regreso el proximo verano.","Fernando Velazquez - Mexico Aug/09"],["feedback/feedback-04.jpg","I've been lucky enough to rent a super cannondale for 5 days, perfect service and very good prices, also did a guided tour and it was great, overall highly recommended if you like cycling, thanks oli.Tim","Tim Smith - England Feb/10"],["feedback/feedback-05.jpg","Many thanks to Oli for a fantastic tour, great guiding, great trails and some awesome pictures, I'll hopefully be back next year...","Wayann Merlin - Italy Sep/09"],["feedback/feedback-06.jpg","Just a quick email to say thanks again for a brilliant tour, I both really enjoyed it. Anyway, keep up the good work and may see you again if you'll have me back!!","Sam Burton - England Oct/09"],["feedback/feedback-07.jpg","Thank 's for a fantastic tour riding in the sun, excellent tips and hospitality, i'll be back again in September, see you soon Oli.","Steve Brooks - England May/09"],["feedback/feedback-08.jpg","No imaginaba que Ibiza tuviese lugares tan bonitos... la ruta que hemos hecho a sido una pasada, un abrazo y espero que nos volvamos a ver pronto Oli.","Edu - Spain Apr/10"],["feedback/feedback-09.jpg","Hi Oliver, Thank you for the tour the other week, was awesome, great riding, great scenery and great company! im only sorry I didnt get chance to book you for the second week. I hope to see you next year!","Carl Bromley - England Jul/10"],["feedback/feedback-10.jpg","Dear Oliver,I was really happy and excited about the wonderful tour Thursday, spectacular location and intensity in the right, of course it is easy for you to work with the beautiful island of Ibiza.","Roberto Rabbachin - Italy Jul/10"],["feedback/feedback-11.jpg","thank you all for a good day i will be back at some point next year i hope to see you again, all once again thank you i will try and learn some spanish for the next time mally","Mally Hodson - England Aug/10"],["feedback/feedback-12.jpg","La verdad que lo pasamos genial, despues de tanta cervecita apetece darle a los pedales, las vistas son impresionantes. El guia un fiera...espero vernos otra vez.Saludos","Alvaro Aguerri - Spain Aug/10"],["feedback/feedback-13.jpg","Buenos días Oliver,a esta manera me gustaria agradecer mucho por la excursion de ayer. Todos (incluso Linda) lo han pasado pipa, Incluso la comida ha sido un exito puro!! Muchas gracias por este bien consejo!","Fabian Kemper - Germany Oct/10"],["feedback/feedback-14.jpg","Thanks for the bikes on tuesday oliver - all great and we had a top day out and found some great trails. Will def get bikes when back next time!","Nick Jones - England Aug/10"],["feedback/feedback-15.jpg","We were blown away by how friendly and helpful Oliver is. Ibiza MTB and Oliver made our holiday perfect! The rides were awesome and tailored to us (more difficult and technical routes for me!! Easier routes when the wife came along!!). Some fantastic downhills and uphills!! Great scenery and a really great guide. Would recomed Ibiza MTB to anybody and everybody. Brilliant!.","David and Louise - England Oct/10"],["feedback/feedback-16.jpg","This is our first trip to Ibiza and hopefully not our last as it's a beautiful island.  We chose a five day bed and mountain biking package and were not disappointed.  The hotel is lovely and the breakfast tasty, with home made bread, jams and freshly picked fruit.  Oliver at IbizaMTB is a fantastic guide with an obvious love of the island and made the cycling exciting and safe.","Seamus and Wendy - England Oct/10"],["feedback/feedback-17.jpg","Hi Oliver, thanks a lot again for the mystery ride to the great hidden places. Without you i would have missed the best parts of the island. Thanks again for the great company and time and I will definetely be back soon for another adventure ride ;)","Gurpreet - England Apr/11"],["feedback/feedback-18.jpg","We really want to thank you for the wonderful mountainbike tour you organise for us. Everything was above our expections. The bikes were brand new, nice quality and well equiped with a bottle of water and a helmet on every single bike. Our Guide, Oliver, was really helpfull and speaks good english. As I was with all my family (from 14 to over 60), I choose for the easy tour, Las salinas Tour. It was really, really nice. Oliver gave us some explanations about las salinas and good tips to find a good beach restaurant. The tour was not just like a touristic tour but we've discovered the beauty on the island. Nice experience. The bike tour will remain a really nice souvenir of our Ibiza week!","Gersdorff family - Belgium Apr/11"]]

function rnd (n) {
	return Math.floor(Math.random()*n)
}


$(document).ready(function() {        
	var idsub, subCatNames = ["#lospacks","#elhotel","#lasrutas","#tarifas","#tuequipaje","#programa"];
	var submenuSwitcher = function (id) {
		for (var i = 0; i < subCatNames.length; i++){
			idsub = "#paq0"+ (i +1);
			if (subCatNames[i] !== id) {
				$(subCatNames[i]).hide();
				$(idsub).toggleClass("selected",false);
			} else {
				$(id).show();
				$(idsub).toggleClass("selected",true);
			};
		};
	}
	
	$("#paq01").click(function() {
		submenuSwitcher("#lospacks");
	});
	$("#paq02").click(function() {
		submenuSwitcher("#elhotel");
	});
	$("#paq03").click(function() {
		submenuSwitcher("#lasrutas");
	});
	$("#paq04").click(function() {
		submenuSwitcher("#tarifas");
	});
	$("#paq05").click(function() {
		submenuSwitcher("#tuequipaje");
	});
	$("#paq06").click(function() {
		submenuSwitcher("#programa");
	});
	
	var number_random = rnd(18);
    $("span.tweet_text").text(feedbackRandom[number_random][1]);
    $("span.name_feedback").text(feedbackRandom[number_random][2]);
	$("img.img_random").attr("src", feedbackRandom[number_random][0]);
	$(".tweet").tweet({
        username: "ibizamtb",
        join_text: "auto",
        avatar_size: 48,
        count: 1,
        auto_join_text_default: "", 
        auto_join_text_ed: "we",
        auto_join_text_ing: "we were",
        auto_join_text_reply: "we replied to",
        auto_join_text_url: "we were checking out",
        loading_text: "loading tweets..."
    });

    //Execute the slideShow, set 4 seconds for each images  
    imgSlideShow(4500);

	$("div.tabs").tabs(".images > div", { 

	        // enable "cross-fading" effect 
	        effect: 'fade', 
	        fadeOutSpeed: "slow", 

	        // start from the beginning after the last tab 
	        rotate: true 

	    // use the slideshow plugin. It accepts its own configuration 
	    }).slideshow();
  		

});  
  
function imgSlideShow(speed) {  
  
  
    //append a LI item to the UL list for displaying caption  
    // $('ul.slideshow').append('<li id="slideshow-caption" class="caption"><div class="slideshow-caption-container"><h3></h3><p></p></div></li>');  
  
    //Set the opacity of all images to 0  
    $('ul.slideshow li').css({opacity: 0.0});  
      
    //Get the first image and display it (set it to full opacity)  
    $('ul.slideshow li:first').css({opacity: 1.0});  
      
    //Get the caption of the first image from REL attribute and display it  
    // $('#slideshow-caption h3').html($('ul.slideshow a:first').find('img').attr('title'));  
    // $('#slideshow-caption p').html($('ul.slideshow a:first').find('img').attr('alt'));  
          
    //Display the caption  
    // $('#slideshow-caption').css({opacity: 0.3, bottom:0});  
      
    //Call the gallery function to run the slideshow      
    var timer = setInterval('gallery()',speed);  
      
    //pause the slideshow on mouse over  
    $('ul.slideshow').hover(  
        function () {  
            clearInterval(timer);     
        },    
        function () {  
            timer = setInterval('gallery()',speed);           
        }  
    );  
      
}  
  
function gallery() {  
  
  
    //if no IMGs have the show class, grab the first image  
    var current = ($('ul.slideshow li.show')?  $('ul.slideshow li.show') : $('#ul.slideshow li:first'));  
  
    //Get next image, if it reached the end of the slideshow, rotate it back to the first image  
    var next = ((current.next().length) ? ((current.next().attr('id') == 'slideshow-caption')? $('ul.slideshow li:first') :current.next()) : $('ul.slideshow li:first'));  
          
    //Get next image caption  
    // var title = next.find('img').attr('title');   
    // var desc = next.find('img').attr('alt');      
          
    //Set the fade in effect for the next image, show class has higher z-index  
    next.css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1000);  
      
    //Hide the caption first, and then set and display the caption  
    // $('#slideshow-caption').animate({bottom:-70}, 300, function () {  
    //         //Display the content  
    //         $('#slideshow-caption h3').html(title);  
    //         $('#slideshow-caption p').html(desc);                 
    //         $('#slideshow-caption').animate({bottom:0}, 500);     
    // });       
  
    //Hide the current image  
    current.animate({opacity: 0.0}, 1000).removeClass('show');  
  
}  
