function toggle(id,target){
	scrollPos();
	var zoomer = document.getElementById(id);
	zoomer.style.top = (docHeight / 2) - 200 + scrollTop + 'px';
	zoomer.style.left = (docWidth / 2) - 280 + 'px';
	if(target){
		var zoomerImg = zoomer.getElementsByTagName("IMG")[0];
		zoomerImg.src=target.src;
		zoomerImg.src=zoomerImg.src.replace(".jpg","_BIG.jpg");
		zoomerImg.className="show";
	}else{
		var zoomerImg = zoomer.getElementsByTagName("IMG")[0];
		zoomerImg.className="hide";
	}
}
function preloader() 
{
	//this is the name of the image holder
	var divId = 'holder';
	if(!document.getElementById(divId))return false;
    // create object
   
    // set image list
    var images = document.getElementsByTagName("IMG");
    // start preloading
    for(i=0; i<images.length; i++){
		var thisImage=images[i];
		if(thisImage.className.indexOf("zoom")!=-1){
			var source = images[i].src.replace(".jpg","_BIG.jpg");
			var imageObj = new Image();
			imageObj.src=source;
			thisImage.onclick = function(){
				toggle(divId,this);
			}
		}
    }
} 

function scrollPos(){
	if(document.documentElement.clientHeight){
		if(document.documentElement.clientHeight<document.body.clientHeight){
				docHeight = document.documentElement.clientHeight;
				docWidth = document.documentElement.clientWidth;				
		}else{
				docHeight = document.body.clientHeight;
				docWidth = document.body.clientWidth;
		}	
		scrollTop = document.documentElement.scrollTop;
	}
	else if(document.body){
		scrollTop = document.body.scrollTop;
		docHeight = document.body.clientHeight;
		docWidth = document.body.clientWidth;
	}
	
}
addLoadEvent(preloader);
