// JavaScript Document
$(function( ){
	$("#osusume_link").load("ban_top_btm.html .mainContent",function() {
var osusume_height01 = $("div#osusume_link .component.squareComponent").height();
var osusume_height_01 = osusume_height01+10;
$("div#osusume_link .mainContent").height(osusume_height01);
});
	
	$("ul.bannerContent").load("side_L_banner.html");
	$("p.footerText").load("foot_navi.html");
	$("#com_snavi").load("com_snavi.html");
	$("#owner_snavi").load("owner_snavi.html");

	$("ul.globalMenu li:first").addClass("first");
	$("ul.globalMenu li:last").addClass("last");
	$("li.category dd:last").addClass("last");
	$("div#box_topics dt:first").addClass("first");
								
	});


(function($) {

	$(function() {
		$.yuga.selflink();
	});

	//---------------------------------------------------------------------

	$.yuga = {
		// URIを解析したオブジェクトを返すfunction
		Uri: function(path){
			var self = this;
			this.originalPath = path;
			//絶対パスを取得
			this.absolutePath = (function(){
				var e = document.createElement('span');
				e.innerHTML = '<a href="' + path + '" />';
				return e.firstChild.href;
			})();
			//絶対パスを分解
			var fields = {'schema' : 2, 'username' : 5, 'password' : 6, 'host' : 7, 'path' : 9, 'query' : 10, 'fragment' : 11};
			var r = /^((\w+):)?(\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/.exec(this.absolutePath);
			for (var field in fields) {
				this[field] = r[fields[field]];
			}
			this.querys = {};
			if(this.query){
				$.each(self.query.split('&'), function(){
					var a = this.split('=');
					if (a.length == 2) self.querys[a[0]] = a[1];
				});
			}
		},
		//現在のページと親ディレクトリへのリンク
		selflink: function (options) {
			var c = $.extend({
				selfLinkAreaSelector:'body',
				selfLinkClass:'current',
				parentsLinkClass:'parentsLink',
				postfix: '_cr',
				changeImgSelf:true,
				changeImgParents:true
			}, options);
			$(c.selfLinkAreaSelector+((c.selfLinkAreaSelector)?' ':'')+'a[href]').each(function(){
				var href = new $.yuga.Uri(this.getAttribute('href'));
				var setImgFlg = false;
				if ((href.absolutePath == location.href) && !href.fragment) {
					//同じ文書にリンク
					$(this).addClass(c.selfLinkClass);
					setImgFlg = c.changeImgSelf;
				} else if (0 <= location.href.search(href.absolutePath)) {
					//親ディレクトリリンク
					$(this).addClass(c.parentsLinkClass);
					setImgFlg = c.changeImgParents;
				}
			});
		}

	};
})(jQuery);




// ビフォー・アフターリスト
$(function(){
	$.ajax({
    url:"list_before_after_wall.xml",
    dataType:"xml",
    success:function(data){

	  $("entry",data).each(
		  function(number){
			  number = number+1;
			  $("ul#list_detail.wall").append("<li><a href='#" + number +"'>"+$("title",this).text()+"</a></li>")
	   })

    }
    });
});

$(function(){
	$.ajax({
    url:"list_before_after_room.xml",
    dataType:"xml",
    success:function(data){

	  $("entry",data).each(
		  function(number){
			  number = number+1;
			  $("ul#list_detail.room").append("<li><a href='#" + number +"'>"+$("title",this).text()+"</a></li>")
	   })

    }
    });
});

$(function(){
	$.ajax({
    url:"list_before_after_outside.xml",
    dataType:"xml",
    success:function(data){

	  $("entry",data).each(
		  function(number){
			  number = number+1;
			  $("ul#list_detail.outside").append("<li><a href='#" + number +"'>"+$("title",this).text()+"</a></li>")
	   })

    }
    });
});

$(function(){
	$.ajax({
    url:"list_before_after_doboku.xml",
    dataType:"xml",
    success:function(data){

	  $("entry",data).each(
		  function(number){
			  number = number+1;
			  $("ul#list_detail.doboku").append("<li><a href='#" + number +"'>"+$("title",this).text()+"</a></li>")
	   })

    }
    });
});


// ビフォー・アフター詳細
$(function(){
	$.ajax({
    url:"list_before_after_wall.xml",
    dataType:"xml",
    success:function(data){

	  $("entry",data).each(
		  function(number){
			  number = number+1;
			  $("div#box_before_after.wall").append(
			  

"<div id='" + number + "' class='box_example clearfix'>" +

"<h5>" + $("title",this).text() + " </h5>" +

"<p>" + $("texts",this).text() + " </p>" +

"<h6>" + $("title_photo",this).text() + " <br />" +
"<span>（" + $("building",this).text() + "） </span></h6>" +

"<div class='box_before'>" +
"<h6><img src='reform_images/ttl_before.gif' width='137' height='33' alt='施工前' /></h6>" +
"<p class='img_reform_photo'><img src='reform_images/" + $("before_photo",this).text() + " ' alt='画像' /></p>" +

"</div>" +

"<div class='box_after'>" +
"<h6><img src='reform_images/ttl_after.gif' width='123' height='33' alt='施工後' /></h6>" +
"<p class='img_reform_photo'><img src='reform_images/" + $("after_photo",this).text() + " ' alt='画像' /></p>" +
"<p class='btn_reform_inquiry'><a href='#'><img src='reform_images/btn_reform_inquiry.gif' width='146' height='45' alt='お問い合せいただくと閲覧可能になります。' /></a></p>" +
"<p class='typo_attent'>＊お問い合せいただくと閲覧可能になります。</p>" +
"</div>" +

"</div>" +

"<div class='pageTop'><a href='#pageTop' onclick='backToTop(); return false;'>ページトップ</a></div>" +

"<p class='goto_reformtop_min'><a href='owner_reform.html'><img src='reform_images/btn_goto_reformtop_min.gif' width='111' height='11' alt='リフォーム／改修 関連トップへ' /></a></p>"
			  
			  )
	   })

    }
    });
});

$(function(){
	$.ajax({
    url:"list_before_after_room.xml",
    dataType:"xml",
    success:function(data){

	  $("entry",data).each(
		  function(number){
			  number = number+1;
			  $("div#box_before_after.room").append(
			  

"<div id='" + number + "' class='box_example clearfix'>" +

"<h5>" + $("title",this).text() + " </h5>" +

"<p>" + $("texts",this).text() + " </p>" +

"<h6>" + $("title_photo",this).text() + " <br />" +
"<span>（" + $("building",this).text() + "） </span></h6>" +

"<div class='box_before'>" +
"<h6><img src='reform_images/ttl_before.gif' width='137' height='33' alt='施工前' /></h6>" +
"<p class='img_reform_photo'><img src='reform_images/" + $("before_photo",this).text() + " ' alt='画像' /></p>" +

"</div>" +

"<div class='box_after'>" +
"<h6><img src='reform_images/ttl_after.gif' width='123' height='33' alt='施工後' /></h6>" +
"<p class='img_reform_photo'><img src='reform_images/" + $("after_photo",this).text() + " ' alt='画像' /></p>" +
"<p class='btn_reform_inquiry'><a href='#'><img src='reform_images/btn_reform_inquiry.gif' width='146' height='45' alt='お問い合せいただくと閲覧可能になります。' /></a></p>" +
"<p class='typo_attent'>＊お問い合せいただくと閲覧可能になります。</p>" +
"</div>" +

"</div>" +

"<div class='pageTop'><a href='#pageTop' onclick='backToTop(); return false;'>ページトップ</a></div>" +

"<p class='goto_reformtop_min'><a href='owner_reform.html'><img src='reform_images/btn_goto_reformtop_min.gif' width='111' height='11' alt='リフォーム／改修 関連トップへ' /></a></p>"
			  
			  )
	   })

    }
    });
});

$(function(){
	$.ajax({
    url:"list_before_after_outside.xml",
    dataType:"xml",
    success:function(data){

	  $("entry",data).each(
		  function(number){
			  number = number+1;
			  $("div#box_before_after.outside").append(
			  

"<div id='" + number + "' class='box_example clearfix'>" +

"<h5>" + $("title",this).text() + " </h5>" +

"<p>" + $("texts",this).text() + " </p>" +

"<h6>" + $("title_photo",this).text() + " <br />" +
"<span>（" + $("building",this).text() + "） </span></h6>" +

"<div class='box_before'>" +
"<h6><img src='reform_images/ttl_before.gif' width='137' height='33' alt='施工前' /></h6>" +
"<p class='img_reform_photo'><img src='reform_images/" + $("before_photo",this).text() + " ' alt='画像' /></p>" +

"</div>" +

"<div class='box_after'>" +
"<h6><img src='reform_images/ttl_after.gif' width='123' height='33' alt='施工後' /></h6>" +
"<p class='img_reform_photo'><img src='reform_images/" + $("after_photo",this).text() + " ' alt='画像' /></p>" +
"<p class='btn_reform_inquiry'><a href='#'><img src='reform_images/btn_reform_inquiry.gif' width='146' height='45' alt='お問い合せいただくと閲覧可能になります。' /></a></p>" +
"<p class='typo_attent'>＊お問い合せいただくと閲覧可能になります。</p>" +
"</div>" +

"</div>" +

"<div class='pageTop'><a href='#pageTop' onclick='backToTop(); return false;'>ページトップ</a></div>" +

"<p class='goto_reformtop_min'><a href='owner_reform.html'><img src='reform_images/btn_goto_reformtop_min.gif' width='111' height='11' alt='リフォーム／改修 関連トップへ' /></a></p>"
			  
			  )
	   })

    }
    });
});

$(function(){
	$.ajax({
    url:"list_before_after_doboku.xml",
    dataType:"xml",
    success:function(data){

	  $("entry",data).each(
		  function(number){
			  number = number+1;
			  $("div#box_before_after.doboku").append(
			  

"<div id='" + number + "' class='box_example clearfix'>" +

"<h5>" + $("title",this).text() + " </h5>" +

"<p>" + $("texts",this).text() + " </p>" +

"<h6>" + $("title_photo",this).text() + " <br />" +
"<span>（" + $("building",this).text() + "） </span></h6>" +

"<div class='box_before'>" +
"<h6><img src='reform_images/ttl_before.gif' width='137' height='33' alt='施工前' /></h6>" +
"<p class='img_reform_photo'><img src='reform_images/" + $("before_photo",this).text() + " ' alt='画像' /></p>" +

"</div>" +

"<div class='box_after'>" +
"<h6><img src='reform_images/ttl_after.gif' width='123' height='33' alt='施工後' /></h6>" +
"<p class='img_reform_photo'><img src='reform_images/" + $("after_photo",this).text() + " ' alt='画像' /></p>" +
"<p class='btn_reform_inquiry'><a href='#'><img src='reform_images/btn_reform_inquiry.gif' width='146' height='45' alt='お問い合せいただくと閲覧可能になります。' /></a></p>" +
"<p class='typo_attent'>＊お問い合せいただくと閲覧可能になります。</p>" +
"</div>" +

"</div>" +

"<div class='pageTop'><a href='#pageTop' onclick='backToTop(); return false;'>ページトップ</a></div>" +

"<p class='goto_reformtop_min'><a href='owner_reform.html'><img src='reform_images/btn_goto_reformtop_min.gif' width='111' height='11' alt='リフォーム／改修 関連トップへ' /></a></p>"
			  
			  )
	   })

    }
    });
});

