(function($, window, document, undefined){
$(function(){

/* =====================================================================


	common


===================================================================== */

$window = $(window);
$document = $(document);
$html = $('html');
$body = $('body');

$html.addClass('json');

//userAgent
var _UA = navigator.userAgent;
var _asIE  = (_UA.indexOf('MSIE') > -1)?true:false;
var _asIE6 = (_UA.indexOf('MSIE 6') > -1)?true:false;
var _asIE7 = (_UA.indexOf('MSIE 7') > -1)?true:false;
var _asIE8 = (_UA.indexOf('MSIE 8') > -1)?true:false;
var _asIPad = (_UA.indexOf('iPad') > -1)?true:false;
var _asIPhone = (_UA.indexOf('iPhone') > -1)?true:false;
var _asAndroid = (_UA.indexOf('Android') > -1)?true:false;

if(_asIE) $html.addClass('ie');
if(_asIE6) $html.addClass('ie6');
if(_asIE7) $html.addClass('ie7');
if(_asIE8) $html.addClass('ie8');

//jquery.belatedPNG.js
set_fixPng('.iepngfix');
function set_fixPng(v) {
	if(!$.support.opacity){
		$(v).fixPng();
	}
}

/*
set_IE6fixPng('.ie6pngfix');
function set_IE6fixPng(v) { if(_asIE6){$(v).fixPng();}}
*/

//functions
function anti_px(v){return Number(v.replace('px',''));}
function num_diff(v1,v2){var v3=v1-v2; if(v3<0)v3*=-1; return v3;}
function getRand(from, to){return from+Math.floor(Math.random()*(to-from+1));}
function formatNum(keta, num) {
  var src = new String(num);
  var cnt = keta - src.length;
  if (cnt <= 0) return src;
  while (cnt-- > 0) src = "0" + src; return src;
}


Array.prototype.shuffle = function() {
    var i = this.length;
    while(i){
        var j = Math.floor(Math.random()*i);
        var t = this[--i];
        this[i] = this[j];
        this[j] = t;
    }
    return this;
}

//元の配列には変更を加えず、ランダムに並べ替えられた新しい配列を返す。
Array.prototype.shuffle2 = function(){
    var len = this.length;
    var ary = this.concat();
    var res = [];
    while(len) res.push(ary.splice(Math.floor(Math.random()*len--),1));
    return res
}

function _$(v){$v=$(v);if($v.length<=0){return false}return $v;};

var preload_img = new Image();

src_on_off('.srcOnOff');
function src_on_off(t){
	var $t = $(t); if($t.length<=0){return false}
	if(!$t.attr('src')) $t = _$(t+' *[src]');
	if($t.length<=0){return false}
	$t.bind({ 'mouseenter': function(){f0($(this));}, 'mouseleave': function(){f1($(this));} });
	function f0(t2){ t2.attr('src', t2.attr('src').replace(/^(.+)(\..+)$/,"$1_on$2")) }
	function f1(t2){ t2.attr('src', t2.attr('src').replace(/^(.+)_on(\..+)$/,"$1$2")) }
	$.each($t, function(){
		preload_img.src = $(this).attr('src').replace(/^(.+)(\..+)$/,"$1_on$2");
		//alert(preload_img.src);
	});
}

function heightline(t, c){
	$t = $(t);
	$.each($t, function(){
		var $this = $(this);
		var $c = $(c, $this);
		var h = 0;
		$.each($c, function(){
			//preload_img.src = $(this).attr('src');
			h = Math.max(h, $(this).height());
		});
		$c.height(h+'px');
	});
}


/* ---------------------------------------------------------------------

	debugbox

--------------------------------------------------------------------- */

//debugbox_set();

function debugbox_set(){
	$body = $('body');
	$body.append('<div id="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxdebugbox">');// x=50
}
function debugbox(v){
	$('#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxdebugbox').html(v);
}

//debugbox('<a href="/a/index.html">/a/index.html</a><br /><a href="/a/sitemap_contact.html">sitemap_contact.html</a>');

/* ---------------------------------------------------------------------

	smooth_scroll

--------------------------------------------------------------------- */

smooth_scroll();
function smooth_scroll(){
	$('a[href^="#"]').bind('click', function(){
		var href = $(this).attr('href');
		$('html, body').animate({'scrollTop':$(href).offset().top},1000,'easeInOutCubic');
		return false;
	});
};


/* ---------------------------------------------------------------------

	font-size

--------------------------------------------------------------------- */
fontSize();
function fontSize(){
	var $this = $('.change_font_size');
	if($this.length<=0) return false;
	var $ul = $('ul', $this);
	var $li_img = $('li img', $ul);
	$li_img.bind('click', function(){
		var _index = $li_img.index(this);
		var set_fontsize = '13px';
		if(_index<=0){
			set_fontsize = '11px';
		}else if(_index>1){
			set_fontsize = '16px';
		}
		$body.css('font-size', set_fontsize);
	});
}


/* ---------------------------------------------------------------------

	setFancybox

--------------------------------------------------------------------- */

function setFancybox(_t, _width, _height){
	var $t = $(_t);
	if($t.size()<=0) return false;
	$t.fancybox({
		'modal' 	: false,
		'padding'	: 0,
		'width'		: _width,
		'height'	: _height,
		'titleShow'	: false,
		'autoScale'	: false,
		'autoDimensions' : false,
		'transitionIn'	: 'fade',
		'transitionOut'	: 'fade',
		'type'		: 'iframe'
	});
}


/* =====================================================================


	index


===================================================================== */

/* ---------------------------------------------------------------------

	index_keyvisual

--------------------------------------------------------------------- */
index_keyvisual();
function index_keyvisual(){
	var $kv = $('.index_keyvisual');
	if($kv.length<=0) return false;
	
	var $kv_li = $('li', $kv);
	var $kv_li_length = $kv_li.length;
	
	if($kv_li_length<=1) return false;
	
	/*
$.each($kv_li, function(){
		var $this = $(this);
		$this.prepend('<span>'+$kv_li.index(this)+'</span>');
	});
*/
	
	var _rand = [];
	var n = 0;
	while(n <= $kv_li_length) {
		_rand[n] = n;
		++n;
		//debugbox("n:"+n+" | _rand[n]:"+_rand[n]);
	}
	_rand.shuffle();
	
	$kv_li.hide();
	$kv_li.eq(_rand[0]).show();
	
	var n = nn = dp = -1;
	movie_fnc();
	function movie_fnc(){
		if(n < $kv_li_length-1){
			++n;
			dp = 0;
		}else{
			n = 0;
			dp = 1000;
		}
		(n < $kv_li_length-1)? nn=n+1 : nn=0;
		
		//alert(nn+","+n);
		//debugbox("photos_p_length:"+photos_p_length+" / n:"+n+" / nn:"+nn);
		//debugbox("n:"+n+" / nn:"+nn+" / _rand[n]:"+_rand[n]+" / "+$kv_li.eq(_rand[nn]).find('img').attr('src'));
		$kv_li.eq(_rand[n]).delay(5000+dp).fadeToggle(2000);
		$kv_li.eq(_rand[nn]).delay(7500+dp).fadeToggle(2000+dp, "linear", function(){
			movie_fnc();
		});
		
	}
}


/* =====================================================================


	#areaInex .indexKeyvisual


===================================================================== */
areaIndex_indexKeyvisual();
function areaIndex_indexKeyvisual(){
	var $this = $('#areaIndex .indexKeyvisual');
	if($this.length<=0) return false;
	
	var $map = $('.l .map', $this);
	var $areaList = $('.areaList2', $this);
	var $areaList_li = $('li', $areaList);
	$areaList_li.bind({
		'mouseenter': function(){
			var $this = $(this);
			var _class = $this.attr('class');
			$('img', $map).attr('src', '/area/images/index_keyvisual_'+_class+'.png');
		}
	});
	
	var $btns_li = $('.btns li', $this);
	$btns_li.bind({
		'mouseenter': function(){
			var $this = $(this);
			var _class = $this.attr('class');
			$('img', $map).attr('src', '/area/images/index_keyvisual_'+_class+'.png');
		}
	});
	
}


/* =====================================================================


	#recruitSeminarIndex


===================================================================== */
(function(){
	//return false;
	$this = $('#recruitSeminarIndex');
	if($this.length<=0) return false;
	
	$seminarSubDescription = $('.seminarSubDescription', $this);
	if($seminarSubDescription.length<=0) return false;
	
	$seminarSubDescription.next('div').addClass('seminarSubDescription');
	$seminarSubDescription.removeClass('seminarSubDescription');
	
	return false;
})();



/* =====================================================================


	.thumbnailListA1


===================================================================== */
thumbnailListA1_fnc();
function thumbnailListA1_fnc(){
	var $this = $('.thumbnailListA1');
	if($this.length<=0) return false;
	
	$.each($('li', $this), function(){
		var $this = $(this);
		$this.css({
			'cursor': 'pointer'
		});
		
		$('a',$this).click(function(){
			return false;
		});
		
		var src;
		var href;
		var target;
		$this.bind({
			'mouseenter': function(){
				src = $('.h0 img',$this).attr('src');
				//alert(src);
				$('.h0 img',$this).attr('src', src.replace(/^(.+)(\..+)$/,"$1_on$2"));
			}
			,'mouseleave': function(){
				src = $('.h0 img',$this).attr('src');
				$('.h0 img',$this).attr('src', src.replace(/^(.+)_on(\..+)$/,"$1$2"));
			}
			,'mousedown': function(){
				href = $('a',$this).attr('href');
				target = $('a',$this).attr('target');
				//alert(href);
				if(target == "_blank"){
					window.open(href);
				}else{
					location.href = href;
				}
				
			}
		});
	});
	
}



/* =====================================================================


	tabA1


===================================================================== */
tabA1_fnc();
function tabA1_fnc(){
	var $tabA1 = $('.tabA1');
	if($tabA1.length<=0) return false;
	
	var $section = $('.section', $tabA1);
	var $tab_body = $('> .tab_body', $section);
	var $h2 = $('h2', $tabA1);
	
	$('h2.tab0', $tabA1).addClass('current');
	$('h2.tab0', $tabA1).next().toggle();
	
	function bindMousedown($t, $body, $h){
		$h.removeClass('current');
		$t.toggleClass('current');
		$body.hide();
		$t.next().show();
	}
	
	$h2.bind({
		'mousedown': function(){
			bindMousedown($(this), $tab_body, $h2);
			/*
			$h2.removeClass('current');
			$(this).toggleClass('current');
			$tab_body.hide();
			$(this).next().show();
			*/
		}
	});
	
	var dURL = document.URL;
	var dURLio = dURL.indexOf('#');
	
	$.each($section, function(){
		var $this = $(this);
		var $tab_body2 = $('.tab_body .tab_body', $this);
		
		var $h3 = $('h3', $this);
		$('h3.tab0', $this).addClass('current');
		$('h3.tab0', $this).next().toggle();
		$h3.bind({
			'mousedown': function(){
				bindMousedown($(this), $tab_body2, $h3);
			}
		});
	});
	
	if(dURLio){
			var str = dURL.substring(dURLio, dURL.length);
			if(str.indexOf('?')>=1) str = str.substring(0,str.indexOf('?'));
			var str1 = str2 = "";
			if(str.indexOf('_')>=1){
				str1 = str.substring(0,str.indexOf('_'));
				str2 = str.substring(str.indexOf('_'),str.length);
			}
			var opentab1 = opentab2 = 0;
			
			if(str1 == "#event"){ opentab1 = 0;} else
			if(str1 == "#campaign"){ opentab1 = 1;} else
			if(str1 == "#factory"){ opentab1 = 2;}
			
			if(str2 == "_all"){ opentab2 = 0;} else
			if(str2 == "_hokushin"){ opentab2 = 1;} else
			if(str2 == "_toushin"){ opentab2 = 2;} else
			if(str2 == "_tyushin"){ opentab2 = 3;} else
			if(str2 == "_nanshin"){ opentab2 = 4;} else
			if(str2 == "_niigata"){ opentab2 = 5;}
			
			//alert("tabA1 "+str1+":"+str2+" "+opentab1+":"+opentab2);
			bindMousedown($('h2.tab'+opentab1, $tabA1), $tab_body, $h2);
			var _t = $('h2.tab'+opentab1, $tabA1).next();
			bindMousedown($('h3.tab'+opentab2, _t), $('h3.tab'+opentab2, _t).next(), $('h3', _t));
	}
}

/* =====================================================================


	tabB


===================================================================== */

/* ---------------------------------------------------------------------

	tabB1

--------------------------------------------------------------------- */
tabB1_fnc();
function tabB1_fnc(){
	var $tabB1 = $('.tabB1');
	if($tabB1.length<=0) return false;
	
	function bindMousedown($t, $body, $h3){
		$h3.removeClass('current');
		$t.toggleClass('current');
		$body.hide();
		$t.next().show();
	}
	
	var dURL = document.URL;
	var dURLio = dURL.indexOf('#');
	
	$.each($tabB1, function(){
		var $this = $(this);
		var $section = $('> .section', $this);
		var $tab_body = $('> .tab_body', $section);
		var $h3 = $('> h3', $section);
		if($h3.length<=0){
			var $h3 = $('> h4', $section);
			if($h3.length<=0){
				var $h3 = $('> h5', $section);
			}
		}
		
		$('> .tab0', $section).addClass('current');
		$('> .tab0', $section).next().toggle();
		//$section.eq(0).css('position', 'relative');
		$h3.bind({
			'mousedown': function(){
				bindMousedown($(this), $tab_body, $h3);
			}
		});
		
		if(dURLio){
			var str = dURL.substring(dURLio, dURL.length);
			if(str.indexOf('?')>=1) str = str.substring(0,str.indexOf('?'));
			var opentab = 0;
			//alert("tabB1 "+str);
			/*
				if(str == "#"){ opentab = 0;} else
				if(str == "#"){ opentab = 1;} else
				if(str == "#"){ opentab = 2;} else
				if(str == "#"){ opentab = 3;} else
				if(str == "#"){ opentab = 4;} else
				if(str == "#"){ opentab = 5;}
			*/
			//alert(str);
			if($('#lineupIndex').length>=1){
				if(str == "#heim"){ opentab = 0;} else
				if(str == "#toyou"){ opentab = 1;} else
				if(str == "#north"){ opentab = 2;} else
				if(str == "#apart"){ opentab = 3;}
			}
			//alert($('#c h2').html());
			if($('.exhibitionIndex, .estateIndex').length>=1 || $('#c h2').html().indexOf('h_950x62_event')>=1){
				if(str == "#all"){ opentab = 0;} else
				if(str == "#hokushin"){ opentab = 1;} else
				if(str == "#toushin"){ opentab = 2;} else
				if(str == "#tyushin"){ opentab = 3;} else
				if(str == "#nanshin"){ opentab = 4;} else
				if(str == "#niigata"){ opentab = 5;}
			}
			
			if($('.exhibitionDetail, .estateDetail').length>=1){
			if($('.tab3',$this).length<=0){
				if(str == "#blockplan"){ opentab = 0;} else
				if(str == "#resume"){ opentab = 1;} else
				if(str == "#madori"){ opentab = 1;} else
				if(str == "#map"){ opentab = 2;}
			}else{
				if(str == "#blockplan"){ opentab = 0;} else
				if(str == "#madori"){ opentab = 1;} else
				if(str == "#resume"){ opentab = 2;} else
				if(str == "#map"){ opentab = 3;}
			}
			}
			
			if($('#caseInteriorIndex').length>=1){
				if(str == "#entrance"){ opentab = 0;} else
				if(str == "#living"){ opentab = 1;} else
				if(str == "#kitchen_dining"){ opentab = 2;} else
				if(str == "#japanese"){ opentab = 3;} else
				if(str == "#bedroom"){ opentab = 4;} else
				if(str == "#nursery"){ opentab = 5;} else
				if(str == "#study"){ opentab = 6;} else
				if(str == "#sanitary"){ opentab = 7;} else
				if(str == "#other"){ opentab = 8;}
			}
			
			bindMousedown($('.tab'+opentab, $this), $tab_body, $h3);
			/* --- */
		}
		
	});
	
}

/* ---------------------------------------------------------------------

	tabB2

--------------------------------------------------------------------- */
tabB2_fnc();
function tabB2_fnc(){
	var $tabB2 = $('.tabB2');
	if($tabB2.length<=0) return false;
	
	$.each($tabB2, function(){
		var $this = $(this);
		var $section = $('> .section', $this);
		var $tab_body = $('> .tab_body', $section);
		var $h3 = $('> h3', $section);
		if($h3.length<=0){
			var $h3 = $('> h4', $section);
			if($h3.length<=0){
				var $h3 = $('> h5', $section);
			}
		}
		
		$section.eq(0).addClass('current');
		$section.eq(0).find('.tab_body').next().toggle();
		$h3.bind({
			'mousedown': function(){
				$h3.removeClass('current');
				$(this).toggleClass('current');
				$tab_body.hide();
				$(this).next().show();
			}
		});
	
	});
	
}

/* =====================================================================


	tabC1


===================================================================== */

tabC1_fnc();
function tabC1_fnc(){
	var $tabC1 = $('.tabC1');
	if($tabC1.length<=0) return false;
	
	$.each($tabC1, function(){
		var $this = $(this);
		var $section = $('> .section', $this);
		var $tabBody = $('> .tabBody', $section);
		var $tabH0 = $('> .tabH0', $section);
		
		if(_asIE6){
			
			/*
			var $wrap = $this.closest('.boxright');
			//if($wrap.height()>0) alert($wrap.height());
			$.each($wrap, function(){
				$(this).height($(this).height()+$(this).find('.tabC1').height());
			});
			*/
		}
		
		var $tab0 = $('.tab0' ,$this);
		var $tab1 = $('.tab1' ,$this);
		var $tab2 = $('.tab2' ,$this);
		
		/* .tab1 */
		if($tab0.length<=0){
			$('.tabH0' ,$tab1).css('left', '0px');
			$('.tabBody' ,$tab1).css('background-position', '68px 0');
		}
		/* .tab2 */
		if($tab0.length<=0 || $tab1.length<=0){
			$('.tabH0' ,$tab2).css('left', '158px');
			$('.tabBody' ,$tab2).css('background-position', '228px 0');
		}
		if($tab0.length<=0 && $tab1.length<=0){
			$('.tabH0' ,$tab2).css('left', '0px');
			$('.tabBody' ,$tab2).css('background-position', '68px 0');
		}
		
		//$('> .tab0 > .tabH0', $this).addClass('current');
		//$('> .tab0 > .tabH0', $this).next().toggle();
		$tabH0.bind({
			'mousedown': function(){
				if($(this).closest('.section').hasClass('current')){
					$section.removeClass('current');
					$tabBody.hide();
				}else{
					$section.removeClass('current');
					$(this).closest('.section').toggleClass('current');
					$tabBody.hide();
					$(this).next().show();
				}
			}
		});
	
	});
	
}


/* =====================================================================


	form page


===================================================================== */
form_pages();
function form_pages(){
	var $submit = $('#submit');
	var $toinputform = $('#toinputform');
	if( $submit.length<=0 && $toinputform.length<=0 ) return false;
	
	src_on_off('#submit');
	src_on_off('#toinputform');
	src_on_off('#backForm3');
	
	heightline('form table ul.float', 'li');
}

/* =====================================================================


	catalog


===================================================================== */
//catalogWrap_fnc();
function catalogWrap_fnc(){
	var $this = $('.catalogWrap');
	//heightline('.catalogWrap', 'dl');
}

/* =====================================================================


	form /reuse_heim/


===================================================================== */

function pageSpcontentReuseExhibition(){
	var $this = $('.pageSpcontentReuseExhibition');
	if($this.size()<=0) return false;
	
	setFancybox('.fancybox1', 526, 546);
	setFancybox('.fancybox2', 526, 546);
	setFancybox('.fancybox3', 526, 546);
	setFancybox('.fancybox4', 526, 546);
	setFancybox('.fancybox5', 526, 546);
}
pageSpcontentReuseExhibition();


function fncFormReuse_heim(){
	var $this = $('.pageContactReuse_heim');
	if($this.size()<=0) return false;
	var $blockStep1_2 = $('#blockStep1_2');
	//var $checkbox = $('#checkboxBlockStep1_2');
	var $checkbox = $('#openplanLabel1');
	
	var _checked = $('#openplan1').get(0).checked;
	if(!_checked){
		$blockStep1_2.hide(0);
	}
	//$checkbox.bind({
	$('#openplanLabel1, #openplan1').bind({
		'mousedown': function(){
			$blockStep1_2.toggle(0);
			if(_asIE6){
				var a = $('input',$(this)).attr('checked');
				if(!a){
					$('input',$(this)).attr('checked','checked');
				}else{
					$('input',$(this)).removeAttr('checked');
				}
			}
		}
	});
	
	setFancybox('.fancyboxPlan', 910, 537);
	setFancybox('.fancyboxA', 910, 537);
	setFancybox('.fancyboxB', 522, 537);
}
fncFormReuse_heim();


/* =====================================================================


	.boxPhotosA1 - lineup detail


===================================================================== */
boxPhotosA1_fnc();
function boxPhotosA1_fnc(){
	var $this = $('.boxPhotosA1');
	if($this.length<=0) return false;
	
	$.each($this, function(){
		var $this = $(this);
		
		var $photos = $('.photos', $this);
		var $photos_img = $('p img' ,$photos);
				
		var photo_num = photo_num_min = 1;
		
		var $prevnext = $('.prevnext', $this);
		var $thumbnail = $('.thumbnail', $this);
		var $thumbnail_li = $('li', $thumbnail);
		var thumbnail_length = $thumbnail_li.length;
		
		if(thumbnail_length <= 1) return false;
		
		$prevnext.show();
		
		/*---------------------------------
		
			$thumbnail
		
		----------------------------------*/
		$thumbnail_li.append('<span></span>');
		
		$thumbnail_li.eq(0).addClass('current');
		$thumbnail_li.bind('click', function(){
			var _index = $thumbnail_li.index(this);
			photo_num = _index+1;
			//$photos_img.fadeOut(50);
			$photos_img.attr('src', 'data/photo'+formatNum(3,photo_num)+'.jpg');
			//$photos_img.fadeIn(50);
			$thumbnail_li.removeClass('current');
			$(this).addClass('current');
		});
		
		
		/*---------------------------------
		
			$prevnext
		
		----------------------------------*/
		var $prev = $('.prev', $prevnext);
		var $next = $('.next', $prevnext);
		
		$prev.bind('click', function(){
			(photo_num > photo_num_min)? --photo_num : photo_num = thumbnail_length;
			$photos_img.attr('src', 'data/photo'+formatNum(3,photo_num)+'.jpg');
			$thumbnail_li.removeClass('current');
			$thumbnail_li.eq(photo_num-1).addClass('current');
		});
		
		$next.bind('click', function(){
			(photo_num < thumbnail_length)? ++photo_num : photo_num = photo_num_min;
			$photos_img.attr('src', 'data/photo'+formatNum(3,photo_num)+'.jpg');
			$thumbnail_li.removeClass('current');
			$thumbnail_li.eq(photo_num-1).addClass('current');
		});
		
		
	});
	
}


/* =====================================================================


	.modalA1


===================================================================== */
/*
modalA1_fnc('.modalA1', '.btnModalPrint img');
modalA1_fnc('#modalStaffInterview01', 'a[href="#a-staff_interview01"]');
modalA1_fnc('#modalStaffInterview02', 'a[href="#a-staff_interview02"]');
modalA1_fnc('#modalStaffWeek01', 'a[href="#a-staff_week01"]');
modalA1_fnc('#modalStaffWeek02', 'a[href="#a-staff_week02"]');
function modalA1_fnc(mt1, mt2){
	var $this = $(mt1);
	if($this.length<=0) return false;
	
	var $btnModalOn = $(mt2);
	if($btnModalOn.length<=0) return false;
	
	$.each($this, function(){
		var $this = $(this);
		var $bg = $('.bg', $this);
		var $body = $('.body', $this);
		var $close = $('.btnClose', $body);
		
		if(_asIE6) $this.css('height', $document.height()+'px');
		
		$btnModalOn.bind('click', function(){
			$body.css('margin-top', $document.scrollTop()+20);
			if(_asIE6) $document.scrollTop(0);
			$this.show();
		});
		
		$close.bind('click', function(){ $this.hide(); return false;});
		$bg.bind('click', function(){ $this.hide();});
		$body.bind('click', function(){});
		
	});
}
*/

//modalA1_fnc('.modalA1', '.btnModalPrint img');
setModal_fnc('#setModal', '.aSetModal');
function setModal_fnc(mt1, mt2){
	var $aSetModal = $(mt2);
	if($aSetModal.length<=0) return false;
	
	$('body').append('<div id="setModal"></div>');
	var $this = $(mt1);
	
	$.each($this, function(){
		var $this = $(this);
		
		if(_asIE6) $this.css('height', $document.height()+'px');
		
		$aSetModal.bind('click', function(){
			if(_asIE6) $document.scrollTop(0);
			//alert($(this).attr('href'));
			$this.load($(this).attr('href'), function(){
				var $modal = $('.modalA_off', $this);
				var $body = $('.body', $modal);
				$body.css('margin-top', $document.scrollTop()+20);
				$body.bind('click', function(){});
				$('.bg', $modal).bind('click', function(){ $this.html('');});
				$('.btnClose', $modal).bind('click', function(){ $this.html('');});
			});
			//$this.show();
		});
		
	});
	return false;
}


/* =====================================================================


	change Img - use in /estate/,/exhibition/


===================================================================== */
viewWrap_fnc();
function viewWrap_fnc(){
	
	$('.viewWrap li a').click(function(){
		var bicSrc = $('#viewBic img').attr('src');
		//bicSrc = bicSrc.substring(bicSrc.lastIndexOf('/'), bicSrc.length);
		
		var changeSrc = $(this).attr('href');
		//var changeSrc = '/' + changeSrc;
		
		$('#viewBic img').attr('src',$('#viewBic img').attr('src').replace(bicSrc, changeSrc));
		$('.viewWrap li').removeClass('on');
		$(this).parent('li').addClass('on');
		
		return false;
	});
}


/* =====================================================================


	


===================================================================== */

/*
$('#recruitSeminarIndex #m .tableA2:nth-of-type(1)').css({
	'margin-top': '20px'
});
*/


/* =====================================================================


	fancybox


===================================================================== */
fancyBox_fnc();
function fancyBox_fnc(){
	
	setFancybox('.fancybox', 770, 858);
	setFancybox('.fancyboxWeek1', 770, 1180);
	setFancybox('.fancyboxWeek2', 770, 1070);
	setFancybox('.fancyboxMovie1', 482, 411);
	
	if($('a').hasClass('fancyboxImg')){
		$('.fancyboxImg').fancybox();
	}
	function closeWindow(){
		$.fancybox.close();
	}
}

/* =====================================================================


	#pagetop


===================================================================== */

//pagetop_fixed('#pagetop', '#f');
function pagetop_fixed(t_main, t_footer){
	var $this = $(t_main);
	var $footer = $(t_footer);
	if($this.length<=0 || $footer.length<=0) return false;
	
	//var $c = $this.
	
	var this_height = $this.height();
	var this_bottom = anti_px($this.css("bottom"));
	
	var $footer_outerHeight = $footer.outerHeight();
	var $document = $(document);
	var $window = $(window);
	var window_height = $window.height();
	var stop_point = $document.height() - $footer_outerHeight - this_bottom - this_height;
	//alert("stop_point : "+stop_point);
	
	$(window).bind('scroll', function(){
		offset = $document.scrollTop()+window_height-this_height-this_bottom;
		//debugbox('stop_point : '+stop_point+' / offset : '+offset);
		if(offset > stop_point) offset = stop_point;
		$this.delay(1000).animate({top:offset},{
			duration: 600,
			queue: false
		},'easeInOutCubic');
		
	});
}

/* =====================================================================


	pageSpcontentReuse


===================================================================== */
function pageSpcontentReuse(){
	var $secCountDown = $('#secCountDown');
	if($secCountDown.size()<=0) return false;
	var $this = $('.countbox .num',$secCountDown);
	var $day1 = $('.day1',$this);
	var $day2 = $('.day2',$this);
	var $hour = $('.hour',$this);
	var $minute = $('.minute',$this);
	
	var _date, _year, _target, _day, _hour, _minute, _second, _sec;
	function fncCountdown(){
		_date = new Date();
		_year = (_date.getYear()<2000)?1900+_date.getYear() : _date.getYear();
		_target = new Date(_year,1,21);
		_sec = _target.getTime()-_date.getTime();
		_day = Math.floor(_sec/(1000*60*60*24));
		_sec -= (_day*(1000*60*60*24));
		_hour = Math.floor(_sec/(1000*60*60));
		_sec -= (_hour*(1000*60*60));
		_minute  = Math.floor(_sec/(1000*60));
		_sec -= (_minute*(1000*60));
		_second  = Math.floor(_sec/1000);
		
		function keta2(_v){
			if(_v<10) _v='0'+_v;
			return _v;
		}
		
		_day = keta2(_day);
		_minute = keta2(_minute);
		_second = keta2(_second);
		
		$day1.text(String(_day).substr(0,1));
		$day2.text(String(_day).substr(1,1));
		$hour.text(_hour);
		$minute.text(_minute);
	}
	fncCountdown();
	var _setTimer = setInterval(fncCountdown, 1000);

}
pageSpcontentReuse();


});
})(jQuery, this, this.document);


/* =====================================================================


	onLoad


===================================================================== */
jQuery.event.add(window, "load", function(){

/* ---------------------------------------------------------------------

	img_vretical_align

--------------------------------------------------------------------- */
//imgVreticalAlign('.imgVreticalAlign');
//imgVreticalAlign('.tabA1 .tab_body .tab_body .boxleft');
function imgVreticalAlign(t){
	var $wrap = $(t);
	if($wrap.length<=0) return false;
	
	$.each($wrap, function(){
		var $this = $(this);
		var $img = $this.find('img');
		var get_h = ($this.height()-$img.height())/2;
		$img.css('margin-top', get_h+'px');
	});
}

});//onLoad


/* =====================================================================


	window


===================================================================== */

function m_win(url,windowname,width,height) {
 var features="location=no, menubar=no, status=yes, scrollbars=yes, resizable=yes, toolbar=no";
 if (width) {
  if (window.screen.width > width)
   features+=", left="+(window.screen.width-width)/2;
  else width=window.screen.width;
  features+=", width="+width;
 }
 if (height) {
  if (window.screen.height > height)
   features+=", top="+(window.screen.height-height)/2;
  else height=window.screen.height;
  features+=", height="+height;
 }
 window.open(url,windowname,features);
}
