
// bookmarks

function bookmark_us($url, $title){

    if (window.sidebar) { // firefox
        window.sidebar.addPanel($title, $url, "");
    }
    else 
        if (window.opera && window.print) { // opera
            var elem = document.createElement('a');
            elem.setAttribute('href', $url);
            elem.setAttribute('$title', $title);
            elem.setAttribute('rel', 'sidebar');
            elem.click();
        }
        else 
            if (document.all) { // ie
                window.external.AddFavorite($url, $title);
            }
}

// slideshows

function slideSwitch(){
    var $active = $('#slideshow IMG.active');
    
    if ($active.length == 0) 
        $active = $('#slideshow IMG:last');
    
    var $next = $active.next().length ? $active.next() : $('#slideshow IMG:first');
    
    $active.addClass('last-active');
    
    $next.css({
        opacity: 0.0
    }).addClass('active').animate({
        opacity: 1.0
    }, 1000, function(){
        $active.removeClass('active last-active');
    });
}

// apartment images

function imageGalleryLoad($image){
    document.getElementById("apartment-image-main-1").style.display = "none";
    document.getElementById("apartment-image-main-2").style.display = "none";
    document.getElementById("apartment-image-main-3").style.display = "none";
    document.getElementById("apartment-image-main-4").style.display = "none";
    document.getElementById("apartment-image-main-5").style.display = "none";
    document.getElementById("apartment-image-main-" + $image).style.display = "block";
}

// buttons

function buttonPosition($id, $position){
    document.getElementById($id).style.backgroundPosition = $position;
}

// calendar

function calendarShow(){

    if (document.getElementById("inline-dates").style.display == "block") {
        document.getElementById("inline-dates").style.display = "none";
    }
    else {
        document.getElementById("inline-dates").style.display = "block";
    }
    
}

function calendarHelp($status){
    document.getElementById("calendar-help").style.display = "none";
    if ($status == 'on') {
        document.getElementById("calendar-help").style.display = "block";
    }
}

function calendarSetDate($date) {
    document.getElementById("search-dates").value = $date;
}

function calendarCheckDates() {
}
