image_index = 1;

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function showElement(topElement, bottomElement) {
    document.getElementById(topElement).style.visibility = 'visible';
    document.getElementById(bottomElement).style.visibility = 'visible';
}

function hideElement(topElement, bottomElement) {
    document.getElementById(topElement).style.visibility = 'hidden';
    document.getElementById(bottomElement).style.visibility = 'hidden';
}

function openWindow (url, winName, popWidth, popHeight) {
		var horizPos = (screen.availWidth - popWidth)/ 2;
		var vertPos = ((screen.availHeight - popHeight)/ 2) + 30;
		window.open(url, winName, "width=" + popWidth + ", height=" + popHeight + ", resizable=no, top=" + vertPos + ", left=" + horizPos + ", scrollbars=no, status=no");
}

function nextImage() {
    image_index = image_index + 1;
    if (image_index > image_count) {
       image_index = 1;
    }
    eval("document.main_image.src='images/" + image_base + image_index + ".jpg'");
}

function prevImage() {
    image_index = image_index - 1;
    if (image_index < 1) {
       image_index = image_count;
    }
    eval("document.main_image.src='images/" + image_base + image_index + ".jpg'");
}

function dummyFunction() {
    image_index = image_index + 1;
    if (image_index > image_count) {
       image_index = 1;
    } alert(image_index);
    eval("document.main_image.src='images/" + image_base + image_index + ".jpg'");
}

function previewCard() {
  whichForm = document.getElementById('ecardform');
  ecardOption = ""
  for (i=0; i<whichForm.ecard.length;i++) {
      if (whichForm.ecard[i].checked) {
         ecardOption = whichForm.ecard[i].value
      }
  }

  if (ecardOption == "") {
     alert("Please select an eCard")
     return false
  }
  
  openWindow('ecard_preview.html?ecard=' + ecardOption, 'Ecard_Preview', 600, 451)
}



