(function(){
window.addEventListener("load", function() { setTimeout(hideAddress, 100) }, false);
	
		function hideAddress() {
			window.scrollTo(0, 1); // pan to the bottom, hides the location bar
		}

/*
window.addEventListener("click",function(event){
	event.preventDefault();
	
	scrollTo(0, 1); 
	
	var theUrl = event.target;
	//alert(theUrl);
	var arr1 = theUrl.href.split("/");
	var the_page = arr1.pop()
	var	arr2 = the_page.split("?");
			the_page = arr2[0];
	var	the_query = arr2[1];
	if(the_page != "lens_calc.php"){
	
	setTimeout(slidePanel,0);
	
},true);
*/
/*
function slidePanel(){
	
	var	topage = document.getElementById('lens_calc');
	var frompage = document.getElementById('lens_calc_list');
	var percent = 100;
			
			topage.style.display="block"
		
	var timer = setInterval(function(){
			percent = percent - 20;				
			
			if (percent <= 0 ){
					percent = 0;
					clearInterval(timer);
					frompage.style.display = "none";
				
				}
		
			topage.style.left = percent + "%" ;
			frompage.style.left = (percent-100) + "%" ;
		
			},35);
	
}
*/

})();


function DecRound(value, precision)
{

precision = parseInt(precision)
var result = ""+Math.round(value * Math.pow(10, precision) ) / Math.pow(10, precision)
//var decPoint = result.length - precision -1 ;
//alert(result.substr(decPoint))
	
	return result
	
}


function calcFocal(d,w,value1,value2){
	
	var sensor = eval (value1 / value2)
	if ((d != "") && (w != ""))
	{
		var ratio = eval (d / w)
		result = eval (ratio * sensor )
		return DecRound(result,2);
	}

}

function calcDist(f,w,value1,value2){
	
	var sensor = eval (value1 / value2)
	if ((f != "") && (w != ""))
	{
		var ratio = eval (f * w)
		result = eval (ratio / sensor)
		return DecRound(result,2);
	}
	
}

function calcDim(f,d,value1,value2){
	
	var sensor = eval (value1 / value2)
	if ((f != "") && (d != ""))
	{
		var ratio = eval (d / f)
		result = eval (ratio * sensor)
		return DecRound(result,2); //hieght
	}
	
}

function get_h(w,ratioX,ratioY){
	
	kvot = eval(w * ratioY / ratioX)
	return DecRound(kvot,2);
	
}

function get_w(h,ratioX,ratioY){
	
	kvot = eval(h * ratioX / ratioY)
	return DecRound(kvot,2);
	
}

