function setFormatForDowntime(){window.opener.document.getElementById('totcost_internet_downtime').value=document.getElementById('annual_admin_cost').value;window.opener.document.getElementById('totcost_network_intrusion').value=document.getElementById('total_of_intrusion_after_downtime').value;calculateGrantTotal();}
function openWindowLinkDowntime(){var fn=document.getElementById("fn").value;var mn=document.getElementById("mn").value;var options="scrollbars=yes,resizable=yes,width=640";window.open("./RoiDowntime?fn="+fn+"&mn="+mn,"",options);}
function setFormatForIntrusion(){window.opener.document.getElementById('totcost_network_intrusion').value=document.getElementById('total_annual_prod_loss_intrusion').value;calculateGrantTotal();}
function openWindowIntrusion(){var fn=document.getElementById("fn").value;var mn=document.getElementById("mn").value;var options="scrollbars=yes,resizable=yes,width=640";window.open("./RoiIntrusion?fn="+fn+"&mn="+mn,"",options);}
function setFormatForSurfing(){window.opener.document.getElementById('totcost_indiscriminate_surfing').value=document.getElementById('tot_annualprod_loss').value;calculateGrantTotal();}
function openWindowIndiscriminateSurfing(){var fn=document.getElementById("fn").value;var mn=document.getElementById("mn").value;var options="scrollbars=yes,resizable=yes,width=640";window.open("./RoiSurfing?fn="+fn+"&mn="+mn,"",options);}
function setFormatForVirus(){window.opener.document.getElementById('totcost_antivirus').value=document.getElementById('tot_annualcost_comp_virus').value;calculateGrantTotal();}
function openWindowVirus(){var fn=document.getElementById("fn").value;var mn=document.getElementById("mn").value;var options="scrollbars=yes,resizable=yes,width=640";window.open("./RoiVirus?fn="+fn+"&mn="+mn,"",options);}
function setFormatForSpam(){window.opener.document.getElementById('totcost_spam').value=document.getElementById('tot_annualcost_comp').value;calculateGrantTotal();}
function openWindowSpam(){var fn=document.getElementById("fn").value;var mn=document.getElementById("mn").value;var options="scrollbars=yes,resizable=yes,width=640";window.open("./RoiSpam?fn="+fn+"&mn="+mn,"",options);}
function setFormatForConnectivity(){window.opener.document.getElementById('totcost_connectivity').value=document.getElementById('annual_remote_connectivity_cost').value;calculateGrantTotal();}
function openWindowConnectivity(){var fn=document.getElementById("fn").value;var mn=document.getElementById("mn").value;var options="scrollbars=yes,resizable=yes,width=640";window.open("./RoiConnectivity?fn="+fn+"&mn="+mn,"",options);}
function setDialupConnection()
{var combo=document.getElementById('dialup_connection');var comboValue=combo.value;if(comboValue=='Yes'){document.getElementById("user_connecting_roadwarriors").disabled=false;}
else{document.getElementById("user_connecting_roadwarriors").disabled=true;document.getElementById("user_connecting_roadwarriors").value="0";}}
function setLeasedLine()
{var combo=document.getElementById('leased_line_connection');var comboValue=combo.value;if(comboValue=='Yes'){document.getElementById('no_of_branch_offices').disabled=false;}
else{document.getElementById('no_of_branch_offices').disabled=true;document.getElementById("no_of_branch_offices").value="0";}}
function checkInt(textbox)
{var val=trim(textbox.value);if(isNaN(val))
{textbox.value='0';textbox.focus();return false;}
if(parseInt(val)<0){textbox.value='0';textbox.focus();return false;}
if(val=='')
{val='0';}
if(parseInt(val)==0||(parseFloat(val)).toFixed(0)=='0'){val='0';}
if(val==null){val='0';}
textbox.value=parseInt(val);}
function checkFloat(textbox)
{var val=trim(textbox.value);if(isNaN(val))
{textbox.value='0.0';textbox.focus();return false;}
if(parseFloat(val)<0.0){textbox.value='0.0';textbox.focus();return false;}
if(val=='')
{val='0.0';}
if(parseFloat(val)=='0'){val='0.0';}
if(val==null){val='0.0';}
textbox.value=val;}
function trim(str)
{if(!str||typeof str!='string')
return null;return str.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' ');}
function calculateCalled(){document.getElementById('actionType').value="calculate";document.cyberoamsiteROI.submit();}
function currencyChanged(){document.getElementById('actionType').value="currencyChanged";document.cyberoamsiteROI.submit();}
function hideROIDetails()
{document.getElementById('roiSpam').style.display='none';document.getElementById('roiVirus').style.display='none';document.getElementById('roiSurfing').style.display='none';document.getElementById('roiIntrusion').style.display='none';document.getElementById('roiLinkDowntime').style.display='none';document.getElementById('roiConnectivity').style.display='none';}
function calculateGrantTotal(){var spam=parseFloat(window.opener.document.getElementById('totcost_spam').value);var virus=parseFloat(window.opener.document.getElementById('totcost_antivirus').value);var surfing=parseFloat(window.opener.document.getElementById('totcost_indiscriminate_surfing').value);var intrusion=parseFloat(window.opener.document.getElementById('totcost_network_intrusion').value);var linkdown=parseFloat(window.opener.document.getElementById('totcost_internet_downtime').value);var connectivity=parseFloat(window.opener.document.getElementById('totcost_connectivity').value);window.opener.document.getElementById('total_cost_company').value=Math.round(spam+virus+surfing+intrusion+linkdown+connectivity);var totalCostCompany=window.opener.document.getElementById("total_cost_company").value;var estimatedCostOfCyberoam=window.opener.document.getElementById("estimated_cost_ofCyberoam").value;var savingWithCyberoam1=totalCostCompany-estimatedCostOfCyberoam;savingWithCyberoam=Math.round(savingWithCyberoam1*100)/100;window.opener.document.getElementById('saving_with_cyberoam').value=savingWithCyberoam;var timeToRecoupInvestment=parseInt((estimatedCostOfCyberoam/(savingWithCyberoam1/365)));window.opener.document.getElementById('time_toRecoup_investment').value=timeToRecoupInvestment;}
