var tempX = 0;
var tempY = 0;
var pozadovanaVrstva = '';
var aktualniCast = '';
var winW = 630;
var IE = false; 

if ( navigator.appName.substr(0,9) ==  'Microsoft' ) {
	IE = true;
}
if ( !IE ){
	document.captureEvents(Event.MOUSEMOVE); 	
	winW = window.innerWidth - 200;	
}else{
	winW = winW -200;
}
function zobrazeni(vrstva,akce){ 
	if ( akce == 'v') {
		//document.onmousemove=getMouseXY;
		pozadovanaVrstva = vrstva;
		string="ukaz(\""+vrstva+"\");";
		setTimeout(string,100);
	}
	if ( akce == 'h' ){
		document.onmousemove = '';
		pozadovanaVrstva = vrstva;
		string = "schovej(\""+vrstva+"\");";
		setTimeout(string,100);
	}
}
function ukaz(vrstva){
		//document.getElementById(vrstva).style.visibility="visible";
		document.getElementById(vrstva).style.display="block";
}
function schovej(vrstva){
		//document.getElementById(vrstva).style.visibility="hidden";
		document.getElementById(vrstva).style.display="none";
}
function getMouseXY(e) {
		if (IE) {
				tempX = event.clientX + document.body.scrollLeft;
				tempY = event.clientY + document.body.scrollTop;
		} else {
				tempX = e.pageX;
				tempY = e.pageY;
		}  
		if (tempX < 0 ) {tempX = 0;}
		if (tempY < 0 ) {tempY = 0;}  
		if (tempX > winW ) { tempX = winW; }
		document.getElementById(pozadovanaVrstva).style.top=tempY + 10;
		document.getElementById(pozadovanaVrstva).style.left=tempX + 10;
		document.onmousemove = '';
		return true;
}

function FormSendData( o , send){
	if( o ){ 
		$.blockUI({ //
			message:  '<h2>Moment prosím...</h2><img src="'+zacatekUrl+'images/loading_animation.gif" alt="upload dat in progress" />',
			css: { //
				border: 'none',
				width: '250px', 
				padding: '15px',
				backgroundColor: '#000', 
				'-webkit-border-radius': '10px', 
				'-moz-border-radius': '10px', 
				opacity: '.5', 
				color: '#fff' 
			} 
		});
		if( send ) {
			o.submit();
		}else{
			return false;
		}
	}
}

/**
* create date: 2008-10-22, megac@abcool.cz
*/
function SessionRefresh(casReloadu){ //
	if( casReloadu > 0 ){ //
		if( $('#SessionRefresh').size() == 0  ){
			$('body').append('<div id="SessionRefresh" style="display:none;"></div>');
		}
		$('#SessionRefresh').load(zacatekUrl+'session_refresh.php');
		var reload = casReloadu*1000; // prevod ze sekund
		setTimeout('SessionRefresh('+casReloadu+')',reload);
	} 
}
if( refreshSessionTime > 0 ){
	SessionRefresh(refreshSessionTime);
	refreshSessionTime = 0;
}
/**
 * Source: http://krijnhoetmer.nl/stuff/javascript/include-javascript/
 * @param string file
 * @return void
 */
function include(file) {
	if (document.createElement && document.getElementsByTagName) {
		var head = document.getElementsByTagName('head')[0];
		var script = document.createElement('script');
		script.setAttribute('type', 'text/javascript');
		script.setAttribute('src', file);
		head.appendChild(script);
	} else {
		alert('Your browser can\'t deal with the DOM standard. That means it\'s old. Go fix it!');
	}
}

/**
 * @param mixed mixed_var
 * @return bool
 */
function is_number(mixed_var) {
	if ( isNaN(mixed_var) )return false;
	else return true;
}


function CenaNaDesetnik( hodnota ){
	var v1 = parseFloat(hodnota).toFixed(presnostVypoctu);
	if(!is_number(v1)) return '';
	var v2 = Math.round(v1);
	return (v2 == v1?(v2==0?'':v2):v1);
}

function CreateMarze(MC,VC,VAT, sDPH){
	var marze = 0;
	if( MC != 0 && VC != 0 ){ 
		if (typeof(GetDPHOn) == 'function'){
			if( GetDPHOn() ){
				marze = MC/(VC/100) - 100;
			}else{
				marze = MC / ((VC * (100+VAT)/100)/100) - 100;//	
			}
		}else{
			marze = MC/(VC/100) - 100;
		}
	}
	return marze;
}



// jquery LightBox
/*
 * $(document).ready(function(){ // $(function() {
 * $('a[@rel*=lightbox]').lightBox({ // overlayBgColor: '#AAF', overlayOpacity:
 * 0.6, imageLoading: zacatekUrl+'images/_loading.gif', imageBtnClose:
 * zacatekUrl+'images/_closelabel.gif', imageBtnPrev:
 * zacatekUrl+'images/prev.gif', imageBtnNext: zacatekUrl+'images/next.gif',
 * containerResizeSpeed: 350, txtImage: 'Obrázek', txtOf: 'cs' }); }); });
 */


