/**
 * @package 
 * @author {@link mailto:ss@toolboxstudios.com Steve Simons, Toolbox Studios, Inc.}
 * @license http://toolboxstudios.com Contact about usage
 * @revision $Revision: $
 * @copyright Copyright 2010
**/


jQuery(document).ready( function() {
	jQuery('form.subscribeTC input[name=ea], form.searchTC input[name=s]')
		.focus( function(e) {
			if ( this.defaultValue == this.value)
				this.value = '';
			this.select();
		})
		.blur( function(e) {
			if ( this.value.replace(/\s/g, '') == '')
				this.value = this.defaultValue;
		});
	jQuery('form.subscribeTC input[name=ea][value=]')
		.attr( 'value', 'Enter Email to Subscribe')
		.attr( 'defaultValue', 'Enter Email to Subscribe');
		
	jQuery('form.subscribeTC')
		.submit( function(e) {
			var email = this.ea;
			if ( email.defaultValue == email.value)
				alert( 'Enter your email address');
			else if ( !email.value.match(/^\s*[\w\._-]+@([\w_-]+\.)+\w+\s*$/))
				alert( email.value + ' does not appear to be a valid email address');
			else {
				return true;
			}
			e.stopPropagation();
			return false;
		});

	jQuery('form.searchTC input[name=s][value=]')
		.attr( 'value', 'Search ThinkConnectivity')
		.attr( 'defaultValue', 'Search ThinkConnectivity');
	jQuery('form.searchTC')
		.submit( function(e) {
			var s = this.s;
			if ( s.defaultValue == s.value)
				alert( 'Enter something to search');
			else {
				return true;
			}
			e.stopPropagation();
			return false;
		});
	
	
	if ( jQuery( '#topNav li.curMenu').length == 0)
		jQuery( '#topNav li.pageNav.page26')
			.addClass( 'curMenu');
});
