/*	画像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) {} 



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

//radius
	if(/MSIE/.test(navigator.userAgent)) {
		DD_roundies.addRule('#buy2_top2 .p1', 10); 
	}

});





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);}
	);


//hover3
	function funHvop3() {
		jq$(this).stop().fadeTo(150,0.7).fadeTo(200,1.0);	
	}
	
	var hpOp3 = jq$('.hv_op3 img');
	hpOp3.mouseover(funHvop);


//hover4 access arrow
	var hpOp4 = jq$('.hv_op4 img');
	jq$('.hv_op4 img').fadeTo(150, 0);
	hpOp4.hover(
		function(){jq$(this).stop().fadeTo(400, 1.0);},
		function(){jq$(this).stop().fadeTo(150, 0);}
	);


//hover5
	var hpOp5 = jq$('.hv_op5 a');
	hpOp5.hover(
		function(){jq$(this).parent().stop().fadeTo(100,0.6).fadeTo(400,1.0)},
		function(){jq$(this).parent().stop().fadeTo(0,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");
	}



//acc_nv
	var acNvLi = jq$('#ac_nv li a');
	acNvLi.hover(function(){jq$(this).addClass('hv')},function(){jq$(this).removeClass('hv')});
	if(lnvID != "") {
		jq$('a', '#ac_nv' + 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');
	})







//faq
	jq$('.faq_section').each(function(){
		var thisQ =  jq$(this).find('.question');
		var thisA = jq$(this).find('.answer');
		thisA.css({'display':'none'});
		thisQ.click(function(){
			if(thisA.css('display') == 'none') {
				jq$(thisA).slideDown('400','easeOutCubic');	
			} else {
				jq$(thisA).slideUp('easeOutCubic');
			}
		})
	})







//info
	var infoSect = jq$('.info_sect');
	
	jq$('.dd_box').each(function(){
		jq$('body').append('<div class="dd_layer">' + jq$(this).html() + '</div>');
	});
	
	var dd_layer = jq$('.dd_layer');
	dd_layer.css('display','none');
	
	jq$(infoSect).find('.dt').each(function(){
		jq$(this).click(function(){
			var thisIndex = jq$('body .dt').index(this);
			var thisTop   = jq$(this).offset().top + jq$(this).height();
			var thisLeft  = jq$(this).offset().left;
			jq$(dd_layer[thisIndex]).css({
				 top :  thisTop + 1 +  'px',
				 left : thisLeft + 'px'
			});
			if(jq$(dd_layer[thisIndex]).css('display') == 'none') {
				jq$(dd_layer[thisIndex]).fadeIn();
			} else {
				jq$(dd_layer[thisIndex]).fadeOut();
			}
		});
		
		
		
		
	});
	dd_layer.find('.info_close').click(function(){jq$(this).parent().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') {
			//faq_box2の処理
			if(jq$('.faq_link2').length){ closeAllFl2DD();}
			
			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);
		}
	})



//faq_box2
	var fl2Dt = jq$('.faq_link2 dt');
	var fl2DD = jq$('.faq_link2 dd');
	
	function closeAllFl2DD() {
			fl2DD.css({'display':'none'});
			fl2Dt.removeClass();
			jq$('.closeBtn').unbind().remove();
			jq$('.faq_open_box2_top').remove();
			jq$('.faq_open_box2_btm').remove();
			
			//faq_boxの処理
			if(jq$('.faq_open_box').length) {
				jq$('.faq_open_box').find('.box_hd').next().css({'display':'none'});	
				jq$('.faq_open_box').find('.faq_open_box_top').remove();
				jq$('.faq_open_box').find('.faq_open_box_btm').remove();
				jq$('.faq_open_box').find('.closeBtn').unbind().remove();
			}
	}
	
	//fl2DD.css({'display':'none'});
	
	fl2Dt.each(function(){
		jq$(this).click(function(){
			var targetDD = jq$(this).next('dd');
			var targetDDChInner = targetDD.find('.answer_inner');
			var targetDDChInner2 = targetDD.find('.answer_inner2');
			
			if(jq$(this).next('dd').css('display') == 'none' ) {
				closeAllFl2DD();
				jq$(this).addClass('hv');
				targetDDChInner.before('<div class="faq_open_box2_top">');
				targetDDChInner.after('<div class="faq_open_box2_btm">');
				
				targetDD.css({
					'top': jq$(this).offset().top + jq$(this).height() + 3 + 'px',
					'left' :jq$(this).offset().left - 3 + 'px'
				}).fadeIn(200,function(){
					if (/MSIE (6\.)/.test(navigator.userAgent)){
						if(targetDDChInner2.height() > 450) {
							targetDDChInner2.css({'height':'450px'});
						}
//						else if (targetDDChInner2.height() < 130) {
//							targetDDChInner2.css({'height':'130px'});
//						};
					}
					jq$(this).append('<p class="closeBtn" title="閉じる"><span></span></p>');
					jq$(this).find('.closeBtn').fadeIn(200).bind('click',closeAllFl2DD);
				});
			} else {
				closeAllFl2DD();
			}
		})
	});






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




//blog entry target
jq$('a[href^=http]','.entry_body').not('[href*="nexus13.co.jp"]').attr("target","_blank");
jq$('.entry_body .mt-enclosure-image a').attr("target","_blank");




//buy2_flow
	if(jq$('#buy2_flow').length) {
		jq$('#buy2_flow .class2 .inner .div, #buy2_flow .class3 .inner .div').each(function(){
			jq$(this).css('margin-top',0 - jq$(this).height()/2 + 'px');
		});
	}



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












/* 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);

}());














