function go2URL(url) {
	window.self.location.href = url;
}

var oldClass = "";
function leftMenuOver(eTD, state) {
	if ( state == true )
	{
		oldClass = eTD.className;
		eTD.className = oldClass + " ovr";
	}
	else
	{
		eTD.className = oldClass;
		oldClass = "";
	}
}

var oldButtonClass = "";
function buttonOver(eButton, state) {
	if ( state == true )
	{
		oldButtonClass = eButton.className;
		eButton.className = oldButtonClass + " ovr";
	}
	else
	{
		eButton.className = oldButtonClass;
		oldButtonClass = "";
	}
}

function loginButtonClass (id, newClass) {
	btnID = id; btnClass = newClass;
	if ( newClass == "" )
	{
		document.getElementById(btnID).className = btnClass;
	}
	else
	{
		activateButton = setTimeout('document.getElementById(btnID).className = btnClass', 400);
	}
}

function rollRowsSegHP(obj,state) {
	if (state == 'seg1') { bgrColor = '#A0191A'; }
	if (state == 'seg2') { bgrColor = '#BB650A'; }
	if (state == 'seg3') { bgrColor = '#2771A5'; }
	if (state == 'seg4') { bgrColor = '#973180'; }
	if (state == 'seg5') { bgrColor = '#759026'; }
	if (state == 'hypo') { bgrColor = '#1963A9'; }
	if (state == '') { bgrColor = ''; }
	obj.style.backgroundColor = bgrColor;
}

function showDP(anch,title,subtitle)	{
	return popImageDP(anch.href,title,subtitle);
}

function popImageDP(imageURL,imageTitle,imageSubtitle){
	var AutoClose = true;
	var PositionX = 10;
	var PositionY = 10;
	var defaultWidth  = 640;
	var defaultHeight = 480;
	var imgWin = window.open('','photoDetail','scrollbars=no,resizable=1,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY);
	if( !imgWin ) { return true; } //popup blockers should not cause errors
	imgWin.document.write('<!DOCTYPE HTML PUBLIC "-\/\/W3C\/\/DTD HTML 4.01 Transitional\/\/EN" "http:\/\/www.w3.org\/TR\/html4\/loose.dtd">\n' +
		'<html>\n'+
		'<head><title>'+imageTitle+' - '+imageSubtitle+'<\/title>\n'+
		'<meta http-equiv="Content-Type" content="text\/html; charset=windows-1250">\n'+
		'<script type="text\/javascript">\n'+
		'function resizeWinTo() {\n'+
		'if( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }'+
		'var oH = document.images[0].height, oW = document.images[0].width;\n'+
		'oW = oW + 60; oH = oH + 116\n' +
		'if( !oH || window.doneAlready ) { return; }\n'+ //in case images are disabled
		'window.doneAlready = true;\n'+ //for Safari and Opera
		'var x = window; x.resizeTo( oW + 300, oH + 300 );\n'+
		'var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;\n'+
		'if( x.innerWidth ) { myW = x.innerWidth+30; myH = x.innerHeight; }\n'+
		'else if( d && d.clientWidth ) { myW = d.clientWidth+30; myH = d.clientHeight; }\n'+
		'else if( b && b.clientWidth ) { myW = b.clientWidth+30; myH = b.clientHeight; }\n'+
		'if( window.opera && !document.childNodes ) { myW += 16; }\n'+
		'x.resizeTo( oW = oW + ( ( oW + 300 ) - myW ), oH = oH + ( (oH + 300 ) - myH ) );\n'+
		'var scW = screen.availWidth ? screen.availWidth : screen.width;\n'+
		'var scH = screen.availHeight ? screen.availHeight : screen.height;\n'+
		'if( !window.opera && screen.width>800 ) { x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }\n'+
		'}\n'+
		'<\/script>'+
		'<link rel="stylesheet" type="text\/css" href="\/css\/u\/main.css">'+
		'<link rel="stylesheet" type="text\/css" href="\/css\/u\/main_dp.css">'+
		'<\/head><body id="photoDetail" onload="resizeWinTo();"'+(AutoClose?' onblur="self.close();"':'')+'>'+
		'<p class="galleryTitle"><span>Developerské projekty - fotogalerie<\/span><\/p>'+
		(document.layers?('<layer left="0" top="0">'):('<div style="position:absolute;left:15px;top:56px;">'))+
		'<img src="'+imageURL+'" alt="Otevírám obrázek ..." title="" onload="resizeWinTo();" onclick="window.close();"><br>'+
		'<p class="galleryDescription"><strong>' + imageTitle + '<\/strong> - ' + imageSubtitle + '<\/p>\n' +
		(document.layers?'<\/layer>':'<\/div>')+'<\/body><\/html>');
	imgWin.document.close();
	if( imgWin.focus ) { imgWin.focus(); }
	return false;
}

var lastRegionIndex = null;

function hideRegion() {
	var region = document.getElementById('i'+lastRegionIndex);
	region.style.visibility='hidden';
	return false;
}

function showRegion(regionIndex) {
	var region = document.getElementById('i'+regionIndex);
	lastRegionIndex = regionIndex;
	region.style.visibility='visible';
	return false;
}

//Mojebanka - Mojeplatba - Seznam obchodníků
function initMpMerchants() {
	$("#category-button").click(function() {
		var category = $("#category-list").val();
		if (category == "") {
			$("div.category").show();
		}
		else {
			$("div.category").hide();
			$("[class*=" + category + "]").show();
		}
	    return false;
	});
}

// funkce vrací počet výsledků fulltextového hledání - z výpisu ve stránce (pro účely YWA měřících kódů)
function getFulltextResult() {
	var result = 0;
	var resultString;
	if (($("div.fulltext div.nav div.c-red").size() == 1)) {
		resultString = $("div.fulltext div.nav div.c-red").text();
		result = resultString.substr(resultString.indexOf(":")+1,resultString.indexOf("(")-resultString.indexOf(":")-1);
		result = "<" + result.trim() + ">";
	}
	return result;
}

String.prototype.trim = function () {
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
}

/*detekce výšky pro otevírání popupu*/
function getHeigt(){
	var maxHeight = 890;
	var winHeight = screen.availHeight;
	if(winHeight > maxHeight){
		winHeight = maxHeight;
	}
	return winHeight;
}

