function killEnter(e){
e = e? e : window.event;
var k = e.keyCode? e.keyCode : e.which? e.which : null;
if (k == 13){
if (e.preventDefault)
e.preventDefault();
return false;
};
return true;
};
if(typeof document.addEventListener!='undefined')
document.addEventListener('keydown', killEnter, false);
else if(typeof document.attachEvent!='undefined')
document.attachEvent('onkeydown', killEnter);
else{
if(document.onkeydown!=null){
var oldOnkeydown=document.onkeydown;
document.onkeydown=function(e){
oldOnkeydown(e);
killEnter(e);
};}
else
document.onkeydown=killEnter;
}


function numbersonly(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
   
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;

// numbers
else if ((("0123456789").indexOf(keychar) > -1))
   return true;
else
   return false;
}

var submitForm = function() {
	
	$("form").submit();
	
	}

var modifyLink = function () {
	
	var prodID = $(this).attr('id').split("_");
	prodID = prodID[1];
	if($(this).val())
	{
		qty = parseInt($(this).val());
	}
	else
	{
		qty = 0;
	}

	if(parseInt(qty) != 0)
	{
		$("#buy_"+prodID).fadeTo(0,1);
		$("#buy_"+prodID).css({cursor:"pointer"});
		$("#buy_"+prodID).bind('click',submitForm);
	}
	else
	{
		$("#buy_"+prodID).fadeTo(0,0.5);
		$("#buy_"+prodID).css({cursor:"default"});
		$("#buy_"+prodID).unbind('click',submitForm);
	}
			
	}


$(document).ready(function() {
	$('#productList ul li:eq(1) span').css("borderTop","none");
	$('.list_box ul li:last').css("paddingBottom","8px");
	
	$(".ticket_quantity").each(modifyLink)
	
	$('.ticket_quantity').bind('keyup',modifyLink);
	
	
	
	
	});