var myPopup;
function popup(id, width, height)
{
	if(!width && !height){
		width = 550;
		height = 600;
	}

    if (id.indexOf("/") != 0) {
        if (id.indexOf("http://") != 0) {
            id = "/" + id;
		}
    }
    
    if (id.indexOf(".html") == -1) {
        id = id;
    }

	myWindow = window.open(id, 'popupwind','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width='+ width + ', height=' + height + '', false);
	
	myWindow.focus();
	void('');
}

function imgswap(id, img){
	var item = document.getElementById(id);
	//alert(PATH + img);
	if(item != null)
		item.src = PATH + img;
}

//Product Thumbnail Rollover
$(document).ready(function(){
	$(".products #product .multi a").hover(
		function() {
			//Capture the new image link and build a new medium image link for display
			var swapimglink = $(this).attr("href");
			var medimglink = $(this).attr("href");
			medimglink = medimglink.replace("-zoom","-prod");
			swapimglink = swapimglink.replace("-zoom","");
			
			//Swap Product Image Link
			$(".detailImagePointer a").attr("href",swapimglink);
			//Swap Product Image
			$(".detailImagePointer #large img").attr("src",medimglink);
			//Swap Infobar Enlarge Link
			$(".infobar #largeimglink").attr("href",swapimglink);
			
			//Reset Shadowbox Cache to update links
			Shadowbox.clearCache();
			Shadowbox.setup();
			$('.cloud-zoom, .cloud-zoom-gallery').CloudZoom();			
		}
	);
});

