$(document).ready(function() {
	
// Open links in new window
$("a[rel='external']").click(function(){window.open(this.href); return false;});

// anketa
$(".vote-item a").click(function(){
  id_answer = $(this).attr('id').split('_');
  id_poll = $(this).attr('class');
  
  $.post('/modules/poll/ajax_poll.php', {
  	    id_answer: id_answer[1],
  	    id_poll: id_poll
  	    },
  	    function(data){
	       $('#poll_'+id_poll).html(data);
      	});
});
// anketa

// Focus text for searchbox
$("#searchstring").focus(function(){
	if ($(this).val() == $(this)[0].title){
		$(this).removeClass("TextActive");
		$(this).val("");
	}
});
$("#searchstring").blur(function(){
	if ($(this).val() == ""){
		$(this).addClass("TextActive");
		$(this).val($(this)[0].title);
	}
});
$(".Text").blur();        

// Navigation
$('#nav li').hover(function() {
	$(this)
	.find('.submenu')
	.stop(true, true)
	.slideDown(20);
}, function() {
	$(this)
	.find('.submenu')
	.stop(true,true)
	.slideUp(20);
});

$('#nav li').mouseover(function() {
	$(this).addClass('hover');
});

$('#nav li').mouseout(function() {
	$(this).removeClass('hover');
});

$('.submenu').hide();

// Antispam
if($('#antispamblock').length){
    $('#antispam').val('777');
    $('#antispamblock').hide();
}

// Send to friend
$("#friend").fancybox({
	'width'			: 500,
	'height'		: 325,
	'autoScale'		: false,
	'transitionIn'	: 'none',
	'transitionOut'	: 'none',
	'type'			: 'iframe',
	'titleShow'		: false,
	'scrolling'		: 'no'
});

// Partners


// Fancybox
if ($('a[rel*=group]').length) {
	$("a[rel*=group]").fancybox({
		'titlePosition': 'over',
		'titleFormat': function(title, currentArray, currentIndex, currentOpts){
		return '<span id="fancybox-title-over">Obrázek ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
	}
});
}

// Fancybox IE
if ($.browser.msie) {
	if ($('a[rel*=group]').length) {
		$("a[rel*=group]").fancybox({
			'titlePosition': 'over',
			'transitionIn': 'none',
			'transitionOut': 'none',
			'titleFormat': function(title, currentArray, currentIndex, currentOpts){
				return '<span id="fancybox-title-over">Obrázek ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
			}
		});
	}
}

});//End document ready
