$(document).ready(init);
function init()
{
	$('.winblogrollcat').children('ul').hide();
	$('.winblogrollcat .trigger').click(function(evt){
		$(this.parentNode).children('ul').slideToggle('fast');
	});
   $('.carousel ul').cycle({'prev':'.previous','next':'.next','play':'.play','pause':'.pause'});

$('.share_mod').click(function() {
    e.stopPropagation();
})

var prButton = $('#pr_box_button');
var prText = $('#pr_text');
prButton.click(function(){
	if(prText.is(':visible'))
		{
		prText.fadeTo('fast',0,function(){
			prText.slideUp('fast');
			});
		}
	else
		{
		prText.fadeTo('fast',0).slideDown('fast',function(){
			prText.fadeTo('fast',1);
			});
		}
});

$(function(){
    var isItOn = 0;
    $('li.share a.trigger').click(function() {
        var thisIndex = $('li.share a.trigger').index(this);
        if($('.share_mod:eq('+thisIndex+')').is(":hidden"))
            {
            $('.share_mod').eq(thisIndex).show();
            $('.share_close').eq(thisIndex).show();
            $('.share').eq(thisIndex).css("background","#ddd");
            }
        else
            {
            $('.share_mod').eq(thisIndex).hide();
            $('.share_close').eq(thisIndex).hide();
            $('.share').eq(thisIndex).css("background","#fff");
            }
        return false;
        preventDefault();
    });
    $(document).click(function(){  
        $('.share_close').hide();
        $('.share_mod').hide();
        $('.share').css("background","#fff");
        isItOn = 0;
    });
}); 
}


/*
jQuery cycling slider
*/

(function( $ ){

	$.fn.cycle = function( options )
	{
		var o = {
			itemsVisible:1,
			duration:300,
			autoNext:15000
		}
		$.extend(o, options);
		return this.each(function(){

			var itemsVisible = o.itemsVisible;
			var duration = o.duration; // milliseconds for animation

			var pt = $(this);
			pt.children().clone().appendTo(pt); // duplicate the list

			var items = pt.children('li');
			var count = items.length;
			var w = items.eq(0).width(); // grab the width of the first item
			var current = count /2;

			pt.width( w * itemsVisible ); // set the container to the width of the first item times the number of items
			pt.height( items.eq(0).height() ); // set the container to the height of the first item

			items.each(function(idx){
				$(this).css({'position':'absolute', 'top':'0', 'left':w * idx});
			});

			$.scrollTo.defaults.axis = 'x';
			pt.scrollTo( w * current );//reset the screen to (0,0)



			var offsetWidth = pt[0].offsetWidth;
			if(o.prev)
			{
				$(o.prev).click(function(){
					clearInterval(timer);
					function after (){
						current--;
						if(current == 0)
						{
							current += count/2;
							pt.scrollTo( w * current );
						}
						timer = startTimer();
					}

					pt.scrollTo('-=' + (w) + 'px', duration, {onAfter:after});
					return false;
				});
			}

			if(o.next)
			{
				$(o.next).click(gotoNext);
			}

			function gotoNext()
			{
				clearInterval(timer);
				function after (){

					current++;
					if(current == (count - itemsVisible))
					{
						current -= count/2;
						pt.scrollTo( w * current );

					}
					timer = startTimer();
				}

				pt.scrollTo('+=' + (w) + 'px', duration, {onAfter:after});
				return false;
			}

			function startTimer()
			{
				return setInterval(gotoNext, o.autoNext);
			}

			var timer = startTimer(); // timer

			// if a play AND pause button are specified, set up separate handlers
			if(o.play && o.pause)
			{
				$(o.play).click(gotoNext);

				$(o.pause).click(function(){
					clearInterval(timer);
					return false;
				})
			}

			// if a play button is specified with no pause button, create a toggle
			if(o.play && !o.pause)
			{
				$(o.play).click(function()
				{

					if(timer)
					{
						clearInterval(timer);
						timer = null;
					}else{
						gotoNext();
					}
					return false;
				});
			}

		});

	}

})( jQuery );


;(function($){$.scrollTo=function(target,duration,settings){$($.browser.safari?'body':'html').scrollTo(target,duration,settings)};$.scrollTo.defaults={axis:'y',duration:1};$.fn.scrollTo=function(target,duration,settings){if(typeof duration=='object'){settings=duration;duration=0}settings=$.extend({},$.scrollTo.defaults,settings);if(!duration)duration=settings.speed||settings.duration;settings.queue=settings.queue&&settings.axis.length==2;if(settings.queue)duration=Math.ceil(duration/2); if(typeof settings.offset=='number')settings.offset={left:settings.offset,top:settings.offset};return this.each(function(){var elem=this,$elem=$(elem),t=target,toff,attr={},win=$elem.is('html,body');switch(typeof t){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(t)){t={top:t,left:t};break}t=$(t,this);case'object':if(t.is||t.style)toff=(t=$(t)).offset()}$.each(settings.axis.split(''),parse);animate(settings.onAfter);function parse(i,axis){var Pos=axis=='x'?'Left':'Top',pos=Pos.toLowerCase(),key='scroll'+Pos,act=elem[key];if(toff){attr[key]=toff[pos]+(win?0:act-$elem.offset()[pos]);if(settings.margin){attr[key]-=parseInt(t.css('margin'+Pos))||0;attr[key]-=parseInt(t.css('border'+Pos+'Width'))||0}if(settings.offset&&settings.offset[pos])attr[key]+=settings.offset[pos]}else{attr[key]=t[pos]}if(/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max(axis));if(!i&&settings.queue){if(act!=attr[key])animate(settings.onAfterFirst);delete attr[key]}};function animate(callback){$elem.animate(attr,duration,settings.easing,function(){if(callback)callback.call(this,$elem,attr,t)})};function max(axis){var el=win?$.browser.opera?document.body:document.documentElement:elem,Dim=axis=='x'?'Width':'Height';return el['scroll'+Dim]-el['client'+Dim]}})}})(jQuery);