/**
 * Developed by James Johnson of Excellent Ingenuity LLC
 * For Rain Collection Supplies.com
 * 05-2011
 */


function calcby(){
    for (Count = 0; Count < 2; Count++) {
        if (form.calcby[Count].checked)
            break;
    }
    alert ("Button " + Count + " is selected");
}
	
function calculate(form){
	var sqft = document.calcform.sqft.value;
	var length = form.getElementById("legth").value;
	var width = form.getElementById("width").value;
	
	var mysqft;
	
	 switch(checksize(sqft, length, width))
	 {
	 case 0:
		 window.alert(Please enter your square footage or the length and widt of your building in feet);
		 break;
	 case 1:
		 mysqft = sqft;
		 break;
	 case 2:
		 mysqft = length * width;
	 }
	 
	 
	
	
}

function checksize(sqft, length, width){
	var returncode = 0;
	if (sqft != "" || sqft != null){
		if(isNaN(sqft) == true){
			returncode = 0;
		}else {
			returncode = 1;
		}
	}else {
		returncode = 0;
	}
		
	if(returncode == 0){
		
		if ((length != "" || length != null) && (width != "" || width != null) ){
			if((isNaN(length) == true) && (isNaN(width) == true)){
				returncode = 0;
			}else {
				returncode = 2;
			}else {
				returncode = 0;
			}
		}
	}
	return returncode;
}
