
function kw2le() {
	document.getElementById('le').value = Math.round(parseFloat(document.getElementById('kw').value) * 13.587)/10;
}

function le2kw() {
	document.getElementById('kw').value = Math.round(parseFloat(document.getElementById('le').value) * 7.36)/10;
}

function m2foot(v1,v2) {
	document.getElementById(v2).value = Math.round(parseFloat(document.getElementById(v1).value) * 32.808399)/10;
}

function foot2m(v1,v2) {
	document.getElementById(v2).value = Math.round(parseFloat(document.getElementById(v1).value) * 3.048)/10;
}

function thousands(field){
	var input = new String(field.value);
	kimeno = '';
	j = 0;
	input = replaceSubstring(input,' ','');
	hossz = input.length;
	for( i = hossz-1;i >= 0; i--) {
		if ( (( j % 3) == 2) && ( j<(hossz-1) ) ) {
			kimeno = ' '+ input.substr(i,1) + kimeno;
		} else {
			kimeno = input.substr(i,1) + kimeno;
		}
		j++;
	}
	field.value = kimeno;
}

function replaceSubstring(inputString, fromString, toString) {
	var temp = inputString;
	if (fromString == "") {
		return inputString;
	}
	if (toString.indexOf(fromString) == -1) {
		while (temp.indexOf(fromString) != -1) {
			var toTheLeft = temp.substring(0, temp.indexOf(fromString));
			var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
			temp = toTheLeft + toString + toTheRight;
		}
	}else{
		var midStrings = new Array("~", "`", "_", "^", "#");
		var midStringLen = 1;
		var midString = "";
		while (midString == "") {
			for (var i=0; i < midStrings.length; i++) {
				var tempMidString = "";
				for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; }
				if (fromString.indexOf(tempMidString) == -1) {
					midString = tempMidString;
					i = midStrings.length + 1;
				}
			}
		}
		while (temp.indexOf(fromString) != -1) {
			var toTheLeft = temp.substring(0, temp.indexOf(fromString));
			var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
			temp = toTheLeft + midString + toTheRight;
		}
		while (temp.indexOf(midString) != -1) {
			var toTheLeft = temp.substring(0, temp.indexOf(midString));
			var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);
			temp = toTheLeft + toString + toTheRight;
		}
	}
	return temp;
}

// popups
// -- EUB utasbiztositás V3.0 --
function OpenBrWindow(theURL, winName, features, myWidth, myHeight, isCenter) {
	if(window.screen)if(isCenter)if(isCenter == "true" ) {
		var myLeft = (screen.width-myWidth)/2;
		var myTop = (screen.height-myHeight)/2;
		features += (features !='' )?',':'';
		features += ',left='+myLeft+',top='+myTop;
 	}
	window.open(theURL,winName, features+(( features != '' )? ',':'' ) + 'width=' + myWidth + ',height=' + myHeight );
}
// --------
function euszemelybiz1() {
	newWindow = window.open("http://www.best-office.hu/info/euhealth_b/euszemelybiz1.html", "EU_biztositas", "left=400,top=335,width=435,height=240, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no");
}

function euszemelybiz3() {
	newWindow = window.open("http://www.best-office.hu/info/euhealth_b/euszemelybiz3.html", "EU_biztositas", "left=400,top=335,width=520,height=240, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no");
}

// -- Stock in trade
function stockintrade() {
	newWindow = window.open("http://www.best-office.hu/info/stockintrade.html", "Repertoar","left=400,top=335,width=400,height=320, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");
}

// -- EUB ablak
function eubtrade() {
	newWindow = window.open("http://eub.web.services.hu/online/index.php?pkod=26513", "", "left=240,top=200, width=745,height=665, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no");
}

// -- AXA ablak
function axatrade() {
	newWindow = window.open("https://www.cslife.travelonline.hu/bestoffice","", "left=220,top=150,width=580,height=740, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no");
}

// -- Megtakaritas
function megtakaritas() {
	newWindow = window.open("http://www.best-office.hu/info/megtakaritas.html", "Megtakaritas","left=300,top=235,width=520,height=260, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");
}

// -- Garancia gfb ár
function gfbargarancia() {
	newWindow = window.open("http://www.best-office.hu/info/gfb_ar_garancia.html", "Argarancia", "left=320,top=250,width=480,height=480, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");
}