function getCookie(name) {
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0) {
		offset = cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) {
				end = cookie.length;
			}
			setStr = unescape(cookie.substring(offset, end));
		}
	}
	return(setStr);
}

Cufon.replace('#services strong.sub, .subheadercontainer span, .just-the-way', { fontFamily: 'Just The Way You Are' });
Cufon.replace('div#follow-us, div.step-inscription h3, div.rotator-title span', { fontFamily: 'Helvetica Neue LT Std' });
Cufon.replace('.article-title, h2, .subheadercontainer h2, .project-description h3, .project-info h3, .normal-content h1,.normal-content h2,   #services h2 , .get-social, ul.step li h3,  .helvetica', { fontFamily: 'Helvetica Neue LT Std1' });
Cufon.replace('div#footercontainer h3, .thin, .aside-block h4, .project-description h4, .project-info h4, .normal-content h3, div.rotator-title b', { fontFamily: '1Helvetica Neue LT Std' });


jQuery(document).ready(function(){
	jQuery("#filters li").click(function() {

		jQuery("#filters li.active").removeClass("active");
		jQuery(this).addClass("active");
		var element_index = jQuery("#filters li").index(this);

		var filterBy = $("#filters li a").eq(element_index).attr("rel");


		var number_of_items = jQuery('ul#projects li.'+filterBy+'').length;
		obecnie_klas = filterBy;
		//calculate the number of pages we are going to have
		number_of_pages1 = Math.ceil(number_of_items/show_per_page);

		var navigation_html = '<ul class="page align-right"><li class="page-left"><a href="javascript:javascript:previous();" title="prev" id="mcprev">Prev</a></li>';
		var current_link = 0;
		while(number_of_pages1 > current_link){
			navigation_html += '<li class="page-page"><a href="javascript:go_to_page(' + current_link +')" longdesc="' + current_link +'">'+ (current_link + 1) +'</a></li>';
			current_link++;
		}
		navigation_html += '<li class="page-right"><a href="javascript:next();" title="next" id="mcnext">Next</a></li></ul>';

		jQuery('.page_navigation').html(navigation_html);

		//add active_page class to the first page link
		jQuery('.page_navigation li.page-page:first').addClass('active');

		//hide all the elements inside content div
		jQuery('ul#projects li').css('display', 'none');

		//and show the first n (show_per_page) elements
		jQuery('ul#projects li.'+filterBy+'').slice(0, show_per_page).css('display', 'block');

		go_to_page(0);

	});
});



jQuery(function(){
	jQuery('a.new-window').click(function(){
	           window.open(this.href);
 		return false;
	 });
});
