var min = 35, max = 80;
var diagramPercentValues = [];
var appgate_ID = "10005H";
var country = "com";
var lang = "en"
// var url = "http://www.gfps.com/appgate/ecat/common_flow/10005H/COM/en/searchview.html?query=";
// http://www.gfps.com/appgate/ecat/common_flow/[appgate_ID]/[country]/[lang]/catalog.do?action=product-redirect&codeNumber=[Code-Nummer]
var url = "http://www.gfps.com/appgate/ecat/common_flow/";
var calcCounter = 0;
var isFirstInputChange = true;
var fittingSelected = sensorSelected = false;
function preparePrint()
{
$("#pUnits").text($("input[name='flow_liquid']:checked").val() == "Eu"?"metric":"imperial");
$("#pStandard").text($("#selectstandard").val());
$("#pMaterial").text($("#selectmaterial").val());
$("#pDimension").text($("#selectdn").val());
$("#pSensorType").text($("#selectSensorsensorType").val());
$(".pFilter").hide();
switch ($("#selectSensorsensorType").val())
{
case "Flow":
if($("#filter").is(":hidden")){
$("#pFilterFlowMin").hide();
$("#pFilterFlowMax").hide();
$("#pFilterFlowSolids").hide();
} else {
$("#pFilterFlowMin").show();
$("#pFilterFlowMax").show();
$("#pFilterFlowSolids").show();
$("#pFilterFlowMinText").text($("#filterFlowMin").val());
$("#pFilterFlowMaxText").text($("#filterFlowMax").val());
$("#pFilterSolidsText").text($("input[name='flow_liquid']:checked").val()==0?"No":"Yes");
}
break;
}
$("#pYourResult").empty();
$("#pYourResult").append($("#sensorResults").html());
$("#pYourResult").append("
" + $("#installationFittingResults").html() + "
");
$("#pYourResult .resetSelection").remove();
}
window.onafterprint = function(){
$("#pYourResult").empty();
}
function init()
{
$("#firstP").css("left", "7.5%");
$("#lastP").css("left", "90.3%");
//setFilterFlowUnit("Eu");
$("#filter_flow").hide();
// if (getUrlParameter("m") != "" && typeof getUrlParameter("m") != "undefined")
// {
if(getUrlParameter("m")) $('#selectmaterial option').filter(function () { return $(this).text() == getUrlParameter("m").replaceAll("+"," "); }).prop("selected", true);
if(getUrlParameter("f"))$('#selectSensorsensorType option').filter(function () { return $(this).text() == getUrlParameter("f").replaceAll("+"," "); }).prop("selected", true);
if(getUrlParameter("d"))$('#selectdn option').filter(function () { return $(this).val() == getUrlParameter("d").replaceAll("+"," "); }).prop("selected", true);
if(getUrlParameter("st")) $('#selectstandard option').filter(function () { return $(this).text() == getUrlParameter("st").replaceAll("+"," "); }).prop("selected", true);
if(getUrlParameter("ff1"))$('#filterFlowMin').val(getUrlParameter("ff1").replaceAll("+"," "));
if(getUrlParameter("ff2"))$('#filterFlowMax').val(getUrlParameter("ff2").replaceAll("+"," "));
if(getUrlParameter("fc1"))$('#filterConductivityProcessTemperatureMin').val(getUrlParameter("fc1").replaceAll("+"," "));
if(getUrlParameter("fc2"))$('#filterConductivityProcessTemperatureMax').val(getUrlParameter("fc2").replaceAll("+"," "));
if(getUrlParameter("fc3"))$('#filterConductivityConducticityMin').val(getUrlParameter("fc3").replaceAll("+"," "));
if(getUrlParameter("fc4"))$('#filterConductivityConducticityMax').val(getUrlParameter("fc4").replaceAll("+"," "));
if(getUrlParameter("fp1"))$('#filterPhProcessTemperatureMin').val(getUrlParameter("fp1").replaceAll("+"," "));
if(getUrlParameter("fp2"))$('#filterPhProcessTemperatureMax').val(getUrlParameter("fp2").replaceAll("+"," "));
if(getUrlParameter("fp3"))$('#filterPhConducticityMin').val(getUrlParameter("fp3").replaceAll("+"," "));
if(getUrlParameter("fp4"))$('#filterPhConducticityMax').val(getUrlParameter("fp4").replaceAll("+"," "));
if(getUrlParameter("fo1"))$('#filterOrpProcessTemperatureMin').val(getUrlParameter("fo1").replaceAll("+"," "));
if(getUrlParameter("fo2"))$('#filterOrpProcessTemperatureMax').val(getUrlParameter("fo2").replaceAll("+"," "));
if(getUrlParameter("u"))$("input[name='rUnits'][value="+getUrlParameter("u").replaceAll("+"," ")+"]").prop("checked", true);
if(getUrlParameter("so")) $("input[name='flow_liquid'][value="+getUrlParameter("so").replaceAll("+"," ")+"]").prop("checked", true);
if (getUrlParameter("ao") && getUrlParameter("ao").replaceAll("+", " ") == 1)
{
$("#filter").show();
$("#filter_flow").show();
$(".openParams").text("- close additional parameters");
$(".openParams").show();
} else {
$("#filter").hide();
$("#filter_flow").hide();
$(".openParams").text("+ open additional parameters");
$(".openParams").hide();
}
var item;
if (getUrlParameter("f"))
{
switch (getUrlParameter("f").replaceAll("+"," "))
{
case "Flow":
item = $("#filter_flow");
break;
case "pH":
item = $("#filter_pH");
break;
case "Conductivity":
item = $("#filter_Conductivity");
break;
case "ORP":
item = $("#filter_orp");
break;
}
$(".filter").hide();
item.show();
changeFitting();
}
// } else
// {
//
// }
if (getUrlParameter("appgate_ID") != "" && typeof getUrlParameter("appgate_ID") != "undefined")
{
appgate_ID = getUrlParameter("appgate_ID");
}
if (getUrlParameter("country") != "" && typeof getUrlParameter("country") != "undefined")
{
country = getUrlParameter("country");
}
if (getUrlParameter("lang") != "" && typeof getUrlParameter("lang") != "undefined")
{
lang = getUrlParameter("lang");
}
$(".infoI").hover(function () {
$(this).parent().find(".tipp").fadeIn();
}, function () {
$(this).parent().find(".tipp").fadeOut();
});
}
function sendMail()
{
var rUnits = $("input[name='rUnits']:checked").val(),
rSolids = $("input[name='flow_liquid']:checked").val(),
selectMaterialVal = $("#selectmaterial").val().replaceAll(" ", "+"),
selectStandardVal = $("#selectstandard").val().replaceAll(" ", "+"),
selectDimensionVal = $("#selectdn").val().replaceAll(" ", "+"),
selectSensorTypeVal = $("#selectSensorsensorType").val().replaceAll(" ", "+"),
filterFlowMin = $("#filterFlowMin").val().replaceAll(" ", "+"),
filterFlowMax = $("#filterFlowMax").val().replaceAll(" ", "+"),
filterConductivityProcessTemperatureMin = $("#filterConductivityProcessTemperatureMin").val(),
filterConductivityProcessTemperatureMax = $("#filterConductivityProcessTemperatureMax").val(),
filterConductivityConducticityMin = $("#filterConductivityConducticityMin").val(),
filterConductivityConducticityMax = $("#filterConductivityConducticityMax").val(),
filterOrpProcessTemperatureMin = $("#filterOrpProcessTemperatureMin").val(),
filterOrpProcessTemperatureMax = $("#filterOrpProcessTemperatureMax").val(),
filterPhProcessTemperatureMin = $("#filterPhProcessTemperatureMin").val(),
filterPhProcessTemperatureMax = $("#filterPhProcessTemperatureMax").val(),
filterPhConducticityMin = $("#filterPhConducticityMin").val(),
filterPhConducticityMax = $("#filterPhConducticityMax").val(),
additionalOptions;
if($("#filter").is(":hidden")){
additionalOptions = 0;
} else {
additionalOptions = 1;
}
var mailurl = 'https://www.gfps.com///support_and_services/online_tools/sensor-installationfitting-finder.html?m=';
//location.href = "mailto:?to=&subject="+mailSubject+"&body="+mailBody1+"https://gfpstools.com/sensor-installationfitting-tool/?m=" + selectMaterialVal + "%26st=" + selectStandardVal + "%26so=" + rSolids + "%26ao=" + additionalOptions + "%26u=" + rUnits + "%26ff1=" + filterFlowMin + "%26ff2=" + filterFlowMax + "%26f=" + selectSensorTypeVal + "%26d=" + selectDimensionVal + "%26fc1=" + filterConductivityProcessTemperatureMin + "%26fc2=" + filterConductivityProcessTemperatureMax + "%26fc3=" + filterConductivityConducticityMin + "%26fc4=" + filterConductivityConducticityMax + "%26fp1=" + filterPhProcessTemperatureMin + "%26fp2=" + filterPhProcessTemperatureMax + "%26fp3=" + filterPhConducticityMin + "%26fp4=" + filterPhConducticityMax + "%26fo1=" + filterOrpProcessTemperatureMin + "%26fo2=" + filterOrpProcessTemperatureMax + "%26lang=" + lang+mailBody2;
location.href = "mailto:?to=&subject="+mailSubject+"&body="+mailBody1+mailurl + selectMaterialVal + "%26st=" + selectStandardVal + "%26so=" + rSolids + "%26ao=" + additionalOptions + "%26u=" + rUnits + "%26ff1=" + filterFlowMin + "%26ff2=" + filterFlowMax + "%26f=" + selectSensorTypeVal + "%26d=" + selectDimensionVal + "%26fc1=" + filterConductivityProcessTemperatureMin + "%26fc2=" + filterConductivityProcessTemperatureMax + "%26fc3=" + filterConductivityConducticityMin + "%26fc4=" + filterConductivityConducticityMax + "%26fp1=" + filterPhProcessTemperatureMin + "%26fp2=" + filterPhProcessTemperatureMax + "%26fp3=" + filterPhConducticityMin + "%26fp4=" + filterPhConducticityMax + "%26fo1=" + filterOrpProcessTemperatureMin + "%26fo2=" + filterOrpProcessTemperatureMax + "%26lang=" + lang+mailBody2;
}
var fittingLocked = false, sensorLocked = false;
function calcFilterFlowVal(val)
{
val = val.replace(",", ".");
var dn = $("#selectdn").val();
var r1, r2;
switch ($("#filterFlowUnit").val())
{
case "m1":
r1 = val;
r2 = (val * 4 / ( 3600000 * Math.PI)) * Math.pow( (1000 / dn ),2);
break;
case "m2":
r1 = val * 60;
r2 = (val * 4 / ( 60000 * Math.PI)) * Math.pow(( 1000 / dn ),2);
break;
case "m3":
r1 = val * 3600;
r2 = (val * 4 / ( 1000 * Math.PI)) * Math.pow(( 1000 / dn ),2);
break;
case "m4":
r1 = val * 1000;
r2 = (val * 4 / ( 3600 * Math.PI)) * Math.pow(( 1000 / dn ),2);
break;
case "m5":
r1 = val * 60000;
r2 = (val * 4 / ( 60 * Math.PI)) * Math.pow(( 1000 / dn ),2);
break;
case "m6":
r1 = val * 3600000;
r2 = (val * 4 / Math.PI) * Math.pow(( 1000 / dn ),2);
break;
case "i1":
r1 = val * 1728 / 231 / 60;
r2 = ( val / 3600 * 4 / Math.PI ) / Math.pow(( dn / 304.8 ), 2);
break;
case "i2":
r1 = val * 1728 / 231;
r2 = ( val / 60 * 4 / Math.PI ) / Math.pow(( dn / 304.8 ), 2);
break;
case "i3":
r1 = val * 1728 / 231 * 60;
r2 = ( val * 4 / Math.PI ) / Math.pow(( dn / 304.8 ), 2);
break;
case "i4":
r1 = val / 60;
r2 = ( val / 3600 * 231 / 1728 * 4 / Math.PI ) / Math.pow(( dn / 304.8 ), 2);
break;
case "i5":
r1 = val;
r2 = ( val / 60 * 231 / 1728 * 4 / Math.PI ) / Math.pow(( dn / 304.8 ), 2);
break;
case "i6":
r1 = val * 60;
r2 = ( val * 231 / 1728 * 4 / Math.PI ) / Math.pow(( dn / 304.8 ), 2);
break;
case "i7":
r1 = val / 13860;
r2 = ( val / 3600 * 1 / 1728 * 4 / Math.PI ) / Math.pow(( dn / 304.8 ), 2);
break;
case "i8":
r1 = val / 231;
r2 = ( val / 60 * 1 / 1728 * 4 / Math.PI ) / Math.pow(( dn / 304.8 ), 2);
break;
case "i9":
r1 = val *60 / 231;
r2 = ( val / 1728 * 4 / Math.PI ) / Math.pow(( dn / 304.8 ), 2);
break;
}
return {"flow":r1, "speed":r2};
}
function resetFittings()
{
$("#installationFittingResults").empty();
$("#installationFittingResults").append('