jQuery(document).ready(function(){
	
	//Main Picture Mousehover
	
	jQuery("div#mainPic").hover(function() {
		jQuery("div#snapData").animate({opacity: 0}, 300);
	}, function() {
		jQuery("div#snapData").animate({opacity: 0.6}, 300);
	});
	
	//Share Quation
	
	jQuery("span#qUrl a").toggle(function() {
		jQuery("div.answer").css("display","none");
		jQuery("span.quation a").css("background","");
		jQuery("div#aUrl").slideToggle("fast");
		jQuery(this).css("background","#CCC");
	}, function() {
		jQuery("div#aUrl").slideToggle("fast");
		jQuery("span.quation a").css("background","");
		jQuery("div.answer").css("display","none");
		jQuery(this).css("background","");
	});
	
	jQuery("span#qLink a").toggle(function() {
		jQuery("div.answer").css("display","none");
		jQuery("span.quation a").css("background","");
		jQuery("div#aLink").slideToggle("fast");
		jQuery(this).css("background","#CCC");
	}, function() {
		jQuery("div#aLink").slideToggle("fast");
		jQuery("span.quation a").css("background","");
		jQuery("div.answer").css("display","none");
		jQuery(this).css("background","");
	});
	
	jQuery("span#qHtml a").toggle(function() {
		jQuery("div.answer").css("display","none");
		jQuery("span.quation a").css("background","");
		jQuery("div#aHtml").slideToggle("fast");
		jQuery(this).css("background","#CCC");
	}, function() {
		jQuery("div#aHtml").slideToggle("fast");
		jQuery("span.quation a").css("background","");
		jQuery("div.answer").css("display","none");
		jQuery(this).css("background","");
	});
	
	//Comment Form
	
	jQuery('input#comment-author').blur(function(){
		var $$=$(this);
		if($$.val()=='' || $$.val()==$$.attr('title')){
        	$$.css('color', '#CCC').val($$.attr('title'));
		}
    }).focus(function(){
		var $$=$(this);
		if($$.val()==$$.attr('title')){
			jQuery(this).css('color', '#666').val('');
		}
    }).parents('form:first').submit(function(){
    	var $$=$('input#comment-author');
    	if($$.val()==$$.attr('title')){
			$$.triggerHandler('focus');
		}
    }).end().blur();
	
	jQuery('input#comment-email').blur(function(){
		var $$=$(this);
		if($$.val()=='' || $$.val()==$$.attr('title')){
        	$$.css('color', '#CCC').val($$.attr('title'));
		}
    }).focus(function(){
		var $$=$(this);
		if($$.val()==$$.attr('title')){
			jQuery(this).css('color', '#666').val('');
		}
    }).parents('form:first').submit(function(){
    	var $$=$('input#comment-email');
    	if($$.val()==$$.attr('title')){
			$$.triggerHandler('focus');
		}
    }).end().blur();
	
	jQuery('textarea#comment-text').blur(function(){
		var $$=$(this);
		if($$.val()=='' || $$.val()==$$.attr('title')){
        	$$.css('color', '#CCC').val($$.attr('title'));
		}
    }).focus(function(){
		var $$=$(this);
		if($$.val()==$$.attr('title')){
			jQuery(this).css('color', '#666').val('');
		}
    }).parents('form:first').submit(function(){
    	var $$=$('textarea#comment-text');
    	if($$.val()==$$.attr('title')){
			$$.triggerHandler('focus');
		}
    }).end().blur();
	
	// Recently Snap
	
	jQuery(".recent_pic img,img.transparency").animate({opacity: 0.6}, 100);
	
	jQuery(".recent_pic img,img.transparency").hover(function() {
		jQuery(this).animate({opacity: 1.0}, 300);
	}, function() {
		jQuery(this).animate({opacity: 0.6}, 300);
	});
	
	jQuery(".recent_pic a").hover(function(){
		jQuery(this).addClass("active");
	}, function(){
		jQuery(this).removeClass("active");
	});
	
	jQuery(".recent_pic a span.play span").hover(function(){
		jQuery(this.parentNode.parentNode).removeClass("active");
	}, function(){
	});
	
	jQuery("form").attr("action","http://scrapture.org/cgi/comments.cgi");
	
	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");
	});
	
});
