jQuery(document).ready(function(){
	jQuery("#sysMsg").fadeOut(3000);
	jQuery("#errMsg").fadeOut(3000);
	
	jQuery('#CommentName')
    .blur(function(){
      var $$=jQuery(this);
      if($$.val()=='' || $$.val()==$$.attr('title')){
        $$.css('color', '#999')
          .val($$.attr('title'));
      }
    })
    .focus(function(){
      var $$=jQuery(this);
      if($$.val()==$$.attr('title')){
        jQuery(this).css('color', '#000')
               .val('');
      }
    })
    .parents('form:first').submit(function(){
      var $$=jQuery('#CommentName');
      if($$.val()==$$.attr('title')){
        $$.triggerHandler('focus');
      }
    }).end()
    .blur();
	
	jQuery('#CommentBody')
    .blur(function(){
      var $$=jQuery(this);
      if($$.val()=='' || $$.val()==$$.attr('title')){
        $$.css('color', '#999')
          .val($$.attr('title'));
      }
    })
    .focus(function(){
      var $$=jQuery(this);
      if($$.val()==$$.attr('title')){
        jQuery(this).css('color', '#000')
               .val('');
      }
    })
    .parents('form:first').submit(function(){
      var $$=jQuery('#CommentBody');
      if($$.val()==$$.attr('title')){
        $$.triggerHandler('focus');
      }
    }).end()
    .blur();
	
	jQuery("form#comment_form").attr("action","http://scrapture.org/app/comments/add/");
	
	jQuery("#comment-add").hover(function(){
		$(this).attr("src","http://static.scrapture.org/img/streetsnap/addBtnHover.jpg");
	}, function(){
		$(this).attr("src","http://static.scrapture.org/img/streetsnap/addBtn.jpg");
	});
	
	jQuery("#comment-add").click(function(){
		$(this).fadeOut("fast");
		$("#waitBtn").fadeIn("fast");
	});
});
