var rottest;
var iens6 = document.all || document.getElementById; var ns4 = document.layers; ;
var showPriceLayer = true;
var ua = navigator.userAgent;
var safari = false;
if ((i = ua.indexOf("Safari")) >= 0) safari = true;
var safariOffsetX = 0;
var safariOffsetY = 0;
var showBubble = new Array(false, false, false, false, false, false, false, false, false);
var bubbleTimer = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0);
var timerID;

function getScreenSize() {
    var myWidth = 0, myHeight = 0;
    if (typeof (window.innerWidth) == 'number') {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }
    SCREEN_WIDTH = myWidth;
    SCREEN_HEIGHT = myHeight;
}

function showBackLyr() {
    getScreenSize();
    var backLyrStyle = getStyleObject("backgroundLyr");
    if (backLyrStyle) {
        backLyrStyle.width = SCREEN_WIDTH + "px";
        backLyrStyle.height = 2000;
        changeObjectVisibility('backgroundLyr', 'visible');
    }
}

function hideBackLyr() {
    changeObjectVisibility('backgroundLyr', 'hidden');
}

function showBubblez(bubbleID) {
    //alert("showing bubble "+bubbleID+", showBubble["+bubbleID+"]="+showBubble[bubbleID]);
    // writeLayer("bubbleDiv", null, "<iframe src=\"watchVideoHome.aspx?showThumbs=0&g=8&padding=0&fh=268&cb=0\" width=\"445\" height=\"268\" frameborder=\"no\" scrolling=\"no\"></iframe>");
    if (showBubble[bubbleID] == true) {
        var bubbleBoxTD = getObject("bubbleBoxTD" + bubbleID);
        var rotatorBox = getObject("demo");
        var bubbleHTML = "";
        var bubbleOffsetX = 0;
        var bubbleOffsetY = 0;
        var bubbleDivStyle = getStyleObject("bubbleDiv" + bubbleID);

        switch (bubbleID) {
            case 0:
                bubbleOffsetX = 40;
                bubbleOffsetY = -60;
                bubbleHTML = "<img src=\"/images/designBubble.gif\" onclick=\"javascript:showBubble[0]=false;clearBubble(0);showBubbleSticky(0);\">"
                break;
            case 1:
                bubbleOffsetX = 50;
                bubbleOffsetY = -35;
                bubbleHTML = "<img src=\"/images/affordBubble.gif\" onclick=\"javascript:showBubble[1]=false;clearBubble(1);showBubbleSticky(1);\" />"
                break;
            case 2:
                bubbleOffsetX = 40;
                bubbleOffsetY = -50;
                bubbleHTML = "<img src=\"/images/installBubble.gif\" onclick=\"javascript:showBubble[2]=false;clearBubble(2);showBubbleSticky(2);\" />"
                break;
            case 3:
                bubbleOffsetX = 50;
                bubbleOffsetY = -35;
                bubbleHTML = "<img src=\"/images/seeOurCoolestProjects.gif\" onclick=\"javascript:showBubble[3]=false;clearBubble(3);showBubbleSticky(3);\" />"
                break;
            case 4:
                bubbleOffsetX = 100;
                bubbleOffsetY = 228;
                break;
            case 5:
                bubbleOffsetX = 130;
                bubbleOffsetY = 228;
                break;
            case 6:
                bubbleOffsetX = 160;
                bubbleOffsetY = 228;
                break;
            case 7:
                bubbleOffsetX = 190;
                bubbleOffsetY = 228;
                break;
            case 8:
                bubbleOffsetX = 220;
                bubbleOffsetY = 228;
                break;
        }
        if (bubbleID < 4) {
            // box bubbles
            bubbleDivStyle.left = findPos(bubbleBoxTD)[0] + bubbleOffsetX;
            bubbleDivStyle.top = findPos(bubbleBoxTD)[1] + bubbleOffsetY;
            writeLayer("bubbleDiv" + bubbleID, null, bubbleHTML);
        } else {
            // rotator bubbles
            bubbleDivStyle.left = findPos(rotatorBox)[0] + bubbleOffsetX;
            bubbleDivStyle.top = findPos(rotatorBox)[1] + bubbleOffsetY;
        }

        changeObjectVisibility('bubbleDiv' + bubbleID, 'visible');
    } else { alert(" showbubble is not true"); }


    return true;
}

function showBubbleSticky(bubbleID, index) {
    var bubbleBoxTD = getObject("bubbleBoxTD" + bubbleID);
    var bubbleHTML = "";
    var bubbleOffsetX = 0;
    var bubbleOffsetY = 0;
    var bubbleStickyDivStyle = getStyleObject("bubbleStickyDiv" + bubbleID);

    clearBubbleStickyAll();
    showBackLyr();
    switch (bubbleID) {
        case 0:
            bubbleOffsetX = 41;
            bubbleOffsetY = -402;
            bubbleStickyDivStyle.left = findPos(bubbleBoxTD)[0] + bubbleOffsetX;
            bubbleStickyDivStyle.top = findPos(bubbleBoxTD)[1] + bubbleOffsetY;

            bubbleHTML = "<iframe src=\"watchVideoHome2.aspx?showThumbs=0&g=13&padding=0&cb=0\" width=\"640\" height=\"375\" frameborder=\"no\" scrolling=\"no\"></iframe>";
            break;
        case 1:
            bubbleOffsetX = 1;
            bubbleOffsetY = -499;
            bubbleStickyDivStyle.left = findPos(bubbleBoxTD)[0] + bubbleOffsetX;
            bubbleStickyDivStyle.top = findPos(bubbleBoxTD)[1] + bubbleOffsetY;

            bubbleHTML = "<iframe src=\"inline_stories2.aspx\" width='430' height='450' frameborder='no' scrolling='yes' style='overflow-x: hidden;'></iframe>";
            break;
        case 2:
            bubbleOffsetX = 41;
            bubbleOffsetY = -340;
            bubbleStickyDivStyle.left = findPos(bubbleBoxTD)[0] + bubbleOffsetX;
            bubbleStickyDivStyle.top = findPos(bubbleBoxTD)[1] + bubbleOffsetY;

            bubbleHTML = "<iframe src=\"watchVideoHome2.aspx?forceHighBandwidth=1&g=7&showThumbs=0&padding=0&cb=0\" width=\"618\" height=\"315\" frameborder=\"no\" scrolling=\"no\"></iframe>";
            changeObjectVisibility('instructionOverlay2', 'visible');
            break;
        case 3:
            bubbleOffsetX = -151;
            bubbleOffsetY = -643;
            bubbleStickyDivStyle.left = findPos(bubbleBoxTD)[0] + bubbleOffsetX;
            bubbleStickyDivStyle.top = findPos(bubbleBoxTD)[1] + bubbleOffsetY;

            bubbleHTML = "<iframe src=\"inline_projects.aspx\" width=\"577\" height=\"595\" frameborder=\"no\" scrolling=\"yes\"></iframe>";
            break;
        case 4:
            // filmstrip testimonial sticky bubble
            bubbleHTML = testesFilmText[index];

            // make y coord relative to position of prev button
            var leftButton = getObject("pp2");
            bubbleOffsetY = findPos(leftButton)[1] - 83 - testesFilmHeights[index]; ;

            // for x coord, get position of current thumb
            var curThumb = document.getElementById("u" + index);
            bubbleOffsetX = findPos(curThumb)[0] + 10;

            // position arrow on bottom of bubble based on thumb position
            var bubbleFooter = getStyleObject("bubbleStickyDiv4Footer");
            bubbleFooter.paddingLeft = "32";

            if (((index > 3) && (index < 7)) || (index > 9)) {
                // for the two rightmost bubbles, shift them over a bit to keep them onscreen.
                bubbleFooter.paddingLeft = "352";
                bubbleOffsetX -= 320;
            }

            bubbleStickyDivStyle.left = bubbleOffsetX;
            bubbleStickyDivStyle.top = bubbleOffsetY;

            HideContent('testimonialDiv');
            break;

    }

    writeLayer("bubbleStickyDivVideo" + bubbleID, null, bubbleHTML);
    changeObjectVisibility('bubbleStickyDiv' + bubbleID, 'visible');

}


function queueBubble(i) {
    showBubble[i] = true;
    clearTimeout(bubbleTimer[i]);
    bubbleTimer[i] = setTimeout("showBubblez(" + i + ")", 200);
}

function unqueueBubble(i) {
    showBubble[i] = false;
    clearTimeout(bubbleTimer[i]);
    bubbleTimer[i] = setTimeout("clearBubble(" + i + ")", 200);
}
function clearBubble(i) {
    //alert("in clearBubble with showbubble[" + i + "]=" + showBubble[i]);
    if (showBubble[i] == false) {
        clearTimeout(bubbleTimer[i]);
        //writeLayer(("bubbleDiv"+String(i)), null, "");
        changeObjectVisibility(('bubbleDiv' + String(i)), 'hidden');
    }
}

function clearBubbleSticky(i) {
    //alert("in clearBubble with showbubble[" + i + "]=" + showBubble[i]);
    writeLayer(("bubbleStickyDivVideo" + String(i)), null, "");
    changeObjectVisibility(('bubbleStickyDiv' + String(i)), 'hidden');
    unextrudeBox(i);
    hideBackLyr();
}

function clearBubbleStickyAll() {
    for (var i = 0; i < 5; i++) {
        clearBubbleSticky(i);
    }
}

function clearBubbleQueue() {
    showBubble = new Array(false, false, false, false);
    clearTimeout(bubbleTimer[i]);
    writeLayer("bubbleDiv1", null, "");
    changeObjectVisibility('bubbleDiv1', 'hidden');

}

function extrudeBox(i) {
    var bubbleBoxTD = getStyleObject("bubbleBoxTD" + i);
    bubbleBoxTD.background = "url(images/homeSquareBackOn.gif)";

    var boxTextDivStyle = getStyleObject("bubbleBoxDiv" + i);
    boxTextDivStyle.left = 2;
    boxTextDivStyle.top = 2;

    var boxImgDivStyle = getStyleObject("bubbleBoxImg" + i);
    boxImgDivStyle.left = 2;
    boxImgDivStyle.top = 2;

}

function unextrudeBox(i) {
    var bubbleBoxTD = getStyleObject("bubbleBoxTD" + i);
    bubbleBoxTD.background = "url(images/homeSquareBackOff.gif)";

    var boxTextDivStyle = getStyleObject("bubbleBoxDiv" + i);
    boxTextDivStyle.left = 0;
    boxTextDivStyle.top = 0;

    var boxImgDivStyle = getStyleObject("bubbleBoxImg" + i);
    boxImgDivStyle.left = 0;
    boxImgDivStyle.top = 0;


}

function getObject(x74) {
    var x67;
    if (iens6) {
        x67 = document.getElementById ? document.getElementById(x74) : document.all.x74;
    } else if (ns4) { x67 = eval("document." + x74); }
    return x67;
};

function findPos(obj) {
    var curleft = curtop = 0;
    if (obj.offsetParent) {
        curleft = obj.offsetLeft
        curtop = obj.offsetTop
        while (obj = obj.offsetParent) {
            curleft += obj.offsetLeft
            curtop += obj.offsetTop
        }
    }
    if (safari)
        return [curleft + safariOffsetX, curtop + safariOffsetY];
    else
        return [curleft, curtop];

}

function gotoShowroom() {
    window.location = "ClosetOrganizers.aspx";
    return false;
}

function showVideoViewer(i) {
    //slideshow.pausePlay();pauseAlways();

    if (i == 1) {
        var mainImg = getObject("imageTwo");
        var videoViewerStyle = getStyleObject("videoViewer");

        videoViewerStyle.left = findPos(mainImg)[0] - 1;
        videoViewerStyle.top = findPos(mainImg)[1] + 0;
        writeLayer("videoViewer", null, "<iframe style=\"margin-top: 15px;\" src=\"watchVideoHome2.aspx?showThumbs=0&g=2&padding=0&fh=268&cb=0\" width=\"445\" height=\"268\" frameborder=\"no\" scrolling=\"no\"></iframe>");
    } else {
        var mainImg = getObject("imageFive");
        var videoViewerStyle = getStyleObject("videoViewer");

        videoViewerStyle.left = findPos(mainImg)[0] - 1;
        videoViewerStyle.top = findPos(mainImg)[1] + 0;
        writeLayer("videoViewer", null, "<iframe style=\"margin-top: 15px;\" src=\"watchVideoHome2.aspx?forceHighBandwidth=1&g=12&fh=268&showThumbs=0&padding=0&cb=0\" width=\"445\" height=\"268\" frameborder=\"no\" scrolling=\"no\"></iframe>");
    }

    changeObjectVisibility('videoViewer', 'visible');
    changeObjectVisibility('rotatorPlayImg', 'hidden');
    changeObjectVisibility('rotatorPrevImg', 'hidden');
    changeObjectVisibility('rotatorNextImg', 'hidden');
}

function hideVideoViewer() {
    var mainImg = getObject("imageTwo");
    var videoViewerStyle = getStyleObject("videoViewer");

    writeLayer("videoViewer", null, "");
    changeObjectVisibility('videoViewer', 'hidden');
    changeObjectVisibility('rotatorPlayImg', 'visible');
    changeObjectVisibility('rotatorPrevImg', 'visible');
    changeObjectVisibility('rotatorNextImg', 'visible');

}

function repositionVideoViewer() {
    var mainImg = getObject("imageTwo");
    var videoViewerStyle = getStyleObject("videoViewer");

    if (mainImg) {
        videoViewerStyle.left = findPos(mainImg)[0] - 1;
        videoViewerStyle.top = findPos(mainImg)[1] + 0;
    }
}

function statusMsg(msg) {
    window.status = msg;
    return true;
}

function writeLayer(ID, parentID, sText) {
    if (document.layers) {
        var oLayer;
        if (parentID) {
            oLayer = eval('document.' + parentID + '.document.' + ID + '.document');
        } else {
            oLayer = document.layers[ID].document;
        }
        oLayer.open();
        oLayer.write(sText);
        oLayer.close();
    }
    else if (parseInt(navigator.appVersion) >= 5 && navigator.
            appName == "Netscape") {
        document.getElementById(ID).innerHTML = sText;
    }
    else if (document.all) document.all[ID].innerHTML = sText
    else {
        //alert("hi");
        document.getElementById(ID).innerHTML = sText;
    }
} 

var playPauseBtn;
var slideshow;
function landingInit() {
    changeObjectVisibility('rotatorNextImg', 'hidden');

    var mapHeaderImg = getStyleObject("mapHeader");
    var mapImg = getObject("usMap");

    mapHeaderImg.left = findPos(mapImg)[0] + 50;
    mapHeaderImg.top = findPos(mapImg)[1] + 10;

    changeObjectVisibility('mycarousel', 'visible');

    //this.usMap.attachEvent("onmousedown", testFunc);
    document.onclick = hideAllBubbles;

    // precache stories map mouseovers
    MM_preloadImages('images/homeSquareBackOn.gif', 'images/homeSquareBackOff.gif', 'images/homeBoxSquareOn.gif', '/images/bubble-T.gif', '/images/bubble-TL.gif', '/images/bubble-TR.gif', '/images/bubble-L.gif', '/images/bubble-R.gif', '/images/bubble-B.gif', '/images/bubble-BL.gif', '/images/bubble-BR.gif', '/images/bubbleWithHeader-TL.gif', '/images/bubbleWithHeader-TR.gif', '/images/bubble-Arrow.gif', '/images/designBubble2.gif', '/images/affordBubble.gif', '/images/installBubble.gif', '/images/seeOurCoolestProjects.gif', '/images/showroom/gth_38.jpg', '/images/showroom/gth_46.jpg', '/images/showroom/gth_45.jpg', '/images/showroom/gth_5', '/images/showroom/gth_33.jpg', '/images/showroom/gth_39.jpg', '/images/showroom/gth_57.jpg', '/images/testimonials/popupName1.gif', '/images/testimonials/popupName2.gif', '/images/testimonials/popupName3.gif', '/images/testimonials/popupName4.gif', '/images/testimonials/popupName5.gif', '/images/testimonials/popupName6.gif', '/images/testimonials/popupName7.gif', '/images/testimonials/popupName8.gif', '/images/testimonials/popupName9.gif', '/images/testimonials/popupName10.gif', '/images/testimonials/popupName11.gif', '/images/testimonials/popupName12.gif', '/images/realCustomers.gif', '/images/testimonials/stripThumb7.gif', '/images/testimonials/stripThumb8.gif', '/images/testimonials/stripThumb9.gif', '/images/testimonials/stripThumb10.gif', '/images/testimonials/stripThumb11.gif', '/images/testimonials/stripThumb12.gif', '/images/testimonials/map2_us.gif', '/images/testimonials/map2_hi.gif', '/images/testimonials/map2_md.gif', '/images/testimonials/map2_de.gif', '/images/testimonials/map2_nj.gif', '/images/testimonials/map2_ct.gif', '/images/testimonials/map2_ri.gif', '/images/testimonials/map2_ma.gif', '/images/testimonials/map2_nh.gif', '/images/testimonials/map2_vt.gif', '/images/testimonials/map2_me.gif', '/images/testimonials/map2_ny.gif', '/images/testimonials/map2_pa.gif', '/images/testimonials/map2_oh.gif', '/images/testimonials/map2_in.gif', '/images/testimonials/map2_mi.gif', '/images/testimonials/map2_wi.gif', '/images/testimonials/map2_il.gif', '/images/testimonials/map2_wv.gif', '/images/testimonials/map2_va.gif', '/images/testimonials/map2_ky.gif', '/images/testimonials/map2_nc.gif', '/images/testimonials/map2_tn.gif', '/images/testimonials/map2_sc.gif', '/images/testimonials/map2_ga.gif', '/images/testimonials/map2_fl.gif', '/images/testimonials/map2_al.gif', '/images/testimonials/map2_ms.gif', '/images/testimonials/map2_la.gif', '/images/testimonials/map2_tx.gif', '/images/testimonials/map2_ar.gif', '/images/testimonials/map2_mo.gif', '/images/testimonials/map2_ia.gif', '/images/testimonials/map2_mn.gif', '/images/testimonials/map2_ok.gif', '/images/testimonials/map2_ks.gif', '/images/testimonials/map2_ne.gif', '/images/testimonials/map2_sd.gif', '/images/testimonials/map2_nd.gif', '/images/testimonials/map2_co.gif', '/images/testimonials/map2_wy.gif', '/images/testimonials/map2_mt.gif', '/images/testimonials/map2_id.gif', '/images/testimonials/map2_ut.gif', '/images/testimonials/map2_nm.gif', '/images/testimonials/map2_az.gif', '/images/testimonials/map2_ak.gif', '/images/testimonials/map2_nv.gif', '/images/testimonials/map2_ca.gif', '/images/testimonials/map2_or.gif', '/images/testimonials/map2_wa.gif');

}

function hideAllBubbles(e) {

    try {

        var target = (e && e.target) || (event && event.srcElement);
        if (checkParent(target)) {
            clearBubbleStickyAll();
            HideContent('testimonialDiv');
            HideContent('testimonialDivSticky');
            hideBackLyr();
        }
    } catch (ex) { }

}

function checkParent(t) {

    while (t.parentNode) {
        //alert(t.id);
        if ((t.id.indexOf("bubble") != -1) || (t.id.indexOf("carousel") != -1) || (t.id.indexOf("map") != -1) || (t.id.indexOf("scroller") != -1)) {
            return false
        }
        t = t.parentNode
    }
    return true
}
// scroll stuff:

function MM_findObj(n, d) { //v4.01
    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n); return x;
}

// map stuff
function swapImage(name) {
    document.usMap.src = name;
}

// filmstrip popup bubbles
var cX = 0; var cY = 0; var rX = 0; var rY = 0;
function UpdateCursorPosition(e) { cX = e.pageX; cY = e.pageY; }
function UpdateCursorPositionDocAll(e) { cX = event.clientX; cY = event.clientY; }
if (document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }
function AssignPosition(d, thumb) {
    if (self.pageYOffset) {
        rX = self.pageXOffset;
        rY = self.pageYOffset;
    }
    else if (document.documentElement && document.documentElement.scrollTop) {
        rX = document.documentElement.scrollLeft;
        rY = document.documentElement.scrollTop;
    }
    else if (document.body) {
        rX = document.body.scrollLeft;
        rY = document.body.scrollTop;
    }
    if (document.all) {
        cX += rX;
        cY += rY;
    }
    if (thumb.substr(0, 1) == "t") {
        // testimonial
        d.style.left = (cX - 55) + "px";
        d.style.top = "365px";
    } else {
        d.style.left = (cX - 55) + "px";
        var leftButton = getObject("pp");
        d.style.top = findPos(leftButton)[1] - 70;
        d.style.left = findPos(document.getElementById(thumb))[0] + 10;
    }
}
function HideContent(d) {
    if (d.length < 1) { return; }
    document.getElementById(d).style.display = "none";
}
function ShowContent(d, th) {
    //alert(typeof th);

    if (d.length < 1) { return; }
    var dd = document.getElementById(d);


    var testimonialHTML = "";
    if (th && ((typeof th) == "object")) {
        // called from the map with format (state, event).  We'll write an iframe to the div.
        // we'll resuse the div that we used for the testimoinals filmstrip since it uses the same header.
        var width = "490";
        var height = "350";
        var testimonialHTML = '<iframe style="overflow-x: hidden;"  src="/inline_stories.aspx?stateID=' + d + '" width="' + width + '" height="' + height + '" frameborder="0" ></iframe>';
        writeLayer("bubbleStickyDivVideo4", null, testimonialHTML);

        // position bubble
        var testeBubbleDiv = document.getElementById("bubbleStickyDiv4");
        testeBubbleDiv.style.left = mouseX(th) - 93;
        testeBubbleDiv.style.top = mouseY(th) - 452;
        //testeBubbleDiv.style.display = "block";

        // reset the arrow position on bottom of bubble
        var bubbleFooter = getStyleObject("bubbleStickyDiv4Footer");
        bubbleFooter.paddingLeft = "82";

        changeObjectVisibility('bubbleStickyDiv4', 'visible');

    } else if (th) {
        if (th.substr(0, 1) == "t") {
            // clicked on the testimonial marquee
            // write current testimonial to testimonialDiv and position relative to current mouse position.
            // determine testimonial index
            var testiIndex = th.substr(1, 1);

            // write tesitmonial to div
            var testimonialHTML = "<div style='width:270px;height:250px; overflow: auto; padding-right: 20px;'><div class='headerRed' STYLE='font-size: 14px; TEXT-TRANSFORM: uppercase;'>" + testimonialsName[testiIndex] + "</div><span class='sectionGrey' style='font-size: 12px; line-height: 1.5;'>" + testimonialsTextFull[testiIndex] + "</span></div>";
            writeLayer("testimonialContentDivSticky", null, testimonialHTML);

            // scroll to top of div
            testimonialContentDiv.scrollTop = 0;

            AssignPosition(dd, th);

        } else if (th.substr(0, 1) == "s") {
            // mousedover the showroom filmstrip
            // display the clickForPriceDiv div that contains a 'click for price' graphic, and position based on thumbnail.

            // find position of prev button for y coord.
            var leftButton = getObject("pp");
            dd.style.top = findPos(leftButton)[1] - 70;

            // get position of current thumb for x coord
            var curThumb = document.getElementById(th);
            dd.style.left = findPos(curThumb)[0] + 10;
        } else if (th.substr(0, 1) == "u") {
            // mousedover the testimonial filmstrip
            // display the testimonialContentDiv div that contains the customers name and position based on thumbnail and location.

            // determine testimonial index
            var testiIndex = th.substr(1, th.length);

            // write tesitmonial to div
            //var testimonialHTML = "<div class='headerRed' STYLE='font-size: 14px; TEXT-TRANSFORM: uppercase;'>" + testimonialsName[testiIndex] + "</div><span class='sectionGrey' style='font-size: 12px; line-height: 1.5;'>" + testimonialsTextFull[testiIndex] + "</span>";
            var testimonialHTML = "<a href='#' onclick='showBubbleSticky(4," + testiIndex + "); return false;'><img id='tb" + testiIndex + "' name='tb" + testiIndex + "' src='/images/testimonials/popupName" + testiIndex + ".gif'></a>";
            writeLayer("testimonialContentDiv", null, testimonialHTML);

            // find position of prev button for y coord.
            var leftButton = getObject("pp2");
            dd.style.top = findPos(leftButton)[1] - 70;

            // get position of current thumb for x coord
            var curThumb = document.getElementById(th);
            dd.style.left = findPos(curThumb)[0] + 10;
        }


        //AssignPosition(dd, th);
        // show bubble
        dd.style.display = "block";
    } else {
        // show bubble
        dd.style.display = "block";
    }

}

function mouseX(evt) {
    if (evt.pageX) return evt.pageX;
    else if (evt.clientX)
        return evt.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
    else return null;
}
function mouseY(evt) {
    if (evt.pageY) return evt.pageY;
    else if (evt.clientY)
        return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
    else return null;
}

function ReverseContentDisplay(d) {
    if (d.length < 1) { return; }
    var dd = document.getElementById(d);
    AssignPosition(dd);
    if (dd.style.display == "none") { dd.style.display = "block"; }
    else { dd.style.display = "none"; }
}


function mycarousel_initCallback(carousel) {
    jQuery('.jcarousel-control a').bind('click', function () {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });

    jQuery('.jcarousel-scroll select').bind('change', function () {
        carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
        return false;
    });

    jQuery('#mycarousel-next').bind('click', function () {
        carousel.next();
        return false;
    });

    jQuery('#mycarousel-prev').bind('click', function () {
        carousel.prev();
        return false;
    });
};



function mycarousel_initCallback2(carousel) {
    jQuery('.jcarousel-control a').bind('click', function () {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });

    jQuery('.jcarousel-scroll select').bind('change', function () {
        carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
        return false;
    });

    jQuery('#mycarousel2-next').bind('click', function () {
        carousel.next();
        return false;
    });

    jQuery('#mycarousel2-prev').bind('click', function () {
        carousel.prev();
        return false;
    });
};
jQuery(document).ready(function () {
    jQuery('#mycarousel').jcarousel({
        animation: "slow",
        scroll: 6,
        visible: 6,
        initCallback: mycarousel_initCallback,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
    jQuery('#mycarousel2').jcarousel({
        animation: "slow",
        scroll: 6,
        visible: 6,
        initCallback: mycarousel_initCallback2,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});


