/*
Site:           masugadesign.com
Page:           functions.js
Created:        Aug 25 2007
Modified:       Sep 22 2008
General sitewide functions
--------------------------------------------------------- 
ryan masuga, masugadesign.com
ryan@masugadesign.com 
--------------------------------------------------------- */



$(document).ready( function(){
$("#searchButton").hide().width(0);
// alert('loaded');

$("a[@rel~='lightbox']").addClass("link_pic");

$("a[@rel='external']").not(".noicon").addClass("external");
$("a[@rel='external']").click(function() {
 return !window.open($(this).attr("href"));
 });

/*
 if ($.browser.msie) {
 // adding the images via javascript, because if the inline element wraps,
 // NO image will show in explorer. which is bad. yo, this solves it.
 var $linkpic = new Image();
 $linkpic.src = "/images/site/link_pic.png";

 // var $extpic = new Image();
 // $extpic.src = "/images/sitev2/link_ext.png";

 $("#container #content #middle-column a.link_pic").append($linkpic);
 $("#container #content #middle-column a.link_ext").append(" (External Link)");
 }
*/


/* ==> search form at top of each page */
$("#searchBox #searchText").css('opacity',0.25);


$('#searchBox').hoverIntent(function(){
	
   // $("#searchBox #searchText")
   // .animate({right: "34px"}, 250).fadeTo(250,1);
	$("#searchBox #searchText").fadeTo(250,1);
	
	$("#searchBox #searchButton").width(24).show("slow");
	
		},function(){
			
		$("#searchBox #searchButton").animate( { opacity:"100%"}, 1000 ).hide("slow");
			
		$("#searchBox #searchText").animate( { opacity:"100%"}, 1000 ).fadeTo("slow",0.25);
		
});

	var text = 'Search...';
	var srchField = $("#search #searchText");
	srchField.attr("value", text); 
	// if default text is there on focus, clear it out, otherwise leave it alone
	srchField.focus( function(){if(srchField.val() == text){srchField.attr("value", '');}});
	// when leaving field, check if it's empty; put default text back
	srchField.blur( function(){if(srchField.val() == ''){srchField.attr("value", text); }});




$('#footer ul a span').hide();

$('#footer ul a').hover(function() {
	var str = $("span:first",this).text();
	$('#footer ul li.footerCreditsFirst').html(str);
}, function() {
	$('#footer ul li.footerCreditsFirst').html('&nbsp;');
});

$('#footer p#copyright #validCheck').hide();

$('p#copyright a.check').hover(function(){
	$('#footer p#copyright #validCheck').show(); // This should set the opacity to 100% on hover
		},function(){
		$('#footer p#copyright #validCheck').hide(); // This should set the opacity back to 60% on mouseout
});


}); /* close ready */
