/*=========================================*/
/*== Return to Thumb (Single Image Page) ==*/
/*=========================================*/
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)
}




/***************************/
/* 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 JR Photos and the credited photographers. All rights reserved. Unauthorized use is prohibited."



var vanityTable = 
 {
     customization : "http://www.jrphotosandwebdesign.com/gallery/1448761",
     customize : "http://www.jrphotosandwebdesign.com/gallery/1448761",
     smuginfo : "http://www.jrphotosandwebdesign.com/gallery/1448761",
     ideas : "http://www.jrphotosandwebdesign.com/gallery/2959631",
     examples : "http://www.jrphotosandwebdesign.com/gallery/2959631",
     rebeccaandryan : "http://www.jrphotosandwebdesign.com/gallery/2426755",
     carpathiakickers : "http://www.jrphotosandwebdesign.com/gallery/1901090",
     shelbylions :   "http://www.jrphotosandwebdesign.com/gallery/1269979",
     nicoleandpaul : "http://www.jrphotosandwebdesign.com/gallery/2692676",
     cvhs86 : "http://www.jrphotosandwebdesign.com/gallery/1679934",
     bradley07 : "http://www.jrphotosandwebdesign.com/gallery/2950099",
     lobossoccer : "http://www.jrphotosandwebdesign.com/gallery/2954609",
     wedinfo : "http://www.jrphotosandwebdesign.com/gallery/1104104",
     beckyanddan : "http://www.jrphotosandwebdesign.com/gallery/3108427",
     courtneyandjohnny : "http://www.jrphotosandwebdesign.com/gallery/3115273",
     guestbook : "http://www.jrphotosandwebdesign.com/gallery/1288911",
     fanfare : "http://www.jrphotosandwebdesign.com/gallery/1288911",
     alyssa : "http://www.jrphotosandwebdesign.com/gallery/5481127_hcXug",
     trisha : "http://www.jrphotosandwebdesign.com/gallery/5550186_SMLeZ",
graphics : "http://www.jrphotosandwebdesign.com/gallery/5406565_UdSAe/1/339574223_8kD4z/Large",
blog : "http://www.jrphotosandwebdesign.com/gallery/5406522_Vg5kD",
wgc : "http://www.jrphotosandwebdesign.com/gallery/6016919_tVS64",
family08 : "http://www.jrphotosandwebdesign.com/gallery/4277581_oqcWg"
   };




function IsHomePage()
 {
    return(YD.hasClass(document.body, 'homepage'));
 }
 
 function CheckRedirects()
 {
     if (IsHomePage())    // only run this code on the home page
     {
         // get the path from the current URL, 
         // convert it to lowercase and remove the leading slash
         var path = window.location.pathname.toLowerCase().substr(1);
         
         var newURL = vanityTable[path];        // look it up in our table
         
         // if we found it in the table && newURL is different than where we are
         if (newURL && (newURL != window.location))
         {
             window.location.replace(newURL);        // go to the new URL
         }
     }
 }


function openLinkWindowSlide(URL)
  {
   linkWindow=window.open(URL,"linkInfo","width=800,height=850,dependent=yes,resizable=no,scrollbars=no,toolbar=no,menubar=no");
    linkWindow.focus();
   
  }


var upper_limit = 3;
var urlnumber = 0;
var player = "http://www.webdesignsbyjr.com/smugsspjr0/xspf_player_slim.swf";
var showsong1 = "?playlist_url=http://www.webdesignsbyjr.com/smugsspjr0/mlist";
var showsong2 = ".xspf&autoplay=1&repeat_playlist=1&autoresume=1";


function RandomNumber() 
{ 
urlnumber = Math.round(upper_limit * Math.random());
}

RandomNumber();
var song = player + showsong1 + urlnumber + showsong2;



function doOnLoad() {
  if (window.AlbumID && (window.AlbumID == "5406565"  ))
  //
  removeLinkFromImg();
  }






function removeLinkFromImg()

{

    var links = document.getElementsByTagName("A");

    for (var i = 0; i < links.length; i++)

    {

        var link = links[i];

        var divElm = link.parentNode;

        if (!divElm)

            continue;

        divElm = divElm.parentNode;

        if (!divElm)

            continue;

        if (divElm.className.indexOf("photo")<0)

            continue;

        link.href = "javascript:void(0);";

    }

} 


function ContactFormValidate()
{
	if (document.ContactForm.customername.value == "")
	{
		alert("Your Name is required");
		document.ContactForm.customername.focus();
		return false;

	}
      if (document.ContactForm.customeremail.value == "")
	{
		alert("Your E-Mail Address is required");
		document.ContactForm.customeremail.focus();
		return false;
	}
	

}













