// JavaScript Document

var count = 0;
var rome_count = 0;

function rome_album(index){

max = 8
rome_count = rome_count + index

if(rome_count == (max + 1)){
rome_count = 0
}

if(rome_count == (max - (max + 1))){
rome_count == (max)
}

var rome_pic = new Array("1","2","3","4","9","5",
                        "6","7","8");
var text = new Array();

i=0;
while(i>9){
text[i] = "Comments will be added soon!";
i = i + 1;
}
/*
text[0] = "Gosh...so beautiful! Talking about the cake that is. The couple is good looking too :)";
text [1] = "Armando tries to tie Kitte's hands into a pretzel, but she is so strong!";
text[2] = "Oh yeah BABY! Armando thinks he is hot stuff...look at the way Kitte is looking at him... ";
text[2] = text[2] + 'Sadly, Armando doesn\'t know Kitte was actually only looking at a big red spot on Armando\'s face.';
text[3] = "This picture was taken close to the end of our engagement party. We were SO TIRED!";
text[4] = "A picture of Armando in Mexico. The day after the engagement party. He looks tired, no?";
text[5] = "Yes, we went fishing! Kitte really enjoyed her fishing trip. She knows a lot about fishing.";
text[6] = "At first Armando did not believe Kitte was good at fishing. She kept saying \"Eat the ";
text[6] = text[6] + 'squid, eat the squid!! If you eat the squid you will catch a fish, I promise!!';
text[7] = "Armando stares at Kitte eating the squid and is like... YEAH RIGHT! You can\'t catch a fish like that...";
text[8] = "Kitte catches a fish... (Armando is behind the camera eating some squid)";
text[9] = "Armando gets upset that someone threw away a gatorade bottle in the trash. It could have been recycled!!";
text[10] = "Armando also is upset that someone didn\'t drink all of the gatorade!  He finishes it off. ";
*/
document.getElementById('myAnchor').innerHTML=text[rome_count]

    var new_img = new Object();
    new_img = new Image();
    img_loc = "http://www.mywebavenue.com/pics/"
    img_loc = img_loc + 'rome' + rome_pic[rome_count] + '.jpg'
    new_img.src = img_loc
    document.getElementById("pic").src = new_img.src
}


function ep_album(index){

max = 10
count = count + index

if(count == (max + 1)){
count = 0
}

if(count == (max - (max + 1))){
count == 8
}

var ep_pic = new Array("0050","0062","0070","0080","0093","0110",
                        "0111","0119","0120","0159",
                        "0160");
var text = new Array();

text[0] = "Gosh...so beautiful! Talking about the cake that is. The couple is good looking too :)";
text [1] = "Armando tries to tie Kitte's hands into a pretzel, but she is so strong!";
text[2] = "Oh yeah BABY! Armando thinks he is hot stuff...look at the way Kitte is looking at him... ";
text[2] = text[2] + 'Sadly, Armando doesn\'t know Kitte was actually only looking at a big red spot on Armando\'s face.';
text[3] = "This picture was taken close to the end of our engagement party. We were SO TIRED!";
text[4] = "A picture of Armando in Mexico. The day after the engagement party. He looks tired, no?";
text[5] = "Yes, we went fishing! Kitte really enjoyed her fishing trip. She knows a lot about fishing.";
text[6] = "At first Armando did not believe Kitte was good at fishing. She kept saying \"Eat the ";
text[6] = text[6] + 'squid, eat the squid!! If you eat the squid you will catch a fish, I promise!!';
text[7] = "Armando stares at Kitte eating the squid and is like... YEAH RIGHT! You can\'t catch a fish like that...";
text[8] = "Kitte catches a fish... (Armando is behind the camera eating some squid)";
text[9] = "Armando gets upset that someone threw away a gatorade bottle in the trash. It could have been recycled!!";
text[10] = "Armando also is upset that someone didn\'t drink all of the gatorade!  He finishes it off. ";

document.getElementById('myAnchor').innerHTML=text[count]

    var new_img = new Object();
    new_img = new Image();
    img_loc = "http://www.mywebavenue.com/pics/img_"
    img_loc = img_loc + ep_pic[count] + '.jpg'
    new_img.src = img_loc
    document.getElementById("pic").src = new_img.src
}

function final_check(type){


 if(type==0){
   alert("We are re-directing you back to the wedding register page.")
   top.location.replace('http://www.myWebAvenue.com/wedding_register.php')
 }
 if(type==1){
   if(document.final_checkout.total.value == "" ||
      document.final_checkout.total.value == null ||
      document.final_checkout.total.value <= 0 ||
      document.final_checkout.total.value == NaN){
      
      alert("A total value was not calculated, please try again. Thanks!");
      
      }
      else{
         document.final_checkout.submit();
      }
 }
  if(type==2){
         document.giveGift.submit();
  }
  if(type==3){
         document.giveGift.opt.value = 1;         
         window.location = "http://www.myWebAvenue.com/final_checkout.php?opt=1";
         window.location.submit();
  }
}

function sum(total, money, honeymoon)
{
      if(money <= 0 || money == null || money == ""){
        money = 0;
      }
      if(honeymoon <= 0 || honeymoon == null || honeymoon == ""){
        honeymoon = 0;
      }
     var A = parseFloat(total);
     var B = parseFloat(money);
     var C = parseFloat(honeymoon);
     document.final_checkout.total.value = A + B + C;
}




function countdown_clock(year, month, day, hour, minute, format)
         {
         //I chose a div as the container for the timer, but
         //it can be an input tag inside a form, or anything
         //who's displayed content can be changed through
         //client-side scripting.
         html_code = '<div id="countdown"></div>';
         
         document.write(html_code);
         
         countdown(year, month, day, hour, minute, format);                
         }
         
function countdown(year, month, day, hour, minute, format)
         {
         Today = new Date();
         Todays_Year = Today.getFullYear() - 2000;
         Todays_Month = Today.getMonth() + 1;                  
         
         //Convert both today's date and the target date into miliseconds.                           
         Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(), 
                                 Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();                                 
         Target_Date = (new Date(year, month, day, hour, minute, 00)).getTime();                  
         
         //Find their difference, and convert that into seconds.                  
         Time_Left = Math.round((Target_Date - Todays_Date) / 1000);
         
         if(Time_Left < 0)
            Time_Left = 0;
         
         switch(format)
               {
               case 0:
                    //The simplest way to display the time left.
                    document.all.countdown.innerHTML = Time_Left + ' seconds';
                    break;
               case 1:
                    //More datailed.
                    days = Math.floor(Time_Left / (60 * 60 * 24));
                    Time_Left %= (60 * 60 * 24);
                    hours = Math.floor(Time_Left / (60 * 60));
                    Time_Left %= (60 * 60);
                    minutes = Math.floor(Time_Left / 60);
                    Time_Left %= 60;
                    seconds = Time_Left;
                    
                    dps = 's'; hps = 's'; mps = 's'; sps = 's';
                    //ps is short for plural suffix.
                    if(days == 1) dps ='';
                    if(hours == 1) hps ='';
                    if(minutes == 1) mps ='';
                    if(seconds == 1) sps ='';
                    
                    document.all.countdown.innerHTML = days + ' day' + dps + ' ';
                    document.all.countdown.innerHTML += hours + ' hour' + hps + ' ';
                    document.all.countdown.innerHTML += minutes + ' minute' + mps + ' and ';
                    document.all.countdown.innerHTML += seconds + ' second' + sps;
                    break;
               default: 
                    document.all.countdown.innerHTML = Time_Left + ' seconds';
               }
               
         //Recursive call, keeps the clock ticking.
         setTimeout('countdown(' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ',' + format + ');', 1000);
         }
