var currentThumb = null;

$(function () {
    $(".img-swap").each(function () {
		if(currentThumb == null) {
			clickThumb(this);
			return false;
		}
    });
    $(".img-swap").live('click', function () {
		clickThumb(this);
    });
});

function clickThumb(thumb){
	if (currentThumb != null) {
		swapImage(currentThumb);
	}
	swapImage(thumb);
	currentThumb = thumb;
}

function swapImage(img) {
    if ((img.src != null) && (img.src != '')) {
        if (img.src.indexOf("-0") > -1) {
            img.src = img.src.replace("-0", "-1");
        } else {
            img.src = img.src.replace("-1", "-0");    
        }
    }
}
