/*	画像Path
============================================================*/
var siteMatrix = "/matrix";



/*	byon.js difference
============================================================*/
var dif;
dif = 0;


/*
 * IE PNG Fix v1.4
 *
 * Copyright (c) 2006 Takashi Aida http://www.isella.com/aod2/
 *
 */

// IE5.5+ PNG Alpha Fix v1.0RC4
// (c) 2004-2005 Angus Turnbull http://www.twinhelix.com

// This is licensed under the CC-GNU LGPL, version 2.1 or later.
// For details, see: http://creativecommons.org/licenses/LGPL/2.1/

if (typeof IEPNGFIX == 'undefined') {
//--============================================================================

var IEPNGFIX = {
	blank:  siteMatrix + '/images/blank.gif',
	filter: 'DXImageTransform.Microsoft.AlphaImageLoader',

	fixit: function (elem, src, method) {
		if (elem.filters[this.filter]) {
			var filter = elem.filters[this.filter];
			filter.enabled = true;
			filter.src = src;
			filter.sizingMethod = method;
		}
		else {
			elem.style.filter = 'progid:' + this.filter +
				'(src="' + src + '",sizingMethod="' + method + '")';
		}
	},

	fixwidth: function(elem) {
		if (elem.currentStyle.width == 'auto' &&
			elem.currentStyle.height == 'auto') {
			elem.style.width = elem.offsetWidth + 'px';
		}
	},

	fixchild: function(elem, recursive) {
		if (!/MSIE (5\.5|6\.|7\.)/.test(navigator.userAgent)) return;

		for (var i = 0, n = elem.childNodes.length; i < n; i++) {
			var childNode = elem.childNodes[i];
			if (childNode.style) {
				if (childNode.style.position) {
					childNode.style.position = childNode.style.position;
				}
				else {
					childNode.style.position = 'relative';
				}
			}
			if (recursive && childNode.hasChildNodes()) {
				this.fixchild(childNode, recursive);
			}
		}
	},

	fix: function(elem) {
		if (!/MSIE (5\.5|6\.|7\.)/.test(navigator.userAgent)) return;

		var bgImg =
			elem.currentStyle.backgroundImage || elem.style.backgroundImage;

		if (elem.tagName == 'IMG') {
			if ((/\.png$/i).test(elem.src)) {
				this.fixwidth(elem);
				this.fixit(elem, elem.src, 'scale');
				elem.src = this.blank;
				elem.runtimeStyle.behavior = 'none';
			}
		}
		else if (bgImg && bgImg != 'none') {
			if (bgImg.match(/^url[("']+(.*\.png)[)"']+$/i)) {
				var s = RegExp.$1;
				this.fixwidth(elem);
				elem.style.backgroundImage = 'none';
				this.fixit(elem, s, 'scale'); // crop | image | scale

				if (elem.tagName == 'A' && elem.style) {
					if (!elem.style.cursor) {
						elem.style.cursor = 'pointer';
					}
				}

				this.fixchild(elem);
				elem.runtimeStyle.behavior = 'none';
			}
		}
	},

	hover: function(elem, hvImg) {
		var bgImg = elem.style.backgroundImage;

		if (!bgImg && elem.currentStyle) bgImg = elem.currentStyle.backgroundImage;

		if (elem.tagName == 'IMG' && hvImg) {
			var image = elem.src;
			elem.onmouseover = function() {
				elem.src = hvImg;
				IEPNGFIX.fix(elem);
			};
			elem.onmouseout = function() {
				elem.src = image;
				IEPNGFIX.fix(elem);
			};
		}
		else if (bgImg && bgImg != 'none' && hvImg) {
			elem.onmouseover = function() {
				elem.style.backgroundImage = 'url(' + hvImg + ')';
				IEPNGFIX.fix(elem);
			};
			elem.onmouseout = function() {
				elem.style.backgroundImage = bgImg;
				IEPNGFIX.fix(elem);
			};
		}

		IEPNGFIX.fix(elem);
	}
};

//--============================================================================
} // end if (typeof IEPNGFIX == 'undefined')









/*  
============================================================*/
try { 
	document.execCommand('BackgroundImageCache', false, true); 
} catch(e) {} 



//reset
jq$(document).ready(function(){
	jq$("a").focus(function(){this.blur();})
	jq$("area").focus(function(){this.blur();})

//	if(navigator.platform.indexOf("Win") != -1) return false;
//	if(jq$.browser.mozilla) {
		//jq$("body").addClass("body_mac_moz");
		//jq$("#gnv2").addClass("body_mac_moz");
		//jq$("#main_outer").addClass("body_mac_moz");
		//jq$("#footer_outer").addClass("body_mac_moz");
//	}
});





jq$(document).ready(function(){
//--============================================================================



//link_blog
	var rightBlogLink = jq$('#main_right  #link_blog');
	jq$('dl:last',rightBlogLink).addClass('last');


//index_section
	var indexList = jq$('#index_list');
	jq$('p',indexList).flatHeights();
	jq$('li:odd',indexList).css({'margin-right':'0'});


//acceptable
	var acDD = jq$('#acceptable dd');
	acDD.flatHeights();


//brands
	var brandsP = jq$('#brands p');
	brandsP.flatHeights();


//hover
	function funHvop() {
		jq$(this).stop().fadeTo(150,0.2).fadeTo(400,1.0);	
	}
	
	
	var hpOp = jq$('.hv_op img');
	hpOp.mouseover(funHvop);


//hover2
	var hpOp2 = jq$('.hv_op2 img');
	hpOp2.hover(
		function(){jq$(this).fadeTo(150, 0.6);},	function(){jq$(this).fadeTo(400, 1.0);}
	);


//gnv2
	var gnv2Li = jq$('#gnv2 li');
	gnv2Li.hover(
		function(){jq$(this).children(".nm").stop().fadeTo(150, 0.1);},
		function(){jq$(this).children(".nm").stop().fadeTo(400, 1.0);}
	);

	if(gnv2ID != "") {
		jq$('#gnv2' + gnv2ID).children(".hv").css({"z-index":"3"});
	}

//lnv
	var lnvA = jq$('#lnv a');
	lnvA.hover(function(){jq$(this).addClass('hv')},function(){jq$(this).removeClass('hv')});
	if(lnvID != "") {
		jq$('#lnv' + lnvID).addClass("hv").unbind("mouseover").unbind("mouseout");
	}



//diamond/rolex 
  	var fadeOutDuration = 100;
  	var fadeInDuration = 400;
	var minOp = 0.2 ;

	var opSNum;
	opSNum = location.search.replace('?','');
	opSNum = opSNum.split('=');
	opS = opSNum[1];
	


//diamond_price table flatheights
	var DiaPriceTables = jq$('#diamond_price .table');
	function intDiaPriceTables() { 
		DiaPriceTables.flatHeights();
		jq$('.table:odd', '#diamond_price').css({"margin-right":"0"});
	}
	intDiaPriceTables();
	

//diamond_price
	var DiaSheets = jq$('#diamond_price .sheets'); 
	var DiaImgPath = '/diamond/matrix/images/';
	var DiaPrintPath = '/diamond/print/d';
	var dpNaviBtn = jq$('#diamond_price_navi1  li');
	var dpNaviBtn2 = jq$('#diamond_price_navi2  li');
	var dPrintBtn = jq$('#pring_btn').children('a');
	
	DiaSheets.hide();
	if(DiaSheets.length) {
		if(opS == undefined) { 
			if(jq$.cookie('dpl_cookie')==null){
				opS = 0;
			} else {
				opS = jq$.cookie('dpl_cookie');
			}
		} else {
			jq$.cookie('dpl_cookie',opS ,{ expires: 7 });
		}

		jq$(jq$(DiaSheets)[opS]).show();
		
		dpNaviBtn.each(function(i){jq$(this).children('img').attr('src',DiaImgPath + 'dpl_navi_nrm'+ i +'.gif')});
		jq$(jq$(dpNaviBtn)[opS]).children('img').attr('src',DiaImgPath + 'dpl_navi'+ opS +'.gif');
		
		dpNaviBtn2.each(function(i){jq$(this).children('img').attr('src',DiaImgPath + 'dpl_navi_nrm'+ i +'.gif')});
		jq$(jq$(dpNaviBtn2)[opS]).children('img').attr('src',DiaImgPath + 'dpl_navi2_'+ opS +'.gif');
		
		dPrintBtn.attr('href',DiaPrintPath + opS +'.php');


	}
	
	
	dpNaviBtn.each(function(i){
		jq$(dpNaviBtn[i]).click(function(){
			DiaSheets.hide();
			jq$(jq$(DiaSheets)[i]).show().fadeTo(fadeOutDuration,minOp).fadeTo(fadeInDuration,1.0);

			dpNaviBtn.each(function(i){jq$(this).children('img').attr('src',DiaImgPath + 'dpl_navi_nrm'+ i +'.gif')});
			jq$(this).children('img').attr('src',DiaImgPath + 'dpl_navi'+ i +'.gif');
			
			dpNaviBtn2.each(function(i){jq$(this).children('img').attr('src',DiaImgPath + 'dpl_navi_nrm'+ i +'.gif')});
			jq$(dpNaviBtn2[i]).children('img').attr('src',DiaImgPath + 'dpl_navi2_'+ i +'.gif');
			
			dPrintBtn.attr('href',DiaPrintPath + i +'.php');
			jq$.cookie('dpl_cookie',i,{ expires: 7 });
		});
	})
	dpNaviBtn2.each(function(i){
		jq$(dpNaviBtn2[i]).click(function(){
			DiaSheets.css({'display':'none'});
			jq$(jq$(DiaSheets)[i]).show().fadeTo(fadeOutDuration,minOp).fadeTo(fadeInDuration,1.0);
			
			dpNaviBtn2.each(function(i){jq$(this).children('img').attr('src',DiaImgPath + 'dpl_navi_nrm'+ i +'.gif')});
			jq$(this).children('img').attr('src',DiaImgPath + 'dpl_navi2_'+ i +'.gif');
			
			dpNaviBtn.each(function(i){jq$(this).children('img').attr('src',DiaImgPath + 'dpl_navi_nrm'+ i +'.gif')});
			jq$(dpNaviBtn[i]).children('img').attr('src',DiaImgPath + 'dpl_navi'+ i +'.gif');
			
			dPrintBtn.attr('href',DiaPrintPath + i +'.php');
			jq$.cookie('dpl_cookie',i,{ expires: 7 });

			jq$('html, body').animate({ scrollTop: 0 }, 0);
			
		});
	})

//Rolex_price
	
	var RolexSheets = jq$('#rolex_price .sheets'); 
	var RolexImgPath = '/rolex/matrix/images/';
	var RolexPrintPath = '/rolex/print/r';
	var rpNaviBtn = jq$('#rolex_price_navi1 li');
	var rpNaviBtn2 = jq$('#rolex_price_navi2 li');
	var rPrintBtn = jq$('#pring_btn').children('a');
	var rpPageDownNavi = jq$('.rolex_price_navi2 ul',RolexSheets);
	
	RolexSheets.hide();
	if(RolexSheets.length) {
		if(opS == undefined) { 
			if(jq$.cookie('rpl_cookie')==null){
				opS = 0;
			} else {
				opS = jq$.cookie('rpl_cookie');
			}
		} else {
			jq$.cookie('rpl_cookie',opS ,{ expires: 7 });
		}

		jq$(jq$(RolexSheets)[opS]).show();
		
		rpNaviBtn.each(function(i){jq$(this).children('img').attr('src',RolexImgPath + 'rpl_navi_nrm'+ i +'.gif')});
		jq$(jq$(rpNaviBtn)[opS]).children('img').attr('src',RolexImgPath + 'rpl_navi'+ opS +'.gif');
		
		rpNaviBtn2.each(function(i){jq$(this).children('img').attr('src',RolexImgPath + 'rpl_navi_nrm'+ i +'.gif')});
		jq$(jq$(rpNaviBtn2)[opS]).children('img').attr('src',RolexImgPath + 'rpl_navi'+ opS +'.gif');
		
		rPrintBtn.attr('href',RolexPrintPath + opS +'.php');
		jq$.cookie('rpl_cookie',opS,{ expires: 7 });


	}
	
	rpNaviBtn.each(function(i){
		jq$(rpNaviBtn[i]).click(function(){
			RolexSheets.hide();
			jq$(jq$(RolexSheets)[i]).show().fadeTo(fadeOutDuration,minOp).fadeTo(fadeInDuration,1.0);
			
			rpNaviBtn.each(function(i){jq$(this).children('img').attr('src',RolexImgPath + 'rpl_navi_nrm'+ i +'.gif')});
			jq$(this).children('img').attr('src',RolexImgPath + 'rpl_navi'+ i +'.gif');
			
			rpNaviBtn2.each(function(i){jq$(this).children('img').attr('src',RolexImgPath + 'rpl_navi_nrm'+ i +'.gif')});
			jq$(rpNaviBtn2[i]).children('img').attr('src',RolexImgPath + 'rpl_navi2_'+ i +'.gif');
			
			rPrintBtn.attr('href',RolexPrintPath + i +'.php');
			jq$.cookie('rpl_cookie',i,{ expires: 7 });
			
		});
	})
	rpNaviBtn2.each(function(i){
		jq$(rpNaviBtn2[i]).click(function(){
			RolexSheets.hide();
			jq$(jq$(RolexSheets)[i]).show().fadeTo(fadeOutDuration,minOp).fadeTo(fadeInDuration,1.0);
			
			rpNaviBtn2.each(function(i){jq$(this).children('img').attr('src',RolexImgPath + 'rpl_navi_nrm'+ i +'.gif')});
			jq$(this).children('img').attr('src',RolexImgPath + 'rpl_navi2_'+ i +'.gif');
			
			rpNaviBtn.each(function(i){jq$(this).children('img').attr('src',RolexImgPath + 'rpl_navi_nrm'+ i +'.gif')});
			jq$(rpNaviBtn[i]).children('img').attr('src',RolexImgPath + 'rpl_navi'+ i +'.gif');
			
			rPrintBtn.attr('href',RolexPrintPath + i +'.php');
			jq$.cookie('rpl_cookie',i,{ expires: 7 });

			jq$('html, body').animate({ scrollTop: 0 }, 0);
			
		});
	})

	//byon.js dif
	rpPageDownNavi.each(function(){
		jq$('a', this).click(function(){dif = -20});
		jq$('a:first', this).click(function(){dif = 0});
	});










//googlemap
	if(document.getElementById("gmap")) {
		lat = 34.7190703;
		lng = 135.4815583;
		var div = document.getElementById("gmap");
		try {if(!GBrowserIsCompatible()) throw "don't support";}
		catch(e) {	div.innerHTML = "ご利用のブラウザはGoogleマップに対応していません。";return;}

		var map = new GMap2(div);
		var latlng = new GLatLng(lat,lng);
		map.setCenter(latlng,zoom);	
		map.addControl(new GLargeMapControl3D());
		map.enableContinuousZoom();
		map.enableDoubleClickZoom();
		var marker = new GMarker(map.getCenter());
		map.addOverlay(marker);	
		
		if(print_map != "1") { 
			map.addControl(new GMapTypeControl());
			map.addControl(new GOverviewMapControl());
			var offset = new GSize(10, -20);
			var textnode = '<span style="display:block;font-size:14px;line-height:5;text-align:center;"><strong>株式会社ネクサス</strong></span>';
			marker.openInfoWindowHtml(textnode);
		}
	}


//resizable
	if(jq$('textarea.resizable', 'form').length) {
	jq$('textarea.resizable:not(.processed)').TextAreaResizer();
	}


//sitemap
	jq$('.smap_right', '#sitemap').each(function(i){
		jq$(this).children('p:last').addClass('last');
	})




//metal pricelist display
	if(gnv2ID == "") jq$('#link_comparison').css('display','none');




//faq
(function(){

	if(!location.href.match('/faq/')) return false;

	var faqopS;
	var pImg = '/faq/matrix/images/btn_plus.jpg';
	var mImg = '/faq/matrix/images/btn_minus.jpg';
	var txtShow = '表示する';
	var txtHide = '非表示にする';

	if(location.hash) faqopS = location.hash.replace('#faq_section','');

	if(faqopS == undefined) {
		faq_int();
	} else {
		faq_int();
		var openSection =    jq$('#faq_section' + faqopS);
		var aOpenSection =   jq$(openSection).find('.answer');
		var btnOpenSection = jq$(openSection).find('.toggle_btn');
		var qOpenSection =   jq$(openSection).find('.question');
		
		jq$(aOpenSection).css('display','block');
		jq$(btnOpenSection).attr('alt',txtHide).attr('src',mImg);
		jq$(qOpenSection).unbind().toggle(
			function(){
				jq$(btnOpenSection).attr('alt',txtShow).attr('src',pImg);
				jq$(aOpenSection).slideUp('easeOutCubic');
			},
			function(){
				jq$(btnOpenSection).attr('alt',txtHide).attr('src',mImg);
				jq$(aOpenSection).slideDown('400','easeOutCubic');
			}
		)
	}
	
	function faq_int() {
		jq$('.faq_section').each(function(){
			var thisBtn = jq$(this).find('.toggle_btn');
			var thisQ =   jq$(this).find('.question');
			var thisA =   jq$(this).find('.answer');
			jq$(thisBtn).mouseover(funHvop);
			jq$(thisQ).toggle(
				function(){
					jq$(thisBtn).attr('alt',txtHide).attr('src',mImg);
					jq$(thisA).slideDown('400','easeOutCubic');
				},
				function(){
					jq$(thisBtn).attr('alt',txtShow).attr('src',pImg);
					jq$(thisA).slideUp('easeOutCubic');
				}
			)
		});
	}

}());





//info
var infoSect = jq$('.info_sect');
jq$(infoSect).find('dd').css({'display':'none'});
jq$(infoSect).find('dt').click(function(){
	var layerDd = jq$(this).next('dd');
	if(jq$(layerDd).css('display') == 'none') {
		jq$(layerDd).fadeIn();
	} else {
		jq$(layerDd).fadeOut();
	}
});
jq$(infoSect).find('.info_close').click(function(){jq$(this).parent('dd').fadeOut()});



//historyback
jq$('.historyback img').click(function(){history.back();})





//faq_box
function closeDDSeq() {
	jq$(this).parent().fadeOut(150,function(){
		jq$(this).find('.faq_open_box_top').remove();
		jq$(this).find('.faq_open_box_btm').remove();
		jq$(this).find('.closeBtn').unbind().remove();
	});
}

jq$('.faq_open_box').find('.box_hd').click(function(){
	var fobDD = jq$(this).next(); 
	if(fobDD.css('display') == 'none') {
		fobDD.find('.faq_open_box_inner2').before('<div class="faq_open_box_top">');
		fobDD.find('.faq_open_box_inner2').after('<div class="faq_open_box_btm">');
		fobDD.fadeIn('fast',function(){
			fobDD.append('<p class="closeBtn" title="閉じる"><span></span></p>');
			fobDD.find('.closeBtn').fadeIn(200).bind('click',function(){
				jq$(this).fadeOut(150,closeDDSeq);
			});
		});
	} else {
		jq$(fobDD).find('.closeBtn').fadeOut(150,closeDDSeq);
	}
})






//acceptable.php
	var okList = jq$('#ok li p');
	okList.flatHeights();




//--============================================================================
});












/* byon.js
 * Copyright (c) 2009 SACHIO MARUYAMA
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 */


(function(){

	function pageScroll(){

		var scrolledX = scrolledY = null;
		var targetX = targetY = null;
		var scrollX,scrollY;
		var html = document.documentElement;
		var body = document.body;
		var scrollBtns = document.links;
		var url = location.href.replace(location.hash,"");
		
		var easing = 0.25;
		var interval = 30;
		
		
		for(var i=0;i<scrollBtns.length;i++){
			if(scrollBtns[i].getAttribute("href").match("#")){
				var btn = scrollBtns[i];
				btn.onclick = function(){
					var TargetId = (this.getAttribute("href").replace(url,"")).substr(1);
					if (document.getElementById(TargetId)) {
						var Target = document.getElementById(TargetId);
						try {
							var position = Target.getBoundingClientRect();
							targetX = position.left + (body.scrollLeft || html.scrollLeft) - html.clientLeft;
							targetY = position.top + (body.scrollTop || html.scrollTop) - html.clientTop;
						} catch(e) {
							targetX = Target.offsetLeft, targetY = Target.offsetTop;
						}
						scrollX = window.pageXOffset || html.scrollLeft || body.scrollLeft || 0;
						scrollY = window.pageYOffset || html.scrollTop || body.scrollTop || 0;
						scroll();
						return false;
					}
				}
			}
		}
	
		function scroll(){
			var X = window.pageXOffset || html.scrollLeft || body.scrollLeft || 0;
			var Y = window.pageYOffset || html.scrollTop || body.scrollTop || 0;
//			scrollX += Math.floor((targetX - X) * easing);
			scrollX = X;
			scrollY += Math.floor((targetY - Y + dif) * easing);
			if((targetY === scrollX && targetY === scrollY) || (X === scrolledX && Y === scrolledY)) {
				scrolledX = scrolledY = null;
			} else {
				window.scrollTo(scrollX, scrollY);
				scrolledX = X, scrolledY = Y;
				setTimeout(function(){scroll()},interval);
			}
		}
	}
    
	function addEvent(eventTarget, eventName, func){
        if(eventTarget.addEventListener){
            eventTarget.addEventListener(eventName, func, false);
        }else if(window.attachEvent){
            eventTarget.attachEvent('on'+eventName, function(){func.apply(eventTarget);});
        }
    }

	addEvent(window, 'load', pageScroll);

}());













