jQuery(document).ready(function($){
	var $topOffset = 70;
	
	if(is_blog_page){
		$('#menu-item-10 a').html('Ideas');
	} else if (!navigator.userAgent.match(/iPhone/i) && !navigator.userAgent.match(/iPad/i) && !navigator.userAgent.match(/Android/i) && !navigator.userAgent.match(/Blackberry/i) && !navigator.userAgent.match(/WebOs/i)) { // detect mobile browser
      
		$(window).scroll(function(){
	        var aOffset = $('#header').offset();
	
	        if($(window).scrollTop() > $topOffset) {
	            $('#header').addClass('fixed');
	        }else{
	            $('#header').removeClass('fixed');
	        }
		});
		
		$('#menu-item-10 a').html('<span id="ideas">idea</span><span>s</span>')
		.children('span:first-child').css('width', '3px').css('right', '17px');
		
		
		$('#menu-item-10 a').hover(
			function() {
				$('#ideas').animate({ width: '27' }, {duration:400, queue:false});
			},
			function() {
				$('#ideas').animate({ width: '3' }, {duration:400, queue:false});
			}
		);
	
	}
	
	if(typeof(slider_enabled)!='undefined'){
		cur_slide = 0;
		if(!no_cats) cur_cat = $('#slide_cats li.cur').attr('id').substr(1);
		
		$('#port_slides li.nav').click(function(){
			var dir = $(this).hasClass('left') ? -1 : 1;
			var new_slide = cur_slide+dir;
			if(new_slide<0) new_slide = last_slide;
			else if(new_slide>last_slide) new_slide = 0;
	
			switch_slide(new_slide);
		});
		
		if(!no_cats){
			$('#slide_cats li').click(function(){
				switch_slide($('#port_slides li.c'+$(this).attr('id').substr(1)+':first').attr('id').substr(1));
			});
		}
		
		switch_slide = function(id){
			id=parseInt(id);
			$('#s'+cur_slide).fadeOut();
			$('#s'+id).fadeIn();
			
			if(!no_cats){
				new_cat = $('#s'+id).attr('class').substr(1);
				$('#c'+cur_cat).removeClass('cur');
				$('#c'+new_cat).addClass('cur');
			
				cur_cat = new_cat;
			}
			
			cur_slide = id;
		}
	}
	
	
	
});
