﻿//0=REadyMix, 1=Agg, 2=AME, 3=mscg, 4=saag, 5=pump, 6=icf 
var imglist0 = new Array(
                         'headerImg/ReadyMix110.jpg',
                         'headerImg/ReadyMix114.jpg',
                         'headerimg/pump121.jpg',
                         'headerImg/ReadyMix119.jpg',
                         'headerImg/ReadyMix117.jpg',
                         'headerImg/icf102.jpg',
                         'headerimg/pump103.jpg',
                         'headerImg/ReadyMix106.jpg',
                         'headerImg/Safe100.jpg',
                         'headerimg/mscg108.jpg',                         
                         'headerimg/mscg115.jpg',
                         'headerImg/plant100.jpg',
                         'headerImg/ReadyMix108.jpg',
                         'headerImg/pump106.jpg',
                         'headerImg/ReadyMix100.jpg',
                         'headerImg/ReadyMix101.jpg',                         
                         'headerImg/ReadyMix112.jpg',
                         'headerImg/ReadyMix120.jpg'
                         );
                         
                         
var imglist1 = new Array('headerimg/agg110.jpg',
                         'headerimg/agg100.jpg',
                         'headerimg/agg103.jpg',
                         'headerimg/agg105.jpg',
                         'headerimg/agg102.jpg',
                         'headerImg/ReadyMix104.jpg',
                         'headerimg/agg108.jpg',
                         'headerimg/agg106.jpg',
                         'headerimg/agg109.jpg');
                         
var imglist2 = new Array('headerImg/ame102.jpg',
                         'headerimg/ame101.jpg',
                         'headerimg/ame103.jpg');
                         
var imglist3 = new Array('headerimg/mscg100.jpg',
                         'headerimg/ReadyMix101.jpg',
                         'headerimg/mscg107.jpg',
                         'headerimg/mscg104.jpg',
                         'headerimg/mscg108.jpg',
                         'headerimg/mscg110.jpg',
                         'headerimg/mscg112.jpg',
                         'headerimg/mscg102.jpg',
                         'headerimg/mscg113.jpg',
                         'headerimg/mscg115.jpg');
                         
var imglist4 = new Array('headerimg/saag100.jpg','headerimg/agg100.jpg', 'headerimg/ReadyMix107.jpg');

var imglist5 = new Array('headerimg/pump100.jpg',
                         'headerimg/pump101.jpg', 
                         'headerimg/pump106.jpg',
                         'headerImg/icf102.jpg',
                         'headerimg/pump103.jpg',
                         'headerImg/ReadyMix110.jpg',
                         'headerImg/pump110.jpg',
                         'headerimg/pump113.jpg',
                         'headerImg/pump114.jpg',
                         'headerimg/pump116.jpg',
                         'headerImg/pump119.jpg',
                         'headerimg/pump104.jpg'
                         );
                         
var imglist6 = new Array('headerImg/icf100.jpg',
                         'headerImg/icf101.jpg',
                         'headerImg/icf102.jpg',
                         'headerImg/icf103.jpg',
                         'headerImg/icf106.jpg',                         
                         'headerImg/icf104.jpg');

var imglist7 = new Array('headerImg/rental.jpg');                         
                         
var imglist = imglist0;

var j = new Array(); /* set up in init() */
var newsTitle = new Array(
                          "Green Building",
                          "Booster Washout Tank&reg;",  
                          "Community",
                          "Pervious",
                          "Fischer Sand &amp; Aggregate"
                          );
                         
var newsText = new Array(
                         "<p>AVR, Inc. is a leader in green building technology. From pervious concrete and ICF construction to Leadership in Energy and Environmental Design (LEED&#8482;) high cement replacement concrete, we can do it.</p><p>Click <a href=\"green.aspx\">here</a> to view our Green construction capabilities.</p>",
                         "<p>Introducing the award winning Booster Washout Tank.  It is the ONLY gravity fed chute wash system that puts the rinse water where you want it, back in the drum.  The Booster Washout Tank is easy to install, use and maintain. There are no pumps or energy sources required, which means less opportunity for breakdowns.</p><p>For more information please click <a href='http://www.boosterwashout.com/'>here</a>.</p>", 
                         "<p>AVR, Inc. affiliate AME recently partnered with Cement Masons Local 633 to help the Disabled Veterans build a park and gazebo in Sartell, Minnesota.  The Disabled Veterans wanted a solid, well built structure that would need very little maintenance and last for many years.  All of the placing and finishing expertise, along with our donated concrete, was put to good use to give the veterans what they deserved.</p><p><a href=\"community.aspx\">Click here</a> to view more information on AVR’s community involvement.</p>",
                         "<p>Pervious concrete allows stormwater to infiltrate directly into the sub grade, minimizing the need for costly detention ponds. Pervious concrete is so popular because it saves both money and land needed for development.</p><p>Click <a href=\"green.aspx#Pervious\">here</a> to view a video showing the water infiltration capabilities of pervious concrete.</p>",
                         "<p>Fischer Sand &amp; Aggregate was recently selected by Shafer Contracting as the aggregate supplier for the paving on the Crosstown Commons project in Minneapolis, Minnesota.  Well over 100,000 tons of aggregate will be produced and delivered throughout this project.</p><p>Click <a href=\"aggregate.aspx\">here</a> to view more information on Fischer Sand &amp; Aggregate.</p>"
                         );

var newsImage = new Array(
                          "images/icfsmall.jpg",
                          "images/boostertank.jpg", 
                          "images/community1.jpg",
                          "images/pervioussmall.jpg",
                          "images/fsasmall.jpg"
                          );

var newsHeight = new Array(
                          "130",
                          "86", 
                          "128",
                          "100",
                          "123"
                          );

var timeOutId;

var imgdelay = 8000;

var newsDelay = 10000;
var spotDelay = 12000;
var newsTimer;
var currentNews = 0;
var rotateNews = 0;

   var maxSpot = 11;
   var currentSpot = 0;
   function rotateSpots()
   {
        
        hideAll();
        currentSpot++;
        if(currentSpot > maxSpot) currentSpot = 0;
        document.getElementById( 'spot'+currentSpot).style.display='block';
        timeOutId = setTimeout('rotateSpots()', spotDelay)
   }
  function hideAll()
  {  
     for(i=0; i<=maxSpot; i++)
     {
        document.getElementById( 'spot'+i).style.display='none';
     }
  }
   function prevSpot()
   {
   //alert('prevSpot');
        hideAll();
        currentSpot--;
        if(currentSpot < 0) currentSpot = maxSpot;
        document.getElementById( 'spot'+currentSpot).style.display='block';
        clearTimeout(timeOutId);
        timeOutId = setTimeout('rotateSpots()', spotDelay);
   }
   function nextSpot()
   {
        hideAll();
        currentSpot++;
        if(currentSpot > maxSpot) currentSpot = 0;
        document.getElementById( 'spot'+currentSpot).style.display='block';
        clearTimeout(timeOutId);
        timeOutId = setTimeout('rotateSpots()', spotDelay);
   }
  
  
function showwarning()
{
    if(document.getElementById('concreteburns').style.display!='block')
        document.getElementById('concreteburns').style.display='block';
    else
        document.getElementById('concreteburns').style.display='none';
    
}
function showProject(proj)
{
   document.getElementById("contentimg").src = proj;

}

function showHycrete(hycrete, app, ht)
{
        //document.getElementById('hycreteviewer').style.background-position='0px '+ ht + 'px';
        document.getElementById('hycreteviewer').style.background = "url(contentimg/hc-sprite.jpg) 0px "+ht+"px";

 //  document.getElementById("hycreteimg").src = 'contentimg/hc-vwr.gif';
 //  document.getElementById("hycreteimg").src = hycrete;
   document.getElementById("hyapp01").className = '';
   document.getElementById("hyapp02").className = '';
   document.getElementById("hyapp03").className = '';
   document.getElementById("hyapp04").className = '';
   document.getElementById("hyapp05").className = '';
   document.getElementById("hyapp06").className = '';
   document.getElementById("hyapp07").className = '';
   document.getElementById("hyapp08").className = '';
   document.getElementById("hyapp09").className = '';
   document.getElementById("hyapp10").className = '';
   document.getElementById("hyapp"+app).className = "hilite";
   

}
function showPlant(pic, ht)
{
        //document.getElementById('hycreteviewer').style.background-position='0px '+ ht + 'px';
        document.getElementById('plantslide').style.background = "url(contentimg/NewBurnsvillePlant.jpg) 0px "+ht+"px";

 //  document.getElementById("hycreteimg").src = 'contentimg/hc-vwr.gif';
 //  document.getElementById("hycreteimg").src = hycrete;
   
   document.getElementById("p01").className = '';
   document.getElementById("p02").className = '';
   document.getElementById("p03").className = '';
   document.getElementById("p04").className = '';
   document.getElementById("p05").className = '';
   document.getElementById("p06").className = '';
   document.getElementById("p07").className = '';
   document.getElementById("p08").className = '';
   document.getElementById("p09").className = '';
   document.getElementById("p10").className = '';
   document.getElementById("p11").className = '';
   document.getElementById("p12").className = '';
   document.getElementById("p13").className = '';
   document.getElementById("p14").className = '';
   document.getElementById("p15").className = '';
   document.getElementById("p16").className = '';
   document.getElementById("p"+pic).className = "hilite";
   

}


// JScript File
function pageSetup(piclist, pic, rotate, proj, news)
{
   //rotateSpots();
   timeOutId = setTimeout('rotateSpots()', spotDelay)
   showNews(news);
   
   
}

function showmenu7(menu, item1, item2)
{
   var itemObj;
   //Hightlight Home, Products, About, Homeowner, or Contractor
   if(menu=='home') itemObj = document.getElementById('MainPage');
   else
    if(menu=='products') itemObj = document.getElementById('ProductsAndServices');
   else 
    if(menu=='about') itemObj = document.getElementById('AboutAvr');
   else
    if(menu=='homeowner') itemObj = document.getElementById('Homeowner');
   else
    if(menu=='contractor') itemObj = document.getElementById('Contractor');

   itemObj.style.color='#ff0000';
}

function showheader(piclist, imgPos, rotate, hilite)
{
   
      if(piclist==0) imglist=imglist0;
      if(piclist==1) imglist=imglist1;
      if(piclist==2) imglist=imglist2;
      if(piclist==3) imglist=imglist3;
      if(piclist==4) imglist=imglist4;
      if(piclist==5) imglist=imglist5;
      if(piclist==6) imglist=imglist6;
      if(piclist==7) imglist=imglist7;
      
      if(imgPos < 0)
        {

            rdm = 60/imglist.length;
            
            currentDate = new Date();
            core = currentDate.getSeconds();
            core = Math.floor(core/rdm);
 
            imgPos = core;
 
         }
      if(imgPos >= imglist.length || imgPos <0) imgPos = 0;
    
   document.getElementById('headerImg').src = imglist[imgPos];


   if(++imgPos  ==  imglist.length)
      imgPos=0;
   if(rotate==1) setTimeout("showheader(" + piclist + "," + imgPos + "," + rotate + ",'x')",imgdelay);
   
      
   if(hilite != '' && hilite != 'x')
   {     
         document.getElementById(hilite).className="hilite";
         var tmp = hilite.replace("side","subm");
         document.getElementById(tmp).className="hilite";
   }

}


function showNews(news)
{

      if(news < 0)
        {
            rdm = 2; /*60/newsImage.length+10;*/
            currentDate = new Date();
            core = currentDate.getSeconds();
            core = Math.floor(core/rdm);
            news = core;
         }
      if(news >= newsImage.length || news <0) news = 1;
    
   currentNews = news;
   var n = "<h4>NEWS/EVENTS</h4>";
   n = n + "<h5>" + newsTitle[news] + "</h5>";
   n = n + "<img src = '" + newsImage[news] + "' width='170' height='"+newsHeight[news] +"' />";
   n = n + newsText[news];
   document.getElementById('newsandevents').innerHTML = n;
}

function prevNews()
{
   clearTimeout(newsTimer);
   if(currentNews == 0)
     currentNews = newsImage.length;
   currentNews = currentNews - 1;
   showNews(currentNews);
   if(rotateNews==1) newsTimer = setTimeout("nextNews()", newsDelay);
   
}

function nextNews()
{
   clearTimeout(newsTimer);
   currentNews = currentNews + 1;
   if(currentNews == newsImage.length)
     currentNews = 0;
   showNews(currentNews);
   if(rotateNews==1) newsTimer = setTimeout("nextNews()", newsDelay);

}

function showMenu(menu, xpos, ypos)
{  

   var currMenuOn = true;
   var retValue = true;
   
   if(menu=='') 
   {
      closeAll();
      return false;
   }
   //clearitems(menu);

   //scrollTo(xpos,0);
   document.getElementById('mm').style.left = xpos+'px';
   document.getElementById('mm').style.top = ypos+'px';
   document.getElementById('mm').style.display = 'block';
   document.getElementById('Readymix').style.background= '#000';
   document.getElementById('Other').style.background= '#000';
   document.getElementById('AboutAvr').style.background= '#000';

   
   
   if(document.getElementById(menu).style.display != 'block')
      currMenuOn = false;

      closeMainMenus();
      //closeSubMenus();
      //document.getElementById('sm').style.display = 'none';
      document.getElementById(menu).style.display = 'block';
      if(menu == 'mm1')
         document.getElementById('Readymix').style.background= '#800 url(images/bulletsmall.gif) repeat-y';

      if(menu == 'mm2')
         document.getElementById('Other').style.background= '#800 url(images/bulletsmall.gif) repeat-y';

      if(menu == 'mm3')
         document.getElementById('AboutAvr').style.background= '#800 url(images/bulletsmall.gif) repeat-y';
      
   
   return true;
}

function closeAll()
{
      document.getElementById('Readymix').style.background= '#000';
      document.getElementById('Other').style.background= '#000';
      document.getElementById('AboutAvr').style.background= '#000';
      closeMainMenus();  
      document.getElementById('mm').style.display = 'none';
      //document.getElementById('sm').style.display = 'none';
}
function closeMainMenus()
{
   document.getElementById('mm1').style.display = 'none'; 
   document.getElementById('mm2').style.display = 'none';  
   document.getElementById('mm3').style.display = 'none';  
}

function togglepanel(id)
{   
   if(document.getElementById(id).style.display != 'block')
   {
      document.getElementById(id).style.display='block';
   }
   else
   {
      document.getElementById(id).style.display='none';
   }
}
