// adlervia

// titles
//jQuery(document).ready(function(){
//	$("#bar li").hover(
//		function(){
//			var iconName = $(this).find("p");
//			
//			$(this).find("span").attr({
//				"style": 'display:block'
//			});
//			$(this).find("span").animate({opacity: 0.9, top: "24"}, {queue:false, duration:400});
//		}, 
//		function(){
//			var iconName = $(this).find("p");
//			
//			$(this).find("span").animate({opacity: 0, top: "20"}, {queue:false, duration:400}, "linear",
//				function(){
//					$(this).find("span").attr({"style": 'display:none'});			
//				}
//			);
//		});
//});
$(document).ready(function(){

$('[rel=tooltip]').bind('mouseover', function(){
	  
		
	
 if ($(this).hasClass('ajax')) {
	var ajax = $(this).attr('ajax');	
			
  $.get(ajax,
  function(theMessage){
$('<div class="tooltip">'  + theMessage + '</div>').appendTo('body').fadeIn('fast');});

 
 }else{
			
	    var theMessage = $(this).attr('content');
	    $('<div class="tooltip">' + theMessage + '</div>').appendTo('body').fadeIn('fast');
		}
		
		$(this).bind('mousemove', function(e){
			$('div.tooltip').css({
				'top': e.pageY - ($('div.tooltip').height() / 2) - 5,
				'left': e.pageX + 15
			});
		});
	}).bind('mouseout', function(){
		$('div.tooltip').fadeOut('fast', function(){
			$(this).remove();
		});
	});
						   });
// titles


function scrollShow() {
$('.shownav').scrollable( {
size: 5,
horizontal:true, 
speed: 300,
prev:'.prev',
next:'.next',
activeClass:'active',
items: 'ol'
});
}



function scrollAnchors() {
function filterPath(string) {
return string
.replace(/^\//,'')
.replace(/(index|default).[a-zA-Z]{3,4}$/,'')
.replace(/\/$/,'');
}
var locationPath = filterPath(location.pathname);
$('a[href*=#]').each(function() {
var thisPath = filterPath(this.pathname) || locationPath;
if (locationPath == thisPath
&& (location.hostname == this.hostname || !this.hostname)
&& this.hash.replace(/#/,'') ) {
var $target = $(this.hash), target = this.hash;      
if (target && target != '#prev' && target != '#next') {
var targetOffset = $target.offset().top;
$(this).click(function(event) {
event.preventDefault();
$('html, body').animate({scrollTop: targetOffset}, 1000, function() {
location.hash = target;
});
});
}
}
});
}


$(document).ready(function() {

if( jQuery.browser.msie && (jQuery.browser.version < 7) ) {
	// IE6
}
else if(location.pathname == '/'){
	scrollAnchors();
	$('#nav a[href=#uvod]').click().addClass('active');
}

// safari
if(jQuery.browser.safari){
$('html').addClass('safari');
}

// Funcoes nav
$('#nav a').click(function() {

if($(this).attr('href') == location.hash) { return false; }

var href = $(this).attr('href').replace('#','');
$('#nav a.active').removeClass('active');
$(this).addClass('active');

if( href == 'uvod' ) {
$('ul.nav-b').attr( { className: 'nav-a' });
$('div.foot-b').attr( { className: 'foot-a' });
}

else if( href == 'home' ) {
$('ul.nav-b').attr( { className: 'nav-a' });
$('div.foot-a').attr( { className: 'foot-b' });
}

else {
$('ul.nav-a').attr( { className: 'nav-b' });
$('div.foot-a').attr( { className: 'foot-b' });
}

});





});
