﻿
//Converts image and link elements to thumbnails (by Joan Piedra (http://www.joanpiedra.com), extended by Matthew Rohr
jQuery.fn.thumbs = function() { return this.wrap('<div class="thumb-img"><div class="thumb-inner">' + '</div></div>'); }
//Absolute positions the image in the middle of the thumbnail frame by Joan Piedra (http://www.joanpiedra.com), extended by Matthew Rohr

jQuery.fn.thumbsImg = function() {
    return this.each(function() {
        //$(this).removeAttr("style") 
//        if (navigator.appName != 'Microsoft Internet Explorer') {
//        $(this).css('left', '-' + (parseInt($(this).width()) / 2) + 'px');
//        $(this).css('top', '-' + (parseInt($(this).height()) / 2) + 'px');
//        jQuery(this).css('position', 'absolute');
//        jQuery(this).css('margin-left', '50%'); jQuery(this).css('margin-top', '50%');
//        }
    })
}

var vCycleImages = setInterval("setImgCycleStatus()", 1000);

$(function() {
    $('#slideShowPromotional').cycle();
    $('#slideShowPromotional').cycle('stop');
    $('#slideShowScreenShots').cycle();
    $('#slideShowScreenShots').cycle('stop');
});

function setImgCycleStatus() {
    if ($.preloadImages("promo1", "promo2", "siteTour1", "siteTour2", "siteTour3", "siteTour4")) {
        //Promo
        $('#slideShowPromotional').after('<div id="slideShowNav">').cycle({
            timeout: 5000, //500
            speed: 1000, //3000
            pause: 1,
            startingSlide: 0,
            pager: '#slideShowNav'
        });

        //Home Page Slide Shows
        $('#slideShowScreenShots').cycle({
            timeout: 2500,
            speed: 1000,
            pause: 1,
            startingSlide: 0
        });
        clearInterval(vCycleImages);
    }
}

jQuery.preloadImages = function() {
    var bImgLoaded = true;

    for (var i = 0; i < arguments.length; i++) {
        if (document.getElementById(arguments[i]).complete == false) {
            bImgLoaded = false;
        }
    }
    return bImgLoaded;
}
//Image Rollover
function rollover(imgTag, picture) {
    document.getElementById(imgTag).src = picture;
}
