/*
This clears out the "hint" in the input fields and clears them out. Replaces with the original hint if no text is entered.
Thanks to Jörn Zaefferer:
http://bassistance.de/2007/01/23/unobtrusive-clear-searchfield-on-focus/
*/
$.fn.clearField = function() {
	return this.addClass('hint-text').focus(function() {
		if( this.value == this.defaultValue ) {
			this.value = "";
      $(this).removeClass('hint-text');
		}
	}).blur(function() {
		if( !this.value.length ) {
			this.value = this.defaultValue;
      $(this).addClass('hint-text');
		}
	});
};



/*
Rollovers for the input type="image".
Thanks to Atlanta Jones:
http://www.atlantajones.com/2008/07/02/even-easier-jquery-rollovers/
*/
$.fn.rollOver = function() {
	// Set the original src
	rollsrc = $(this).attr("src");
	if (rollsrc) {
		rollON = rollsrc.replace('off', 'on');
		newImg = new Image(); // create new image obj
		$(newImg).attr("src", rollON); // set new obj's src
	}
	
	this.mouseover(function() {
		imgsrc = $(this).attr("src");
		if (typeof(imgsrc) != 'undefined') {
		imgsrcON = imgsrc.replace('off', 'on');
		$(this).attr("src", imgsrcON);
		}
	});

	// Handle mouseout
	this.mouseout(function(){
		if (typeof(imgsrc) != 'undefined') {
		$(this).attr("src", imgsrc);
		}
	});
};



/*
Initialize
*/
$(function() {
	Cufon.replace('#primary_content h2', { fontFamily: 'Rockwell Std' });

	$("#top_navigation li.login a").fancybox({
		padding: 0,
		margin: 0,
		width: 406,
		height: 260,
		autoDimensions: false,
		overlayOpacity: 0.9,
		overlayColor: '#fff',
		showCloseButton: false
	});
});
