function getFilters(strURL) {
     $.ajax({
        url: strURL,
        type : 'GET',
        success: function(resp) {
            $("#hotelsbycity").html(resp);
        }
    });
}

/*function enableSubmit(id) {
    $("#" +id).removeAttr("disabled");
}*/

function ajax_filter(page) {
    if(page == null || page == "undefined") {
        page = 1;
    } else if(page == '') {
        page = $(".pagers_cur").html();
    }
    var root_url = $("#root_url").html();
    var hotels = $("#hotels").val();
    var cities = $("#cities").val();
    var rooms = $("#rooms").val();
    $("#hotelresults").fadeOut("slaw");
    $.ajax({
            url: root_url + 'ajax/item2',
            type : 'POST',
            data: ({
                hotel: hotels,
                city: cities,
                room: rooms,
                page: page,
                p1: $( "#slider-range" ).slider( "values", 0 ),
                p2: $( "#slider-range" ).slider( "values", 1 )

            }),
            success: function(resp) {
                $("#hotelresults").html(resp);
                $("#hotelresults").fadeIn("slaw");
            }
    });
}

function apartment_filter(page) {
    if(page == null || page == "undefined") {
        page = 1;
    } else if(page == '') {
        page = $(".pagers_cur").html();
    }
    var root_url = $("#root_url").html();
    var cities = $("#apart_cities").val();
    var rooms = $("#apart_quantities").val();
    $("#hotelresults").fadeOut("slaw");
    $.ajax({
            url: root_url + 'ajax/item3',
            type : 'POST',
            data: ({
                city: cities,
                room: rooms,
                page: page,
                p1: $( "#slider-range2" ).slider( "values", 0 ),
                p2: $( "#slider-range2" ).slider( "values", 1 )

            }),
            success: function(resp) {
                $("#hotelresults").html(resp);
                $("#hotelresults").fadeIn("slaw");
            }
    });
}

function tour_filter(page) {
    if(page == null || page == "undefined") {
        page = 1;
    } else if(page == '') {
        page = $(".pagers_cur").html();
    }
    if($("#tour_name").val() == '') {
        $("#tour_error").fadeIn("slaw");
        return false;
    }
    var root_url = $("#root_url").html();
    var tour_name = $("#tour_name").val();
    $("#hotelresults").fadeOut("slaw");
    $.ajax({
            url: root_url + 'index/filtertours',
            type : 'POST',
            data: ({
                tourname:tour_name,
                page: page
            }),
            success: function(resp) {
                $("#tour_error").fadeOut("slaw");
                $("#hotelresults").html(resp);
                $("#hotelresults").fadeIn("slaw");
            }
    });
}

function ticket_filter(page) {
    if(page == null || page == "undefined") {
        page = 1;
    } else if(page == '') {
        page = $(".pagers_cur").html();
    }
    if($("#from_id").val() == 0 || $("#to_id").val() == 0) {
        $("#ticket_error").fadeIn("slaw");
        return false;
    }
    var root_url = $("#root_url").html();
    $("#hotelresults").fadeOut("slaw");
    $.ajax({
            url: root_url + 'index/filtertickets',
            type : 'POST',
            data: ({
                from_id: $("#from_id").val(),
                to_id: $("#to_id").val(),
                page: page
            }),
            success: function(resp) {
                $("#ticket_error").fadeOut("slaw");
                $("#hotelresults").html(resp);
                $("#hotelresults").fadeIn("slaw");
            }
    });
}

function check_ticket_form() {
	var error = false;
	if($("#fcountry").val() == '') {
		error = true;
	}
	if($("#lcountry").val() == '') {
		error = true;
	}
	if($("#check_indatepicker").val() == '') {
		error = true;
	}
	if($("#check_outdatepicker").val() == '') {
		error = true;
	}
	if(error == true) {
		$("#ticket_errors").html("You must fill in all of the fields.");
	}
	else {
		$("#ticket_form").attr("action", '/index/ticketbook/');
		$("#ticket_form").submit();
	}
		
}

$(document).ready(function() {
    $('.scroll-pane').jScrollPane({showArrows: true});
    //Show Banner
    $(".main_image .desc").show(); //Show Banner
    $(".main_image .block").animate({ opacity: 0.85 }, 1 ); //Set Opacity

    //Click and Hover events for thumbnail list
    $(".image_thumb ul li:first").addClass('active');
    $(".image_thumb ul li").click(function(){
            //Set Variables
            var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
            var imgTitle = $(this).find('a').attr("href"); //Get Main Image URL
            var imgDesc = $(this).find('.block').html(); 	//Get HTML of block
            var imgDescHeight = $(".main_image").find('.block').height();	//Calculate height of block

            if ($(this).is(".active")) {  //If it's already active, then...
                    return false; // Don't click through
            } else {
                    //Animate the Teaser
                    $(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
                            $(".main_image .block").html(imgDesc).animate({ opacity: 0.85,	marginBottom: "0" }, 250 );
                            $(".main_image img").attr({ src: imgTitle , alt: imgAlt});
                    });
            }

            $(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all lists
            $(this).addClass('active');  //add class of 'active' on this list only
            return false;

    }) .hover(function(){
            $(this).addClass('hover');
            }, function() {
            $(this).removeClass('hover');
    });

    //Toggle Teaser
    $("a.collapse").click(function(){
            $(".main_image .block").slideToggle();
            $("a.collapse").toggleClass("show");
    });
});

$(window).bind("load", function() {
        $("div#my-folio-of-works").slideViewerPro({
        thumbs: 6, 
        autoslide: true, 
        asTimer: 3500, 
        typo: true,
        galBorderWidth: 0,
        thumbsBorderOpacity: 0, 
        buttonsTextColor: "#707070",
        buttonsWidth: 40,
        thumbsActiveBorderOpacity: 0.8,
        thumbsActiveBorderColor: "aqua",
        shuffle: false
        });
});

function Price_form_submit() {
    $("#price_form").submit();
}

function search_form() {
    var search_word = $("#search_inp").val();
    search_word = escape(search_word);
    if(search_word.length != '') {
        $("#search_form").attr("action",$("#root_url").html()+"index/search/word/"+search_word);
        $("#search_form").submit();
    }
    return true;
}














