// cultural infusion load script
jQuery(document).ready(function() {
	
	//COLLAPSIBLE SIDEBAR WIDGETS
	//initial collapse
	jQuery('#text-4 .textwidget').hide();
	jQuery('#text-3 .textwidget').hide();
	
	jQuery('h1.widgettitle').click(function() {
		var titleparent = jQuery(this).parent().get(0).id;
		
		//if h1 clicked on is one of the custom widgets...
		if (titleparent == 'sb-latestnews' || titleparent == 'sb-comingup') {
			if (jQuery('#'+titleparent+' .customwidget').is(':visible')) {
				jQuery('#'+titleparent+' .customwidget').hide();
			} else {
				jQuery('#'+titleparent+' .customwidget').show();
			}
		//if its a simple text widget...
		} else {
			if (jQuery('#'+titleparent+' .textwidget').is(':visible')) {
				jQuery('#'+titleparent+' .textwidget').hide();
			} else {
				jQuery('#'+titleparent+' .textwidget').show();
			}
		}
	});
	
	//SEARCH BOX
	//initial set text unless holding search value
	if (jQuery('input#search').val() == '' || jQuery('input#search').val() == 'search site...') {
		jQuery('input#search').val('search site...');
		jQuery('input#search').css('font-style', 'italic');
		jQuery('input#search').css('color', 'rgb(170,170,170)');
	}
	//change on focus
	jQuery("#search").focus(function(){
		if (jQuery('input#search').val() == 'search site...') {
			jQuery('input#search').val('');
			jQuery('input#search').css('font-style', 'normal');
			jQuery('input#search').css('color', 'rgb(51,51,51)');
		}
	});
	//change on blur
	jQuery("#search").blur(function(){
		if (jQuery('input#search').val() == '') {
			jQuery('input#search').val('search site...');
			jQuery('input#search').css('font-style', 'italic');
			jQuery('input#search').css('color', 'rgb(170,170,170)');
		}
	});
});
