function getWinWidth()
{
  if (document.body && document.body.clientWidth)
    return document.body.clientWidth;
  else
  {
    return window.innerWidth;
  }
}

function getWinHeight()
{
	var myHeight = 0;

	if (typeof(window.innerHeight) == 'number') {
		//Non-IE
		myHeight = window.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight) {
		//IE 6+ in 'standards compliant mode'
		myHeight = document.documentElement.clientHeight;
	}
	else if (document.body && document.body.clientHeight) {
		//IE 4 compatible
		myHeight = document.body.clientHeight;
	}

	return myHeight;

}

function set_vybava_rozmery()
{
	var x=getWinWidth();
	var y=getWinHeight();
	var o=document.getElementById('eq_main');
	var r1=document.getElementById('row1');
	var r3=document.getElementById('row3');
	if (o) {
		if (x) {
			o.style.width = (x - 204) + "px";
			r3.style.width = (x - 20) + "px";
		}
		if (y) {
			o.style.height = (y - 380) + "px";
		}
	}
	if (r1) {
		if (x) {
			r1.style.width = (x - 20) + "px";
		}
	}
}

function tisice(polozka)
{
	polozka = Math.round(polozka);
	polozka = "" + polozka;
	var vysledek = "";
	for (i = 0; i < polozka.length - 3; i = i+3) {
		cast = polozka.substr(polozka.length - 3 - i, 3);
		vysledek = cast + " " + vysledek;
	}
	cast = polozka.substr(0,polozka.length - i);
	vysledek = cast + " " + vysledek;
	vysledek = vysledek.substr(0, vysledek.length - 1);
	return vysledek;
}


var car_price = 0;
var n1 = false;

function price_display()
{
	var x;
				
	x = document.getElementById("js_cena_dph");
	if (x)
		x.innerHTML = tisice(car_price) + " Kč";

 	x = document.getElementById("js_cena_bez_dph");
	if (x)
		x.innerHTML = tisice(Math.round(car_price / 1.19)) + " Kč";

	if (x)	{
 		x = document.getElementById("js_cena_bez_dph_wrap");
		x.style.visibility = n1 ? "visible" : "hidden";
	}
	
	x = document.getElementById("js_prev_cena_dph");
	x.innerHTML = tisice(car_price) + " Kč";

 	/*x = document.getElementById("js_prev_cena_bez_dph");
	x.innerHTML = tisice(Math.round(car_price / 1.19)) + " Kč";*/
	
 	/*x = document.getElementById("js_prev_cena_bez_dph_wrap");
	x.style.visibility = n1 ? "visible" : "hidden";*/
}

function price_eq_set(price, add, n1_mode)
{	
	if (add)
		car_price += Number(price);
	else
		car_price -= Number(price);

	n1 = n1_mode;

	price_display();

}

function price_orig_set(price, add, sleva)
{	
	if (add)
		car_price += Number(price);
	else
		car_price -= Number(price);
	
	
	price_display();

}

