if(typeof(ecarlist) !== 'object') { ecarlist = {} };
ecarlist.gallery_thumbs = {
	onLoad: function(){
		var templateColors = document.getElementsByTagName("ul");
		for(var x=0; x < templateColors.length; x++){			
			if(templateColors[x].className == "templateColors"){                     
				var templateTags = templateColors[x].getElementsByTagName("a");
				for(var y=0; y < templateTags.length; y++){
					templateTags[y].onclick=function(){
						ecarlist.gallery_thumbs.switchImages(this);
						return false;
					}
				} 				
			}
		}
	},
	switchImages: function(thumb_image){
		var thumb_split = thumb_image.getAttribute('id').split('_'); //thumb_split is the id 
		var link = document.getElementById(thumb_split[0]);    //this is varible holds an object with the big default images link
		var img = link.getElementsByTagName('img')[0];         //this is the varible to switch the default image
		var extension = thumb_split[1] + ".html";
		var linkTwo = link.getAttribute('href').split('/');   //im taking the current defualt big image link, taking out the html file name and adding on html file clicked on
		linkTwo.pop();
		linkTwo = linkTwo.join('/');
		linkTwo = linkTwo+"/"+extension;
		link.setAttribute("href", linkTwo);
		img.setAttribute("src", thumb_image.getAttribute('href'));			
	}
}
window.onload = ecarlist.gallery_thumbs.onLoad;