/* 
	ostatnie zmiany: 
	16:51 2008-09-03

	TODO:
	-
	-
	-
*/

$(document).ready(function() {

/* 
	box z profilowanymi wycieczkami na str. głównej
	---------------------------------------------	*/
	// !TODO: przerobić na jQuery fn (plugin)	
	(function() {	
		var parentID = '#box_boardSet'	
		var items = $(parentID+' ul.board')
		$(items).not('.active').hide()
		var current = $(parentID+' ul.board').index($('ul.active')) // - 1;	
		var toggle = function(index_old,index_new) {
			$(items[index_old]).hide()
			$(items[index_new]).show()
			//$(items).hide()
			//$(items[index_new]).show('slow')
				// !TODO: krokowo ujawniające się <LI> z góry na dół
			$(parentID+' h2 span').text( $(items[index_new]).attr("title") )		
			
		}
		
		$(parentID+' .switchers .next').click( function() {
			old = current
			if (++current > items.length-1) (current = 0)
			toggle(old,current)
		});
		
		$(parentID+' .switchers .prev').click( function() {
			old = current		
			if (--current < 0) (current = items.length-1)
			toggle(old,current)
		});
	})(jQuery)
	// ---------------------------------------------	
 

/* 
	przełączanie wyszukiwarki
	---------------------------------------------	*/
	$('a.searchtoggler').click( function () {
		$('#search').toggleClass('search_full').toggleClass('search_basic') 
		return false
	})	
	// ---------------------------------------------	

	
/* 
	IE <= 7
	---------------------------------------------	*/ 
	if ( jQuery.browser.msie && jQuery.browser.version <= 7) {
		$('#main').append('<div class="clear"></div>');
	}
	/* "poleć znajomemu" */
	var recommendform = $("#recommendform")
	var askform = $("#askform")
	var offerform = $("#offerform")
	var rezform = $("#rezform")
	
	$("#act-recommend").click( function() {		
		recommendform.show()
		//window.location = ('#up')
		rezform.hide() 	
		askform.hide()
		offerform.hide() 
	})
	$("#recommendform-close").click( function() {
		recommendform.hide()
		return false
	})
	/* "ask" */
	
	$("#act-ask").click( function() {		
		askform.show()
		//window.location = ('#up')
		rezform.hide() 	 
		recommendform.hide()
		offerform.hide()
	})
	$("#askform-close").click( function() {
		askform.hide()
		return false
	})
	
	/* "offer" */
	
	$("#act-offer").click( function() {		
		offerform.show()
		//window.location = ('#up')	
		rezform.hide() 
		recommendform.hide()
		askform.hide()
	})
	$("#act-rez").click( function() {		
		rezform.show()
		//window.location = ('#up')
		offerform.hide()	 
		recommendform.hide()
		askform.hide()
	})
})