$(document).ready(function() {
	
	// open links in new window
	$("a[rel='external']").attr("target","_blank");
	
	// show/hide field labels	
	$('fieldset').addClass('js');               // attached styling class for js capable browsers	
	$('select').prevAll('.label_wrap').children('label').hide();  // hide select field labels for js capable browsers
	
	$('input.inputText').each(function(){
		if( $(this).attr('value') != '' ){			
			$(this).parent('span').prev().children('label').hide();				
		}													 
	});
	
	$('textarea.inputArea').each(function(){
		if( $(this).attr('value') != '' ){			
			$(this).prev().children('label').hide();				
		}													 
	});		
	
	$('input.inputText').focus(function(){										
		$(this).parent('span').prev().children('label').hide();
	}).blur(function(){		
		if( $(this).attr('value') == '' ){
			$(this).parent('span').prev().children('label').show();
		}
	});
	
	$('textarea.inputArea').focus(function(){										
		$(this).prev().children('label').hide();
	}).blur(function(){		
		if( $(this).attr('value') == '' ){
			$(this).prev().children('label').show();
		}
	});
	
	// input button rollovers
	var btn_src = null;
	$('input.button').hover(
	  function () {			  	
		btn_src = $(this).attr("src");
		btn_src = btn_src.substring(0, btn_src.length-4);		  
		btn_src_over = btn_src + '-over.gif';		
		btn_src += '.gif'; // re-attached the extension				
		$(this).attr({
			src: btn_src_over
		});
	  }, 
	  function () {		
		$(this).attr({
			src: btn_src
		});
	  }		  
	);
	
	
	// security question dropdown
	if( $('.select_security').length > 0 ){
		$('.select_security').selectbox({
		   containerClass : 'selectbox-wrapper2',
		   inputClass: 'selectbox_security'
		});	
	}
	
	
	
});
