// 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'); });
	});
	
	
	// EMAIL CONTACT BOX
	//$("a.contact-box").fancybox({ 'width':425, 'height':260 });
	
	
	// ORANGE TABLE: HIGHLIGHT EVERYTHING ROW
	$('table.orange tbody').each(function() {
		$('tr', this).each(function() {
			if (($(this).context['rowIndex'] % 2) == 0) {
				$(this).addClass('hl');
			}
		});
	});
	
});


