$(function(){
/***************************/

//$(document).pngFix();



// external links
$('a[rel="external"]').click( function() {
	var page, linkRe = /redirect.php\?url=(.*)/;
	$('<div id="redirect-dialog" title="External site link">loading...</div>')
		.dialog({
			height: 140,
			modal: true,
			draggable: false,
			resizable: false,
			close : function (event, ui) {
					$(this).parent().empty();
			}						
		});
	
	page = $(this).attr('href');
	if (!linkRe.test(page)) {
		page = 'redirect.php?url=' + escape(page);
	}
	else {
		page = 'redirect.php?url=' + page.match(linkRe)[1];
	}

	$.get(page, function (res, status){
		if ( status == "success" || status == "notmodified" )	{
			$("#redirect-dialog").html(
				$("<div/>")
					.append(res.replace(/<script(.|\s)*?\/script>/g, ""))
					.find("#content")
					.children()
			)
			.find("a").click( function () {
				$("#redirect-dialog").parent().empty();										
			});
		}
	});

	return false;
}).attr("title","This link will open a new window");


$(".bottleshot img,#labels #content ul,#promotions #content .date,#wines  #content  .map a").ifixpng();


/***************************/
});
