$(function() {
    if ($.browser.msie && $.browser.version.substr(0,1)<7) return;
    if($('div#foo.business .logos').length>0) {
        var data = [
            // ["Philips", "philips.gif", "http://www.usa.philips.com/"], 
            // ["Gates Business Solutions", "gates.gif", "http://gatesbusinesssolutions.com"],  
	    // ["TDS", "tds.gif", "http://tds.net"],
           ["Land's End", "le.gif", "http://landsend.com"],
           ["GeoAnalytics, Inc.", "geo.gif", "http://geoanalytics.com/"],
           ["Dean Health Plan", "dean.gif", "http://.deancare.com"],
           ["Thrivent Financial for Lutherans", "thrivent.gif", "http://thrivent.com"],
           ["Springs Windows Fashions", "springs.gif", "http://springswindowfashions.com"],
           ["Sentry Insurance", "sentry.gif", "http://sentry.com"],
           ["Great Lakes Higher Education Corporation", "greatlakes.gif", "http://mygreatlakes.com"],
           ["State of Wisconsin", "state.gif", "http://wisconsin.gov"]

        ];

        var start=function(){
            var list=$('div#foo.business .logos table tr')
            $.each(data,function(i,el) {
                list.append('<td><a href="'+el[2]+'"><img src="/images/clients/'+el[1]+'" alt="'+el[0]+'" /></a></td>')
            })

            var xstart=parseInt($('div#foo.business .slide').css('left'))
            var size=$('div#foo.business .logos td').length-3
            var count=0
            var slider=function(){
                count+=1
                var xnow=parseInt($('div#foo.business .slide').css('left'))
                if (Math.abs(xnow+(size*150))<25) {
                    $('div#foo.business .slide').css('left',0)
                    count=0
                } else {
                    $('div#foo.business .slide').animate({left:"-"+(count*150)+"px"},1500)
                }
            }
            setInterval(slider,3000)
        }
        setTimeout(start,1000)
    }
});

$(function() {
    if ($.browser.msie && $.browser.version.substr(0,1)<7) return;
    if($('div#bar.business .logos').length>0) {
        var data = [
            // ["Bethel", "bethel.gif", "http://www.bethel-madison.org/"], 
            // ["Name Badge Productions", "nbp.gif", "http://namebadgeproductions.com"], 
            // ["Hellenbrand Glass, LLC", "hg.gif", "http://www.hellenbrandglass.com/"], 
            ["State of Wisconsin", "state.gif", "http://wisconsin.gov"],
            ["AgCoA", "agcoa.gif", "http://agcoa-us.com"],
            ["La Mont Medical Inc.", "lamont.gif", "http://lamontmedical.com"],
            ["Ourston Roundabout Engineering", "ourston.gif", "http://ourston.com"],
            ["Pharo Heating", "pharo.gif", "http://pharoheating.com"],
            ["NARI of Madison", "nari.gif", "http://remodelingmadison.org"],
            ["Precision Communications", "pci.gif", "http://pciwi.com"],
            ["E80 Pluc Constructors, LLC", "e80.gif", "http://e80plus.com"],
            ["Mid-State Equipment", "midstate.gif", "http://midstateequipment.com"],
        ];

        var start=function(){
            var list=$('div#bar.business .logos table tr')
            $.each(data,function(i,el) {
                list.append('<td><a href="'+el[2]+'"><img src="/images/clients/'+el[1]+'" alt="'+el[0]+'" /></a></td>')
            })

            var xstart=parseInt($('div#bar.business .slide').css('left'))
            var size=$('div#bar.business .logos td').length-3
            var count=0
            var slider=function(){
                count+=1
                var xnow=parseInt($('div#bar.business .slide').css('left'))
                if (Math.abs(xnow+(size*150))<25) {
                    $('div#bar.business .slide').css('left',0)
                    count=0
                } else {
                    $('div#bar.business .slide').animate({left:"-"+(count*150)+"px"},1500)
                }
            }
            setInterval(slider,3000)
        }
        setTimeout(start,1000)
    }
});

