$(function(){
	$("#search_submit").val("");
	
	$("a[rel=external]").removeAttr('rel').attr('target', '_blank');
	
	$("#content table.browse")
		.dataTable(
			{
				bStateSave:true,
				aaSorting:[[1,'asc']],
				aoColumns:
					[
						{"bSortable":false},
						{"sType":"html"},
						{"sType":"html"},
						{"sType":"html"},
						{"bSortable":false},
						null,
						{"bSortable":false},
						{"bSortable":false},
						{"bSortable":false}
					],
				bPaginate:true,
				sPaginationType: "full_numbers",
				bFilter:false,
				oLanguage:
					{
						sInfo:"Titel _START_ t/m _END_ van de _TOTAL_",
						sLengthMenu:"Bekijk _MENU_ titels",
						oPaginate :
							{
								sNext : "<span>Volgende</span> &raquo;",
								sPrevious : "&laquo; <span>Vorige</span>"
							}
					},
				sDom : '<"top"ipl<"clear">>t'
			}
		)
		.find('tbody tr').css({cursor:'pointer'}).click(function () {
		    if ($(this).find('a').eq(0).attr('href')) {
		        window.location = $(this).find('a').eq(0).attr('href');
		    }
		});
		
		var c = $("td.price","form#order-form")
					.not('td.no_print');
		
		$("input#verder_winkelen")
			.bind('click',function(){
				window.location="/";
			});
		
		$("input#afrekenen")
			.bind('click',function(){
				window.location="/afrekenen";
			});
		
		$("input#orkest_toe")
			.bind('click',function(){
				window.location="/gebruiker/orkesten";
			});
		
		c.each(function(){
			$(this).data("price",$(this).html())
		});
			
		var d = $("#total").html();
		
		$("form#order-form input:radio")
			.bind("change",function(){
				var b = $(this).val();
				
				if(b==='ferskaat'){
					c.each(function(){
						
						var a=$(this).data("price")+" <strong>+ &euro; 6</strong>";
						
						$(this).html(a)}
					);
					
					$("#total")
						.html("<strong>bovenstaande bedragen + verz. kosten</strong>");
					
				}else{
					
					c.each(function(){
						var a = $(this).data("price");
						
						$(this).html(a)}
						
					);
					
					$("#total").html(d);
				}
				
			});
		
		var e = $("form#order-form input:radio[checked]").val();
		
		if(e==='ferskaat'){
			$("form#order-form input:radio").change();
		}
		
		$('#search_txt')
			.val('Zoek muziek...')
			.bind('click',function(){
				$(this).val('').unbind('click')
			});
		
		$('#hhw_container')
			.bind('click',function(){
				$('#search_txt').focus().click()
			});
		//	.corners('8px');
			
		//$('.dataTables_wrapper .top').corners();
		//$('form#user_login').corners();
});