var overview = new Array()
overview[0] = "images/overview.jpg";
overview[1] = "images/overviews.jpg";

var webDesign = new Array()
webDesign[0] = "images/web-design-solution.jpg";
webDesign[1] = "images/web-design-solutions.jpg";

var webDevelopment = new Array()
webDevelopment[0] = "images/web-development-solution.jpg";
webDevelopment[1] = "images/web-development-solutions.jpg";

var ecommerce = new Array()
ecommerce[0] = "images/ecommerce-solution.jpg";
ecommerce[1] = "images/ecommerce-solutions.jpg";

var seo = new Array()
seo[0] = "images/seo-solution.jpg";
seo[1] = "images/seo-solutions.jpg";

var cms = new Array()
cms[0] = "images/content-management-system.jpg";
cms[1] = "images/content-management-systems.jpg";

var portfolio = new Array()
portfolio[0] = "images/portfolio.jpg";
portfolio[1] = "images/portfolios.jpg";

var testimonials = new Array()
testimonials[0] = "images/testimonials-solution.jpg";
testimonials[1] = "images/testimonials-solutions.jpg";

var standards = new Array()
standards[0] = "images/standards-solution.jpg";
standards[1] = "images/standards-solutions.jpg";

var partners = new Array()
partners[0] = "images/partners-solution.jpg";
partners[1] = "images/partners-solutions.jpg";

var contact = new Array()
contact[0] = "images/contact-midwinter-integrated-web-solution.jpg";
contact[1] = "images/contact-midwinter-integrated-web-solutions.jpg";



function fadeinSlideshow(elem, imageList, slideDuration, fadeSpeed, current) {
    // get the length of the image array.
    var listSize = imageList.length;
    // If there's no current image selected, or the value is out of the range of the
    // slideshow, then set the current image to zero.
    if (!current || current >= listSize) current = 0;
    // If there's no slide duration set, set it to 5 seconds.
    if (!slideDuration) slideDuration = 1500;
    // If there's no fade speed set, set it to 1 second.
    if (!fadeSpeed) fadeSpeed = 1000;
    // Set the image's source to the current image's url.
    $(elem + " img").attr("src", imageList[current]);
    // If the current element is at the maximum of the element size, then set the 
    // wrapper's background (aka, the next image) to the first image.
    if (current == (listSize - 1)) {
        $(elem).css("background", "transparent url(" + imageList[0] + ") no-repeat");
    } else {
    // If not, set the next image in the list to the background of the wrapper.
        $(elem).css("background", "transparent url(" + imageList[current + 1] + ") no-repeat");
    }
    // Hold the current image for a period of time equal to slideDuration. Once that's done, then
    // fade the current image's opacity until the background image shows. Once that is done, then
    // call this same function again with the next image in line.
    $(elem + " img").animate({ opacity: "1" }, slideDuration).animate({ opacity: "0.01" }, fadeSpeed, function() { $(this).css("opacity", "1"); fadeinSlideshow(elem, imageList, slideDuration, fadeSpeed, current + 1) });
} // end of function fadeinSlideshow()

function runSlideshow1(){
    fadeinSlideshow("#overview", overview, 2500, 1500);
}
function runSlideshow2(){
    fadeinSlideshow("#webDesign", webDesign, 2500, 1500);
}
function runSlideshow3(){
    fadeinSlideshow("#webDevelopment", webDevelopment, 2500, 1500);
}
function runSlideshow4(){
    fadeinSlideshow("#ecommerce", ecommerce, 2500, 1500);
}
function runSlideshow5(){
    fadeinSlideshow("#seo", seo, 2500, 1500);
}
function runSlideshow6(){
    fadeinSlideshow("#cms", cms, 2500, 1500);
}
function runSlideshow7(){
    fadeinSlideshow("#portfolio", portfolio, 2500, 1500);
}
function runSlideshow8(){
    fadeinSlideshow("#testimonials", testimonials, 2500, 1500);
}
function runSlideshow9(){
    fadeinSlideshow("#standards", standards, 2500, 1500);
}
function runSlideshow10(){
    fadeinSlideshow("#partners", partners, 2500, 1500);
}
function runSlideshow11(){
    fadeinSlideshow("#contact", contact, 2500, 1500);
}

$(document).ready(runSlideshow1);
$(document).ready(runSlideshow2);
$(document).ready(runSlideshow3);
$(document).ready(runSlideshow4);
$(document).ready(runSlideshow5);
$(document).ready(runSlideshow6);
$(document).ready(runSlideshow7);
$(document).ready(runSlideshow8);
$(document).ready(runSlideshow9);
$(document).ready(runSlideshow10);
$(document).ready(runSlideshow11);
