﻿isc.defineClass("ImageRotator", "Canvas").addProperties({
  height:0,
  width:0,
  cur:0,
  min:0,
  max:0,
  initWidget: function()
    {
      this.Super("initWidget", arguments);  
      
      for(var i=0; i<=this.imageList.length - 1; i++)
        {
          var img = isc.Img.create({
            ID:this.ID + i,
            opacity:0,
            //className:"rotatorImage",
            width:this.width,
            height:this.height,
            animateTime:1500,
            src:"../images/homeimages/" + this.imageList[i].image
          });          
          this.addChild(img);
          this.max = i;
        }
      
      this.cur = this.min;
      window.setTimeout(this.ID + ".fadeIn();",500);     
      
    }, 
  rotate: function()
    {      
      if(this.cur<this.max)
        {          
          this.cur += 1;          
        }
      else
        {
          this.cur = this.min;          
        }      
      window.setTimeout(this.ID + ".fadeOut();",500);
    },
  loadImage: function()
    {
      this.image.setSrc(this.src.replace("#",this.cur));
      window.setTimeout(this.ID + ".fadeIn();",2000);
    },
  fadeIn: function()
    {      
      var img = eval(this.ID + this.cur);
      img.animateFade(100);
      window.setTimeout(this.ID + ".rotate();",5000);
    },
  fadeOut: function()
    {
      for(var i=this.min;i<=this.max;i++)
        {
          var img = eval(this.ID + i);
          if(img.isVisible())
            {
              img.animateFade(0);
            }
        }
      window.setTimeout(this.ID + ".fadeIn();",1000);
    }
    
});

isc.VLayout.create({
  width:"100%",
  resized:function()
    {
      if(typeof PageBottomLeft != "undefined")
        {
          if(PageBottomLeft.getPageTop() > 0)
            {
              PageLeft.setHeight(PageBottomLeft.getPageTop());
              PageRight.setHeight(PageBottomLeft.getPageTop());
            }
        }    
    },
  members:[
    isc.HLayout.create({
      width:"100%",
      members:[
        isc.LayoutSpacer.create({
          width:"*"
        }),
        isc.Img.create({
          ID:"PageLeft",
          width:26,
          height:"*",
          src:"../images/PageLeft.png"
        }),
        isc.VLayout.create({
          members:[
            isc.HLayout.create({
              className:"menuStyle",
              align:"center",
              height:70,     
              members:[             
                isc.ImgButton.create({
                  ID:"menuOne",
                  width:163,
                  height:55,
                  showTitle:true,
                  showFocused:false,
                  showDown:false,
                  title:"About Us",
                  titleStyle:"buttonOne",
                  src:"../Images/m1.png",
                  click:"window.location = '../about/about.aspx';"
                }),
                isc.ImgButton.create({
                  ID:"menuTwo",
                  width:164,
                  height:66,
                  showTitle:true,
                  showFocused:false,
                  showDown:false,
                  title:"Rental",
                  titleStyle:"buttonTwo",
                  src:"../Images/m2.png",
                  click:"window.location = '../rental/rental.aspx';"
                }),
                isc.ImgButton.create({
                  ID:"menuThree",
                  width:164,
                  height:69,
                  showTitle:true,
                  showFocused:false,
                  showDown:false,
                  title:"Tours",
                  titleStyle:"buttonThree",
                  src:"../Images/m3.png",
                  click:"window.location = '../tours/tours.aspx';"
                }),
                isc.ImgButton.create({
                  ID:"menuFour",
                  width:164,
                  height:69,
                  showTitle:true,
                  showFocused:false,
                  showDown:false,
                  title:"High Rollers",
                  titleStyle:"buttonFour",
                  src:"../Images/m4.png",
                  click:"window.location = '../tours/tours.aspx';"
                }),
                isc.ImgButton.create({
                  ID:"menuFive",
                  width:164,
                  height:66,
                  showTitle:true,
                  showFocused:false,
                  showDown:false,
                  title:"Bus Tickets",
                  titleStyle:"buttonFive",
                  src:"../Images/m5.png",
                  click:"window.location = '../route/route.aspx';"
                }),
                isc.ImgButton.create({
                  ID:"menuSix",
                  width:164,
                  height:56,
                  showTitle:true,
                  showFocused:false,
                  showDown:false,
                  title:"Contracted",
                  titleStyle:"buttonSix",
                  src:"../Images/m6.png",
                  click:"window.location = '../contract/contract.aspx';"
                })          
              ]
            }),
            isc.Canvas.create({
              ID:"MainCanvas",
              className:"mainCanvas",
              width:983,
              height:400
            }),
            isc.HTMLFlow.create({
              className:"footerSpacer",
              width:983,
              height:10
            }),
            isc.HLayout.create({
              width:983,
              height:10,
              className:"footerBar",
              members:[
                isc.LayoutSpacer.create({
                  width:"*"
                }),
                isc.HTMLFlow.create({
                  className:"footer",
                  contents:"&copy 2010 Badger Coaches",
                  height:15,
                  width:140
                })
              ]
            })            
          ]
        }),
        isc.Img.create({
          ID:"PageRight",
          width:26,
          height:"*",
          src:"../images/PageRight.png"
        }),
        isc.LayoutSpacer.create({
          width:"*"
        })
      ]
    }),
    isc.HLayout.create({
      width:"100%",
      members:[
        isc.LayoutSpacer.create({
          width:"*"
        }),
        isc.Img.create({
          ID:"PageBottomLeft",
          width:33,
          height:36,
          src:"../images/PageBottomLeft.png"
        }),
        isc.Img.create({
          ID:"PageBottom",
          width:969,
          height:36,
          src:"../images/PageBottom.png"
        }),
        isc.Img.create({
          ID:"PageBottomRight",
          width:33,
          height:36,
          src:"../images/PageBottomRight.png"
        }),
        isc.LayoutSpacer.create({
          width:"*"
        })
      ]
    })
  ]
});

isc.HLayout.create({
  width:"100%",
  top:70,
  members:[
    isc.LayoutSpacer.create({
      width:"*"
    }),   
    isc.LayoutSpacer.create({
      width:850
    }),
    isc.Img.create({
      src:"/images/feedback.png",
      width:22,
      height:16
    }),
    isc.HTMLFlow.create({
      width:30,
      className:"subFeedback",
      contents:"<a href='/feedback.aspx'>&nbsp;Feedback</a>"
    }),
    isc.LayoutSpacer.create({
      width:"*"
    })
  ]
})

	    


