convert = {
	projectPhotos: function() {
		var links = $('#content .thumbs a');
		
		if (links.length > 1) {
			links.click(function() {
				var index = links.index(this);
				var photo = $('#content .photos .photo:eq(' + index + ')');
				convert.showPhoto(photo, links, $(this), true);
				document.location = this.href;
				
				// don't activate unless the photo is hidden
				// if (photo.is(':hidden')) {
				// 	links.removeClass('selected');
				// 	$('#content .photos .photo:visible').fadeOut();
				// 	photo.fadeIn();
				// 	$(this).addClass('selected');
				// }
				
				return false;
			});
		}
		
		// load the existing photo from location hash
		var hash = document.location.hash;
		if (hash) {
			hash = hash.substring(1) - 1;
			
			var photo = $('#content .photos .photo:eq(' + hash + ')');
			var link = $('#content .thumbs li:eq(' + hash + ') a');
			convert.showPhoto(photo, links, link, false);
			
			// if (photo.is(':hidden')) {
			// 	$('#content .photos .photo:visible').hide();
			// 	photo.show();
			// }			
		}
	},
	
	showPhoto: function (photo, links, link, animate) {
		if (photo.is(':hidden')) {
			links.removeClass('selected');
			
			if (animate) {
				$('#content .photos .photo:visible').fadeOut();
				photo.fadeIn();
			} else {
				$('#content .photos .photo:visible').hide();
				photo.show();
			}
			
			link.addClass('selected');
		}
	},
	
	contact: function() {
		convert.input('#f1', 'Your Message');
		convert.input('#f2', 'Your Name');
		convert.input('#f3', 'Your Email Address');
	},
	
	input: function(elem, defaultText, preventDefault) {
		var elem = $(elem);
		var preventDefault = preventDefault == null ? 'blank' : preventDefault;
		var hintClass = 'input-hint';

		if (elem.length > 0) {
			var input = elem.get(0);

			// make sure we're dealing w/ an input field
			var tagName = input.tagName.toLowerCase();
			if ((tagName == 'input' && input.type == 'text') || (tagName == 'textarea')) {

				// load up the default text if nothing is in the field
				var val = $.trim(elem.val());
				if (val === '') {
					elem.val(defaultText);
					elem.addClass(hintClass);
				} else if (val == defaultText) {
					elem.addClass(hintClass);
				}

				// show our default text if there is nothing in the field
				elem.blur(function() {
					if ($.trim(this.value) === '') {
						this.value = defaultText;
						elem.addClass(hintClass);
					}
				});

				// hide our default text when input is clicked
				elem.focus(function() {
					if (this.value == defaultText) {
						this.value = '';
					}
					elem.removeClass(hintClass);
				});

				// prevent form from submitting when default value exists in header site search only - otherwise it submits default text
				if (preventDefault === true || preventDefault == 'blank') {
					form = $(elem.get(0).form);
					if (form) {
						form.submit(function(event) {
							if ($.trim(elem.val()) == defaultText || $.trim(elem.val()) == "") {
								if (preventDefault === true) {
									event.preventDefault();
									elem.focus();
								} else {
									elem.val('');
								}
							}
							return true;
						});
					}
				}
			}
		}
	},
	
	oldBrowserCheck: function() {
		if ($.browser.msie && parseInt($.browser.version) < 7)
			$('body').prepend('<div id="old-browser">Looks like you\'re using an older version of Internet Explorer. For the best experience, please consider upgrading to a newer browser. - <a href="http://www.getfirefox.com/" target="_blank">Firefox</a> / <a href="http://www.apple.com/safari/download/" target="_blank">Safari</a> / <a href="http://update.microsoft.com/" target="_blank">Internet Explorer</a></div>');
	}
}