// JavaScript Document
$(document).ready(function() {
	// Safely inject CSS3 and give the search results a shadow
	var cssObj = { 'box-shadow' : '#888 5px 10px 10px', // Added when CSS3 is standard
	'-webkit-box-shadow' : '#888 5px 10px 10px', // Safari
	'-moz-box-shadow' : '#888 5px 10px 10px'}; // Firefox 3.5+
	$("#suggestions").css(cssObj);
	
	// Fade out the suggestions box when not active
	$("input").blur(function(){
	$('#suggestions').fadeOut();
							 });
});

function WatermarkFocus(txtElem, strWatermark) 
{     
	if (txtElem.value == strWatermark) txtElem.value='';
}
function WatermarkBlur(txtElem, strWatermark) 
{     
	if (txtElem.value == '') txtElem.value=strWatermark;
}
function suggestionLookup(inputString, feedUrl) {
	if(inputString.length ==0) {
		$('#suggestions').fadeOut();
	} else {
		$.getFeed({
		   url: feedUrl + '?k=' + inputString,
		   success: function(feed) {
			  var html = '<p id="searchsuggestions">';
					  for(var i = 0; i < feed.items.length && i < 5; i++) {
						  var item = feed.items[i];
						  html += '<a href="'
						  + item.link
						  + '">'
						  + '<span class="searchheading">'
						  + item.title
						  + '</span>'
						  + '<span>'
						  + item.description
						  + '</span>'
						  + '</a>';
						  
						}
					  html += '</p>';
					  if (html != '<p id="searchsuggestions"></p>') {
					      $('#suggestions').html(html);
					      $('#suggestions').fadeIn();
					  }
		   }
		});
	}
}
function facebookLike()
{
 	document.write("<div id=\"facebook-like\" style=\"padding-bottom:5px;\"><iframe src=\"http://www.facebook.com/plugins/like.php?href=" + location.href + "&layout=standard&show_faces=true&width=450&action=like&colorscheme=dark\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"True\" style=\"border:none; overflow:hidden; width:450px; height:63px; \"></iframe></div>");
}