// click clear function for contact form
function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
		thisfield.value = "";
	}
}
	
function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
		thisfield.value = defaulttext;
	}
}

// jQuery
$(document).ready(function() {
	
	// add class to first and last child elements so we can target easily with css
	$('li:first-child, .cart_table tr:first-child, .cart_table th:first-child, .cart_table td:first-child').addClass('first');
	$('li:last-child, .cart_table tr:last-child, .cart_table th:last-child, .cart_table td:last-child').addClass('last');
	
	// animate the arrow on the highlighted package banner
	setInterval( function() {
		$('.banner_arrow').animate({'bottom': '-25px'}, 700).animate({'bottom': '-30px'}, 700);
	}, 700);
	
	// grab the zip search forms parent element
	// and insert it into the appropriate fields
	$('.zip_search').each(function(index) {
	
		var parentID = $(this).parent().attr('id');
		var	parentClass = $(this).parent().attr('class');
		var formLocation;
		
		if (parentID == undefined || $.trim(parentID) == "" || $.trim(parentID) == 'undefined') {
			formLocation = parentClass;
		}
		else { 
			formLocation = parentID;
		}	
		
		$(this).attr('name', formLocation + '_zip_search');
		$(this).attr('id', formLocation + '_zip_search');
	
	});
	
});
