﻿function resizePhotoreel() {
    var b = parseInt($("body").height());
    var c = parseInt($("#contentholder").height());
    //alert("b = "+ b + " : c = "+ c);
    if (b > c) {
        
        $("#photoreel").height(b);
        $("#picholder").height((b - 80));
        $("#downarrow").css({ top: (b - 40) + "px" })
    } else {
        $("#photoreel").height(c);
        $("#picholder").height((c - 80));
        $("#downarrow").css({ top: (c - 40) + "px" })
    }




}

function listingHover(id) {
    var img = $("#listing_" + id);
    var div = $("#listingHover_" + id);

    img.css({opacity: 0.5});

    var position = img.position();

    

    div.css({top:(position.top+170) + "px", left: position.left + "px"});
    
    
    
    
}

function listingHoverOff(id) {
   
    var img = $("#listing_" + id);
    var div = $("#listingHover_" + id);

    img.css({ opacity: 1.0 });

    div.css({top:"-5000px", left:"-5000px"});
}


var interval;
function startFade() {

    $("#currentHeader").val("1");
    var count = parseInt($("#headerCount").val());
    var current = parseInt($("#currentHeader").val());
    var next = current + 1

    

    $("#header" + current).fadeIn('slow', function() {
        //alert("done");
        interval = window.setTimeout('window.setInterval("continueFade(\'false\');", 8000);', 8000);
    });
}

function continueFade(firstRun) {
    
    if (firstRun == "false") {
        var count = parseInt($("#headerCount").val());
        var current = parseInt($("#currentHeader").val());
        var next = current+1;

        if (next > count) {
            next = 1;
        }

        //alert(current + " " + next);

        $("#header" + current).fadeOut('normal', function() {
            $("#header" + next).fadeIn('normal', function() {
                $("#currentHeader").val(next);
            });
        });
    } else {
        window.clearInterval(interval);
        interval = window.setInterval("continueFade('false');", 8000);
    }
}


function visitImages() {
    $('a.visitgallery').lightBox({
        imageLoading: '/images/lightbox-ico-loading.gif',
        imageBtnClose: '/images/lightbox-btn-close.gif',
        imageBtnPrev: '/images/lightbox-btn-prev.gif',
        imageBtnNext: '/images/lightbox-btn-next.gif'
    });
}

function clothingImages() {
    //alert("now");
    $('a.clothinggallery').lightBox({
        imageLoading: '/images/lightbox-ico-loading.gif',
        imageBtnClose: '/images/lightbox-btn-close.gif',
        imageBtnPrev: '/images/lightbox-btn-prev.gif',
        imageBtnNext: '/images/lightbox-btn-next.gif'
    });
}


