
var $j = jQuery.noConflict();

$j(document).ready(function ()
{
    $j("#2").lavaLamp({
               fx: "backout", 
               speed: 1200,
               click: function(event, menuItem) {
                   return true;
                }
            });
});



//colorbox
$j(document).ready(function(){
	$j("a[rel='galeria']").colorbox();
	$j(".zadajpytanie").colorbox({width:"500px", height:"440px", iframe:true});
});	

$j(document).ready(function(){
$j("#projects").simplyScroll({
			className: 'logicbox',
			pauseOnHover: true,
			autoMode: 'loop'
});		});
	

	
							
//When page loads…
$j(document).ready(function(){
	$j(".tab_content").hide(); //Hide all content
	$j("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$j(".tab_content:first").show(); //Show first tab content
	
	//On Click Event
	$j("ul.tabs li").click(function() {
		$j("ul.tabs li").removeClass("active"); //Remove any “active” class
		$j(this).addClass("active"); //Add “active” class to selected tab
		$j(".tab_content").hide(); //Hide all tab content
		var activeTab = $j(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		activeTab = activeTab.split("#"); //bugfixed by droope :)
	if ($j.browser.msie)
		{$j("#"+activeTab[activeTab.length-1]).show(); }
		else
		{$j("#"+activeTab[activeTab.length-1]).fadeIn(); }

	//$j("#"+activeTab[activeTab.length-1]).fadeIn(); //Fade in the active ID content
	return false;
	});

	//When page loads…
	$j(".tab2_content").hide(); //Hide all content
	$j("ul.tabs2 li:first").addClass("active").show(); //Activate first tab
	$j(".tab2_content:first").show(); //Show first tab content

	//On Click Event
	$j("ul.tabs2 li").click(function() {
	$j("ul.tabs2 li").removeClass("active"); //Remove any “active” class
	$j(this).addClass("active"); //Add “active” class to selected tab
	$j(".tab2_content").hide(); //Hide all tab content
	var activeTab2 = $j(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
	activeTab2 = activeTab2.split("#"); //bugfixed by droope :)
	$j("#"+activeTab2[activeTab2.length-1]).fadeIn(); //Fade in the active ID content
	return false;
	});

});


//scrollable
$j(document).ready(function() {
	$j("#infinite").scrollable({clickable:false});	
	$j("#infinite2").scrollable({clickable:false, items: '.items2', prevPage: '.prevPage2', nextPage: '.nextPage2'});
	$j("#infinite3").scrollable({clickable:false, items: '.items3', prevPage: '.prevPage3', nextPage: '.nextPage3'});
	$j("#infinite4").scrollable({clickable:false, items: '.items4', prevPage: '.prevPage4', nextPage: '.nextPage4'});	
});	
		
				
var intervalo;
function fechar(){
	$j('#koszyk2').animate({
		top: '-70px'
	}, 500, function() {
		// Animation complete.
	});
}

$j(document).ready(function() {
	$j('#koszyk2').mouseover(function(){
		clearInterval(intervalo);
		$j(this).animate({
			top: '0px'
		}, 300, function() {
			// Animation complete.
		});
	});
	
	$j('#koszyk2').mouseout(function(){
		intervalo = setTimeout('fechar()',500);
	});
		
});
	

$j(document).ready(function() {

	$j("#topnav li").prepend("<span></span>"); //Throws an empty span tag right before the a tag

	$j("#topnav li").each(function() { //For each list item...
		var linkText = $j(this).find("a").html(); //Find the text inside of the <a> tag
		$j(this).find("span").show().html(linkText); //Add the text in the <span> tag
	}); 

	$j("#topnav li").hover(function() {	//On hover...
		$j(this).find("span").stop().animate({
			marginTop: "-40" //Find the <span> tag and move it up 40 pixels
		}, 250);
	} , function() { //On hover out...
		$j(this).find("span").stop().animate({
			marginTop: "0"  //Move the <span> back to its original state (0px)
		}, 250);
	});

});
