// +----------------------------------------------------------------+
// | Array functions that are missing in IE 5.0                     |
// | Author: Cezary Tomczak [www.gosu.pl]                           |
// | Free for any use as long as all copyright messages are intact. |
// +----------------------------------------------------------------+

// Removes the last element from an array and returns that element.
if (!Array.prototype.pop) {
    Array.prototype.pop = function() {
        var last;
        if (this.length) {
            last = this[this.length - 1];
            this.length -= 1;
        }
        return last;
    };
}

// Adds one or more elements to the end of an array and returns the new length of the array.
if (!Array.prototype.push) {
    Array.prototype.push = function() {
        for (var i = 0; i < arguments.length; ++i) {
            this[this.length] = arguments[i];
        }
        return this.length;
    };
}

// Removes the first element from an array and returns that element.
if (!Array.prototype.shift) {
    Array.prototype.shift = function() {
        var first;
        if (this.length) {
            first = this[0];
            for (var i = 0; i < this.length - 1; ++i) {
                this[i] = this[i + 1];
            }
            this.length -= 1;
        }
        return first;
    };
}

// Adds one or more elements to the front of an array and returns the new length of the array.
if (!Array.prototype.unshift) {
    Array.prototype.unshift = function() {
        if (arguments.length) {
            var i, len = arguments.length;
            for (i = this.length + len - 1; i >= len; --i) {
                this[i] = this[i - len];
            }
            for (i = 0; i < len; ++i) {
                this[i] = arguments[i];
            }
        }
        return this.length;
    };
}

// Adds and/or removes elements from an array.
if (!Array.prototype.splice) {
    Array.prototype.splice = function(index, howMany) {
        var elements = [], removed = [], i;
        for (i = 2; i < arguments.length; ++i) {
            elements.push(arguments[i]);
        }
        for (i = index; (i < index + howMany) && (i < this.length); ++i) {
            removed.push(this[i]);
        }
        for (i = index + howMany; i < this.length; ++i) {
            this[i - howMany] = this[i];
        }
        this.length -= removed.length;
        for (i = this.length + elements.length - 1; i >= index + elements.length; --i) {
            this[i] = this[i - elements.length];
        }
        for (i = 0; i < elements.length; ++i) {
            this[index + i] = elements[i];
        }
        return removed;
    };
}



// Automatic Changing of images 

//Pictures to switch in About page

var Rollpic1 = "gallery/about.gif";
var Rollpic2 = "gallery/about1.gif";
var Rollpic3 = "gallery/about2.gif";

//Start at the what pic:
var PicNumber=1;
//Number of pics:
var NumberPictures=3;
//Time between pics switching in secs
var HowLongBetweenPic=5;

//SwitchPic Function
function SwitchPic(counter){

 if(counter < HowLongBetweenPic){
 
  counter++;
  
  //DEBUG in the status bar at the bottom of the screen
  window.status="About Vigan: "+counter+" PicNumber: "+PicNumber+" ";
  
 
 //Display pic in what <IMG> tag roll is what I called the image
  document.rolla.src = eval("Rollpic" + PicNumber);
  
  //function calls itself
  CallSwitchPic=window.setTimeout("SwitchPic("+counter+")",1500); 
  
  }
  
  else{
   //if its not the last picture goto the next picture
   if(PicNumber < NumberPictures){
    PicNumber++;
    SwitchPic(0);
   }
   //its the last picture go to the first one
   else{
    PicNumber=1;
    SwitchPic(0);
    }
 
  }

}

//Pictures to switch in Location page

var Rollpics1 = "gallery/location.gif";
var Rollpics2 = "gallery/location1.gif";
var Rollpics3 = "gallery/location2.gif";

//Start at the what pic:
var PicNumbers=1;
//Number of pics:
var NoOfPictures=3;
//Time between pics switching in secs
var HowLongBetweenPic=5;

//SwitchPic Function
function SwitchPic_loc(counters){

 if(counters < HowLongBetweenPic){
 
  counters++;
  
  //DEBUG in the status bar at the bottom of the screen
 window.status="Vigan Plaza Hotel : "+counters+" Location: "+PicNumbers+" ";
  
 
 //Display pic in what <IMG> tag roll is what I called the image
  document.rollx.src = eval("Rollpics" + PicNumbers);
  
  //function calls itself
  CallSwitchPic=window.setTimeout("SwitchPic_loc("+counters+")",1500); 
  
  }
  
  else{
   //if its not the last picture goto the next picture
   if(PicNumbers < NoOfPictures){
    PicNumbers++;
    SwitchPic_loc(0);
   }
   //its the last picture go to the first one
   else{
    PicNumbers=1;
    SwitchPic_loc(0);
    }
 
  }

}

//Pictures to switch in Getting Around page

var Rollpix1 = "gallery/around.gif";
var Rollpix2 = "gallery/around1.gif";
var Rollpix3 = "gallery/around2.gif";
var Rollpix4 = "gallery/around3.gif";
var Rollpix5 = "gallery/around4.gif";
var Rollpix6 = "gallery/around5.gif";


//Start at the what pic:
var PicNumb=1;
//Number of pics:
var NumberOfPic=6;
//Time between pics switching in secs
var HowLongBetweenPic=4;

//SwitchPic Function
function SwitchPic_arn(countern){

 if(countern < HowLongBetweenPic){
 
  countern++;
  
  //DEBUG in the status bar at the bottom of the screen
 window.status="Vigan Plaza Hotel : "+countern+" Getting Around : "+PicNumb+" ";
  
 
 //Display pic in what <IMG> tag roll is what I called the image
  document.rolle.src = eval("Rollpix" + PicNumb);
  
  //function calls itself
  CallSwitchPic=window.setTimeout("SwitchPic_arn("+countern+")",1500); 
  
  }
  
  else{
   //if its not the last picture goto the next picture
   if(PicNumb < NumberOfPic){
    PicNumb++;
    SwitchPic_arn(0);
   }
   //its the last picture go to the first one
   else{
    PicNumb=1;
    SwitchPic_arn(0);
    }
 
  }

}

//Pictures to switch in Amenities page

var Rollpiz1 = "gallery/amenities.gif";
var Rollpiz2 = "gallery/amenities1.gif";
var Rollpiz3 = "gallery/amenities2.gif";




//Start at the what pic:
var PicNum=1;
//Number of pics:
var NumberOfPics=3;
//Time between pics switching in secs
var HowLongBetweenPic=4;

//SwitchPic Function
function SwitchPic_ame(counten){

 if(counten < HowLongBetweenPic){
 
  counten++;
  
  //DEBUG in the status bar at the bottom of the screen
  window.status="Vigan Plaza Hotel : "+counten+" Amenities : "+PicNum+" ";
  
 
 //Display pic in what <IMG> tag roll is what I called the image
  document.rollss.src = eval("Rollpiz" + PicNum);
  
  //function calls itself
  CallSwitchPic=window.setTimeout("SwitchPic_ame("+counten+")",1500); 
  
  }
  
  else{
   //if its not the last picture goto the next picture
   if(PicNum < NumberOfPics){
    PicNum++;
    SwitchPic_ame(0);
   }
   //its the last picture go to the first one
   else{
    PicNum=1;
    SwitchPic_ame(0);
    }
 
  }

}

//Pictures to switch in Activity page

var Rollpi1 = "gallery/activity.gif";
var Rollpi2 = "gallery/activity1.gif";
var Rollpi3 = "gallery/activity2.gif";
var Rollpi4 = "gallery/activity3.gif";
var Rollpi5 = "gallery/activity4.gif";
var Rollpi6 = "gallery/activity5.gif";
var Rollpi7 = "gallery/activity6.gif";
var Rollpi8 = "gallery/activity7.gif";
var Rollpi9 = "gallery/activity8.gif";



//Start at the what pic:
var PicNo=1;
//Number of pics:
var NumberOfPictures=9;
//Time between pics switching in secs
var HowLongBetweenPicz=4;

//SwitchPic Function
function SwitchPic_act(count){

 if(count < HowLongBetweenPicz){
 
  count++;
  
  //DEBUG in the status bar at the bottom of the screen
  window.status="Vigan Plaza Hotel : "+count+" Activities : "+PicNo+" ";
  
 
 //Display pic in what <IMG> tag roll is what I called the image
  document.rolly.src = eval("Rollpi" + PicNo);
  
  //function calls itself
  CallSwitchPic=window.setTimeout("SwitchPic_act("+count+")",1500); 
  
  }
  
  else{
   //if its not the last picture goto the next picture
   if(PicNo < NumberOfPictures){
    PicNo++;
    SwitchPic_act(0);
   }
   //its the last picture go to the first one
   else{
    PicNo=1;
    SwitchPic_act(0);
    }
 
  }

}


//Pictures to switch in About page

var Rollz1 = "Gall/lobby/main4.gif";
var Rollz2 = "Gall/sitio/main3.gif";
var Rollz3 = "Gall/bigaa/main3.gif";
var Rollz4 = "Gall/bal/main1.gif";
var Rollz5 = "Gall/vigan/main0.gif";
var Rollz6 = "Gall/burgos/main0.gif";
var Rollz7 = "Gall/museum/main0.gif";
var Rollz8 = "Gall/syquia/main1.gif";
var Rollz9 = "Gall/st/main1.gif";

//Start at the what pic:
var PicNos=1;
//Number of pics:
var NumberOfPictures=9;
//Time between pics switching in secs
var HowLongBetweenPic=3;

//SwitchPic Function
function Switch(cntr){

 if(cntr < HowLongBetweenPic){
 
  cntr++;
  
  //DEBUG in the status bar at the bottom of the screen
  window.status="Gallery of Vigan: "+cntr+" PicNumber: "+PicNos+" ";
  
 
 //Display pic in what <IMG> tag roll is what I called the image
  document.rolls.src = eval("Rollz" + PicNos);
  
  //function calls itself
  CallSwitchPic=window.setTimeout("Switch("+cntr+")",1500); 
  
  }
  
  else{
   //if its not the last picture goto the next picture
   if(PicNos < NumberOfPictures){
    PicNos++;
    Switch(0);
   }
   //its the last picture go to the first one
   else{
    PicNos=1;
    Switch(0);
    }
 
  }

}
