$(document).ready(function(){

	/* clear inputs */

	$('input.text').focus(function(){
		$(this).attr('value','');
	});

	/* some additional classes */
	$(function(){
		$('fieldset:last').addClass('fieldset-last');
		$('.grid-content-secondary h3:first').addClass('first');
	
	});

	/*hover for ie */

	$('input.submit').hover( function(){
		$(this).addClass('over');
	},
	function(){
		$(this).removeClass('over');
	});
	
	$('tr').hover( function(){
		$(this).addClass('over');
	},
	function(){
		$(this).removeClass('over');
	});
	$('.grid-content-secondary h4').hover( function(){
		$(this).addClass('over');
	},
	function(){
		$(this).removeClass('over');
	});

	/* stripe table */

	$('.results tr:even').addClass('even');
	$('.results tr:odd').addClass('odd');

	/* toggle  */
	
	$(function(){
		$('div.info').hide();
		$('.grid-content-secondary h4').toggle(function(){
			$(this).addClass('open'); 
		},
		function () {
			$(this).removeClass('open');
		}),
		$('.grid-content-secondary h4').click(function(){
			$(this).next('div.info').toggle();
		});
	});

	/* tooltip */
	
	$("a.tooltip").qtip({
		style: { 
			width: 400,
			padding: 15,
			background: '#fcf7e9',
			color: '#43423e',
			textAlign: 'left',
			tip: 'leftMiddle',
			border: {
				width: 1,
				color: '#fcf7e9'
			}},
	/*		position: {
				adjust: {
					x: -60,
					y: -50
				} 
			}
	*/
	position: { target: 'mouse', adjust: { x: 10, y: -50 } }
		});
	});

	/* adding an overstate for ie6 (all browsers degrade gracefully with css) */

	$( function(){
		$('div.box-feature dl').hover( function(){
			$(this).css('background-color', '#e6e6e6');
		},
		function(){
			$(this).css('background-color', '#fff');
		});
		$('div.box-content dl').hover( function(){
			$(this).css('background-color', '#e6e6e6');
		},
		function(){
			$(this).css('background-color', '#fff');
		});
		$('body#search-results dl').hover( function(){
			$(this).css('background-color', '#e6e6e6');
		},
		function(){
			$(this).css('background-color', '#fff');
	});
});