// JavaScript Document


$(function() {

	// IMAGES WITH ROLLOVERS
	$('.rollover').each(function() {
		var src = $(this).attr('src');
		if (src) {
			var over = src.replace(/(\.){1}(.{3,4})$/, "-over.$2");
			if ($(this).hasClass('active')) $(this).attr('src', over);
			else {
				var pic = new Image();
				pic.src = over;
				$(this).hover(
					function() { $(this).attr('src', over); },
					function() { $(this).stop(true, false).attr('src', src); }
				);
			}
		}
	});
	
	// IF NOT IE, AND NOT 'class="rollover"'
	// ALL OTHER IMAGES NESTED INSIDE AN '<a>' TAG WILL FADE ON ROLLOVER
	if (navigator.appName != 'Microsoft Internet Explorer') {
		$("a img").each( function() {
			var img = $(this);
			if (!img.hasClass('rollover')) {
				img.parents('a').hover(
					function() { img.css({ opacity: 0.5 }); },
					function() { img.stop(true, false).css({ opacity: 1.0 }); }
				);
			}
		});
	}
	
	// INPUT TEXT WITH PLACEHOLDERS
	$('.placeholder').each( function() {
		var ph = $(this).addClass('faded').val();
		$(this).bind('focus', function() { if ($(this).val() == ph) $(this).val('').removeClass('faded'); });
		$(this).bind('blur', function() { if ($(this).val() == '') $(this).val(ph).addClass('faded'); });
	});
	
	// DROPDOWNS MENUS
	/*
	$('.has-dropdown .show-dropdown ').each(function() {
		// on link rollover, display dropdown
		$(this).hover(
			function() {
				$(this).parents('.mainnav-link').addClass('mainnav-link-hover');
			},
			function() {
				// on dropdown rollout, hide dropdown
				$(this).parents('.mainnav-link').hover(
					function() { },
					function() {
						$(this).removeClass('mainnav-link-hover');
					}
				);
			}
		);
	});
	*/
	
});

