// JavaScript Document

function dontCap(word) {
	var result = word.match(/^www\./);
	switch (word) {
		case 'of':
		case 'the':
		case 'with':
		case 'for':
		case 'in':
		case 'on':
		case 'over':
		case 'under':
			result = true;
			break;
	}
	return result;
}

function addToTitle(page,txt) {

	var _Title = '';
	if (arguments.length>1) {
		var _words = txt.split(' ');
		for (var i=0; i<_words.length; i++) {
			_Title += dontCap(_words[i])?_words[i]:_words[i].charAt(0).toUpperCase() + _words[i].substr(1,_words[i].length-1);
			if (i != _words.length-1) _Title += ' ';
		}
	}
	
	top.document.title = 'Jake Watson - '+fullTitle(page)+(_Title!=''?' - '+_Title:'');
}

function fullTitle(page) {
	var pageTitle;
	if (page == 'post') pageTitle = 'Post Production';
	else if (page == 'web') pageTitle = 'Web Design';
	else pageTitle = page.charAt(0).toUpperCase()+page.substr(1,page.length-1);
	return pageTitle;
}
