$(document).ready(function(){
	
	/*Language PullDown ----------------------------------------------*/
	
	$('select.makeMeFancy').tzSelect({
		render : function(option){
			return $('<li>',{
				html:	'<img src="'+option.data('icon')+'" /><span>'+
						option.data('html-text')+'</span>'
			});
		},
		className : 'hasDetails'
	});
	
	// Calling the default version of the dropdown	
	$('select.regularSelect').tzSelect();
	
	
	
	

	/*RightMenu Accordion ----------------------------------------------*/

	/* This code is executed after the DOM has been completely loaded */
	/* Changing thedefault easing effect - will affect the slideUp/slideDown methods: */

	//$.easing.def = "easeOutBounce";
	/* easeInQuad/easeInOutQuad/easeOutCubic/easeOutQuint/easeOutExpo/easeOutCirc/ */
	$.easing.def = "easeOutCirc";
	

	/* Binding a click event handler to the links: */
	$('li.btn a').click(function(e){
	
		/* Finding the drop down list that corresponds to the current section: */
		var dropDown = $(this).parent().next();
		
		/* Closing all other drop down sections, except the current one */
		$('.dropdown').not(dropDown).slideUp('slow');
		dropDown.stop(false,true).slideToggle('slow');
		
		/* Preventing the default event (which would be to navigate the browser to the link's address) */
		e.preventDefault();
	})
	
});


// XMLHttpRequestオブジェクトを生成する
var xmlHttpRequest;
try
{
    xmlHttpRequest = new XMLHttpRequest();
}
catch( e )
{
    try
    {
        // IE6向けの処理
        xmlHttpRequest = new ActiveXObject( 'Msxml2.XMLHTTP' );
    }
    catch( e )
    {
        // IE5とIE5.5向けの処理
        xmlHttpRequest = new ActiveXObject( 'Microsoft.XMLHTTP' );
    }
}
// 非同期の通知を受け取るイベントハンドラを登録する
xmlHttpRequest.onreadystatechange = function()
{
    var READYSTATE_COMPLETED = 4;
    if( xmlHttpRequest.readyState == READYSTATE_COMPLETED )
    {
        var HTTP_STATUS_OK = 200;
        if( xmlHttpRequest.status == HTTP_STATUS_OK )
        {
            // サーバから受信したレスポンスを表示する
			myD = new Date();
			myYear    = myD.getYear();
			myYear4 = (myYear < 2000) ? myYear+1900 : myYear;
			count = 1;
			$("#nav-3").append('<ul></ul>');
			for(i = myYear4;i >= xmlHttpRequest.responseText;i--){
				$("#nav-3").find("ul").append('<li class="pdnav'+count+'"><a href="/news/index.php?year='+i+'">'+i+'年</a></li>');
				count++;
			}
			$("#nav-3").find("ul").append('<li class="bottom"></li>');
        }
        else
        {
            // エラーを表示する
            alert( xmlHttpRequest.status + xmlHttpRequest.statusText );
        }
    }
}
// HTTPリクエストパラメータを初期化する
xmlHttpRequest.open( 'GET', "http://ueno.dbbox.jp/test_atmj/echojs.php" );

// HTTPリクエストを送信する
xmlHttpRequest.send( null );

