




function getHostname()

{

  re = /(http:\/\/[\w]+\.[\w]+\.[\w]+)\//;

  re.exec(window.location);

  return RegExp.$1;

}



function hasPath(sPath)

{

  re = new RegExp("\/" + sPath + "(\/|$)");

  return re.test(window.location)

}



















/***************************/

/* Menu Code               */

/***************************/







  var menuArray = new Array();

  var tableID   = null;

  var   rowID   = null;



  function collapse(subMenu)

  {

 //         alert(menuArray.length);



    if(subMenu==0)

      {

    //CLOSE ALL OPEN SUB-MENUS IN REVERSE ORDER FROM WHICH THEY WERE OPENED

        for(var i=(menuArray.length)-1; i>=0; i--)

        {

          document.getElementById(menuArray[i]).style.display="none";

            menuArray.length=i;  //DELETES ROW[I] FROM THE ARRAY

        }

      }

    else

      {

      //CLOSE APPROPRIATE SUB-MENU CHILDREN

        var j=menuArray.length;

        while(menuArray[--j]!=subMenu)

      {

          document.getElementById(menuArray[j]).style.display="none";

          menuArray.length=j;

        }

      }

  }



  function checkTable(ID)

  {

  //USED FOR TROUBLESHOOTING

  //alert("rowID="+rowID+", tableID="+tableID+", ID="+ID+", mA[0]="+menuArray[0]+", mA[1]="+menuArray[1]+", mA[2]="+menuArray[2])



  //THE MENU OPTION SELECTED HAS NO SUB-MENUS, SO CLOSE ALL OPEN SUB-MENUS AND STOP PROCESSING

    if(rowID==0)

      {

        collapse(0);

        return;

    }



  //A MENU OPTION FROM A DIFFERENT TABLE (GROUPING) HAS BEEN SELECTED, SO CLOSE ALL SUB-MENUS FROM THE OTHER TABLE

    if(tableID!=ID)

      {

         tableID =ID;

       collapse(0);

      }



      var flag=0;

  //CHECK IF THE SUB-MENU HAS ALREADY BEEN OPENED

      for(var i=0; i<menuArray.length; i++)

      {

        if(menuArray[i]==rowID)

             flag=1;

      }



  //IF THE MENU SELECTED IS ALREADY OPEN

      if(flag==1)

      {

      //COLLAPSE ALL SUB-MENU CHILDREN

        collapse(rowID);

      }

      else

      {

      //DISPLAY THE SUB-MENU

              if((rowID != null) && (rowID != "0") )

              {

                      menuArray[menuArray.length] = rowID;

                      document.getElementById(rowID).style.display = "";

                      //objSpan = eval("document.getElementById('span"+rowID+"')");

                      //objSpan.style.display = "block";

              }

      }

  }









/**********************/

/* Right Click Warning */

/**********************/

rightClickWarning = "All photos are copyrighted by Moments Photography. All rights reserved. Unauthorized use is prohibited."







/***************************/

/* Turn off Popular Voting */

/***************************/

displaySmugPopular = false;



















/* *********************//* Paypal Button Logic *//* *********************/





function setPaypalForm(form) {





urlToImage = webServer + "/gallery/" + AlbumID + "_" + AlbumKey + "/1/" + ImageID + "/Small";

 form.item_number.value = window.location;  if (document.PhotoOrderForm.preitem_type.value == "Click the arrow for a list of picture types")        {        document.PhotoOrderForm.preitem_type.value=preitemtypearray[1];               }





 if (document.PhotoOrderForm.item_name.value == "Click the arrow for item list")        {        document.PhotoOrderForm.item_name.value=printsarray[1];        PhotoOrderFormShowPrice();        } if (document.PhotoOrderForm.printtype.value == "Click the arrow for a list of picture types")        {        document.PhotoOrderForm.printtype.value=typearray[1];        PhotoOrderFormShowPrice();        }















   if (document.PhotoOrderForm.preitem_type.value == "Click the arrow for a list of picture types")        {        document.PhotoOrderForm.preitem_type.value=preitemtypearray[1];               }





    PhotoOrderFormShowPrice();}



function PhotoOrderFormFormatValues(value){ var temp = Math.round(value * 100); temp = temp / 100; return temp;}function PhotoOrderFormShowPrice(){  if (document.PhotoOrderForm.item_name.value != "")        {        if (typematharray[document.PhotoOrderForm.printtype.selectedIndex] == "a")           {                document.PhotoOrderForm.amount.value= PhotoOrderFormFormatValues(parseFloat(printspricearray[document.PhotoOrderForm.item_name.selectedIndex]) + parseFloat(typepricearray[document.PhotoOrderForm.printtype.selectedIndex]));                            }        if (typematharray[document.PhotoOrderForm.printtype.selectedIndex] == "m")           {                document.PhotoOrderForm.amount.value= PhotoOrderFormFormatValues(parseFloat(printspricearray[document.PhotoOrderForm.item_name.selectedIndex]) * parseFloat(typepricearray[document.PhotoOrderForm.printtype.selectedIndex]));           }



               }    if (document.PhotoOrderForm.business.value != "aliciahortman@cox.net")        {        document.PhotoOrderForm.business.value='aliciahortman@cox.net'        }   document.PhotoOrderForm.paypalfilename.value= "Filename: " + mainPhotoFileName;
   document.PhotoOrderForm.os0.value=document.PhotoOrderForm.printtype.value + " Filename: " + mainPhotoFileName;

   document.PhotoOrderForm.preitemtype.value = document.PhotoOrderForm.preitem_type.value + " Filename: " + mainPhotoFileName;   }















/* ****************************//* Paypal Button Logic Events *//* ****************************/



function setPaypalFormev(form) {

 urlToImage = webServer + "/gallery/" + AlbumID + "_" + AlbumKey + "/1/" + ImageID + "/Small";

 form.item_number.value = window.location; if (document.PhotoOrderFormev.item_name.value == "Click the arrow for item list")        {        document.PhotoOrderFormev.item_name.value=printsarrayev[1];        PhotoOrderFormevShowPrice();        } if (document.PhotoOrderFormev.os1.value == "Click the arrow for a list of picture types")        {        document.PhotoOrderFormev.os1.value=typearrayev[1];               }



    PhotoOrderFormevShowPrice();}





function setPaypalFormev(form) {

 urlToImage = webServer + "/gallery/" + AlbumID + "_" + AlbumKey + "/1/" + ImageID + "/Small";

 form.item_number.value = urlToImage; if (document.PhotoOrderFormev.item_name.value == "Click the arrow for item list")        {        document.PhotoOrderFormev.item_name.value=printsarrayev[1];        PhotoOrderFormevShowPrice();        } if (document.PhotoOrderFormev.os1.value == "Click the arrow for a list of picture types")        {        document.PhotoOrderFormev.os1.value=typearrayev[1];               }



    PhotoOrderFormevShowPrice();}

function PhotoOrderFormevFormatValues(value){ var temp = Math.round(value * 100); temp = temp / 100; return temp;}function PhotoOrderFormevShowPrice(){  if (document.PhotoOrderFormev.item_name.value != "")        {        if (typematharrayev[document.PhotoOrderFormev.os1.selectedIndex] == "a")           {                document.PhotoOrderFormev.amount.value= PhotoOrderFormevFormatValues(parseFloat(printspricearrayev[document.PhotoOrderFormev.item_name.selectedIndex]) + parseFloat(typepricearrayev[document.PhotoOrderFormev.os1.selectedIndex]));                            }        if (typematharrayev[document.PhotoOrderFormev.os1.selectedIndex] == "m")           {                document.PhotoOrderFormev.amount.value= PhotoOrderFormevFormatValues(parseFloat(printspricearrayev[document.PhotoOrderFormev.item_name.selectedIndex]) * parseFloat(typepricearrayev[document.PhotoOrderFormev.os1.selectedIndex]));           }



               }    if (document.PhotoOrderFormev.business.value != "aliciahortman@cox.net")        {        document.PhotoOrderFormev.business.value='aliciahortman@cox.net'        }   document.PhotoOrderFormev.paypalfilename.value=mainPhotoFileName;   document.PhotoOrderFormev.os0.value= mainPhotoFileName + "/"  + document.PhotoOrderFormev.sinstruct.value;}



