function drivezakoupenezbozi(jazyk){
	drivezakoupenezbozi_okno = window.open('zakoupenezbozi.aspx?jazyk='+jazyk, 'drivezakoupenezbozi' , 'width=450,height=450,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0,copyhistory');
	if(window.focus){drivezakoupenezbozi_okno.focus()}
}

function tiskproduktu(id,jazyk){
	window.open('tiskproduktu.aspx?id='+id+'&jazyk='+jazyk, '_blank' , 'width=650,height=450,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0,copyhistory');
}

function klicoveslovo(id,jazyk){
	window.open('klicoveslovo.aspx?id='+id+'&jazyk='+jazyk, '_blank' , 'width=400,height=400,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0,copyhistory');
}
		
function changeImages() {
	if (document.images) {
		document[changeImages.arguments[0]].src = eval("produkty/" + changeImages.arguments[1] + ".jpg");
	}
}

// Tooltip

var mousePos = {x:-300,y:-300};
var winSize = null;

//document.onmousemove = mouseMove;
window.onresize = windowResize;

function mouseMove(ev)
{
	ev = ev || window.event;
	mousePos = mouseCoords(ev);
}

function mouseCoords(ev)
{
	if(ev.pageX || ev.pageY){
		return {x:ev.pageX, y:ev.pageY};
	}
	
	return {
		x:ev.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft),
		y:ev.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop)
	}
}

function windowResize( )
{
	winSize = {
		x: ( document.body.clientWidth ) ? document.body.clientWidth : window.innerWidth ,
		y: ( document.body.clientHeight ) ? document.body.clientHeight : window.innerHeight
	}
}

function tooltipAval_show(tooltipId,productId){
	//document.all.ProductAvalaibility.src='stav.aspx?id=10602000';
	frames['ProductAvalaibility'].location.href='stav.aspx?id='+productId
	tooltip_show(tooltipId);
}

function tooltipAval_hide(tooltipId){
	//document.all.ProductAvalaibility.src='stav.aspx';
	frames['ProductAvalaibility'].location.href='stav.aspx';
	tooltip_hide(tooltipId);
}

function tooltip_show(tooltipId){
	document.onmousemove = mouseMove;
	
	var it = document.getElementById(tooltipId);
	
	var newTop = mousePos.y + 10;
	var newLeft = mousePos.x + 10;
	
	if( ( mousePos.x + 230 ) >= winSize.x - 1 ){
		newLeft = mousePos.x - 240;
	}
	
	if( ( mousePos.y + 70 ) >= (winSize.y - 20 + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop)) ){
		newTop = mousePos.y - 80;
	}
	
	it.style.top = newTop + "px";
	it.style.left = newLeft + "px";
    it.style.visibility = 'visible'; 
}

function tooltip_move(tooltipId){
	document.onmousemove = mouseMove;
	
	var it = document.getElementById(tooltipId);
	
	var newTop = mousePos.y + 10;
	var newLeft = mousePos.x + 10;
	
	if( ( mousePos.x + 230 ) >= winSize.x - 1 ){
		newLeft = mousePos.x - 240;
	}
	
	if( ( mousePos.y + 70 ) >= (winSize.y - 20 + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop)) ){
		newTop = mousePos.y - 80;
	}
	
	it.style.top = newTop + "px";
	it.style.left = newLeft + "px";
    it.style.visibility = 'visible'; 
}

function tooltip_hide(tooltipId){
	document.onmousemove = null;
	mousePos = {x:-300,y:-300};
	
    it = document.getElementById(tooltipId); 
    it.style.left = '0px';
	it.style.top = '0px';
    it.style.visibility = 'hidden';
}

window.onload = function(){
	windowResize();
}

// Skryvani DIVU
function ExpColDIV(elementid){
	if (document.getElementById(elementid).style.display == 'none'){
		document.getElementById(elementid).style.display = '';
	} else {
		document.getElementById(elementid).style.display = 'none';
	}
}