function fixPNG(element)
{
	if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent))
	{
		var src;

		if (element.tagName=='IMG')
		{
			if (/\.png$/.test(element.src))
			{
				src = element.src;
				element.src = host_site+"/img/blank.gif";
			}
		}
		else
		{
			src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i)
			if (src)
			{
				src = src[1];
				element.runtimeStyle.backgroundImage="none";
			}
		}

		if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
	}
}

window.onresize = doResize;

var ua = navigator.userAgent.toLowerCase();
var isOpera = (ua.indexOf('opera') > -1);
var isIE = (!isOpera && ua.indexOf('msie') > -1);

function getViewportHeight() {
	return ((document.compatMode || isIE) && !isOpera) ? (document.compatMode == 'CSS1Compat') ? document.documentElement.clientHeight : document.body.clientHeight : (document.parentWindow || document.defaultView).innerHeight;
}

function getDocumentHeight() {
	return Math.max(document.compatMode != 'CSS1Compat' ? document.body.scrollHeight : document.documentElement.scrollHeight, getViewportHeight());
}

function doResize() {
	var DocumentHeight = getDocumentHeight();
	if(DocumentHeight > 760)
		$('#floatingtd').css({height:DocumentHeight-236+"px"});
	else $('#floatingtd').css({height:"auto"});
}

$(document).ready(function(){

  doResize();

  $("td.catimg img:odd").hide();

	$("#addr").click(function() {
		document.location.href = host_site+"/dmenu/1281947528.htm";
	});

	$("#car").click(function() {
		document.location.href = host_site+"/extrapage/1282819421.htm";
	});

	$("#subscribe img").click(function() {
		document.location.href = host_site+"/subscribe.htm";
	})
		.hover(function() {$(this).css({opacity:"1"});
	      }, function() {$(this).css({opacity:"0.6"});
	});

	$("#orderform img").click(function() {
		document.location.href = host_site+"/orderonline.htm";
	})
		.hover(function() {$(this).css({opacity:"1"});
	      }, function() {$(this).css({opacity:"0.6"});
	});

	var url = document.location.href;

	$("div.cat1").click(function() {
		$("#divsel").css({display:"none"});

		$("div.catsel").toggleClass("catsel")
			.find("#catdrop").remove()
			.end().next("table").toggle();

		var td = $(this).toggleClass("catsel")
			.append("<p id='catdrop'></p>")
			.next("table").toggle()
			.find('td.cat2 a[href="'+url+'"]').parent();
		var toptd = td.attr("offsetTop") + td.attr("clientHeight")/2;
		var toptable = td.parent().parent().parent().attr("offsetTop");
		if (!isNaN(toptd))
	  		$("#divsel").css({display:"block", "top":toptd+toptable-4+"px"});
	});

	$("#left #catsel2").trigger("click");

	$("#left tr:not(.sel)").hover(function() {
				$(this).find("img:eq(1)").show()
					.prev().hide()
					.parent().next().addClass("cat3");
	        }, function() {
				$(this).find("img:eq(1)").hide()
					.prev().show()
					.parent().next().removeClass("cat3");
	});

	$("#left tr.sel img").show().first().hide();
});

