$(document).ready(function() {
	$("#menu-secondary-menu").append('<a href="" class="buttonReserve"></a>');
	
	// Gastronomia Tabs
	$('div.tabbedGastro div').hide();
	$('div.tabbedGastro .t1').show();
	$('div.tabbedGastro ul.tabs li.t1 a').addClass('tab-current');
	$('div.tabbedGastro div').css("background-color", "#d7a561");
	$('div.tabbedGastro .t1').css("background-color", "#d7a561");
	$('div.tabbedGastro .t2').css("background-color", "#f4a050");
	$('div.tabbedGastro ul li a').click(function(){
		var thisClass = this.className.slice(0,2);
		$('div.tabbedGastro div').hide();
		switch(thisClass) {
			case 't1':
				$('div.tabbedGastro div').css("background-color", "#d7a561");
				break;
			case 't2':
				$('div.tabbedGastro div').css("background-color", "#f4a050");
				$(this).css("background-color", "#f4a050");
				break;
		}
		$('div.' + thisClass).show();
		$('div.tabbedGastro ul.tabs li a').removeClass('tab-current');
		$(this).addClass('tab-current');
	});
	
	// Villas & Suites Tabs
	$('div.tabbedVilla div').hide();
	$('div.tabbedVilla .t1').show();
	$('div.tabbedVilla ul.tabs li.t1 a').addClass('tab-current');
	$('div.tabbedVilla ul li a').click(function(){
		var thisClass = this.className.slice(0,2);
		$('div.tabbedVilla div').hide();
		switch(thisClass) {
			case 't1':
				break;
			case 't2':
				break;
		}
		$('div.' + thisClass).show();
		$('div.tabbedVilla ul.tabs li a').removeClass('tab-current');
		$(this).addClass('tab-current');
	});
	
	// Wallpapers
	$(".wallpaperLeft img").click(function () {
		$("#previewImage").attr("src", $(this).attr("alt"));
        
        if(alt=$(this).attr("alt").match(/(en_[\d]+)\./)){
            $("#previewImage").attr("alt",alt[1]);
        }else if(alt=$(this).attr("alt").match(/([\d]+)\./)){
            $("#previewImage").attr("alt",alt[1]);
        }
        
        
	});
	$("#wallpaperLow").click(function () {
		var src = $("#previewImage").attr("src");
		//var id = src.substr(src.length-5, 1)
		id=$("#previewImage").attr("alt");
		window.open("wp-content/themes/beachscape/images/wallpapers/800x600/" + id + ".jpg");
	});
	$("#wallpaperHigh").click(function () {
		var src = $("#previewImage").attr("src");
		//var id = src.substr(src.length-5, 1)
        id=$("#previewImage").attr("alt");
		
		window.open("wp-content/themes/beachscape/images/wallpapers/1024x768/" + id + ".jpg");
	});
});
