jQuery(document).ready( function(){
	
	jQuery('#Form_TalkForm_action_SendTalkForm').click(function() {
		if (jQuery('#Form_TalkForm_AgreeTC').attr('checked')) {} else {
			jQuery('#AgreeTC').append(jQuery('<div class="specialValidationError">Please agree to the Terms and Conditions by checking the box above</div>'));
			return false;
		}
	});
	
	jQuery('#SearchForm_SearchForm_Search').val('');
	
	jQuery('.talkMessage, .advocacyMessage').click(function() {
		jQuery(this).fadeOut();
	});
	
	jQuery('#TCPP').click(function(event) {
		event.stopPropagation();
		window.open('terms-and-conditions/','Terms and Conditions &amp; Privacy Policy','width=500,height=400,scrollbars=yes');
		return false;
	});
	
	jQuery('#ResourceQuickSearch ul li').quicksearch({
		position: 'prepend',
		attached: '#ResourceQuickSearch',
		loaderText: '',
		delay: 100
	})
	
	jQuery('.tight .text label, .tight .textarea label').click(function() {
		jQuery(this).next().children().focus();
	});
	jQuery('.tight input.text, .tight textarea').focus(function() {
		jQuery(this).parent().prev('label').fadeOut('slow');
	}).blur(function() {
		if (jQuery(this).val() == '') {
			jQuery(this).parent().prev('label').fadeIn();
		}
	});
	jQuery('#MemberLoginForm_LoginForm #Email label').text('Username');
	jQuery('#TalkLoginForm #Email label, #TalkSignUpForm #Email label').text('Email');
	
	
	jQuery("#RightImages a").fancybox(); 
	jQuery("#HighlightedImage a").fancybox(); 
	
	jQuery('#Content a').each(function() {
		var fileURL = jQuery(this).attr('href');
		if (fileURL) {
			if (fileURL.match(".doc")) {
				jQuery(this).addClass('file');
				jQuery(this).css('background','transparent url(mysite/images/icons/icon_doc.gif) no-repeat scroll 0 0');
			}
			if (fileURL.match(".pdf")) {
				jQuery(this).addClass('file');
				jQuery(this).css('background','transparent url(mysite/images/icons/icon_pdf.gif) no-repeat scroll 0 0');
			}
		}
	});
	jQuery('#Content a.readMore.file').css('background','none');
});