 $(document).ready(function(){
  
   $('a[rel*=facebox]').facebox()

   $(".toggle").click(function(){
	  $(this).next(".table-container").slideToggle("fast"); 
	  $(this).toggleClass("active");
	});
   
   var orderTotal = 0;
   var totalQnty = "";
    
    $("td.quantity input").blur(function() {
     var $row = $(this).parent("td").parent("tr");
     var price = $row.find("td.price").html();
     var total = price * $(this).val();
     $row.find("td.total").html("$"+total);
    });
    
  var order = "";
   
  $("input.order-submit").click(function(){
   	$("td.quantity input").each(function() {
	    var qnty = $(this).val();
	    var $prow = $(this).parent("td").parent("tr");
		var ptotal = $prow.find("td.total").html();
		var pname = $prow.find("td.pname").html();
		var pcode = $prow.find("td.pcode").html();
		if (qnty >= 1) {
		 order = (order+"<tr><td>"+pcode+"</td><td>"+pname+"</td><td>"+"</td><td>"+qnty+"</td><td>"+ptotal+"</td></tr>");
	    }
  	}); 	
  	$('input.order-info').val(order);  
   }); 
});
