$(function() {
$(".itembilde").css("opacity","1.0");
$(".itembilde").hover(function () {
$(this).stop().animate({
opacity: 0.8
}, "slow");
},	
function () {			
$(this).stop().animate({
opacity: 1.0
}, "slow");
});
});


jQuery(document).ready(function() {
    jQuery('#featured-wrap').jcarousel({
		scroll: 1,
		animation: 600,
        auto: 10,
        start: Math.floor(Math.random()*5),
        wrap: 'circular'
    });
});

$(document).ready(function() {	
	
	launchWindow('#message');	
});

function launchWindow(id) {
	
		var winH = $(window).height();
		var winW = $(window).width();
		$(id).hide();
		$(id).css('top',  90);
		$(id).css('left', winW/2-$(id).width()/2);

		$(id).hide().fadeIn(1000).fadeOut(2000);
}

function DraugiemSay( title, url, titlePrefix ){
 window.open(
  'http://www.draugiem.lv/say/ext/add.php?title=' + encodeURIComponent( title ) +
  '&link=' + encodeURIComponent( url ) +
  ( titlePrefix ? '&titlePrefix=' + encodeURIComponent( titlePrefix ) : '' ),
  '',
  'location=1,status=1,scrollbars=0,resizable=0,width=530,height=400'
 );
 return false;
}

$(document).ready(function() {

	//When page loads...
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").fadeIn(3000); //Show first tab content

	//On Click Event
	$("ul.tabs li").click(function() {

		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(1400); //Fade in the active ID content
		return false;
	});

});



$(function()
{
   var alerts = $('#pirma li').hide().fadeTo(1200, 1);
   var currentAlert = 0;
   function nextAlert()
   {
	  alerts.eq(currentAlert).fadeIn(900, nextAlert);
	  ++currentAlert;
	  $('#pirma li').fadeTo(900, 1);
	  
   }
   nextAlert();
   
});
