// script.aculo.us builder.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008

var dsGallery = 
  new Spry.Data.XMLDataSet("galleries/Community/photos.xml", 
      "/gallery/photos/photo[(position() >= 0) and (position() <= 6)]");
var dsData = 
  new Spry.Data.XMLDataSet("galleries/Community/photos.xml", "/gallery");
  
var iFirst = 0;
var iLast = 0;
var iSource  = 1;
var iLastRecordSet;
iLastRecord = 5
	
function fnReloadGalery(strSource)
{

var strURL   = "";
var strXPath = "";


    if (strSource == "N")  
       {  if ( iSource != iLastRecord )  iSource  =  iSource + 1;    }
    else   // strSource == "P"
       { if ( iSource != 1 )  iSource  =  iSource - 1;     }	

 // alert(" I Source = " + iSource);
  
  if (iSource == 1)
   {
     strURL   = 'galleries/Community/photos.xml'; 
	 strXPath = '/gallery/photos/photo[(position() >= 0) and (position() <= 6)]';
   }
	else if(iSource == 2)
   {  
     strURL   = 'galleries/Community/photos.xml'; 
	 strXPath = '/gallery/photos/photo[(position() >= 7) and (position() <= 12)]'; 
   }
   else if (iSource == 3)
   {  
     strURL   = 'galleries/Community/photos.xml'; 
	 strXPath = '/gallery/photos/photo[(position() >= 13) and (position() <= 18)]'; 
   }
   else if (iSource == 4)
   {  
     strURL   = 'galleries/Community/photos.xml'; 
	 strXPath = '/gallery/photos/photo[(position() >= 19) and (position() <= 24)]'; 
   }
   else if (iSource == 5)
   {  
     strURL   = 'galleries/Community/photos.xml'; 
	 strXPath = '/gallery/photos/photo[(position() >= 25) and (position() <= 30)]'; 
   }  
   else if (iSource == 6)
   {  
     strURL   = 'galleries/Community/photos.xml'; 
	 strXPath = '/gallery/photos/photo[(position() >= 31) and (position() <= 36)]'; 
   }
   else if (iSource == 7)
   {  
     strURL   = 'galleries/Community/photos.xml'; 
	 strXPath = '/gallery/photos/photo[(position() >= 37) and (position() <= 42)]'; 
   }
   else if (iSource == 8)
   {  
     strURL   = 'galleries/Community/photos.xml'; 
	 strXPath = '/gallery/photos/photo[(position() >= 43) and (position() <= 48)]'; 
   }
   else if (iSource == 9)
   {  
     strURL   = 'galleries/Community/photos.xml'; 
	 strXPath = '/gallery/photos/photo[(position() >= 49) and (position() <= 54)]'; 
   }
   else if (iSource == 10)
   {  
     strURL   = 'galleries/Community/photos.xml'; 
	 strXPath = '/gallery/photos/photo[(position() >= 55) and (position() <= 60)]'; 
   }
   else
   {
	alert(" Exceeded the image number limit ");   
   }
   

  
  
  
dsGallery.setURL(strURL);
dsGallery.setXPath(strXPath); 
dsGallery.loadData();

}
