$(document).ready(function() {
	$("a.button").hover(
				// over
				function(){
					// store the original image src
					$(this).children(":first-child").attr( "originalsrc" , $(this).children(":first-child").attr("src") );
					
					// add -over to the image unless it is already -over
					if (!$(this).children(":first-child").attr("src").match(/-over/) ) {
						$(this).children(":first-child").attr( "src", $(this).children(":first-child").attr("src").replace(/\./, "-over.") );
					}
					
				},
				
				// out
				function(){
					// replace the original src
					$(this).children(":first-child").attr(
						"src", $(this).children(":first-child").attr("originalsrc")
					);
					
					$(this).children(":first-child").attr(
						"originalsrc", null
					);
				}
			);

		$("input.button").hover(
				// over
				function(){
					// store the original image src
					$(this).attr( "originalsrc" , $(this).attr("src") );
					
					// add -over to the image unless it is already -over
					if (!$(this).attr("src").match(/-over/) ) {
						$(this).attr( "src", $(this).attr("src").replace(/\./, "-over.") );
					}
					
				},
				
				// out
				function(){
					// replace the original src
					$(this).attr(
						"src", $(this).attr("originalsrc")
					);
					
					$(this).attr(
						"originalsrc", null
					);
				}
			);			


	
	$('#emailBox').focus(function() {
		if (this.value == "Get updates via Email") {
			this.value = '';
		}
	});	
	
	$('#searchform #s').focus(function() {
		if (this.value == "Search the Blog") {
			this.value = '';
		}
	});
	
	
});

window.onload = function() {
		// preload
		$("a.button img").each(
			function() {
				$("<img>").attr( "src", $(this).attr("src").replace(/\./, "-over.") );
			}
		);
}


function pop_selects() {
	newwin = window.open('/selects_pop.html', 'videopop', 'width=320,height=286');
}