$(document).ready(function () {
	
	autoFill($("#txtSearch"), "search...");
	
	$('p.text a').attr('target', '_blank');
	$('p.comments a').attr('target', '_blank');
    $("a.zoom").nyroModal({bgColor: 'transparent', forceType: 'image'});
    $("a.youtube").nyroModal({bgColor: 'transparent', minWidth: '480', minHeight: '295'});
    $("a.vimeo").nyroModal({bgColor: 'transparent', minWidth: '400', minHeight: '225'});

	$('a#links_toggle').click(function() {
		if($(this).text()=="+ More Links!"){
			$(this).text("- OMG Less Links!")
		}
		else{
			$(this).text("+ More Links!")
		}
		$('#links').slideToggle(400);
		return false;
	});
	
	$('a#feeds_toggle').click(function() {
		if($(this).text()=="+ Feeds!"){
			$(this).text("- Hide Feeds")
		}
		else{
			$(this).text("+ Feeds!")
		}
		$('#feeds').slideToggle(400);
		return false;
	});
	

});

//Auto-Fill function accepts id of input and fills it with the given value.
//Written by Joe Sak http://www.joesak.com/2008/11/19/a-jquery-function-to-auto-fill-input-fields-and-clear-them-on-click/
function autoFill(id, v){
	$(id).css({ 'color': '#b2adad' }).attr({ value: v }).focus(function(){
		if($(this).val()==v){
			$(this).val("").css({ 'color': '#333', 'width': '100', 'text-align': 'right' });
		}
	}).blur(function(){
		if($(this).val()==""){
			$(this).css({ color: "#b2adad" }).val(v);
		}
	});
	
}