jQuery(document).ready(function(){
	
	$("form#oss-filter select").change(function(){
		$("form#oss-filter").submit();
	});
	
	$("#product-image a").each(function(){ $(this).append("<img src=\"/usr/tpl/default/img/button_zoom.gif\" class=\"zoom\" />"); });
	$("#product-thumbs a").click(function(){ 
		var xurl = $(this).attr("rev");
		var ximg = $(this).attr("href");
		$("#product-image a").attr("href", xurl);
		$("#product-image img.first").removeAttr("width");
		$("#product-image img.first").removeAttr("height");
		$("#product-image img.first").attr("src", ximg);
		return false;
	});
	
	// stupid IE doesn't support last/first selectors so...
	$(":first-child").addClass("first");
	$(":last-child").addClass("last");
	
	// autoclear
	$(".autoclear").each(function(){
		$(this).attr("title", $(this).attr("value"));
	});
	$(".autoclear").focus(function(){
		if ($(this).attr("title") == $(this).attr("value"))
			$(this).attr("value", "");
	});
	$(".autoclear").blur(function(){
		if (!$(this).attr("value") || $(this).attr("value") == "")
			$(this).attr("value", $(this).attr("title"));
		else
			$(this).removeClass("autoclear");
	});
	
	// zebra stripes
	$(
		"table.zebra tbody tr:odd, "
		+ "table#cart tbody tr:odd"
	).addClass('zebra1');
	
	// add input classes since IE can't do attribute selectors
	$("input[@type=text]").addClass("text");
	$("input[@type=password]").addClass("password");

});
