function doLayerSwap(strLayerID){
	$('#mainprodimg').children().css('display','none');
	$('#'+strLayerID).css('display','block');
	$('#prodimgnav a').removeClass('selected');
	$('#'+strLayerID+'link').addClass('selected');

	drawCloseUpLink(strLayerID);
}

function initLayerNav(){
	var strLayerNav='<span class="label">Image:</span>';
	var intCount=0;
	var strSiteLoc=window.location.href;

	$('.imgcontainer').each(function(i){
		intCount=intCount+1
		if(intCount==1){
			strClass=' class="selected"';
		}else{
			strClass='';
		}
		strLayerNav+=' <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.closeup').replaceWith('');

	var strHref=$('#'+strLayerID+' a.thickbox').attr('href');

	if(strHref){
		$('#prodimgnav').append('<a href="'+strHref+'" class="closeup thickbox">Close Up</a>');

		/*Shadowbox.setup("a.shadowbox", {
			
		});*/

		tb_init('a.closeup');
	}
}


function initLayerNavOld(){
	var strLayerNav='<span class="label">Select Image:</span>';
	var strSiteLoc=window.location.href;

	$('.imgcontainer').each(function(i){
		if((i+1)==1){
			strClass=' class="selected"';
		}else{
			strClass='';
		}
		strLayerNav+=' <a href="'+strSiteLoc+'" onclick="doLayerSwap(\'img'+(i+1)+'\');return false;"'+strClass+' id="img'+(i+1)+'link">'+(i+1)+'</a>';
	});

	//drawZoomButton();
	$('#prodimgnav').html(strLayerNav);
}
