$(document).ready(function() {
	/*
	$("#feature-matte").hover(
	  function () { $("#overlay").fadeIn(500); }, 
	  function () { $("#overlay").fadeOut(500); }
	);
	*/

	if ($("#photo-detail").length > 0){
		$("#photo-detail .browse.left").height($("#photo-detail").innerHeight());
		$("#photo-detail .browse.right").height($("#photo-detail").innerHeight());
		$("#photo-detail .matte img.photo").load(function(){
			$("#photo-detail .browse.left").height($("#photo-detail").innerHeight());
			$("#photo-detail .browse.right").height($("#photo-detail").innerHeight());
		});
		$("#photo-detail").hover(
			function(){ $("#photo-detail .browse").addClass("here"); },
			function(){ $("#photo-detail .browse").removeClass("here"); }
		);
		$("#photo-detail .matte").click(function(){ window.location.href = $("#photo-detail a.browse.right").attr("href"); });
	}

	if ($("#comments-toggle").length > 0){
		$("#comments-toggle").click(function () {
			if ($("#comments-list").css('display') == 'none') {
				$("#comments-list").slideDown();
				$("#comments-header").addClass('down');
			} else {
				$("#comments-list").slideUp();
				$("#comments-header").removeClass('down');
			}
			return false;
		});
	}
	
	$("#topnav .searchnav a").click(function () {
		$("#topnav .searchnav").css('overflow', 'hidden');
		$("#topnav .searchnav").animate({width:0}, 500);
		$("#topnav .searchbox").css('overflow', 'hidden');
		var int_searchbox_width = $("#topnav .searchbox").width();
		$("#topnav .searchbox").width(0);
		$("#topnav .searchbox").show();
		$("#topnav .searchbox").animate({width:int_searchbox_width}, 500);
		$("#topnav .searchbox input[type=text]").focus();
		return false;
	});
});
    
function popupShare(str_url){
	window.open(str_url,'flakphotoshare','width=600,height=400,left='+(screen.availWidth/2-225)+',top='+(screen.availHeight/2-150)+'');
}

function clickclear(thisfield, defaulttext, thisobject) {
	if (thisfield.value == defaulttext) {
		thisfield.value = "";
		thisobject.parent().parent().addClass('here');
	}
}

function clickrecall(thisfield, defaulttext, thisobject) {
	if (thisfield.value == "") {
		thisfield.value = defaulttext;
		thisobject.parent().parent().removeClass('here');
	}
}
