var qtyChanged=0;
function checkCart(){
	var cart = document.getElementById('activecart');
	if(cart!=null && cart!='' && cart!= undefined){
		var inputs = new Array();
		inputs=cart.getElementsByTagName('input');
		
		for(i=0;i<inputs.length;i++){
			if(inputs[i].name.search('qty')>-1 && inputs[i].parentNode.parentNode.parentNode.parentNode.id.search('activecart')>-1){
				inputs[i].onblur=checkQty;
				firstCheckQty(inputs[i]);
			}
		}
	}
}
function firstCheckQty(thisinput){
	var qtybox=thisinput;
	var qtyval= new Number(qtybox.value);
	qtyval=qtyval.toFixed(2);
	var qtystrval
	var qtystrval=qtyval.toString(2);
	
	var decimals = qtystrval.substr(qtystrval.length-2,qtystrval.length);
	var whole = qtystrval.substr(0,qtystrval.length-2);
	
	decimals = new Number(decimals);
	
	var newnum='';
	if(decimals!=0 || decimals!=25 || decimals!=50 || decimals!=5 || decimals!=75){
		newnum=whole+''+decimals;
		if(decimals<25 && decimals>0){
			newnum = whole+'25';
			
			qtyChanged=1;
			qtyAlert(qtyChanged);
		}
		else if(decimals<50 && decimals>25){
			newnum = whole+'50';
			
			qtyChanged=1;
			qtyAlert(qtyChanged);
		}
		else if(decimals<75 && decimals>50){
			newnum = whole+'75';
			
			qtyChanged=1;
			qtyAlert(qtyChanged);
		}
		else if(decimals>75){
			var newwhole = new Number(whole);
			newwhole=newwhole+1;
			newnum = newwhole+'.0';
			
			qtyChanged=1;
			qtyAlert(qtyChanged);
		}
		
	}
	else{
		newnum=whole+''+decimals;
	}
	qtybox.value=newnum;

}
var testmsg='';
function checkQty(){
	var qtybox=this;
	var qtyval= new Number(qtybox.value);
	qtyval=qtyval.toFixed(2);
	var qtystrval
	var qtystrval=qtyval.toString(2);
	
	var decimals = qtystrval.substr(qtystrval.length-2,qtystrval.length);
	var whole = qtystrval.substr(0,qtystrval.length-2);
	
	decimals = new Number(decimals);
	
	var newnum='';
	if(decimals!=0 || decimals!=25 || decimals!=50 || decimals!=5 || decimals!=75){
		newnum=whole+''+decimals;
		if(decimals<25 && decimals>0){
			newnum = whole+'25';
			
			qtyChanged=1;
			qtyAlert(qtyChanged);
		}
		else if(decimals<50 && decimals>25){
			newnum = whole+'50';
			
			qtyChanged=1;
			qtyAlert(qtyChanged);
		}
		else if(decimals<75 && decimals>50){
			newnum = whole+'75';
			
			qtyChanged=1;
			qtyAlert(qtyChanged);
		}
		else if(decimals>75){
			var newwhole = new Number(whole);
			newwhole=newwhole+1;
			newnum = newwhole+'.0';
			
			qtyChanged=1;
			qtyAlert(qtyChanged);
		}
	}
	else{
		newnum=whole+''+decimals;
	}
	qtybox.value=newnum;
	
}

function qtyAlert(changed){
	var changedCheck = changed;
	
	if(changed==1){
		alert('Your requested amount has been automatically rounded up because we only accept orders in quarter quantities.');
	}
	qtyChanged=0;
	
}