$(document).ready( function() {
	$( '#scroll' ).ScrollToAnchors(500);
	var tabIteration = 0;
	var url = window.location.href.split("#");
	if (url.length == 2 && url[1].indexOf('-fx') > 0) {
		Zg.p.currentTab = $('#' + url[1].substr(0, url[1].length-3));
		if (Zg.p.currentTab.size() == 1) {
			$('#fx div').each(
				function(iteration) { if(this === Zg.p.currentTab.get(0)) tabIteration = iteration; }
			);
		}
	}
	
	if(!Zg.p.currentTab) Zg.p.currentTab = $('#fx div:first');
	Zg.p.currentTab.SlideToggleUp(400);
	$( '#tabs a' ).eq( tabIteration ).addClass( 'active' ).end().bind( 'click' , Zg.prototype.switchTab );
});
var Zg = function() {};
//================================================================
//□共通変数
//================================================================
Zg.p = {
	inSlide    : false  ,//
	currentTab : null   ,//
	DUMMY_END  : 0       //
};
//*===============================================================
//○タブ切り替え
//*===============================================================
Zg.prototype.switchTab = function() {
	var tabName = this.href.split('#')[1];
	this.blur();
	if ( Zg.p.inSlide == false && Zg.p.currentTab.get(0) != $('#' + tabName.substr(0, tabName.length-3)).get(0) ) {
		$('#tabs a').removeClass('active');
		$(this).addClass('active');
		Zg.p.inSlide = true;
		Zg.p.currentTab.SlideToggleUp(
			400,
			function() {
				Zg.p.currentTab = $('#' + tabName.substr(0, tabName.length-3)).SlideToggleUp(400, function(){Zg.p.inSlide=false;});
			}
		);
	} else {
		return false;
	}
};
//*===============================================================
//○市区町村データの取得
//*===============================================================
Zg.prototype.getAreaData = function() {
	var job_area_id_0 = $( '#job_area_id_0' ).val();
	$( '#job_area_id_1' ).html( '<option value="-">--</option>' )
	if ( job_area_id_0 != '' ) {
		$.ajax( {
			type     : 'GET' ,
			timeout  : 3000  ,
			cache    : false ,
			dataType : 'xml' ,
			url      : 'area.server.php'       ,
			data     : {'parent':job_area_id_0},
			success  : function(xml){
				var html = new Array();
				html.push( '<option value="" selected="selected">--全て--</option>' );
				$(xml).find('area').each( function() {
					html.push( '<option value="' + $(this).find('id').text() + '">' );
					html.push( $(this).find('name').text() );
					html.push( '</option>' );
				} );
				$( '#job_area_id_1' ).html( html.join('') )
			}
		} );
	}
};
