// splitting characters
function getSplitWord(word, separator, index)
{
	 arrayOfStrings = word.split(separator);
	 return arrayOfStrings[index];
}

function toggleDiv(id, flagit)
{
	if (flagit==1)
	{
		if (document.layers) document.layers[id].visibility = "show"
		else if (document.getElementById) document.getElementById(id).style.visibility = "visible"
	}
	else
	{
		if (document.layers) document.layers[id].visibility = "hide"
		else if (document.getElementById) document.getElementById(id).style.visibility = "hidden"
	}
}

function formatEndForceValue(n)
{
	if(isNaN(n))
	{
		return 0.00;
	}
	else
	{
		if(n==null || n=="")
		{
			return 0.00;
		}
		else
		{
			return parseFloat(n);
		}
	}
}

function clearEndForceForm(form)
{
	form.hose_id.value='';
	form.operating_pressure.value='';
	form.efc_result.value='';
}

function getEndForce(form)
{
	var h = Math.pow(formatEndForceValue(form.hose_id.value), 2);
	var p = formatEndForceValue(form.operating_pressure.value)/4;
	var efc_result=3.141592654 * h * p;
	form.efc_result.value=Math.abs(efc_result.toFixed(3));
	//alert(h+" and "+p);
}

// search form decision maker
function OnSubmitSearchForm()
{
	if(document.pressed=='DPL')
	{
		document.dvSearch.action="/dpl/catalog_page.php";
	}
	else if(document.pressed=='DV')
	{
		document.dvSearch.action="/sphider/search.php";
	}
	else
	{
		document.dvSearch.action="/dpl/search.php";
	}
	
	return true;
}