function initImgRotation() {

  // create rotating image objects here 

  // arguments: image name, rotation speed

  var rotator1 = new rotateImgObj('sponsor',2500);

 rotator1.addImages("null.jpg");
  

  // starts rotation for all defined rotateImgObjs

  for (var i=0; i<rotateImgObjs.length; i++) 

    rotateImgObjs[i].timer = setInterval(rotateImgObjs[i].animString + ".rotate()", rotateImgObjs[i].speed);

}



// If all the images you wish to display are in the same location, you can specify the path here 

rotateImgObj.imagesPath = "/images/sponsors/";



rotateImgObjs = []; // holds all rotating image objects defined

// constructor 

function rotateImgObj(nm,s) {

  this.speed = s; this.ctr=0; this.timer=0;  

  this.imgObj = document.images[nm]; // get reference to the image object

  this.index = rotateImgObjs.length; rotateImgObjs[this.index] = this;

  this.animString = "rotateImgObjs[" + this.index + "]";

  

  this.addImages = addRotatingImages;

  this.rotate = rotateImg;

}

// preloads images

function addRotatingImages() {

  this.imgObj.imgs = [];

  for (var i=0; i<arguments.length; i++) {

    this.imgObj.imgs[i] = new Image();

    this.imgObj.imgs[i].src = rotateImgObj.imagesPath + arguments[i];

  }

}



// controls rotation

function rotateImg() {

  if (this.ctr < this.imgObj.imgs.length-1) this.ctr++;

  else this.ctr = 0;

  this.imgObj.src = this.imgObj.imgs[this.ctr].src;

}

//Calculate Ticket Booking Form Totals
function RefreshTotals(frm) {
    var finaltotal = 0
    var proamtotal = 0
    var o1total = 0
    var o2total = 0
    var o3total = 0
    var o4total = 0
    var seasontotal = 0

    proamtotal=parseInt(frm.proamqty.value) * 75
    o1total = parseInt(frm.r1qty.value) * 175
    o2total = parseInt(frm.r2qty.value) * 175
    o3total = parseInt(frm.r3qty.value) * 175
    o4total = parseInt(frm.r4qty.value) * 175
    seasontotal = parseInt(frm.seasonqty.value) * 600


    if (!isNaN(proamtotal)){
    finaltotal = proamtotal
     }
    if (!isNaN(o1total)){
    finaltotal +=  o1total
     }

     if (!isNaN(o2total)){
    finaltotal += o2total
     }

     if (!isNaN(o3total)){
    finaltotal +=  o3total
     }

     if (!isNaN(o4total)){
    finaltotal +=  o4total
     }
     
     if (!isNaN(seasontotal)){
    finaltotal +=  seasontotal
     }
     
     //if (document.navform.shipmethod[1].checked) {
      //  finaltotal +=  60
     //}
     if (proamtotal >= 0) {
                frm.proamamt.value = proamtotal
            }

      if (o1total >= 0) {
                frm.r1amt.value = o1total
            }
    if (o2total >= 0) {
                frm.r2amt.value = o2total
            }

    if (o3total >= 0) {
                frm.r3amt.value = o3total
            }

    if (o4total >= 0) {
                frm.r4amt.value = o4total
            }
            
             if (seasontotal >= 0) {
                frm.seasonamt.value = seasontotal
            }
            
     if (finaltotal >= 0) {
            frm.totamt.value = finaltotal
     }
}

//Calculate Master Card Ticket Booking Form Totals
function MCRefreshTotals(frm) {
    var finaltotal = 0
    var proamtotal = 0
    var o1total = 0
    var o2total = 0
    var o3total = 0
    var o4total = 0
    var seasontotal = 0

    proamtotal=parseInt(frm.proamqty.value) * 60
    o1total = parseInt(frm.r1qty.value) * 140
    o2total = parseInt(frm.r2qty.value) * 140
    o3total = parseInt(frm.r3qty.value) * 140
    o4total = parseInt(frm.r4qty.value) * 140
    seasontotal = parseInt(frm.seasonqty.value) * 480


    if (!isNaN(proamtotal)){
    finaltotal = proamtotal
     }
    if (!isNaN(o1total)){
    finaltotal +=  o1total
     }

     if (!isNaN(o2total)){
    finaltotal += o2total
     }

     if (!isNaN(o3total)){
    finaltotal +=  o3total
     }

     if (!isNaN(o4total)){
    finaltotal +=  o4total
     }
     
     if (!isNaN(seasontotal)){
    finaltotal +=  seasontotal
     }
     
     //if (document.navform.shipmethod[1].checked) {
      //  finaltotal +=  60
     //}
     if (proamtotal >= 0) {
                frm.proamamt.value = proamtotal
            }

      if (o1total >= 0) {
                frm.r1amt.value = o1total
            }
    if (o2total >= 0) {
                frm.r2amt.value = o2total
            }

    if (o3total >= 0) {
                frm.r3amt.value = o3total
            }

    if (o4total >= 0) {
                frm.r4amt.value = o4total
            }
            
             if (seasontotal >= 0) {
                frm.seasonamt.value = seasontotal
            }
            
     if (finaltotal >= 0) {
            frm.totamt.value = finaltotal
     }
}
