function createCookie(cookieName, value)
{   
	var expireDate = new Date();
	expireDate.setDate(expireDate.getDate()+parseInt(14));
	var cookieObj = cookieName+"="+value+"; expires="+expireDate.toGMTString()+"; path=/";
	document.cookie=cookieObj;
}

function getCookieVal(cookieName)
{
	thisCookie = document.cookie.split("; ");
	for (i=0; i<thisCookie.length; i++)
	{
		if (cookieName == thisCookie[i].split("=")[0])
		{
			return(thisCookie[i].split("=")[1]);
		}
	}
	return null;    
}
function showCookieValue(cookieName)
{
	val = getCookieVal(cookieName);
	alert(val);
}

function menuClick(mname)
{
	el = document.getElementById(mname);
	if (el.style.display == "none")
    {
        el.style.display="";
        createCookie(mname,"yes");
    }
	else
    {
        el.style.display="none";
        createCookie(mname,"none");
    }    
}

function closeTab(name)
{
	el = document.getElementById(name);
	if (el.style.display != "none")
	{
		el.style.display="none";
	}
}

function openTabFotoMap(name)
{
	el = document.getElementById(name);
	if (el.style.display == "none")
	{
		el.style.display="";
		createCookie('tabFotoMap', name);
	}
}

function openTabVyhl(name)
{
	el = document.getElementById(name);
	if (el.style.display == "none")
	{
		el.style.display="";
		createCookie('tabVyhl', name);
	}
}

function openTab(name)
{
	el = document.getElementById(name);
	if (el.style.display == "none")
	{
		el.style.display="";
		createCookie('tab', name);
	}
}

function closeTabs()
{
	closeTab('bezMapy');
	closeTab('sMapou');	
}

function closeTabsVyhl()
{
	closeTab('vyhledavani');
	closeTab('kalendar');
}
function closeTabsFotoMap()
{
	closeTab('foto');
	closeTab('mapa');
}

function deactivateTab(name)
{
	el = document.getElementById(name);
	if (el)
	{
		el.className = 'pohledyNadpis';
	}
}

function activateTab(name)
{
	el = document.getElementById(name);
	if (el)
	{
		el.className = 'pohledyNadpisVybrane';
	}
}

function initTabsVyhl()
{
	var val = getCookieVal("tabVyhl");
	if (val == null) {}				
	else {closeTabsVyhl();openTabVyhl(val);}	
}

function initTabsFotoMap()
{
	var val = getCookieVal("tabFotoMap");
	if (val == null) {}				
	else {closeTabsFotoMap();openTabFotoMap(val);}	
}

function openOnlineAuctionWindow(url,auctionKey,sessionId,anonymUser)
{
	if (anonymUser)
	{
		window.open(url+'/viewAnonymAuction.do?key='+auctionKey+'&anonymId='+sessionId, 'auctionWindow', 'titlebar=no,toolbar=no, menubar=no, location=no, directories=no, scrollbars=no, resizable=yes, status=no, width=690, height=645, top=100, left=100');	
	}
	else
	{
		window.open(url+'/checkLoginAuction.do?key='+auctionKey, 'auctionWindow', 'titlebar=no,toolbar=no, menubar=no, location=no, directories=no, scrollbars=no, resizable=yes, status=no, width=690, height=645, top=100, left=100');
	}
}

function initProblemMail(sendQuestionForm,paSymbol)
{
	if (sendQuestionForm!=null)
	{
		sendQuestionForm.problem.value = "true";
		sendQuestionForm.dotaz.value = "Zjištěn problém s dražbou č.j."+paSymbol+"\nPopis problému:";
		sendQuestionForm.dotaz.focus();
	}
}

function emptyFormField(id)
{
	var el = document.getElementById(id);
	if (el!=null && el.value.indexOf('zadejte')>=0)
	{
		el.value='';
	}
}
/* ------------------------------------------------------------------------
	KALENDAR
------------------------------------------------------------------------- */

