var base='http://cvalutar.ro/';var cot=[1,1,1,1,1];var den=['RON','EUR','USD','CHF','GBP'];var den1=['lei','euro','dolari','franci','lire'];var pro=['TVA','Impozit','Impozit'];var cd=1;var ci=0;var pr=24;var val=0;var size=[0,1,26,105,56,24,50,11,20];var vPos=[0,1,1,1,1,1,1,1,1];var s1=294;var s2=128;function gE(e)
{return document.getElementById(e);}
function cls(e,c)
{gE(e).className=c;}
function hide(e){gE(e).style.display='none';}
function show(e){gE(e).style.display='block';}
function gV(e){return gE(e).value;}
function initConv(){for(i=1;i<5;i++)
{cot[i]=gV('cot'+i);}}
function iefix(t){if(gV('p0v')=='Introdu %'){if(t==0)
{gE('p0v').style.color='#FF6600';}
else
{gE('p0v').style.color='#BBBBBB';}}
else
{gE('p0v').style.color='#0066FF';}}
function getkey(e){if(window.event)
{return window.event.keyCode;}
else if(e)
{return e.which;}
else
{return null;}}
function mknr(n)
{t=n.toString();poz=t.indexOf('.');if(poz==-1)
{a=t;b='';}
else
{a=t.substr(0,poz);b=t.substr(poz);}
aux=a.substr(0,a.length%3);a=a.substr(a.length%3);i=0;while(a.length>2)
{i++;if(aux!='')
{aux+='.';}
aux+=a.substr(0,3);a=a.substr(3);}
a=aux;if(b!='')
{b=b.substr(1,2);}
else
{b='00';}
return(a+','+b);}
function goodchars(e,goods)
{var key,keychar;key=getkey(e);if(key==null)
{return true;}
keychar=String.fromCharCode(key);keychar=keychar.toLowerCase();goods=goods.toLowerCase();if(goods.indexOf(keychar)!=-1)
{return true;}
if(key==null||key==0||key==8||key==9||key==13||key==27)
{return true;}
return false;}
function sIT(elementId,text)
{var element;if(document.getElementById)
{element=gE(elementId);}
else if(document.all){element=document.all[elementId];}
if(element)
{if(typeof element.textContent!='undefined')
{element.textContent=text;}
else if(typeof element.innerText!='undefined')
{element.innerText=text;}
else if(typeof element.removeChild!='undefined')
{while(element.hasChildNodes())
{element.removeChild(element.lastChild);}
element.appendChild(document.createTextNode(text));}}}
function roundVal(val)
{var dec=2;var result=Math.round(val*Math.pow(10,dec))/Math.pow(10,dec);return result;}
function conv(p,q)
{if(p!=3&&gV('val')=='suma')
{gE('val').value='0';val=0;}
if(p==0)
{for(i=0;i<5;i++)
{cls('cd'+i,'conv-g');}
cls('cd'+q,'conv-b');cd=q;}
else if(p==1)
{for(i=0;i<5;i++)
{cls('ci'+i,'conv-g');}
cls('ci'+q,'conv-b');ci=q;}
else if(p==2)
{for(i=0;i<4;i++)
{cls('p'+i,'conv-g2');}
cls('p'+q,'conv-b2');gE('p0v').value='Introdu %';gE('p0v').style.color='#BBBBBB';if(q==1)
{pr=24;}
else if(q==2)
{pr=16;}
else if(q==3)
{pr=3;}}
else if(p==3)
{if(gV('val')=='suma')
{val=0;gE('val').value='';}}
else if(p==4)
{if(gV('p0v')=='Introdu %')
{cls('p1','conv-g2');cls('p2','conv-g2');cls('p3','conv-g2');gE('p0v').value='';gE('p0v').style.color='#0066FF';pr=0;}
else if(gV('p0v')!='')
{pr=gV('p0v');}}
val=gV('val');sIT('rez',mknr(roundVal(100*val*cot[cd]/cot[ci])/100));sIT('rez1',mknr(roundVal((100+parseInt(pr,10))*val*cot[cd]/cot[ci]/100)));sIT('rez2',mknr(roundVal(pr*val*cot[cd]/cot[ci]/100)));sIT('cny1',' '+den1[ci]);sIT('cny2',' '+den1[ci]);sIT('cny3',' '+pr+'%');sIT('cny4',' '+pr+'%');}
function shortHex(e)
{e=gV(e).toString().substr(1,6);if(e==='FFFFFF')
{return'F';}
else if(e==='000000')
{return'0';}
else
{return e;}}
function bC()
{val=parseInt(gV('tw'));tmp1=parseInt(gV('cF'));tmp2=parseInt(gV('cB'));if(tmp1==1)
{aux1='-';}
else
{aux1=shortHex('d0');}
if(tmp2==1)
{aux2='-';}
else
{aux2=shortHex('d1');}
if(val<120)
{val=120;}
if(val>300)
{val=300;}
params=gV('p1').toString()+'+'+gV('p2').toString()+'+'+val.toString()+'+'+gV('th').toString()+'+'+aux1.toString()+'+'+aux2.toString()+'+'+shortHex('d2');text='<!-- cvalutar.ro api v.2.3  --><script type="text/javascript" src="'+base+'api.php?'+params+'"></script><noscript><h2><a href="'+base+'" title="Curs valutar"><strong>Curs valutar</strong></a></h2></noscript><!-- end api v.2.3 -->';text_x=base+'api.php?'+params;gE('cod').value=text;}
function tH()
{s2=0;if(gV('c0')==1)
{s2+=20;}
if(gV('c1')==1)
{s2+=15;}
if(gV('c4')==1)
{s2+=18;}
for(i=0;i<18;i++)
{if(gV('v'+i)==1)
{s2+=15;}}
s2+=(1-gV('cB'))*2;gE('svin').style.height=s2+'px';gE('svbox').style.height=s2+'px';gE('th').value=s2;bC();}
function initP()
{for(i=0;i<5;i++)
{gE('v'+i).value=1;}
for(i=5;i<18;i++)
{gE('v'+i).value=0;}
for(i=1;i<9;i++)
{gE('c'+i).value=1;}
gE('cF').value=1;gE('cB').value=1;gE('th').value=128;gE('tw').value=300;gE('cT').value=1;gE('cL').value=1;tH();bC();}
function tC()
{hCP();gE('svin').style.background=gV('d0');gE('svbox').style.color=gV('d2');bC();}
function tW(e)
{e=parseInt(e,10);lungime=e;gE('svin').style.marginLeft=parseInt((300-e)/2)+'px';gE('svin').style.width=(e-(1-parseInt(gV('cB')))*2)+'px';val=parseInt((lungime-s1)/2,10)+'px';if(s1<lungime)
{for(i=0;i<18;i++)
{gE('t'+i+'1').style.width=val;}}
bC();}
function tL()
{tmp=parseInt(gV('cL'));if(tmp===1)
{gE('cL').value=0;show('cLH');cls('cLx','i1 i3');gE('tw').value=300;tW(300);}
else
{gE('cL').value=1;cls('cLx','i2 i3');gE('tw').value=300;tW(300);hide('cLH');}}
function tT()
{tmp=parseInt(gV('cT'));if(tmp===1)
{gE('cT').value=0;show('cTH');cls('cTx','i1 i3');gE('svin').style.color='#000000';gE('d2').style.background='#000000';gE('d2').style.color='#FFFFFF';gE('d2').value='#000000';}
else
{gE('cT').value=1;cls('cTx','i2 i3');hide('cTH');gE('svin').style.color='#000000';hCP();}
bC();}
function tF()
{tmp=parseInt(gV('cF'));if(tmp===1)
{gE('cF').value=0;show('cFH');cls('cFx','i1 i3');gE('svin').style.background='#FFFFFF';gE('d0').style.background='#FFFFFF';gE('d0').style.color='#000000';gE('d0').value='#FFFFFF';}
else
{gE('cF').value=1;cls('cFx','i2 i3');hide('cFH');gE('svin').style.background='transparent';hCP();}
bC();}
function tB()
{tmp=gV('cB');aux=parseInt(gV('tw'));val=parseInt((aux-s1-(tmp*2))/2,10)+'px';gE('th').value=parseInt(gV('th'))+((tmp-0.5)*4);for(i=0;i<18;i++)
{gE('t'+i+'1').style.width=val;}
if(tmp==1)
{gE('cB').value=0;cls('cBx','i1 i3');show('cBH');gE('svin').style.width=(aux-2)+'px';gE('d1').style.background='#000000';gE('d1').style.color='#FFFFFF';gE('d1').value='#000000';gE('svin').style.border='1px solid '+gV('d1');}
else
{gE('cB').value=1;cls('cBx','i2 i3');hide('cBH');gE('svin').style.border='none';gE('svin').style.width=(aux+2)+'px';hCP();}
bC();}
function tV(e)
{e=parseInt(e,10);temp=gV('c'+e);if(temp==1)
{gE('c'+e).value=0;cls('c'+e+'x','i1 i3');if(e!==0&&e!==1&&e!==4)
{s1-=size[e];}
else
{hide('m'+e+'x');gE('c'+e).value=0;}}
else
{gE('c'+e).value=1;cls('c'+e+'x','i2 i3');if(e!==0&&e!==1&&e!==4)
{s1+=size[e];}
else
{show('m'+e+'x');gE('c'+e).value=1;}}
if(e!==0&&e!==1&&e!==4)
{for(i=0;i<18;i++)
{if(temp==1)
{hide('t'+i+e);}
else
{show('t'+i+e);}
gE('t'+i+'1').style.width=parseInt((gV('tw')-s1-(gV('cB')*2))/2,10)+'px';}}
var p2=0;for(i=0;i<9;i++)
{if(gV('c'+i)==1)
{p2+=Math.pow(2,i);}}
gE('p2').value=p2;tH();bC();}
function tM(e)
{e=parseInt(e,10);var p1=0;t=gV('v'+e);if(t==1)
{gE('v'+e).value=0;hide('m'+e);}
else
{gE('v'+e).value=1;show('m'+e);}
for(i=0;i<18;i++)
{t=gV('v'+i);if(t==1)
{cls('v'+i+'x','i2');p1+=Math.pow(2,i);}
else
{cls('v'+i+'x','i1');}}
gE('p1').value=p1;tH();bC();}
function informatiiBanca(e,o)
{e=parseInt(e);o=parseInt(o);if(o==0)
{hide('bankH'+e);show('bankS'+e);hide('bank'+e+'x');}
else
{for(i=0;i<35;i++)
{hide('bank'+i+'x');hide('bankH'+i);show('bankS'+i);}
hide('bankS'+e);show('bankH'+e);show('bank'+e+'x');}}
function detaliazaStire(e,o)
{e=parseInt(e);o=parseInt(o);for(i=0;i<5;i++)
{hide('c'+e+'a'+i);cls('c'+e+'a'+i+'t','stiri');}
show('c'+e+'a'+o);cls('c'+e+'a'+o+'t','stiri0');}
function contactSubiect(e)
{e=parseInt(e);if(e==6 || e==1)
{show('subiect2');}
else
{hide('subiect2');}}
function updateConvertor()
{x=gE('conv1').options[gE('conv1').selectedIndex].value;y=gE('conv2').options[gE('conv2').selectedIndex].value;x=parseInt(x);y=parseInt(y);v=gV('conv3');if(v=='introduceti valoarea'||v=='')
{v=0;}
t1=convertor[3*x+1];e1=convertor[3*x+2];t2=convertor[3*y+1];e2=convertor[3*y+2];c=Math.round((Math.pow(10,14+e2-e1)*v*t2)/t1)/Math.pow(10,14);gE('conv4').value=c;gE('conv5').value=v+' '+convertor[3*x]+' = '+c+' '+convertor[3*y];}
function initiazaConvertorValutar()
{gE('c7').value='24%';gE('c9').innerHTML='rezultat + 24%';gE('c11').innerHTML='din care 24%';gE('c1').value='introduceti valoarea';gE('c2').value='rezultat';gE('c3').value='rezultat detaliat';gE('c8').value='';gE('c10').value='';gE('c12').value=0;}
function updateConvertorValutar()
{t=gE('c6').options[gE('c6').selectedIndex].value;t=parseInt(t)+1;l=gV('c1');if(l=='introduceti valoarea')
{l=0;gE('c1').value=0;}
if(l=='')
{l=0;}
p=gV('c7');if(p=='')
{p=0;}
p=parseInt(p);m1=gE('c4').options[gE('c4').selectedIndex].value;m1=parseInt(m1);m2=gE('c5').options[gE('c5').selectedIndex].value;m2=parseInt(m2);v1=convertor[32*t+m1];v2=convertor[32*t+m2];r=mknr(Math.round(10000*l*v1/v2)/10000);r1=mknr(Math.round(10000*l*(1+p/100)*v1/v2)/10000);r2=mknr(Math.round(100*l*p*v1/v2)/10000);gE('c2').value=r;gE('c3').value=mknr(l)+' '+convertor[m1]+' = '+r+' '+convertor[m2];gE('c8').value=r1;gE('c10').value=r2;gE('c12').value=t;gE('c9').innerHTML='rezultat + '+p+'%';gE('c11').innerHTML='din care '+p+'%';}
function updateInput(e)
{e=parseInt(e);tmp=gV('c1');if(e==1)
{if(tmp=='introduceti valoarea'||tmp=='0')
{gE('c1').value='';}}
else
{if(tmp=='')
{gE('c1').value='introduceti valoarea';gE('c2').value='rezultat';gE('c3').value='rezultat detaliat';}}}
function updateProcent(e)
{e=parseInt(e);tmp=gV('c7');if(e==1)
{tmp=tmp.substr(0,tmp.length-1);if(tmp=='0')
{gE('c7').value='';}
else
{gE('c7').value=tmp;}}
else
{if(tmp=='')
{gE('c7').value='0%';}
else
{gE('c7').value=tmp+'%';}}}
function schimbBanca(e,n)
{e=parseInt(e);n=parseInt(n);if(n!=7)
{t=' sn2l';}
else
{t='';}
for(i=1;i<=n;i++)
{for(j=1;j<5;j++)
{if(i==1)
{cls('sb'+j,'sb2');}
cls('b'+i+'v'+j,'sn2 n'+t);cls('b'+i+'c'+j,'sn2 n'+t);}}
cls('sb'+e,'sb1');for(i=1;i<=n;i++)
{cls('b'+i+'v'+e,'sn2'+t);cls('b'+i+'c'+e,'sn2'+t);}}