function getEleId(eleId)
{
	obj = document.getElementById(eleId);
	if(obj)
	{
		return obj;
	}
	else return false;
}

function getEleProp(eleId, prop){
	obj = document.getElementById(eleId);
	if(obj)
	{
		var toeval = 'obj.'+prop
		return eval(toeval);
	}
	else return false;
}

function setEleProp(eleId, prop, pValue){
	obj = document.getElementById(eleId);
	if(obj)
	{
		var toeval = 'obj.'+prop+' = "'+pValue+'"';
		return eval(toeval);
	}
	else return false;
}

function show(eleId){document.getElementById(eleId).style.display = 'block';}

function hide(eleId){document.getElementById(eleId).style.display = 'none';}

function blick(eleId)
{
	if(document.getElementById(eleId).style.display == 'none'){
		show(eleId);
	}else{
		hide(eleId);
	}
}

function getHeight(eleId)
{
	ele = getEleId(eleId);
	return(ele.offsetHeight);
}

function getWidth(eleId)
{
	ele = getEleId(eleId);
	return(ele.offsetWidth);
}

function openWindow(url, name, features)
{
	window.open(url, name, features);
}

function pictureWindow(picture, title, root)
{
	picWin = window.open(root+'/image.php?title='+title+'&img='+picture, '', 'width=200,height=200,scrolling=no');
}

function submitForm(eleId)
{
	form = document.getElementById(eleId);
	if(form)form.submit();
}

function redir(url) {
	document.location.href = url;
}

function posByElement(targetEleId, topEleId, hCor, vCor, position)
{
	targetEle = getEleId(targetEleId);
	topEle = getEleId(topEleId);

	if(targetEle && topEle)
	{
		eleTop = topEle.offsetHeight + vCor;
		eleLeft = topEle.offsetWidth + hCor;

		while(topEle){
			eleTop += topEle.offsetTop;
			eleLeft += topEle.offsetLeft;

			topEle = topEle.offsetParent;
		}

		//pozice
		if(position == 'bottom-left')eleLeft = eleLeft - getWidth(topEleId);
		if(position == 'top-right')eleTop = eleTop - getHeight(topEleId);

		targetEle.style.top = eleTop+'px';
		targetEle.style.left = eleLeft+'px';
	}
}

function insertFlash(eleId, swfFile, width, height, alt, wmode, flashVars)
{
	directFlashVars = '';
	if(flashVars != '')directFlashVars = '?'+flashVars;

	flashHtml =
	'<!--[if !IE]> -->'+"\n"+
	'<object type="application/x-shockwave-flash" data="'+swfFile+directFlashVars+'" width="'+width+'" height="'+height+'">'+"\n"+
	'<!-- <![endif]-->'+"\n"+
	'<!--[if IE]>'+"\n"+
	'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+width+'" height="'+height+'">'+"\n"+
	'<param name="movie" value="'+swfFile+directFlashVars+'" />'+"\n"+
	'<!--><!---->'+"\n"+
	'<param name="loop" value="true" />'+"\n"+
	'<param name="menu" value="false" />'+"\n"

	if(wmode)flashHtml += '<param name="wmode" value="transparent" />'+"\n";
	if(flashVars != '')flashHtml += '<param name="flashvars" value="'+flashVars+'" />'+"\n";

	flashHtml += alt+"\n";
	flashHtml += '</object>'+"\n";
	flashHtml += '<!-- <![endif]-->'+"\n";

	obj = document.getElementById(eleId);
	obj.innerHTML = flashHtml;
}

$(document).ready(function(){
	$("a[rel^='prettyPhoto']").prettyPhoto();
});
