
function hideLabel(oElement, showHide)
{
	if(oElement.tagName=="SPAN")
	{
		oInputs = oElement.parentNode.getElementsByTagName("INPUT");
		oInput = oInputs[0];
		oLabel = oElement;
		oInput.focus();
	}else
	{
		oInput = oElement;
		oLabelSpans = oElement.parentNode.getElementsByTagName("SPAN");
		oLabel = oLabelSpans[0];
	}// end of else
	if(showHide)
		oLabel.style.display = "none";
	else
		if(oInput.value == "")
			oLabel.style.display = "inline";
		
}// end of function hideLabel(oClick)

function cloneRow(oBtn)
{
	newRow = $(oBtn.parentNode).clone();
	$(oBtn.parentNode).before(newRow);
	oBtn.style.display =  "none";
}// end of function cloneRow(oBtn)

var originalVotes = new Array();

function enquiryMouse(oImg, event)
{
	// save original
	enquirySaveOriginal(oImg.parentNode);
	oImgActuall = oImg;
	// set actuall img
	setEnquiryMouse(oImgActuall, true);
	// set previous imgs
	while(oImgActuall.previousSibling)
	{
		oImgActuall = oImgActuall.previousSibling;
		if(oImgActuall.tagName=="IMG")
		{
			setEnquiryMouse(oImgActuall, true);
		}// end of if is img
	}// end of while
	// clear next imgs
	oImgActuall = oImg;
	while(oImgActuall.nextSibling)
	{
		oImgActuall = oImgActuall.nextSibling;
		if(oImgActuall.tagName=="IMG")
		{
			setEnquiryMouse(oImgActuall, false);
		}// end of if is img
	}// end of while
}//end of function enquiryMouse(isOver)

function setEnquiryMouse(oImg, isOn)
{
	if(isOn)
		oImg.src = oImg.src.replace("off.gif", "on.gif");
	else
		oImg.src = oImg.src.replace("on.gif", "off.gif");
}//end of function setEnquiryMouse(oImg, isOn)

function enquirySetOriginal(oDiv)
{
	for(i=0; i<oDiv.childNodes.length; i++)
	if(oDiv.childNodes[i].tagName=="IMG" && originalVotes[oDiv.childNodes[i].id])
	{
		oImg = oDiv.childNodes[i];
		oImg.src = originalVotes[oImg.id];
	}// end of for
}// end of function enquirySetOriginal(oDiv)

function enquirySaveOriginal(oDiv)
{
	for(i=0; i<oDiv.childNodes.length; i++)
		if(oDiv.childNodes[i].tagName=="IMG" && !originalVotes[oDiv.childNodes[i].id])
		{
			oImg = oDiv.childNodes[i];
			originalVotes[oImg.id] = oImg.src;
		}// end of for
}// end of function enquirySaveOriginal(oDiv)

function log(msg)
{
	document.getElementById("log").innerHTML += msg+", ";
}// end of function log(Msg)

function vote(idDevice, votes)
{
	window.location.href = "sbirka-vynalezu.php?IdDevice="+idDevice+"&Vote="+votes+"&referer="+encodeURIComponent(window.location.href);
}// end of 

function playVideo(oImg)
{
	oDivObjDetail = document.getElementById(oImg.id+"Play");
	oDivObjDetails = oDivObjDetail.parentNode.getElementsByTagName("DIV");
	for(i=0; i<oDivObjDetails.length; i++)
		if(oDivObjDetails[i].style.display=="block")
			jQuery(oDivObjDetails[i]).slideUp('slow', null);
	jQuery(oDivObjDetail).slideDown('slow', null);
}// end of function playVideo(oImg)

function imgPrev(oSpan)
{
	// get all images
	arrImgs = oSpan.parentNode.getElementsByTagName("IMG");
	//show next img
	posImg = 0;
	for(i=1;i<arrImgs.length-2;i++)
		if(arrImgs[i].style.display=="block")
		{
			jQuery(arrImgs[i]).slideUp('slow', null);
			jQuery(arrImgs[i-1]).slideDown('slow', null);
			posImg = i;
			break;
		}// end of if and for
	// hide left hand if is not first
	if(posImg==1)
		oSpan.style.display = "none";
	// view next hand
	if(arrImgs.length>3)
		document.getElementById("imgNext").style.display = "inline";
}// end of function imgPrev(oSpan)

function imgNext(oSpan)
{
	// get all images
	arrImgs = oSpan.parentNode.getElementsByTagName("IMG");
	//show next img
	posImg = 0;
	for(i=0;i<arrImgs.length-2;i++)
		if(arrImgs[i].style.display=="block")
		{
			jQuery(arrImgs[i]).slideUp('slow', null);
			jQuery(arrImgs[i+1]).slideDown('slow', null);
			posImg = i;
			break;
		}// end of if and for
	// hide right hand if is last
	if(posImg==arrImgs.length-4)
		oSpan.style.display = "none";
	// view preview hand
	document.getElementById("imgPrev").style.display = "inline";
}// end of function imgNext(this)

function flashHands()
{
  handStatus = handStatus == 1 ? 0 : 1;
  arrImg1 = new Array("ruka-left.png","ruka-left-v.png");
  arrImg2 = new Array("ruka-right-v.png","ruka-right.png");
  document.getElementById("ruka-left").src = "images/"+arrImg1[handStatus];
  document.getElementById("ruka-right").src = "images/"+arrImg2[handStatus];
}
