function makeOptions(objId, dValue, lang) { if (!lang) lang = 0 var numargs = arguments.length; var selObj = document.getElementById(objId);; var where = (navigator.appName == "Microsoft Internet Explorer") ? -1 : null; var include = new Array(); for (var i=3;i 0) { var inc = false; for (var j=0;j= 37 && e.keyCode <= 40) && !(e.keyCode >= 96 && e.keyCode <= 105) && !(e.keyCode >= 48 && e.keyCode <= 57) ) { if (isNaN(String.fromCharCode(e.keyCode))) return false; } if (e.keyCode == 188 || e.keyCode == 110) { return true; } if (strTest) { if (strTest.indexOf(",") > 0) { strTest += "0"; strTest = strTest.replace(",","."); } } if (isNaN(strTest) && e.keyCode != 8) { return false; } else if (isNaN(strTest) && e.keyCode == 8) { return true; } else { if (strTest == '') return true; if (_gengiFra && _gengiTil && _outputBox && strTest) { var fra = getGengiName(_gengiFra.options[_gengiFra.selectedIndex].value); var til = getGengiName(_gengiTil.options[_gengiTil.selectedIndex].value); _outputBox.value = GengiCalc(fra, til, strTest); } } return true; } ********************************************************/ function initExchange(inputBox, outputBox, btnName, gengiFra, gengiTil) { var inputBox = document.getElementById(inputBox); _outputBox = document.getElementById(outputBox); var btnCalc = document.getElementById(btnName); _gengiFra = document.getElementById(gengiFra); _gengiTil = document.getElementById(gengiTil); _inputBox=inputBox; if (btnCalc) { if (btnCalc.attachEvent ) { btnCalc.attachEvent('onclick',doValidateInput); } else if (btnCalc.addEventListener) { btnCalc.addEventListener('click',doValidateInput,false); } } if (_gengiFra) { if (_gengiFra.attachEvent ) { _gengiFra.attachEvent('onchange',doCurrencyCalculation); } else if (_gengiFra.addEventListener) { _gengiFra.addEventListener('change',doCurrencyCalculation,false); } } if (_gengiTil) { if (_gengiTil.attachEvent ) { _gengiTil.attachEvent('onchange',doCurrencyCalculation); } else if (_gengiTil.addEventListener) { _gengiTil.addEventListener('change',doCurrencyCalculation,false); } } if (inputBox) { if (inputBox.attachEvent ) { inputBox.attachEvent('onkeydown', doValidateInput); inputBox.attachEvent('onkeyup', doValidateInput); inputBox.attachEvent('onkeypress', doValidateInput); } else if (inputBox.addEventListener) { inputBox.addEventListener('keydown', doValidateInput,false); inputBox.addEventListener('keyup', doValidateInput,false); inputBox.addEventListener('keypress', doValidateInput,false); } if (inputBox.value.length == 0) { inputBox.value = '1'; } } } function doCurrencyCalculation() { var strTest; if (_inputBox) strTest = new String(_inputBox.value); if (strTest == '') { _outputBox.value = strTest; return true; } if (_gengiFra && _gengiTil && _outputBox && strTest) { var fra = getGengiName(_gengiFra.options[_gengiFra.selectedIndex].value); var til = getGengiName(_gengiTil.options[_gengiTil.selectedIndex].value); if(fra == til) { _outputBox.value = strTest; } else { _outputBox.value = GengiCalc(fra, til, strTest); } } } var Cuurent_Ip=''; function doValidateInput(e) { if(!e) var e = window.event var tmpCharcode = (e.which) ? e.which : e.keyCode; var strTest; if (_inputBox) strTest = new String(_inputBox.value); if (tmpCharcode != 44 && tmpCharcode != 190 && tmpCharcode != 188 && tmpCharcode != 110 && tmpCharcode != 8 && tmpCharcode != 13 && tmpCharcode != 46 && !(tmpCharcode >= 37 && tmpCharcode <= 40) && !(tmpCharcode >= 96 && tmpCharcode <= 105) && !(tmpCharcode >= 48 && tmpCharcode <= 57)) { if (isNaN(String.fromCharCode(tmpCharcode))) { if(Cuurent_Ip=='') { Cuurent_Ip=''; } _inputBox.value=Cuurent_Ip; return false; } } Cuurent_Ip=_inputBox.value if (tmpCharcode == 188 || tmpCharcode == 110) { return true; } if (strTest) { if (strTest.indexOf(",") > 0) { strTest += "0"; strTest = strTest.replace(",","."); } } if (isNaN(strTest) && tmpCharcode != 8) { return false; } else if (isNaN(strTest) && tmpCharcode == 8) { return true; } else { if (strTest == '') { _outputBox.value = strTest; return true; } if (_gengiFra && _gengiTil && _outputBox && strTest) { var fra = getGengiName(_gengiFra.options[_gengiFra.selectedIndex].value); var til = getGengiName(_gengiTil.options[_gengiTil.selectedIndex].value); if(fra == til) { _outputBox.value = strTest; } else { _outputBox.value = GengiCalc(fra, til, strTest); } } } return true; } function getGengiName(i) { return gengi[i].nafn; } function getGengiId(name) { for (var i=0;i bText ) return 1; return 0; } var gengi = new Array(); gengi[gengi.length]= new Gengi('USD', 'Bandaríkjadalur', 'US dollar', 87,87.42); gengi[gengi.length]= new Gengi('DKK', 'Dönsk króna', 'Danish krona', 16.571,16.667); gengi[gengi.length]= new Gengi('EUR', 'Evra', 'Euro', 123.57,124.27); gengi[gengi.length]= new Gengi('JPY', 'Japanskt jen', 'Japan Yen', .8004,.805); gengi[gengi.length]= new Gengi('CAD', 'Kanadadalur', 'CA dollar', 81.68,82.16); gengi[gengi.length]= new Gengi('NOK', 'Norsk króna', 'Norsk krona', 15.444,15.534); gengi[gengi.length]= new Gengi('XDR', 'SDR', 'XDR', 134.15,134.95); gengi[gengi.length]= new Gengi('GBP', 'Sterlingspund', 'British Pound', 153.1,153.84); gengi[gengi.length]= new Gengi('CHF', 'Svissneskur franki', 'Swiss frank', 77.03,77.47); gengi[gengi.length]= new Gengi('SEK', 'Sćnsk króna', 'Swedish krona', 13.058,13.134); gengi[gengi.length]= new Gengi('ISL', 'Íslensk króna', 'Icelandic krona', 1,1); gengi.sort(gcompare);