﻿//var items = [{ "headline": "Is your technology properly aligned with your business needs?", "copy": "We have a variety of outsources IT service alternatives for small and medium sized business.", "image": "/HeroBizNeeds.jpg", "link": "fixed_rate_service_contracts.aspx" }, { "headline": "Unified communications and VoIP can power businesses past their competition", "copy": "Business phone solutions for small and medium sized business.", "image": "HeroPhone.jpg", "link": "business_phone_systems.aspx" }, { "headline": "Bellevue IT consulting services for small and medium sized businesses", "copy": "With our team of IT professionals you get an unlimited pool of experience and knowledge.", "image": "HeroSmMedBiz.jpg", "link": "it_consulting.aspx" }, { "headline": "rM3 Remote IT management, monitoring, and maintenance services", "copy": "&bull; 24\/7 proactive monitoring and alerts<br \/> &bull; Automated software patch management<br \/> &bull; Preventative asset-based control<br \/> &bull; Comprehensive reporting.", "image": "HeroRemoteIT.jpg", "link": "it_management.aspx"}];
var partnerSliderItems = [
        { "headline": "Microsoft", "copy": "", "image": "microsoft_logo.gif", "link": "microsoft.aspx" },
        { "headline": "SonicWall", "copy": "", "image": "sonicwall-logo.gif", "link": "sonicwall.aspx" },
        { "headline": "WatchGuard", "copy": "", "image": "watchguard.gif", "link": "watchguard.aspx" },
        { "headline": "D-Link", "copy": "", "image": "dlinklogo.gif", "link": "d_link.aspx" },
        { "headline": "Barracuda", "copy": "", "image": "barracuda.jpg", "link": "barracuda.aspx" },
        { "headline": "Cisco", "copy": "", "image": "cisco.gif", "link": "cisco_data.aspx" },
        { "headline": "MX Logic", "copy": "", "image": "mx-logic.gif", "link": "mx_logic.aspx" },
        { "headline": "APC", "copy": "", "image": "apc.jpg", "link": "apc.aspx" },
        { "headline": "Acronis", "copy": "", "image": "acronis.gif", "link": "acronis.aspx" },
        { "headline": "FileRepPro", "copy": "", "image": "file-replication-pro.jpg", "link": "file_replication_pro.aspx" },
        { "headline": "Chartec", "copy": "", "image": "Cyberstreams_Partners_Chartec_Sm.jpg", "link": "chartec.aspx" },
        { "headline": "HP", "copy": "", "image": "Cyberstreams_Partners_HP.jpg", "link": "hp_voice.aspx" },
        { "headline": "Dell", "copy": "", "image": "dell_logo.jpg", "link": "dell.aspx" },
        { "headline": "Trend Micro", "copy": "", "image": "Cyberstreams_Partners_TrendMicro.jpg", "link": "trend_micro.aspx" },
        { "headline": "Rocstor", "copy": "", "image": "rocstor-logo.gif", "link": "rocstor.aspx" },
        { "headline": "Fonality", "copy": "", "image": "Cyberstreams_Partners_Fonality.jpg", "link": "fonality_trixbox.aspx" },
        { "headline": "MultiTech", "copy": "", "image": "Cyberstreams_Partners_MultiTech.jpg", "link": "multi_tech.aspx" },
        { "headline": "Bonsai Media Group", "copy": "", "image": "bonsai_InternetLogo125x125B.png", "link": "http://www.bonsaimediagroup.com" },
    ];

$(document).ready(function() {
    /*for (i in items) {

        var slide = ""
    + '<div style="height: 300px; width:700px; display: none;">'
    + '<h1 class="feature-h1">' + items[i].headline + '</h1>'
    + '<p class="feature-p">' + items[i].copy + ' <a href="' + items[i].link + '">Learn More &raquo;</a></p>'
    + '<a href="' + items[i].link + '"><img class="f" src="images/' + items[i].image + '" alt="' + items[i].headline + '" /></a>';
    +'</div>';

        $('#feature').append(slide);

    }

    $('#feature').cycle({   
    fx: 'fade',
    timeout: 6000,
    delay: -2000,
    pager: '#snav'
    });*/

    for (i in partnerSliderItems) {

        var partnerSliderSlide = ""
			 + '<div style="height: 147px; width:177px; display: none; background-color:transparent">'
			 + '<br class="clear"/>'
			 + '<a href="' + partnerSliderItems[i].link + '"><img class="f" src="images/' + partnerSliderItems[i].image + '" alt="' + partnerSliderItems[i].headline + '" /></a>';
+'</div>';

        $('#partnerSlider').append(partnerSliderSlide);

    }

    $('#partnerSlider').cycle({
        fx: 'fade',
        timeout: 6000,
        delay: -2000
    });

    //$('.nivo-slice').html("<img src='images/Cyberstreams_VidAbout.jpg' alt='test' class='hidden'/>")
});

/*$(document).ready(function() {
$("#clickForMore").toggle(function() {
$("#sidebarNavMiddle ul").css({ "overflow": "auto", "max-height": "none" });
$("sidebarNavMiddle").css("min-height", "300px");
$("sidebar").css("height", "auto");
}, function() {
$("#sidebarNavMiddle ul").css("overflow", "hidden");
});
});*/

/*$(document).ready(function() {
//when "more" anchor clicked
$("clickForMore").toggle(function() {

//increase height of containing div

//show hidden list items

//move remaining sidebar divs down to make room for increased size of sidebarNav

});
});*/

$(document).ready(function () {
    var list = $("#sidebarNavMiddle ul li:gt(5)");
    list.hide();
    $("#clickForMore").toggle(function () {
        list.slideToggle(400);
        $("#sidebar > div:eq(1)").animate({ marginTop: "110px" }, 400, 'swing');
        $("#clickForMore").html("<< Click for less");
        $("#wrapper #sidebar #sidebarNav").css("margin-bottom", "150px");
        return false;
    }, function () {
        $("#clickForMore").html("Click for more >>");
        $("#sidebar > div:eq(1)").animate({ marginTop: "0px" }, 400, 'swing');
        list.slideToggle(400);
        $("#wrapper #sidebar #sidebarNav").css("margin-bottom", "20px");
        return false;
    });
});

$(document).ready(function () {
    //get url of current page
    var pathName = window.location.href;

    //compare to src attribute of each anchors in top nav
    var aHref = [];
    aHref = $("#nav > ul > li > a").each(function () {
        //if comparison matches, change class to "on"
        if (pathName == $(this).attr("href")) {
            $(this).parent().addClass("on");
        }
        //otherwise the class is "off"
        else {
            $(this).parent().addClass("off");
        }
    });

    /*if (pathname == "/") {
        $("#sidebar > a:first-child").css("display:block");
    }*/
});

$(document).ready(function() {
    function preload(arrayOfImages) {
        $(arrayOfImages).each(function() {
            $('<img/>')[0].src = this;
        });
    }

    // Usage:

    preload([
        '../images/HeroBizNeeds.jpg',
        '../images/HeroPhone.png',
        '../images/HeroSmMedBiz.png',
        '../images/HeroRemoteIT.png'
    ]);
});
