$(document).ready(function(){
	$("[rel=cbox]").colorbox({ 'maxWidth': "95%", 'maxHeight': "95%", 'photo': true, 'scalePhotos': true, 'scrolling' : false });
	
	$(".popup").colorbox({ 'iframe' : true, 'width' : '300', 'height' : '400', 'opacity' : '0.3', 'scrolling' : false,
	onComplete		: function(){
    	var elem = $(this);
//    	console.log(elem.attr("title"));
    	if(elem.attr("title") == undefined){
    		$("#cboxTitle").hide();
    	}
    	var allElems = $("a[rel='cbox']");
    	if(allElems.index(elem) == allElems.length-1)
    	{
    		$("#cboxNext").hide();
    		$("#cboxPhoto").unbind("click")
    		$("#cboxPhoto").click(function(){
    			$.fn.colorbox.close();
    		})
    	}
    	if(allElems.index(elem) == 0)
    	{
    		$("#cboxPrevious").hide();
    	}
    }
	 });
	

	// right-bar comments-bar ...
	$(".comment-box-navi").tabs(".comment-box-pane",{
		effect	: "fade",
		current : "active"
	});
	
	//index daily
	$(".news-links").tabs(".daily-pane",{
		current : "active",
		effect	: "fade",
		tabs: "li",
		rotate: true
	}).slideshow({
		autoplay	: true,
		interval	: 10000,
		clickable:false
	});
	//featured events
	$(".events-navi").tabs(".events-holder .side-block",{
		current : "active",
		effect	: "fade",
		tabs: "li",
		rotate: true
	}).slideshow({
		autoplay	: true,
		interval	: 7000,
		clickable:false
	});

	//tooltips
//	$(".tip").tooltip({ predelay: 200, opacity: .9});
})
