var base='http://preluarecursvalutar.ro/';var cot=[1,1,1,1,1];var den=['RON','EUR','USD','GBP','CHF'];var den1=['lei','euro','dolari','lire','franci'];var pro=['TVA','Impozit','Impozit'];var cd=1;var ci=0;var pr=19;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 showCode(e)
{e=parseInt(e);for(i=1;i<=5;i++)
{gE('p'+i).style.border='3px solid #FAFAFA';hide('b'+i);}
gE('p'+e).style.border='3px solid #FF6600';show('b'+e);}
function hideCode(e)
{e=parseInt(e);hide('b'+e);gE('p'+e).style.border='3px solid #FAFAFA';}
function getkey(e){if(window.event)
{return window.event.keyCode;}
else if(e)
{return e.which;}
else
{return null;}}
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 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  -->\n<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();}
var CROSSHAIRS_LOCATION=base+'scripts/crosshairs.png';var HUE_SLIDER_LOCATION=base+'scripts/h.png';var HUE_SLIDER_ARROWS_LOCATION=base+'scripts/position.png';var SAT_VAL_SQUARE_LOCATION=base+'scripts/sv.png';var BUTON_CLOSE_LOCATION=base+'scripts/close.gif';var HEIGHT_OF_OBJ=23;var WIDTH_OF_OBJ=90;var is_div_init=false;var myDiv=gE('d0');function hexToRgb(hex_string,default_){if(default_==undefined){default_=null;}
if(hex_string.substr(0,1)=='#'){hex_string=hex_string.substr(1);}
var r;var g;var b;if(hex_string.length==3){r=hex_string.substr(0,1);r+=r;g=hex_string.substr(1,1);g+=g;b=hex_string.substr(2,1);b+=b;}
else if(hex_string.length==6){r=hex_string.substr(0,2);g=hex_string.substr(2,2);b=hex_string.substr(4,2);}else{return default_;}
r=parseInt(r,16);g=parseInt(g,16);b=parseInt(b,16);if(isNaN(r)||isNaN(g)||isNaN(b)){return default_;}else{return{r:r/255,g:g/255,b:b/255};}}
function rgbToHex(r,g,b,includeHash){r=Math.round(r*255);g=Math.round(g*255);b=Math.round(b*255);if(includeHash==undefined){includeHash=true;}
r=r.toString(16);if(r.length==1){r='0'+r;}
g=g.toString(16);if(g.length==1){g='0'+g;}
b=b.toString(16);if(b.length==1){b='0'+b;}
return((includeHash?'#':'')+r+g+b).toUpperCase();}
var arVersion=navigator.appVersion.split("MSIE");var version=parseFloat(arVersion[1]);function fixPNG(myImage){if((version>=5.5)&&(version<7)&&(document.body.filters)){var node=document.createElement('span');node.id=myImage.id;node.className=myImage.className;node.title=myImage.title;node.style.cssText=myImage.style.cssText;node.style.setAttribute('filter',"progid:DXImageTransform.Microsoft.AlphaImageLoader"+"(src=\'"+myImage.src+"\',sizingMethod='scale')");node.style.fontSize='0';node.style.width=myImage.width.toString()+'px';node.style.height=myImage.height.toString()+'px';node.style.display='inline-block';return node;}
else{return myImage.cloneNode(false);}}
function trackDrag(node,handler){function fixCoords(x,y){var nodePageCoords=pageCoords(node);x=(x-nodePageCoords.x)+document.documentElement.scrollLeft;y=(y-nodePageCoords.y)+document.documentElement.scrollTop;if(x<0)x=0;if(y<0)y=0;if(x>node.offsetWidth-1)x=node.offsetWidth-1;if(y>node.offsetHeight-1)y=node.offsetHeight-1;return{x:x,y:y};}
function mouseDown(ev)
{var coords=fixCoords(ev.clientX,ev.clientY);var lastX=coords.x;var lastY=coords.y;handler(coords.x,coords.y);function moveHandler(ev)
{var coords=fixCoords(ev.clientX,ev.clientY);if(coords.x!=lastX||coords.y!=lastY)
{lastX=coords.x;lastY=coords.y;handler(coords.x,coords.y);}}
function upHandler(ev)
{myRemoveEventListener(document,'mouseup',upHandler);myRemoveEventListener(document,'mousemove',moveHandler);myAddEventListener(node,'mousedown',mouseDown);}
myAddEventListener(document,'mouseup',upHandler);myAddEventListener(document,'mousemove',moveHandler);myRemoveEventListener(node,'mousedown',mouseDown);if(ev.preventDefault)
{ev.preventDefault();}}
myAddEventListener(node,'mousedown',mouseDown);node.onmousedown=function(e)
{return false;};node.onselectstart=function(e)
{return false;};node.ondragstart=function(e)
{return false;};}
var eventListeners=[];function findEventListener(node,event,handler){var i;for(i in eventListeners){if(eventListeners[i].node==node&&eventListeners[i].event==event&&eventListeners[i].handler==handler){return i;}}return null;}
function myAddEventListener(node,event,handler){if(findEventListener(node,event,handler)!=null){return;}
if(!node.addEventListener){node.attachEvent('on'+event,handler);}
else{node.addEventListener(event,handler,false);}
eventListeners.push({node:node,event:event,handler:handler});}
function removeEventListenerIndex(index){var eventListener=eventListeners[index];delete eventListeners[index];if(!eventListener.node.removeEventListener){eventListener.node.detachEvent('on'+eventListener.event,eventListener.handler);}else{eventListener.node.removeEventListener(eventListener.event,eventListener.handler,false);}}
function myRemoveEventListener(node,event,handler){removeEventListenerIndex(findEventListener(node,event,handler));}
function cleanupEventListeners(){var i;for(i=eventListeners.length;i>0;i--){if(eventListeners[i]!=undefined){removeEventListenerIndex(i);}}}myAddEventListener(window,'unload',cleanupEventListeners);function hsvToRgb(hue,saturation,value){var red;var green;var blue;if(value==0.0){red=0;green=0;blue=0;}
else{var i=Math.floor(hue*6);var f=(hue*6)-i;var p=value*(1-saturation);var q=value*(1-(saturation*f));var t=value*(1-(saturation*(1-f)));switch(i){case 1:red=q;green=value;blue=p;break;case 2:red=p;green=value;blue=t;break;case 3:red=p;green=q;blue=value;break;case 4:red=t;green=p;blue=value;break;case 5:red=value;green=p;blue=q;break;case 6:case 0:red=value;green=t;blue=p;break;}}return{r:red,g:green,b:blue};}
function rgbToHsv(red,green,blue){var max=Math.max(Math.max(red,green),blue);var min=Math.min(Math.min(red,green),blue);var hue;var saturation;var value=max;if(min==max){hue=0;saturation=0;}
else{var delta=(max-min);saturation=delta/max;if(red==max){hue=(green-blue)/delta;}else if(green==max){hue=2+((blue-red)/delta);}else{hue=4+((red-green)/delta);}
hue/=6;if(hue<0){hue+=1;}if(hue>1){hue-=1;}}return{h:hue,s:saturation,v:value};}
function pageCoords(node){var x=node.offsetLeft;var y=node.offsetTop;var parent=node.offsetParent;while(parent!=null){x+=parent.offsetLeft;y+=parent.offsetTop;parent=parent.offsetParent;}
return{x:x,y:y};}
var huePositionImg=document.createElement('img');huePositionImg.galleryImg=false;huePositionImg.width=35;huePositionImg.height=11;huePositionImg.src=HUE_SLIDER_ARROWS_LOCATION;huePositionImg.style.position='absolute';var hueSelectorImg=document.createElement('img');hueSelectorImg.galleryImg=false;hueSelectorImg.width=35;hueSelectorImg.height=200;hueSelectorImg.src=HUE_SLIDER_LOCATION;hueSelectorImg.style.display='block';var satValImg=document.createElement('img');satValImg.galleryImg=false;satValImg.width=200;satValImg.height=200;satValImg.src=SAT_VAL_SQUARE_LOCATION;satValImg.style.display='block';var crossHairsImg=document.createElement('img');crossHairsImg.galleryImg=false;crossHairsImg.width=21;crossHairsImg.height=21;crossHairsImg.src=CROSSHAIRS_LOCATION;crossHairsImg.style.position='absolute';var buttonCloseImg=document.createElement('img');buttonCloseImg.galleryImg=false;buttonCloseImg.width=170;buttonCloseImg.height=17;buttonCloseImg.src=BUTON_CLOSE_LOCATION;buttonCloseImg.style.position='absolute';buttonCloseImg.style.cursor='pointer';buttonCloseImg.onclick=tC;function makeColorSelector(inputBox)
{var rgb,hsv
function colorChanged()
{is_div_init=false;var hex=rgbToHex(rgb.r,rgb.g,rgb.b);var hueRgb=hsvToRgb(hsv.h,1,1);var hueHex=rgbToHex(hueRgb.r,hueRgb.g,hueRgb.b);inputBox.style.background=hex;inputBox.value=hex;if(((rgb.r*100+rgb.g*100+rgb.b*100)/3)<65)
{inputBox.style.color="#FFF";}
else
{inputBox.style.color="#000";}
satValDiv.style.background=hueHex;if(gE('d0')===myDiv)
{gE('svin').style.background=hex;}
else if(gE('d1')===myDiv)
{gE('svin').style.border='1px solid '+hex;}
else if(gE('d2')===myDiv)
{gE('svin').style.color=hex;}
crossHairs.style.left=((hsv.v*199)-10).toString()+'px';crossHairs.style.top=(((1-hsv.s)*199)-10).toString()+'px';huePos.style.top=((hsv.h*199)-5).toString()+'px';is_div_init=true;}
function rgbChanged()
{hsv=rgbToHsv(rgb.r,rgb.g,rgb.b);colorChanged();}
function hsvChanged()
{rgb=hsvToRgb(hsv.h,hsv.s,hsv.v);colorChanged();}
var colorSelectorDiv=document.createElement('div');colorSelectorDiv.style.paddingLeft='5px';colorSelectorDiv.style.paddingRight='5px';colorSelectorDiv.style.paddingBottom='5px';colorSelectorDiv.style.position='relative';colorSelectorDiv.style.diplay="inline";colorSelectorDiv.style.height='220px';colorSelectorDiv.style.width='210px';var butonclose=document.createElement('div');butonclose.style.position='relative';butonclose.style.diplay="inline";butonclose.style.height='10px';butonclose.style.width='85px';butonclose.style.left="0px";butonclose.appendChild(buttonCloseImg);colorSelectorDiv.appendChild(butonclose);var satValDiv=document.createElement('div');satValDiv.style.position='relative';satValDiv.style.diplay="inline";satValDiv.style.top='10px';satValDiv.style.width='200px';satValDiv.style.height='200px';var newSatValImg=fixPNG(satValImg);satValDiv.appendChild(newSatValImg);var crossHairs=crossHairsImg.cloneNode(false);satValDiv.appendChild(crossHairs);function satValDragged(x,y)
{hsv.s=1-(y/199);hsv.v=(x/199);hsvChanged();}
trackDrag(satValDiv,satValDragged);colorSelectorDiv.appendChild(satValDiv);var hueDiv=document.createElement('div');hueDiv.style.position='absolute';hueDiv.style.diplay="inline";hueDiv.style.left='210px';hueDiv.style.top='19px';hueDiv.style.width='35px';hueDiv.style.height='200px';var huePos=fixPNG(huePositionImg);hueDiv.appendChild(hueSelectorImg.cloneNode(false));hueDiv.appendChild(huePos);function hueDragged(x,y){is_div_init=false;hsv.h=y/199;hsvChanged();}
trackDrag(hueDiv,hueDragged);colorSelectorDiv.appendChild(hueDiv);function inputBoxChanged(){rgb=hexToRgb(inputBox.value,{r:0,g:0,b:0});rgbChanged();}
myAddEventListener(inputBox,'change',inputBoxChanged);inputBoxChanged();return colorSelectorDiv;}
function colorPickerGetTopPos(inputObj){var returnValue=inputObj.offsetTop;while((inputObj=inputObj.offsetParent)!=null){returnValue+=inputObj.offsetTop;}
return returnValue-HEIGHT_OF_OBJ;}
function colorPickerGetLeftPos(inputObj){var returnValue=inputObj.offsetLeft;while((inputObj=inputObj.offsetParent)!=null)returnValue+=inputObj.offsetLeft;return returnValue+WIDTH_OF_OBJ;}
function sCP(inputObj){hCP();myDiv=inputObj;var color_picker_div=document.createElement('DIV');color_picker_div.style.left=colorPickerGetLeftPos(inputObj)+'px';color_picker_div.style.width='250px';color_picker_div.style.heigth='190px';color_picker_div.style.top=colorPickerGetTopPos(inputObj)+inputObj.offsetHeight+2+'px';color_picker_div.id='theColorPicker';color_picker_div.style.display='block';color_picker_div.appendChild(makeColorSelector(inputObj));document.body.appendChild(color_picker_div);is_div_init=true;}
function hCP(){if(is_div_init){is_div_init=false;document.body.removeChild(document.getElementById('theColorPicker'));}}
function maskedHex(input){var mask='#[0-9a-fA-F]{7}';input.value=input.value.replace(mask,"");}
