// JavaScript Document
  function showFeed(id) {
    if (document.getElementById(id).style.display == "block") {
      document.getElementById(id).style.display = "none";
    }else{
      document.getElementById(id).style.display = "block";
    }
	}
	
	function toggleComments(id) {
	  //alert("disp="+$("#"+id).css("display"));
	  if ($("#comments-"+id).css("display")=="none") {
	    $("#loading").show();
	    $("#ajaxcomments-"+id).load("getcomments.php?parent="+id);
		$("#loading").hide();
	  }
	  //alert($("#ajaxcomments-"+id).innerHTML);
	  animatedcollapse.toggle("comments-"+id);
	}
	
	$(document).ready(function() {
    $("#loading").hide();
	});
	
	function validateForm(f) {
	//	alert("yo="+$(document.getElementById('#cform-'+f)).children("#cname").val());
	//  if ($.trim($("#cform-"+f).children("cname").val())=="") {
	  if ($.trim($("#cform-"+f+" input#cname-"+f).val())=="") {
	    $('div#formmsg-'+f).fadeIn('fast');
	    $("div#formmsg-"+f).html("Please enter your name.");
		setTimeout(function(){ $('div#formmsg-'+f).fadeOut('slow'); }, 4000);
		return false;
	  }
	  if ($.trim($("#cform-"+f+" textarea#message-"+f).val())=="") {
	    $('div#formmsg-'+f).fadeIn('fast');
	    $("div#formmsg-"+f).html("Please enter a comment.");
		setTimeout(function(){ $('div#formmsg-'+f).fadeOut('slow'); }, 4000);
		return false;
	  }
	  var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	  if ($.trim($("#cform-"+f+" input#email-"+f).val())=="" || $("#cform-"+f+" input#email-"+f).val().indexOf("@")<0 || reg.test($("#cform-"+f+" input#email-"+f).val())==false) {
	    $('div#formmsg-'+f).fadeIn('fast');
	    $("div#formmsg-"+f).html("Please enter a valid e-mail address.");
		setTimeout(function(){ $('div#formmsg-'+f).fadeOut('slow'); }, 4000);
		return false;
	  }
      return true;
	}
	
		function findPos(obj) {
		var curleft = obj.offsetLeft || 0;
		var curtop = obj.offsetTop || 0;
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
		return {x:curleft,y:curtop};
	}


