﻿
/***********************************************
* PHP Photo Album script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/

var dimension="6x8" //Specify dimension of gallery (number of images shown), such as 4x2, 3x1 etc
var dimension_a="1x4"
var imagepath="img/thumbs/fac/" //Absolute path to image directory. Include trailing slash (/)
var imagepath_a="img/showcase/fac/"
var href_target="new" //Enter target attribute of links, if applicable

//Sort images by date? ("asc", "desc", or "")
//"desc" for example causes the newest images to show up first in the gallery
//"" disables this feature, so images are sorted by file name (default)
var gsortorder="desc"

//By default, each image hyperlinks to itself.
//However, if you wish them to link to larger versions of themselves
//Specify the directory in which the larger images are located
//The file names of these large images should mirror those of the original
//Enter a blank string ("") to disable this option
var targetlinkdir="img/lrg/fac/"

/////No need to edit beyond here///////////////////

function sortbydate(a, b){ //Sort images function
  if (gsortorder=="asc") //sort by file date: older to newer
    return new Date(a[1])-new Date(b[1])
  else if (gsortorder=="desc") //sort by file date: newer to older
   return new Date(b[1])-new Date(a[1])
}

//if (gsortorder=="asc" || gsortorder=="desc")
galleryarray.sort()
galleryarray_a.sort()

galleryarray[6][0] = "blank.gif";
galleryarray[7][0] = "blank.gif";
galleryarray[8][0] = "blank.gif";
galleryarray[9][0] = "blank.gif";
galleryarray[10][0] = "blank.gif";
galleryarray[11][0] = "blank.gif";



var totalslots=dimension.split("x")[0]*dimension.split("x")[1]
var totalslots_a=dimension_a.split("x")[0]*dimension_a.split("x")[1]

function setOpa(cur,which){
strength=(which==0)? 1 : 0.4

if (cur.style.MozOpacity)
cur.style.MozOpacity=strength
else if (cur.filters)
cur.filters.alpha.opacity=strength*100
}

function buildimage(i){
  var imagecompletepath=(targetlinkdir!="")? targetlinkdir+galleryarray[i][0] : imagepath+galleryarray[i][0]
  if (galleryarray[i][0] == "blank.gif") {
	var tempcontainer='<img src="img/blank.gif" height="7" /><br /><img src="img/blank.gif" width="5" />'
	tempcontainer+='<img class="showcase_img" src="img/blank.gif" />'
	tempcontainer+='<img src="img/blank.gif" width="5" /><br /><img src="img/blank.gif" height="6" />'
	return tempcontainer
  } else {
	var tempcontainer='<img src="img/blank.gif" height="7" /><br /><img src="img/blank.gif" width="5" /><a rel="lytebox[images]" href="'+imagecompletepath+'">'
	tempcontainer+='<img class="showcase_img" style="-moz-opacity:0.4" onMouseover="setOpa(this,0)" onMouseout="setOpa(this,1)" src="'+imagepath+galleryarray[i][0]+'" />'
	tempcontainer+='</a><img src="img/blank.gif" width="5" /><br /><img src="img/blank.gif" height="6" />'
	return tempcontainer
  }
}

function buildimage_a(i){
  var tempcontainer_a='<img src="'+imagepath_a+galleryarray_a[i][0]+'" title="'+galleryarray_a[i][0]+' ['+galleryarray_a[i][1]+']" />'
  tempcontainer_a+='<br />'
  return tempcontainer_a
}

function jumptopage(p){
  var startpoint=(p-1)*totalslots
  var startpoint_a=(p-1)*totalslots_a
  var y=1;
  for (i=0; i<totalslots; i++){
  document.getElementById("slide"+i).innerHTML=(typeof galleryarray[startpoint+i]!="undefined")? buildimage(startpoint+i) : ""
  }
  for (i=0; i<totalslots_a; i++){
  document.getElementById("slide"+i+"_a").innerHTML=(typeof galleryarray_a[startpoint_a+i]!="undefined")? buildimage_a(startpoint_a+i) : ""
  }
  while(document.getElementById("navlink"+y)!=null){
  document.getElementById("navlink"+y).className=""
  y++
}
  document.getElementById("navlink"+p).className="current"
  myLytebox.updateLyteboxItems();
}