$(document).ready(function(){

	//HOME
	$('body.home').append('<p id="home_floating"></p>');
	$('body.home p#home_floating').hide();	

	$('body.home #main').mousemove(function(e) {
		var offset = $('#main').offset();
		$('p#home_floating').css('top',e.pageY).css('left',e.pageX + 20);	
	})
	
	$('body.home #main a').hover(function() {
		var category = $(this).attr('rel');
		$('body').append('<p id="home_floating"></p>');
		$('p#home_floating').html('from <em>' + category + '</em>').fadeIn('fast');
	}, function() {
		$('p#home_floating').remove();
	})

	//EMPTY GRAFS



	//MENU WHERE R U
	var pageClass = $('body').attr('class');
	$('body:not(#blog) #sidebar ul li.' + pageClass + ' a').addClass('current');

	//MENU PROJECT HOVERS
	$('#sidebar ul li.list ul li:not(.current) a').hover(function() {
		$(this).parent().addClass('hovering');
	}, function() {
		$(this).parent().removeClass('hovering');
	})

	//NEW WINDOW PROJECTS
	//$('.projects #main ul.new_window li a').click(function(){
		//var window_width = $('body').width();
		//var window_title = $(this).attr('title');
		//var window_href = $(this).attr('href');
		//window.open(window_href, window_title,"toolbar=0,location=0,menubar=0,scrollbars=1,height=900");
		//return false;
	//})

	//PROJECT LINK
	var default_project = $('#sidebar ul li.list ul li:first a').attr('href');
	$('#sidebar ul li.projects a').attr('href',default_project);

	//THUMBNAIL PAGE
	$('body.projects #main .page-content h2 + ul').addClass('no_description');

	//PHOTO DISPLAY
	var image_width = $('body.projects #main .large_image img').width();
	if (image_width < 300) {
		$('body.projects #main .large_image').css('width','300px');
	}//close if
	else {
		$('body.projects #main .large_image').css('width',image_width);
	}

	$('body.projects #main .large_image img').load(function() {
		var image_width = $('body.projects #main .large_image img').width();
		if (image_width < 300) {
			$('body.projects #main .large_image').css('width','300px');
		}//close if
		else {
			$('body.projects #main .large_image').css('width',image_width);
		}
	})

	//IPHONE MENU 
		$('#iphone_menu_link').click(function() {
			$('#iphone_footer #iphone_footer_menu').show ();
			$('#iphone_footer #iphone_footer_projects').hide();			
		})
		
		$('#iphone_footer #iphone_footer_main li.projects a').click(function() {
			$('#iphone_footer #iphone_footer_main').hide ();
			$('#iphone_footer #iphone_footer_projects').show();
			return false;
		})

});

