function doLayerSwap(strLayerID){
	$('#productdetail .img').children().not('#prodimgnav,.container').css('display','none');
	$('#'+strLayerID).css('display','block');
	$('#prodimgnav a').removeClass('selected');
	$('#'+strLayerID+'link').addClass('selected');

	drawCloseUpLink(strLayerID);
}

function initLayerNav(){
	var strLayerNav='';
	var intCount=0;
	var strSiteLoc=window.location.href;
	var strSep='';

	$('.imgcontainer').each(function(i){
		intCount=intCount+1
		if(intCount==1){
			strClass=' class="selected"';
		}else{
			strClass='';
			//strSep=' | ';
		}
		strLayerNav+=strSep+' <a href="'+strSiteLoc+'" onclick="doLayerSwap(\'img'+intCount+'\');return false;"'+strClass+' id="img'+intCount+'link">'+intCount+'</a>';
	});

	if(intCount>1){
		$('#prodimgnav').html('<span class="imglist">'+strLayerNav+'</span>');
	}else{
		$('#prodimgnav').html('');
	}
	drawCloseUpLink('img1');
}

function drawCloseUpLink(strLayerID){
	$('#prodimgnav a.zoom').replaceWith('');

	var strHref=$('#'+strLayerID+' a.shadowbox').attr('href');
	var strCaption=$('#'+strLayerID+' a.shadowbox').attr('title');

	if(strHref){
		if(strCaption){
			strCaption=' title="'+strCaption+'"';
		}
		$('#prodimgnav').append('<a href="'+strHref+'" class="zoom shadowbox"'+strCaption+'>Zoom In</a>');

		Shadowbox.setup('a.shadowbox', {
			
		});
	}
}

