$(document).ready(function () {
  Shadowbox.init({overlayOpacity: 0.9, initialWidth: 10, initialHeight: 10, animSequence: "sync", handleOversize: "resize"});
  $('#navMenu li').append('<div class="hover"><\/div>');
  $('#navMenu li').children('div').css({"opacity": "0"});
  $('#navMenu li').hover(
    function() {
      $(this).children('.bt').css({color: "#000000"})
      $(this).children('div').stop().animate({"opacity": "1", width: "100%"}, 400);
    },
    function() {
       $(this).children('.bt').css({color: "#FFFFFF"})
      $(this).children('div').stop().animate({"opacity": "0", width: "100%"}, 300);
    }
  );
  
  $('.sidebar a').each(function(){
	  var link = window.location.toString();
	  var a_link = $(this).attr("href");
  
  	if(link.indexOf(a_link) > 0){
		  //alert(a_link + " --- " + link);
  		$(this).addClass('apasat');
  	};
  });
  
  /*
  $('a.continuare').click(function() {
    var $s = $(this).parent().children('.articol').html();
    var $h = $(this).parent().children('.articol').height();
    var $w = $(this).parent().children('.articol').width();
    Shadowbox.open({
        content:    "<div style='color: #ffffff; font-size: 14px; padding: 10px'>" + $s + "</div>",
        player:     "html",
        title:      "",
        height:     $h+20,
        width:      $w+20
    });      
  });
  */
  
  
  $('#continuare1').click(function() {
	  var $s = $('#newsArticle1').children('.articol').html();
	  var $h = $('#newsArticle1').children('.articol').height();
	  var $w = $('#newsArticle1').children('.articol').width();
	  
	  Shadowbox.open({
	        content:    "<div style='color: #ffffff; font-size: 14px; padding: 10px'>" + $s + "</div>",
	        player:     "html",
	        title:      "",
	        height:     $h+20,
	        width:      $w+20
	    });
  });
  
  
  $('#continuare2').click(function() {
	  var $s = $('#newsArticle2').children('.articol').html();
	  var $h = $('#newsArticle2').children('.articol').height();
	  var $w = $('#newsArticle2').children('.articol').width();
	  
	  Shadowbox.open({
	        content:    "<div style='color: #ffffff; font-size: 14px; padding: 10px'>" + $s + "</div>",
	        player:     "html",
	        title:      "",
	        height:     $h+20,
	        width:      $w+20
	    });
  });
  
  	

    /* realizat din php acum
	$('.articol_mic').each(function(){
 		
		if($(this).parent().children('.articol').html().length > 250){
			$(this).html($(this).parent().children('.articol').html().substring(0,250) + " [...]");
		}
		else {
			$(this).html($(this).parent().children('.articol').html());
			$(this).parent().children('.continuare').hide(); 
		}
	});
	*/
	
	
	/*
	$('a[rel^="ext\\:"]').click(function(){
		window.open($(this).attr('rel').substring(4));
	});
	*/
	
	//$(document).ready(function() {

	//Default Action
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //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 rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
	
	$(".logoLink").click(function(){window.location = "/"});
	
	var r = Math.floor(Math.random() * 3)+1;
	$('#vox').css("background", "url('/images/fnou/header/poza" + r + ".jpg') 0px 60px no-repeat");
	/*
	$('#vox').everyTime(30000,function(i) {
		var r = Math.floor(Math.random() * 12)+1;
		$('#vox').css("background", "url('/images/fnou/header/img_" + r + ".jpg') 0px 60px no-repeat");
	});*/
	
	
	$('.ttab').click(function(){
		if($(this).children('.tContent').is(':hidden')){
			$('.tContent').slideUp('normal');
			$(this).children('.tContent').slideDown('slow');
		}
		else{
			$('.tContent').slideUp('normal');
		}
	})
	
});
