function openChannel (form) {

//get information from form
var size = form.size.value
var height = form.height.value
var slope = form.slope.value
var pipetype = form.pipetype.options[form.pipetype.selectedIndex].text
size = parseFloat(size)
height = parseFloat(height)
slope = parseFloat(slope)


//find n for Manning formula


var n
if (pipetype == "Cast Iron, fair condition"){
n = 0.011
}

if (pipetype == "Riveted steel pipe"){
n = 0.014
}

if (pipetype == "Virified sewer pipe"){
n = 0.011
}

if (pipetype == "Concrete pipe"){
n = 0.012
}

if (pipetype == "Wood-stave pipe"){
n = 0.010
}

if (pipetype == "Planed-plank pipe"){
n = 0.010
}

if (pipetype == "Semicircular metal flumes, smooth"){
n = 0.011
}

if (pipetype == "Semicircular metal flumes, corrugated"){
n = 0.023
}

//find hydraulic radius
var r = size/(12*2)
var H = height/12
var wettedPerimeter = 2*r*Math.acos((r-H)/r)
var crossSectionFlowArea = (Math.pow(r,2)*Math.acos((r-H)/r)) - ((r-H)*Math.pow((2*r*H)-Math.pow(H,2),0.5))
var hydraulicRadius = crossSectionFlowArea/wettedPerimeter

//find CHEZY COEFFICIENT

var c = (1.49*Math.pow(hydraulicRadius,0.167))/n

//find velocity in pipe

var v = c*Math.pow((hydraulicRadius*slope),0.5)

//find flow in pipe

var flowfps = v*crossSectionFlowArea
var flowgpm = flowfps*(7.481*60)
flowfps = flowfps * 100
flowfps = Math.round(flowfps)
flowfps = flowfps/100
flowgpm = flowgpm * 100
flowgpm = Math.round(flowgpm)
flowgpm = flowgpm/100
v = v * 100
v = Math.round(v)
v = v/100




form.velocity.value = v
form.flowfps.value = flowfps
form.flowgpm.value = flowgpm

}