// JavaScript Document
$(document).ready(function () {
	// onload sets
	$(".section_content").hide();
	$(".section_header .backgrounder").css({opacity:0.25});
	$(".folio .section_header .backgrounder").css({opacity:0.8});
	$(".section_header .sign").css({fontSize:"0em", opacity:0.1});
	// functions
	$.fn.titleToggle=function(op,mar,sign, signOp){
	 if(!$('#container').hasClass('folio')){
		  $(this).children("div.backgrounder").animate({opacity:op},400);	
		  $(this).children("div.title").animate({marginLeft:mar+"px"},300);
		  $(this).children("div.sign").animate({fontSize:sign+"em", opacity:signOp},300);
		}
		else{
		  op+=0.55;
		  signOp+=0.1;
		  $(this).children("div.backgrounder").animate({opacity:op},400);	
		  $(this).children("div.title").animate({marginLeft:mar+"px"},300);
		  $(this).children("div.sign").animate({fontSize:sign+"em", opacity:signOp},300);
		}
	}
	// mouse events
	$(".section_header").hover(function(){
		if($(this).parent().children("div.section_content").css("display") == "none"){
			$(this).children("div.sign").text("+").css({top:"-7px"});
			$(this).titleToggle(1,20,1.4,0.1);
		}
	});
	$(".section_header").mouseleave(function(){
		if($(this).parent().children("div.section_content").css("display") == "none"){
			$(this).titleToggle(0.25,0,0,0);
		}
	});
	$(".section_header").click(function(){
		if($(this).parent().children("div.section_content").css("display") != "none"){
			$(this).titleToggle(0.25,0,0,0);
		}
		if($(this).parent().children("div.section_content").css("display") == "none"){
			$(this).titleToggle(1,20,1.2,0.1);
			$(this).children("div.sign").text("_").css({top:"-18px"});
		}
				$(this).next().slideToggle('normal')
	});
		// load tweet
	$(".tweet").tweet({
		username: "Haerviu",
		join_text: "auto",
		avatar_size: 32,
		count: 5,
		auto_join_text_default: "I said,",
		auto_join_text_ed: "I",
		auto_join_text_ing: "I were",
		auto_join_text_reply: "I replied to",
		auto_join_text_url: "I was checking out",
		loading_text: "loading tweets..."
	});
	//query
	$(".query").tweet({
		avatar_size: 32,
		count: 4,
		query: "tweet.seaofclouds.com",
		loading_text: "searching twitter..."
	});
});
