
sfHover = function() {
	var sfEls = document.getElementById("ja-mainnav").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; ++i) {
		sfEls[i].onmouseover=function() {
			clearTimeout(this.timer);
			if(this.className.indexOf(" sfhover") == -1)
				this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.timer = setTimeout(sfHoverOut.bind(this), 20);
		}
	}
}

function sfHoverOut() {
	clearTimeout(this.timer);
	this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
}

if (window.attachEvent) window.attachEvent("onload", sfHover);






var valuta;
var kurz =  30.1260;
var cislo = '';
function clearinp(){
	document.getElementById("SKK").value = '';
	document.getElementById("EUR").value = '';            
	cislo = '';
}


function selectcur(mena){
	if (mena == 'SKK'){
		document.getElementById("EUR").style.background = '#EEEEEE'; 
		document.getElementById("SKK").style.background = '#FFFFFF'; 
 		document.getElementById("SKK").focus();
		valuta = 'SKK';
		cislo = '';
	} else {
		document.getElementById("SKK").style.background = '#EEEEEE'; 
		document.getElementById("EUR").style.background = '#FFFFFF';
 		document.getElementById("EUR").focus();	 
		valuta = 'EUR';
		cislo = '';
	}
}

function backspace(){

	  if (valuta == 'SKK'){document.getElementById("SKK").value = document.getElementById("SKK").value.toString().substring(0,document.getElementById("SKK").value.toString().length-1);}
	  if (valuta == 'EUR'){document.getElementById("EUR").value = document.getElementById("EUR").value.toString().substring(0,document.getElementById("EUR").value.toString().length-1);}

	if (valuta == 'SKK'){
	cislo = document.getElementById("SKK").value; 
  document.getElementById("SKK").value = cislo.replace(/[^0-9,]*/i, '');  
	document.getElementById("EUR").value = cislo.replace(/[^0-9,]*/i, '') / kurz;  
			  
	}else {
	cislo = document.getElementById("EUR").value;
  document.getElementById("EUR").value = cislo;
	document.getElementById("SKK").value = cislo * kurz;
	}

}
 
function stlac(tlacitko){
	
	if (tlacitko == 'inter'){
	  if (valuta == 'SKK'){cislo = document.getElementById("SKK").value.replace(',', '.');}
	  if (valuta == 'EUR'){cislo = document.getElementById("EUR").value.replace(',', '.');} 
	}
	else {
	
	
	cislo = cislo + tlacitko ;        
	}
	var many_type;
	var cislo_new;
	many_type ="1_CP_30.1260";
	many_type = many_type.split("_");
	

	tmpCislo = cislo.replace(/[^0-9,]*/i, '');
	var precision = 2;
	
	if (valuta == 'SKK'){ 
	document.getElementById("SKK").value = tmpCislo;
	v = tmpCislo/kurz * parseInt(many_type[0]);
	tmp = Math.round((v*Math.pow(10,precision)))/(Math.pow(10,precision)); 
	tmp = tmp.toFixed(precision);  
	document.getElementById("EUR").value = tmp;  
			  
	}else {
	document.getElementById("EUR").value = tmpCislo;  
	v = tmpCislo*kurz;
	tmp = Math.round((v*Math.pow(10,precision)))/(Math.pow(10,precision)); 	
	document.getElementById("SKK").value = tmp;
	}
}

function str_divide(str,val){
	
	arr = new Array();
	arr = str.split("_");
	
	return arr[val];
}


function change_kurz() {

	stlac('inter');

	
}

function change_user_kurz(input) {
	input.value = input.value.replace(',', '.');
	input.value = input.value.replace(/[^0-9,]*/i, '');
	kurz = input.value;
	document.getElementById('aktkurz').value = input.value;
}

function CheckNumericKeyInfo($char, $mozChar) {
	if($mozChar != null) { // Look for a Mozilla-compatible browser
		if(($mozChar >= 48 && $mozChar <= 57) || $mozChar == 0 || $char == 8 || $mozChar == 13 || $mozChar == 44 || $mozChar == 46) 
			$RetVal = true;
		else {
			$RetVal = false;
	}
  }
  else { // Must be an IE-compatible Browser
	if(($char >= 48 && $char <= 57) || $char == 13 || $char == 44 || $char == 46) 
		$RetVal = true;
	else {
	  $RetVal = false;
	}
  }
  return $RetVal;
}