var widget_show = 0;

var widget_t;



function show_select()
{
 	$('#s_list li').animate({
	    height: 15,
	    opacity: 1.0,
	    border: 1,
	    padding: 1
	}, 300);
	$('#s_list').animate({
	    height: 67,
	    opacity: 1.0,
	    border: 1,
	    padding: 1
	}, 300);	
	$('#s_selector').animate({
		height: 95
	},1)
}	
	
function hide_select()
{
 	$('#s_list li').animate({
	    height: 0,
	    opacity: 0.0,
	    border: 0,
	    padding: 0
	}, 300);
 	$('#s_list').animate({
	    height: 0,
	    opacity: 0.0,
	    border: 0,
	    padding: 0
	}, 300);
	$('#s_selector').animate({
		height: 25
	},300)	
}	
function ch_select(ob)
{
var hasInnerText =(document.getElementsByTagName("body")[0].innerText != undefined) ? true : false;	

	if(hasInnerText)
		var cont = ob.firstChild.innerText;
	else
		var cont = ob.firstChild.textContent;

	$('#s_selected').val(cont);
	
	if(cont == 'Google')
	{
		$('#s_word').attr('name','q');
		$('#s_word').attr('class','seek_g');
	}
	if(cont != 'Google')
	{
		$('#s_word').attr('name','seek');
		$('#s_word').attr('class','seek');
	}
}	


$(document).ready(function() {
    $('#s_list li').click(function(){hide_select();ch_select(this)});
	$('#s_selected').click(function(){show_select();});
	
	$("#widget").hover(function(){
		alert
		$("#widget").stop(true, false).animate({right:"0"},"medium");
	},function(){
		$("#widget").stop(true, false).animate({right:"-300"},"medium");
	},500);

	$("#s_selector").hover(function(){
	},function(){
		hide_select();
	});		
	
	$('.menu_button').click(function(){
		if(widget_show)
		{
			widget_t = setTimeout(function(){show_hide_widget();},50);
			widget_show = 1;
		}
		$('.widget_cont').fadeOut(500);
		setTimeout(function(id){ $('#'+id+'_cont').fadeIn(500);} ,500, this.id);
	});
	
	$("a[rel=fancybox]").fancybox({
		'titleShow'     : false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'easingIn'      : 'easeOutBack',
		'easingOut'     : 'easeInBack'
	});	
	
	hide_select();
});

function judge(id,direct)
{
	$.get(
		"http://legalne.info/html/ajax_response/judge.php",
		{id: id, direct: direct},
		function (response){
			alert(response);
			$("#positiv_"+id).html(response);	
			$("#up_"+id).html('&nbsp');
			$("#down_"+id).html('&nbsp');
		}
	)
}
function addOpenSearch(name,ext,cat,pid,meth)
{
  if ((typeof window.external == "object") && ((typeof window.external.AddSearchProvider == "unknown") || (typeof window.external.AddSearchProvider == "function")))
  {

      window.external.AddSearchProvider("http://legalne.info/toolbar/search.xml")
      $.get('http://legalne.info/html/_js/searchbar.php', function(data) {return true});
  } else {
    alert("Potrzebujesz przeglądarki, która obsługuje OpenSearch (Mozilla)");
  }
}

$(document).ready(function() {
    $('.google_report').click(function () { 
        pageTracker._trackPageview ('/pobran/' + $(this).attr('href').replace('http://',''));
    });
});
