function openWindow(url) {
	window.open(url,this.target,'width=800,height=660,left=119,top=100,scrollbars,toolbar'); 
}

$(document).ready(function() {
	
	var url = 'portfolio.php?slide=hamilton';
	
	// Open portfolio window
	$('.new').click(function(event) {
		event.preventDefault();
		url = $(this).attr('href');
		openWindow(url);
	});
	
	// Hide all other slides
	$('ul.port li').not('#start').hide();
	
	var index = 1;
	
	// Next slide
	$('#prev').click(function(event) {
		event.preventDefault();
		$('ul.port li').hide();
		if(index >= 2) {
			index = index - 1;
		} else {
			index = 5;
		}
		var next = '#slide' + (index);
		$(next).show();
	});
	
	// Previous slide
	$('#next').click(function(event) {
		event.preventDefault();
		$('ul.port li').hide();
		if(index <= 4) {
			index = index + 1;
		} else {
			index = 1;
		}
		var next = '#slide' + (index);
		$(next).show();
	});
	
	// Clear contact form fields
	$('.text').one("focus", function() {
	  $(this).val("");
	});
	$('#comments').one("focus", function() {
	  $(this).val("");
	});
	
	
});
