	jQuery(document).ready(function(){
  		
  		$('#quantity').focus(function () {
  			dosub = 1;
  			$('#qtybutton').removeClass('two');
         	$('#qtybutton').addClass('twoenter');
         	$('#quantity').removeClass('pointme');
                  
    	});
  
    	$('#quantity').blur(function () {
         	$('#qtybutton').removeClass('twoenter');
         	$('#qtybutton').addClass('two');
         	$('#quantity').addClass('pointme');
         
         	qtycheck = $('#quantity').val();
         	var checkOK = "0123456789";
         	var valid = true;
         	string = "" + qtycheck;
         	
         	for (i = 0;  i < string.length;  i++)	{   			
				ch = string.charAt(i);		  	
    			for (j = 0;  j < checkOK.length;  j++) {
					if (ch == checkOK.charAt(j)) {
    				break; }
				}				
				if (j == checkOK.length) {
				valid = false;
				}				
    		}
		
			if (!valid) {   
			$('#pop-whole').fadeIn(500).fadeOut(4000);
			$('#quantity').val('0');
			} else
			{
			if (qtycheck != '' && qtycheck < 50) {   
			$('#pop-min').fadeIn(500).fadeOut(4000);
			$('#quantity').val('50');
			}
			}
         	
         	qty = $('#quantity').val();
         	var price = 0.28;					/* ------ SET PRICE OF BUTTON HERE ------ */
         	longtotal = qty * price;
         	totaldol = Math.floor(longtotal);
         	x = longtotal-totaldol;
         	y = x * 100;
         	z = Math.floor(y);
         
         
         	if (z == '0') {
         		totalcent = "00";
         		} else
         		{
         		if (z < '10') {
         			totalcent = '0' + z;
         			} else
         			{
         			totalcent = z;
        			}         
         		}     
         
        	 total = totaldol + '<span class="cents">&#46;' + totalcent + '</span>';
         
         	if (qty == "" || qty == "0") {
         		$('#quantity').val('0');
         		$('#value').html('0');
         		$('#your-total > p').css({'margin-left' : '-6px'});
        		} else
         		{
         		$('#your-total').addClass('havetotal');
         		$('#value').html(total);
         		$('#your-total > p').css({'margin-left' : '0'})
         		}               
        	
        	dosub = 2;		
         
    	});
    	
    	    	
    	$('#button-buy').submit(function () {
        	if (dosub == '1') {         
        		return false;
         		} else
         		{
         		return true;
         		}
         
        });
         	    	
    	  		
	});