//<![CDATA[


	var search_default_text = 'Search';	// default search box text
	
	// --------------------------------------------------------------------------

	document.writeln('<script type="text/javascript" src="'+page.baseHref+'/js/swfobject.2.0.js"></script>');

 
	// --------------------------------------------------------------------------

	
	$(document).ready(function() {
		// enable search field default text behavior
		$('input#searchFormField').focus(function() {
			if(this.value==search_default_text) {
				$(this).removeClass('default_text');
				this.value = '';
			}
		});		
		$('input#searchFormField').blur(function() {
			if(this.value==search_default_text || !this.value.length) {
				$(this).addClass('default_text');
				this.value = search_default_text;
			}
		});
		
		
		// enable IE hover-like menu behavior
		$('ul#menu li').mouseover(function() {
			$(this).addClass('hover');
		});
		$('ul#menu li').mouseout(function() {
			$(this).removeClass('hover');
		});
		
		
		// enable video popups
		$('div.video_content a.toggle').click(function() {
			// find the first parent that is div.video_content and act on its popup; this allows us to trigger the toggle from any element within the .video_content block
			$(this).parents('div.video_content').find('div.popup').toggle().each(function() {
				switch($(this).css('display')) {
					case 'block':
							/* create video object based on path in .video_path */
							details = $(this).find('div.video_path').html().split('|');
							path = details[0];
							width = details[1];
							height = details[2];
							swf_version = details[3];
							
							v_id = 'video_' + Math.floor(Math.random()*1000);
							$(this).find('div.popup_content').prepend('<div class="video"><div class="video_content" id="' + v_id + '"></div></div>');
							
							if(!swfobject.embedSWF(path, v_id, width, height, swf_version, '/swf/expressInstall.swf', {}, {wmode:'transparent', allowScriptAccess:'always', menu:false})) {
								$('div#' + v_id).html('<p><em>There was an error initializing the movie.</em></p>');
							}
					break;					
					case 'none':					
						/* clean up video object when closing popup */
						$(this).find('div.popup_content div.video').remove();
					break;
				}
			});
			
			return false;
		});
		
		
		// convert span.email_address to mailto links, using name attribute; for example: <span class="email_address" name="foo-at-bar-dot-com">Email Us</span>; if innerHTML is blank, the email addy will be used
		$('span.email_address').each(function(e) {
			c = $(this).hasClass('actionable') ? ' class="actionable"' : '';
			if($(this).html().length) {
				$(this).wrapInner('<a href="mailto:' + $(this).attr('name') + '"' + c + '></a>');
			} else {
				$(this).html('<a href="mailto:' + $(this).attr('name') + '"' + c + '>' + $(this).attr('name') + '</a>');
			}
			$(this).html($(this).html().replace(/-dot-/g, '.').replace(/-at-/g, '@'));
		});
	});


  // --------------------------------------------------------------------------

  function printPage() {
    if (window.print) {
      window.print();
    } else {
      alert(page.noPrintMessage);
    }
  }


  
//]]>
