function PicToggler(w_small, h_small, w_large, h_large) {
	this.w_small = w_small || null;
	this.h_small = h_small || null;
	this.w_large = w_large || null;
	this.h_large = h_large || null;
}
PicToggler.prototype.toggle = function(img, buddyID) {
	/*
		It is assumed that there are two images - a regular-size and a small version, which will have "_small" at the end of the 
		filename, just before the extension.
	*/
	if (img == null) {
		return false;
	}
	var name = img.src;
	
	if (buddyID) {
		this.reduce(document.getElementById(buddyID));
	}
	
	if (name.substr(name.lastIndexOf(".")-6, 6) != "_small") {
		this.reduce(img);
	}
	else {
		this.enlarge(img);
	}
}
PicToggler.prototype.enlarge = function(img) {
	if (img == null) {
		return false;
	}
	var name = img.src;
	var hover_text = "";

	if (name.substr(name.lastIndexOf(".")-6, 6) == "_small") {
		if (this.w_large && this.h_large) {
			img.width = this.w_large;
			img.height = this.h_large;
		}
		img.src = name.substr(0, name.lastIndexOf(".")-6) + name.substr(name.lastIndexOf("."));
		img.alt = hover_text;
		if (img.title != null) {
			img.title = hover_text;
		}
	}
}
PicToggler.prototype.reduce = function(img) {
	if (img == null) {
		return false;
	}
	var name = img.src;
	var hover_text = "Click to enlarge.";

	if (name.substr(name.lastIndexOf(".")-6, 6) != "_small") {
		if (this.w_small && this.h_small) {
			img.width = this.w_small;
			img.height = this.h_small;
		}
		img.src = name.substr(0, name.lastIndexOf(".")) + "_small" + name.substr(name.lastIndexOf("."));
		img.alt = hover_text;
		if (img.title != null) {
			img.title = hover_text;
		}
	}
}

