﻿// Default text
var standardText = "For more than 40 years Doster Construction Company has been dedicated to building, but at Doster business has always been about more than bricks and mortar. We've always known it's about employing the best in the field and servicing the client; it's about valuing people and <span class='highlight'>building lasting relationships.</span>";
var standardPic = "images/hp-rotator-00.jpg";

// Array of pictures
var Pic = new Array();
Pic[0] = "images/hp-rotator-03.jpg";
Pic[1] = "images/hp-rotator-01.jpg";
Pic[2] = "images/hp-rotator-02.jpg";
Pic[3] = "images/hp-rotator-04.jpg";
Pic[4] = "images/hp-rotator-05.jpg";

// Array of Text Elements
var Txt = new Array();
Txt[0] = "As one of the most active educational facility contractors in the region, Doster has developed an outstanding resume of education projects. We understand the demands school administrators and board members face with limited staff, tight budgets, and school opening requirements. ";
Txt[1] = "Consistently ranked by Modern Healthcare among the nation’s most active healthcare general contractors, as a builder of more than 1,275 Healthcare projects, in over 20 states, our clients have often said, &quot;Doster Healthcare thinks like a hospital&quot;.";
Txt[2] = "Doster's extensive experience as a contractor on a wide range of industrial projects demonstrates our skill in this highly specialized field. Our staff members are knowledgeable about the sensitive nature of industrial facilities and the importance of working with the plant personnel to ensure continuity of operations.";
Txt[3] = "Doster Multifamily is the most technologically advanced wood-frame builder in the Southeast.  Building over 1250 units in 2009; under budget, ahead of schedule and with zero defects.";
Txt[4] = "For more than 40 years Doster Construction Company has been dedicated to building, but at Doster business has always been about more than bricks and mortar. We've always known it's about employing the best in the field and servicing the client; it's about valuing people and <span class='highlight'>building lasting relationships</span>.";

$(document).ready(function() {
    // On page_load set the image and text to the default
    //$("#imgHolder img").attr("src", standardPic);
    $("#imgHolder").attr("style", "background: url('" + standardPic + "');"); 
    $("#imgHolder-text p").html(standardText);

    // For each li element with class of "switch"
    $("#subnav-home li.switch").each(
        function(i, val) {
            // Set the hover on / hover off to change the image
            $(val).children("a").hover(
                function() {
                    // Set the image and text to the element i in the array set above
                    //$("#imgHolder img").attr("src", Pic[i]);
                    $("#imgHolder").attr("style", "background: url('" + Pic[i] + "');");
                    $("#imgHolder-text p").html(Txt[i]);
                },
                function() {
                    // Set back to the default text
                    //$("#imgHolder img").attr("src", standardPic);
                    $("#imgHolder").attr("style", "background: url('" + standardPic + "');");
                    $("#imgHolder-text p").html(standardText);
                });
        });

});