// JavaScript Document
var i=1;
var set=1;
var g1=1;
var g2=2;
var g3=3;
var max=5;
var images=[]; 
var enlarged=[];


function chainMainImage(imagePath)
{
	document.getElementById('gallery').src=imagePath;
	return true;
}

function changeimg(i,epath){
	
 if(i==1){
	document.getElementById('gallery').src=images[g1];
	document.getElementById('gallery').name=epath;
	
	
 }
 if(i==2){
	 document.getElementById('gallery').src=images[g2];
	 document.getElementById('gallery').name=epath;
	
 }
 if(i==3){
	 document.getElementById('gallery').src=images[g3];
	 document.getElementById('gallery').name=epath;
 }

}

function previmg(){
	if(g1>set){
		document.g1.src=images[g1-set];
		g1=g1-set;
		document.g2.src=images[g2-set];
		g2=g2-set;
		document.g3.src=images[g3-set];
		g3=g3-set;

	}
}


function popupimg(){
	window.open(document.gallery.src,'image');
}
function popupopen(){
	window.open('two.html','two');
}
function popupclose(){
	window.close();
}
function changetext(){
document.getElementById('inner').innerHTML='I an fine';
}

function enlargeimage(optWidth, optHeight){ //function to enlarge image. Change as desired.

var path=document.getElementById('gallery').name;
var actualWidth=typeof optWidth!="undefined" ? optWidth : "600px" //set 600px to default width
var actualHeight=typeof optHeight!="undefined" ? optHeight : "500px" //set 500px to  default height
var winattributes="width="+actualWidth+",height="+actualHeight+",resizable=yes"
window.open(path,"", winattributes)
}

function nextimg(maxcount)
{
	
	if(maxcount==1 || maxcount==2)
	{
		return;
	}
	
			if(g3<max)
			{
				document.g1.src=images[g1+set];
				g1=g1+set;
				document.g2.src=images[g2+set];
				g2=g2+set;
				document.g3.src=images[g3+set];
				g3=g3+set;
			}
	
}
