$(document).ready(function(){
	
	$('.overview_description').css('display','none');
	$('.link_add').click(function(){
		var id = $(this).parents('.overview_holder').attr('id');
		var aId = id.split('_');
		id = aId[1];
		var select = $(this).parents('.overview_holder').find('select').val();
		if (id>0 && select>0)
		{
			$.get('/product.php',{ 'id':id, 'price_id':select, 'add':'1' });
			alert(product_added);
			location.reload();
		}
	});
	
	$('.imageslider').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
	
	$('.colorbox').colorbox({
		transition:'elastic'
	});
	
	$('input.js_submitbutton').click(function(){
		$(this).attr('disabled','disabled').css('color','#ffffff');
		$(this).siblings('span.loading').show();
		$(this).closest('form').submit();
	});
	
	
	$('a').each(function(){
		var this_href = $(this).attr('href');
		if ( this_href.indexOf('?') != -1 )
			this_href += '&time='+ts_now;
		else
			this_href += '?time='+ts_now;
		$(this).attr('href', this_href);
	});
	
});

function product(path,id,price,txt) {
	return "<a href=\"" + path + "?action=add_product&priceid=" + price + "\">" + txt + "</a>";
}
