
function changeIp(step){
	var divy = $('ipbox').getChildren();
	var current = undefined;

	divy.each(function(subItem, subIndex){
		
		if (subItem.id == 'ipactive' )
		{
			var i = subIndex+step;
			if (i < 0 || i > divy.length - 1)
			{
				step = 0;
			}
			current = subIndex;

			
		}
	});

	if (divy[current+step].id != 'ipactive')
	{
			divy[current].id = '';
			divy[current].removeClass('ipshow');
			divy[current].addClass('hide');
			divy[current].fade(0);

			var next = divy[current+step];
			next.id = 'ipactive';
			next.removeClass('hide');
			next.addClass('ipshow');
			next.setStyle('opacity', 0);

			next.fade(1);
	}

}

function readmore(id){

	if ($('linknews' + id).innerHTML == 'czytaj całość')
	{
		$('news' + id).fade(0)
		$('news' + id).addClass('hide');
		$('news' + id).setStyle('opacity', '100');

		$('newsfull' + id).removeClass('hide');
		$('newsfull' + id).setStyle('opacity', '0');
		$('newsfull' + id).fade(1);

		$('linknews' + id).innerHTML = 'zwiń';
	}
	else
	{
		$('newsfull' + id).fade(0);
		$('newsfull' + id).addClass('hide');
		$('newsfull' + id).setStyle('opacity', '100');

		$('news' + id).removeClass('hide');
		$('news' + id).removeClass('hide');
		$('news' + id).fade(1);

		$('linknews' + id).innerHTML = 'czytaj całość';
	}
	
}

window.addEvent('domready', function(){

	/*var m = Cookie.read('menu');
	if (m == null)
	{
		m = '1';
	}
	$$('.menutd a').removeClass('menuatext');
	$('amenu'+m).addClass('menuatext'); 

	$('amenu'+m).getParent().addClass('tdactive'); */
	
	$$('.menutd').addEvents({
		mouseenter: function(){
			this.addClass('tdactive');
		},
		mouseleave: function(){
			$$('.menutd').removeClass('tdactive');
		}
	});

});

function ofertaTips()
{
	//store titles and text
	$$('a.tipz').each(function(element,index) {
		var content = element.get('title').split('::');
		element.store('tip:title', content[0]);
		element.store('tip:text', content[1]);
	});

	//create the tooltips
	var tipz = new Tips('.tipz',{
		className: 'tipz',
		fixed: false,
		hideDelay: 50,
		showDelay: 50
	});

	tipz.addEvents({  
        'show': function(tip) {  
            tip.fade('in');  
        },  
        'hide': function(tip) {  
            tip.fade('out');  
        }  
    });  
}
