function fixPhotoNav() {

  var oPhotoNav = YD.getElementsByClassName("photoNav", "div");



  for (var i=0; i < oPhotoNav.length; i++) {

    var re = /gallery\/([\d]+)(_(\w+))?\//;

    var oTitle = YD.getElementsByClassName("title", "span", oPhotoNav[i]);

    if (re.test(window.location)) {

      oTitle[0].innerHTML = "|&nbsp;" + oTitle[0].innerHTML + "&nbsp;|";

      re.exec(window.location);

      oPhotoNav[i].innerHTML = oPhotoNav[i].innerHTML + "<span ><a href='/gallery/" + RegExp.$1 + ((RegExp.$2 != undefined) ? RegExp.$2 : "") + "'>Return to Album</a></span>";

    }

  }

}





function isClass(sClass) {



  sClassName = document.body.className;



  re = new RegExp(sClass + "( |$)")







  if (!sClassName)



    return false;







  return re.test(sClassName);



}











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)



}



















/*===================*/



/*== Seach by Date ==*/



/*===================*/



function searchTimeLine(response)



{



  re1 = /<div class="boxBottom">[\s\S]+<\/div>[\s]+<div class="spacer"><\/div>/;



  re2 = /Or, pick an arbitrary date range/;



  response = response.replace(re2,"Or, Pick your own Date Range");



  s = response.match(re1);



  document.getElementById("dateContainer").innerHTML = s;



}

















/***************************/



/* 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 images are copyrighted by Bowen Photography. All rights reserved. Unauthorized use is prohibited.";



/***************************/



/* Turn off Popular Voting */



/***************************/



displaySmugPopular = true;







/****************************************/



/* Places the Smugmug Bar on the bottom */



/****************************************/



SM.PhotoBar.config.position = 'bottom';

   


/* **************************/
/* Paypal Button Logic Main */
/* **************************/



function setPaypalFormm(form) {


 urlToImage =  webServer + "/gallery/" + AlbumID + "_" + AlbumKey + "/1/" + ImageID + "_" + ImageKey + "/Small";
 form.item_number.value = "Image Link: " + urlToImage;

 
 if (document.PhotoOrderFormm.item_name.value == "Click the arrow for item list")
      {
        document.PhotoOrderFormm.item_name.value=printsarraym[1];
        }

 if (document.PhotoOrderFormm.os0.value == "Click the arrow for print type")
      {
        document.PhotoOrderFormm.os0.value=printsarraymt[1];
        }

 PhotoOrderFormmShowPrice();

}





function PhotoOrderFormmFormatValues(value)
{
 var temp = Math.round(value * 100);
 temp = temp / 100;
 return temp;
}

function PhotoOrderFormmShowPrice()

{

  
  
        if (mtypematharray[document.PhotoOrderFormm.os0.selectedIndex] == "a")
           {
                document.PhotoOrderFormm.amount.value= PhotoOrderFormmFormatValues(parseFloat(printspricearraym[document.PhotoOrderFormm.item_name.selectedIndex]) + parseFloat(mtypepricearray[document.PhotoOrderFormm.os0.selectedIndex]));
                }


        if (mtypematharray[document.PhotoOrderFormm.os0.selectedIndex] == "m")
				{
                document.PhotoOrderFormm.amount.value= PhotoOrderFormmFormatValues(parseFloat(printspricearraym[document.PhotoOrderFormm.item_name.selectedIndex]) * parseFloat(mtypepricearray[document.PhotoOrderFormm.os0.selectedIndex]));

			}


     

if (document.PhotoOrderFormm.business.value != "BowenPhotos@charter.net")
	{
    document.PhotoOrderFormm.business.value='BowenPhotos@charter.net'
        }




 document.PhotoOrderFormm.paypalfilename.value=mainPhotoFileName;
 document.PhotoOrderFormm.os1.value= albumtitlepp + '; File Name: ' + mainPhotoFileName + "; Instructions: " + document.PhotoOrderFormm.instruct.value; 

   



}























