function menu(){
	$('.menu').find('li').click(function() {
		window.location = $(this).find('a').attr('href');
	});
}
function hbox() {
	padding = 20;
	width=$('.top_des').width()-padding;
	$('.list').css('width',width);
	pw = $('.list').width();
	if (pw>242) {
		partw = 164;
		partwm=partw+14;
		pl = Math.floor(pw/partwm);
		ps = pl*partwm;
		es = pw-ps-(23*pl);
		sa = es/pl;
		npw = sa+partw;
		$('.hbox').css('width',npw+'px');
	}
}
function centerimg() {
	$('.imgbox').each(function() {
		boxh = $(this).height();
		imgh = $(this).find('img').height();
		margh = (boxh - imgh)/2;
		if (margh > 0) {
			if (margh < 60) { 
				$(this).find('a').css('margin-top',margh);
			}
		}
	}); 
}
function resizew() {
	ww = $(window).width();
	sidemarginwidth = 440;
	$('.top_des').css('width',ww-sidemarginwidth);
	$('.bot_des').css('width',ww-sidemarginwidth);
}
function resized() {
	ww = $(window).width();
	sidemarginwidth = 458;
	$('.detailbg').css('width',ww-sidemarginwidth);
}
function resizeh() {
	ww = $(window).width();
	sidemarginwidth = 226;
	$('.top_des').css('width',ww-sidemarginwidth);
	$('.bot_des').css('width',ww-sidemarginwidth);
}
function cartjs() {
	$('.cartqty').change(function() {
		qty = $(this).parents('.cartitem').find('.cartqty').val();
		pri = $(this).parents('.cartitem').find('.cartprice').html();
		totprice = pri*qty;
		$(this).parents('.cartitem').find('.carttotprice').html(totprice.toFixed(2));
		thetotal = 0;
		$('.cartitem').each(function() {
			thetotal= thetotal + parseFloat($(this).find('.carttotprice').html());
		});
		$('.total').html(thetotal.toFixed(2));
		$('.updatecart').click(function() { return false; });
		$.getJSON("http://www.rustrepair.com/app2/onlinecat.htm?r=lg&p=atc-"+$(this).attr('id')+"-"+$(this).val()+"&CALLBACK=?",function(data) {});
	});
	$('.checkout').click(function() {
		$('.cartitem').each(function() {
			part = $(this).attr('id');
			des = $(this).find('.cartdes').html();
			price = $(this).find('.cartprice').html();
			quantity = $(this).find('input').val();
			//piwikTracker.addEcommerceItem(part, des, '', price, quantity);
		});
		grandTotal = $('.total').html();
		//piwikTracker.trackEcommerceOrder(<?php if ($_COOKIE['ordno']) { echo $_COOKIE['ordno']; }else{ echo $_GET['ord']; } ?>,grandTotal);
		setTimeout("document.location = 'http://www.rustrepair.com/app2/onlinecat.htm?r=<?php echo $freecode; ?>&p=atc-ck'",750);
		return false;
	});
}
