/* images */

// List image names without extension
var myImg= new Array(13)
  myImg[0]= "Provincial-President";
  myImg[1]= "Convention-red-photo"; 
  myImg[2]= "District-A-2";
  myImg[3]= "District-A";
  myImg[4]= "District-B";
  myImg[5]= "District-C";
  myImg[6]= "District-D";
  myImg[7]= "District-E-2";
  myImg[8]= "District-E";
  myImg[9]= "District-F";
  myImg[10]= "District-H-K";
  myImg[11]= "Provincial-Parade";
  myImg[12]= "Colour-Party";
  myImg[13]= "Silver-Cross-Mother";
  
  var myImg2= new Array(16)
  myImg2[0]= "Photo_4";
  myImg2[1]= "Photo_2";
  myImg2[2]= "Photo_3";
  myImg2[3]= "Photo_1";
  myImg2[4]= "Track-and-Field-photos-PIB";
  myImg2[5]= "Track-and-Field-Photos";
  myImg2[6]= "Track-and-Field-Sponsors";  
  myImg2[7]= "TrackandField_Volunteers1";
  myImg2[8]= "TrackandField_Volunteers2";
  myImg2[9]= "TrackandField_Volunteers3";
  myImg2[10]= "TrackandField_Volunteers4";
  myImg2[11]= "TrackandField_Volunteers5";
  myImg2[12]= "TrackandField_Volunteers6";
  myImg2[13]= "TrackandField_Volunteers7";
  myImg2[14]= "TrackandField_Volunteers8";
  myImg2[15]= "TrackandField_Volunteers9"; 
  myImg2[16]= "TrackandField_Volunteers10"; 
// Tell browser where to find the image
myImgSrc = "/images/gallery/prov_conv/";
myImgSrc2 = "/images/gallery/tf/";
// Tell browser the type of file
myImgEnd = ".gif"

var i = 0;
var x = 0;
var c1 = 0;
var c2 = 0;
// Create function to load image
// Function error - 'document.imgSrc.src' is null or not an object
function loadImg(){
  document.imgSrc.src = myImgSrc + myImg[i] + myImgEnd;
  c1=i;
  document.imgSrc2.src = myImgSrc2 + myImg2[x] + myImgEnd;
  c2=x;
 }
// Create link function to switch image backward
function prev(){
  if(i<1){
    var l = i
  } else {
    var l = i-=1;
  }
  document.imgSrc.src = myImgSrc + myImg[l] + myImgEnd;
  c1=l;
 // document.imgSrc.onclick = enLarge1(myImgSrcLg + myImg[l] + myImgEnd);
}
function prev2(){
  if(x<1){
    var z = x
  } else {
    var z = x-=1;
  }
  document.imgSrc2.src = myImgSrc2 + myImg2[z] + myImgEnd;
  c2=z;
}
// Create link function to switch image forward
function next(){	
  if(i>12){
    var l = i
  } else {
    var l = i+=1;
  }
  document.imgSrc.src = myImgSrc + myImg[l] + myImgEnd;
  c1=l;
}
function next2(){
  if(x>15){
    var z = x
  } else {
    var z = x+=1;
  }
  document.imgSrc2.src = myImgSrc2 + myImg2[z] + myImgEnd;
  c2=z;
}
var popwin;
function enLarge(imgId) {	
	// Strip file name from image src	
	var imgseq=1;
	var ImageId=imgId.getAttribute('id');
	var spath=imgId.getAttribute('src');	
	var ifm = StripFilename(spath);
	var ImgPath=myImgSrc+"large/"+ifm;
	//alert(ImageId);
	if(ImageId=="imgSrc"){		
		c=c1;
		imgseq=1;
		ImgPath=myImgSrc+"large/"+ifm;
	} else {		
		c=c2;
		imgseq=2;
		ImgPath=myImgSrc2+"large/"+ifm;
	}
	var pos = "left=100,top=100";
		
	popwin = window.open("GalleryPopup.asp?img="+ImgPath+"&seq="+imgseq+"&caption="+c+"","imageWindow","width=670,height=650,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,"+pos);   
	if (window.focus) { popwin.focus(); }
	}
	
function StripFilename(x) {	
    wholePathLength=x.length;
    strippedPathLength=x.substring(0,x.lastIndexOf("/")).length;
    ifm= x.substring(strippedPathLength+1,wholePathLength);
	ifm=ifm.replace(/.gif/i, ".jpg");
	return ifm;
}
// Load function after page loads
// window.onload=loadImg;

