		
		function toggleImg(imgID)
		{
			// get the tag by id
			var imgTag = document.getElementById(imgID);
			// full path
			var fullPathName = imgTag.src;
			// full path as array via '/'
			var pathSplit = fullPathName.split("/");
			// minus 1 to get number of last array element number
			var getfileNameExt = pathSplit.length - 1;
			// will hold the file path value
			var fullFilePath = ''; 
		 
			// construct the file path based on the split of the path delimiter "/"
			// if there are no "/", it is just an image name
			if (pathSplit.length == 0)
			{
				// no file path
				fullFilePath = ''; 
			}
			// there are "/" then image name needs to be removed from the path
			else if (pathSplit.length > 0)
			{
				// remove file name which should be the last element in the array
				fullFilePath = fullPathName.replace(pathSplit[getfileNameExt], ''); 
			}
		 
			// work out the dynamics of the file name
			var fileNameExt = pathSplit[getfileNameExt]; // name of file with ext
			var fileNameSpilt = fileNameExt.split("."); // filename as array via '.'
			var fileName = fileNameSpilt[0]; // just the file name
			var fileExt = fileNameSpilt[1]; // just the file extention
			var fileNameMainSpilt = fileName.split("_"); // check for a spilt on '_'
			var imgName ='';
		 
			// check the array to see if there is more that 1 array element
			// if there is more than 1 array element that means that
			// this is an _2 image.
		 
			if (fileNameMainSpilt.length > 1)
			{
				// If it is greater than 1, minus 1 to get number of last array 
				// element number
				var fileNameMain = fileNameMainSpilt.length - 1;
				// get array value at fileNameMain
				fileNameMain = fileNameMainSpilt[fileNameMain]; 
				// if the value of the last array element is 2
				if (fileNameMain == 2)
				{
					// create the img 1 file name
					imgName = fileNameMainSpilt[0] + '.' + fileExt;
				}
				// if it isn't 2, then create img 2 file name
				else
				{
					imgName = fileName + '_2.' + fileExt;
				}
			}
			// if the array length is 1
			else
			{
				// create the img 2 file name
				imgName = fileName + '_2.' + fileExt;
			}
		 
			var finalFile = fullFilePath + imgName;
			imgTag.src = finalFile;
		}
