// JavaScript Document

/////////////////////////////////////////////////////
// Alpha Rollover
/////////////////////////////////////////////////////
$(document).ready(function() {
    $(".alhover").fadeTo(1,1)
    .hover( 
        function(){// マウスオーバー時
            $(this).fadeTo(150, 0.5);
        },
        function(){// マウスアウト時
            $(this).fadeTo(400, 1);
        }
    );
});

$(document).ready(function() {
    $(".alhover")
    .click( 
        function(){
            $(this).fadeTo(1,1);
        }
    );
});

$(document).ready(function() {
    $(".alactive").fadeTo(1,0.5)
});


// Div Rollover
(function($){
$(function(){
	$('.works_img').hover(function(){
		$(this).fadeTo(300,0.6);
	},function(){
		$(this).fadeTo(400,1.0);
	});
});
})(jQuery);

// tetraHome Rollover
(function($){
$(function(){
	$('.tetraHome').hover(function(){
		$(this).fadeTo(200,0.9);
	},function(){
		$(this).fadeTo(300,1.0);
	});
});
})(jQuery);




/////////////////////////////////////////////////////
// gettwitter
/////////////////////////////////////////////////////

(function($){
    $.fn.twLine = function(options){ 
        var c = $.extend({
            //ユーザーIDもしくはスクリーン名
            user: null,
            number: 1
        },options || {});
        $(this).each(function(){
            var self = $(this);

        // ユーザー名がなければ処理を終了する
        if( !c.user ) {
            return false;
        }

        // loading文字列とJSONの中身を一覧で表示するためのul要素を入れておく
        self.append(
            '<div class="loading"></div>',
            '<ul/>'
        );
            
            // JSONの取得
            $.getJSON('http://twitter.com/statuses/user_timeline/' + c.user +'.json?callback=?',function(data){  
                // loading文字列を消去
                $('.loading', self).remove();
                
                // ポストがひとつもなかった場合
                if( data.length < 1 ) {
                    $('ul', self).append('<li>投稿がありません。</li>');
                    return false;
                }
                            
                // item毎に･･･
                $.each(data , function(i , items) {
                    
                    // 指定した数を超えた場合は終了する
                    if( i > (c.number - 1) ) {
                        return false;
                    }
                    
                    // itemの中のtextを抜き出してulに追加する
                    $('ul', self).append(
                        $('<li/>',{
                            text:items.text
                        })
                    );
                });
            });
        });
    }
})(jQuery);

jQuery(function($){ 
    $('#tweet').twLine({
        user: 'plusonedesign'
    });
});


/////////////////////////////////////////////////////
// 個人情報保護開閉
/////////////////////////////////////////////////////
$(function(){
	$(".toggle_container").hide();
		$("p.trigger").toggle(function(){
			$(this).addClass("active"); 
			}, function () {
			$(this).removeClass("active");
            });
            
		$("p.trigger").click(function(){
			$(this).next(".toggle_container").slideToggle("slow,");
	});
});


