function trim(str)
{
    return str.replace(/^\s+|\s+$/g,'');
}

function zobraz(id){
	document.getElementById(id).style.display = 'block';
}

function skry(id){
	el=document.getElementById(id).style.display = 'none';
}

function collapse_menu(id)
{
	document.getElementById(id).style.display = document.getElementById(id).style.display == 'none' ? 'block' : 'none';
}

function getCookie(Name){ 
var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
if (document.cookie.match(re)) //if cookie found
return document.cookie.match(re)[0].split("=")[1] //return its value
return ""
}

function setCookie(name, value){
	document.cookie = name+"="+value+";"+"path=/"; //cookie value is domain wide (path=/)
}

function mapa(id)
{
	window.document['mapaimg'].src = '/images/mapa_'+id+'.jpg';
}

$(document).ready(function(){
	$("area.map-overlay").overlay({
		start: {
			top: 'center',
			left: 'center'
		},
		finish: {
			top: 'center',
			left: 'center'
		},
		expose: {
			color: '#000',
			opacity: 0.5,
			loadSpeed: 0,
			closeSpeed: 0
		},
		speed: 'fast',
		zoomType: 'div',
		boxColor: '#fff',
		boxRadius: 5,
		target: '#map-overlay',
		onBeforeLoad: function() {			
			$('#map-overlay .content').html('<p style="margin: 240px 0px 0px 260px;"><img src="/images/lightbox-ico-loading.gif" alt="Nahrávam..." title="Nahrávam" />');
			$('#map-overlay .content').load('/request.php?map=' + this.getTrigger().attr('id'));
        }
	});
	
	$("a.map-overlay").overlay({
		start: {
			top: 'center',
			left: 'center'
		},
		finish: {
			top: 'center',
			left: 'center'
		},
		expose: {
			color: '#000',
			opacity: 0.5,
			loadSpeed: 0,
			closeSpeed: 0
		},
		speed: 'fast',
		zoomType: 'div',
		boxColor: '#fff',
		boxRadius: 5,
		target: '#map-overlay',
		onBeforeLoad: function() {
			var theframe = $('<iframe frameborder="0" scrolling="no"></iframe>');
			var rlink = '/request.php?gmap=' + this.getTrigger().attr('id');
            $(theframe).attr({ src: rlink, style: 'height:605px; width:600px; border:none;' });
            $('#map-overlay .content').html(theframe);
        }
	});
	
	$("img.uitt[title], a.uitt[title]").tooltip();
	if($(".cesta").width()>480){
		$('.search').remove();	
	}
	
	$("a.over").fancybox({overlayOpacity: 0.5, overlayColor: '#000'});
	
	$('.tp, .tt').tipsy({gravity: 's', html: true}); // n | s | e | w
	
	
	$("#introbox").overlay({
		top : 'center',
		// some mask tweaks suitable for facebox-looking dialogs
		mask: {
	
			// you might also consider a "transparent" color for the mask
			color: '#fff',
	
			// load mask a little faster
			loadSpeed: 200,
	
			// very transparent
			opacity: 0.5
		},
		// load it immediately after the construction
		load: true
	
	});
});
