//$.backstretch("/pub/local/img/bg.jpg", {speed: 1});

$(document).ready(function() {
    //$(document).pngFix();

    if (jQuery.browser.msie) {
 
    } else {
        $.backstretch("/pub/local/img/bg.jpg", {speed: 1});
        $('#mainBar, .box, h2, #nav a, input, textarea').corner("5px");
    }

    
    
    if($('div').hasClass('tabbox')) {
        $("#tabs").tabs({
            fx: {
                opacity: 'toggle'
            }
        });
        if(document.location.hash!='') {
    			//get the index from URL hash
    			tabSelect = document.location.hash.substr(1,document.location.hash.length);
    			$("#tabs").tabs('select',tabSelect-1);
    		}
    }
    
     
    $("#links").live("click", function(){

        var content;
        var get_media = '?json=m_media&showAll=1&identifier=media';
        $.fancybox.showActivity();

        $.ajax({
            type: 'POST',
            url: get_media,
            dataType: "json",
            success: function(data) {

                content = '';
                $.each(data,function(i,item){
                    var formatDate = item.Date.split("-");
                    content =  content + '<div class="article"><h3><a title="' + item.Title + '" target="_blank" href="' + item.Link + '">' + item.Title + '</a></h3><em class="date">' + formatDate[2] + '. ' + formatDate[1] + '. ' + formatDate[0] + ' | Autor: ' + item.Author + '</em><p>' + item.Description + '</p></div>';
                });
                $.fancybox(content,
                {
                    'autoDimensions' : false,
                    'width'          : 450,
                    'height'         : 'auto'
                }
                );
            }
        });
        return false;
    });
    
    
$("ul.ytslider").ytplaylist({addThumbs:true, autoPlay: false, holderId: 'ytvideo'});
$("ul.ytslider li:nth-child(3n)").addClass("nooffset");
    
    // youTube link
    $(".youtube").click(function() {
    	$.fancybox({
    			'padding'		: 0,
    			'autoScale'		: false,
    			'transitionIn'	: 'none',
    			'transitionOut'	: 'none',
    			'title'			: this.title,
    			'width'		: 680,
    			'height'		: 495,
    			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
    			'type'			: 'swf',
    			'swf'			: {
    			   	'wmode'		: 'transparent',
    				  'allowfullscreen'	: 'true'
    			}
    		});
    
    	return false;
    });

    // countdown

    $.countdown.regional['sk'] = {
        labels: ['Rokov', 'Mesiacov', 'Týždňov', 'Dní', 'Hodín', 'Minút', 'Sekúnd'],
        labels1: ['Rok', 'Mesiac', 'Týždeň', 'Deň', 'Hodina', 'Minúta', 'Sekunda'],
        labels2: ['Roky', 'Mesiace', 'Týždne', 'Dni', 'Hodiny', 'Minúty', 'Sekundy'],
        compactLabels: ['r', 'm', 't', 'd'],
        whichLabels: function(amount) {
            return (amount == 1 ? 1 : (amount >= 2 && amount <= 4 ? 2 : 0));
        },
        timeSeparator: ':', isRTL: false};
    $.countdown.setDefaults($.countdown.regional['sk']);
    
    var d1 = new Date("March 10, 2012 07:00:00")
    $('#defaultCountdown').countdown({until: d1});


});




