function setCookie(c_name,value,expiredays)
{var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);document.cookie=c_name+"="+escape(value)+((expiredays==null)?"":";expires="+exdate.toGMTString());}
function HideContent_s(d)
{document.getElementById(d).style.display="none";}
function ShowContent_s(d)
{document.getElementById(d).style.display="block";}
function ReverseContentDisplay_s(d)
{if(document.getElementById(d).style.display=="block")
{document.getElementById(d).style.display="none";visible=0;}
else
{document.getElementById(d).style.display="block";visible=1;}
cook_name=d+'_r';visible=visible+'';setCookie(cook_name,visible,365);}
function intval(mixed_var,base)
{var tmp;var type=typeof(mixed_var);if(type=='boolean')
{if(mixed_var==true)
{return 1;}
else
{return 0;}}
else
if(type=='string')
{tmp=parseInt(mixed_var*1,10);if(isNaN(tmp)||!isFinite(tmp))
{return 0;}
else
{return tmp.toString(base||10);}}
else
if(type=='number'&&isFinite(mixed_var))
{return Math.floor(mixed_var);}
else
{return 0;}}
function replaceAll(str,from,to)
{var idx=str.indexOf(from);while(idx>-1)
{str=str.replace(from,to);idx=str.indexOf(from);}
return str;}
function convert_in(c)
{return c*2.54;}
function convert_cm(c)
{return c*0.393700787;}
function inchtocm(i)
{i=replaceAll(i,',','.');document.getElementById('inchtocm').innerHTML=' = '+(i*2.54);}
function cmtoinch(i)
{i=replaceAll(i,',','.');document.getElementById('cmtoinch').innerHTML=' = '+(i*0.393700787);}
function fatoce(i)
{i=replaceAll(i,',','.');document.getElementById('fatoce').innerHTML=' = '+((5/9)*(i-32));}
function cetofa(i)
{i=replaceAll(i,',','.');document.getElementById('cetofa').innerHTML=' = '+((9/5)*i+32);}
function dkhtoppm(i)
{i=replaceAll(i,',','.');document.getElementById('dkhtoppm').innerHTML=' = '+i*17.857142857;}
function dkhtompl(i)
{i=replaceAll(i,',','.');document.getElementById('dkhtompl').innerHTML=' = '+i*0.357375271;}
function ppmtodkh(i)
{i=replaceAll(i,',','.');document.getElementById('ppmtodkh').innerHTML=' = '+i/17.857142857;}
function mpltodkh(i)
{i=replaceAll(i,',','.');document.getElementById('mpltodkh').innerHTML=' = '+i/0.357375271;}
function ppmtompl(i)
{i=replaceAll(i,',','.');v=(i/17.857142857)*0.357375271;document.getElementById('ppmtompl').innerHTML=' = '+v;}
function mpltoppm(i)
{i=replaceAll(i,',','.');v=(i/0.357375271)*17.857142857;document.getElementById('mpltoppm').innerHTML=' = '+v;}
function usgtoli(i)
{i=replaceAll(i,',','.');document.getElementById('usgtoli').innerHTML=' = '+i*3.7854118;}
function litousg(i)
{i=replaceAll(i,',','.');document.getElementById('litousg').innerHTML=' = '+i*0.264172051;}
function ukgtoli(i)
{i=replaceAll(i,',','.');document.getElementById('ukgtoli').innerHTML=' = '+i*4.54609188;}
function litoukg(i)
{i=replaceAll(i,',','.');document.getElementById('litoukg').innerHTML=' = '+i*0.219969157;}
function usgtoukg(i)
{i=replaceAll(i,',','.');v=(i*0.219969157)*3.7854118;document.getElementById('usgtoukg').innerHTML=' = '+v;}
function ukgtousg(i)
{i=replaceAll(i,',','.');v=(i*0.264172051)*4.54609188;document.getElementById('ukgtousg').innerHTML=' = '+v;}
function convert_li_usg(c)
{return c*0.264172051;}
function convert_li_ukg(c)
{return c*0.219969157;}
function calc_fish_tank(i1,i2,i3,i4,m1134,m1138,m1141,m1142,m1146,m1147,m1148,m1149,m1150,m1151)
{h=replaceAll(i1,',','.');w=replaceAll(i2,',','.');l=replaceAll(i3,',','.');plocha=w*l;vyska=h;if(w<l)
total_length=intval(w/3);else
total_length=intval(l/3);if(i4==2)
{plocha=convert_in(convert_in(plocha));vyska=convert_in(h);jednot=m1138;total_length=intval(convert_in(total_length));length_start=intval(convert_in(convert_cm(1)));}
else
{jednot=m1134;length_start=4;}
rybky=intval(plocha/45);vetary=m1142;if(length_start==0)
length_start=1;give_out=' ';if(((rybky<20)||(vyska<20))&&(vyska>0))
document.getElementById('fish_num_place').innerHTML='<p>'+m1141+'</p>';else
{if(vyska>0)
{for(i=length_start;i<=total_length;i++)
{veta_this=replaceAll(vetary,"##TEMPLATE_FISH##",intval(rybky/i));if(i4==2)
vloz_tu=convert_cm(i);else
vloz_tu=i;veta_this=replaceAll(veta_this,"##TEMPLATE_NUMBER##",intval(Math.ceil(vloz_tu)));veta_this=replaceAll(veta_this,"##TEMPLATE_DIMENSION##",jednot);give_out=give_out+'<p>'+veta_this+'</p>';}
objem=plocha*vyska/1000;give_out=give_out+"<p>"+m1147+"<b>"+Math.round(objem*100)/100+"</b> "+" "+m1146+"(<b>"+Math.round(convert_li_usg(objem)*100)/100+"</b> "+m1148+" , <b>"+Math.round(convert_li_ukg(objem)*100)/100+"</b> "+m1149+")</p>";watts=m1150;watts=replaceAll(watts,"##TEMPLATE_MIN_LIGHT##","<b>"+intval(objem/3.2)+"</b>");watts=replaceAll(watts,"##TEMPLATE_MAX_LIGHT##","<b>"+intval(objem/2.1)+"</b>");give_out=give_out+"<p>"+watts+"</p>";watts=m1151;watts=replaceAll(watts,"##TEMPLATE_HEATER##","<b>"+intval(objem/0.81)+"</b>");give_out=give_out+"<p>"+watts+"</p>";document.getElementById('fish_num_place').innerHTML=give_out;}}}
function cyl_fish_tank(i1,i2,i3,m1134,m1138,m1141,m1142,m1146,m1147,m1148,m1149,m1150,m1151)
{h=replaceAll(i1,',','.');w=replaceAll(i2,',','.');give_out=' ';plocha=3.14159265*w*w;vyska=h;total_length=intval(w/3);if(i3==2)
{plocha=convert_in(convert_in(plocha));vyska=convert_in(h);jednot=m1138;total_length=intval(total_length);length_start=intval(convert_in(convert_cm(1)));}
else
{jednot=m1134;length_start=4;}
rybky=intval(plocha/90);vetary=m1142;if(length_start==0)
length_start=1;if(((rybky<20)||(vyska<20))&&(vyska>0))
document.getElementById('cyl_place').innerHTML='<p>'+m1141+'</p>';else
{if(vyska>0)
{for(i=length_start;i<=total_length;i++)
{veta_this=replaceAll(vetary,"##TEMPLATE_FISH##",intval(rybky/i));if(i3==2)
vloz_tu=convert_cm(i);else
vloz_tu=i;veta_this=replaceAll(veta_this,"##TEMPLATE_NUMBER##",intval(Math.ceil(vloz_tu)));veta_this=replaceAll(veta_this,"##TEMPLATE_DIMENSION##",jednot);give_out=give_out+'<p>'+veta_this+'</p>';}
objem=plocha*vyska/4/1000;give_out=give_out+"<p>"+m1147+"<b>"+Math.round(objem*100)/100+"</b> "+" "+m1146+"(<b>"+Math.round(convert_li_usg(objem)*100)/100+"</b> "+m1148+" , <b>"+Math.round(convert_li_ukg(objem)*100)/100+"</b> "+m1149+")</p>";watts=m1150;watts=replaceAll(watts,"##TEMPLATE_MIN_LIGHT##","<b>"+intval(objem/3.2)+"</b>");watts=replaceAll(watts,"##TEMPLATE_MAX_LIGHT##","<b>"+intval(objem/2.1)+"</b>");give_out=give_out+"<p>"+watts+"</p>";watts=m1151;watts=replaceAll(watts,"##TEMPLATE_HEATER##","<b>"+intval(objem/0.81)+"</b>");give_out=give_out+"<p>"+watts+"</p>";document.getElementById('cyl_place').innerHTML=give_out;}}}

