jQuery.noConflict();
(function($) {
/*	$(function(){
		function adaptLayout() {
			window_width = $(window).width();
			if (window_width >= 1280) {
				$(document.body).addClass('wide');
				$('<link id="grid1200" rel="stylesheet" type="text/css" href="css/grid1200.css" />').appendTo('head');
			} else {
				$(document.body).removeClass('wide');
				$('#grid1200').remove();
			}
		}
		$(window).resize(function(){
			adaptLayout();
		});
		adaptLayout();
	});*/
	/* SERVIES PAGE */
	$(function(){
		var services_section  = $('section.services');
		var services_slider   = $('.slider', services_section);
		var services_next     = $('<div class="next">►</div>').prependTo(services_section);
		var services_nav      = $('<nav />').prependTo(services_section);
		var services_navlist  = $('<ul />').prependTo(services_nav);
		var services_articles = $('article', services_section);

		services_articles.each(function(i){
			id = $(this).attr('id');
			h2Text = $('h2', this).text();
			new_li = $('<li data-rel="'+id+'">'+h2Text+'</li>').appendTo(services_navlist);
			if (i == 0) {
				new_li.addClass('active');
			}
		})

		$('li', services_nav).click(function(){
			if ($(this).hasClass('active')) return false;

			$('li', services_nav).removeClass('active');
			$(this).addClass('active');

			pos = $('#'+$(this).attr('data-rel')).position();
			services_slider.stop().animate({left: -pos.left}, 300);

			return false;
		});

		services_next.click(function(){
			if ($('li:last', services_nav).is('.active', services_nav)) {
				$('li', services_nav).eq(0).trigger('click');
			} else {
				$('.active', services_nav).next().trigger('click');
			}
		});

		if (document.location.hash) {
			hash = document.location.hash;
			hash = hash.replace('#goto', 'service');
			$('li[data-rel="'+hash+'"]').click();
		}
	});
})(jQuery);
