/**
 * @name main.js
 * @fileOverview
 * @version 1.0
 * @description
 * <p>(c) FOURDIGIT Inc. Licensed <a href="http://ja.wikipedia.org/wiki/GNU_General_Public_License">GNU General Public License</a>.</p>
 */
//jQuery.noConflict();
(function($){
	var config = function () {
	//Add Browser information to the class of <body>.
		$.addClassUA();
	//easyOver
		$("img.ahover, .ahoverArea img").easyOver();
	//pngfix
		/**$("img[src$=png],p.png").enablePNG(); */
	//popup link
		$(".commonPop").easyPop();
	//anchor link smoothScroll
		$("a[href^=#]").smoothScroll();
	}
	$.fn.extend({
		/**
		* maxHeight
		* @function
		* @return Number
		*/
		maxHeight: function(){
			var _max = 0;
			$(this).each(function(){
				_max = Math.max($(this).height(), _max);
			})
			return _max;
		}
	})
	//onload
	$(function() {
		$('.tabBoxNav').find('a').removeAttr('href');
		config();
		$('.sideNav li').each(function(){
			var thisList = $(this);
			$(this).find('a').hover(
				function(){
					$(thisList).addClass('hover');
				},
				function(){
					$(thisList).removeClass('hover');
				}
			);
		});
		
		/*
		$('.submitBtnLink').each(function(){
			$(this).click(function(){
				$(this).next().click();
			});
		});*/
		
		/*search*/
		$(function(){  
			$('.submitBtnInput').hover(
				function () {
					$(this).css('background-position','left -20px');
				},
				function () {
					$(this).css('background-position','left top');
				}
			);
  });

/*form preview submit*/
	$(function(){  
		$('.previewBtnInput').hover(
			function () {
				$(this).css('background-position','left -32px');
			},
			function () {
				$(this).css('background-position','left top');
			}
		);
  });
		
	$(function(){  
		$('.form_submitBtnInput').hover(
			function () {
				$(this).css('background-position','left -32px');
			},
			function () {
				$(this).css('background-position','left top');
			}
		);
	});
	
	
		$(function(){  
		$('.registBtnInput').hover(
			function () {
				$(this).css('background-position','left -32px');
			},
			function () {
				$(this).css('background-position','left top');
			}
		);
	});

		$(function(){  
		$('.previousBtnInput').hover(
			function () {
				$(this).css('background-position','left -32px');
			},
			function () {
				$(this).css('background-position','left top');
			}
		);
	});


		$(function(){  
		$('.nextBtnInput').hover(
			function () {
				$(this).css('background-position','left -32px');
			},
			function () {
				$(this).css('background-position','left top');
			}
		);
	});


		

		/* toggleSwitch */
		$('.sideNav li.toggleList > ul').hide();
		$('.sideNav li.toggleList').each(function(){
			var thisList = $(this);
			$(this).find('a.toggleSwitch').toggle(
				function(){
					$(thisList)
						.addClass('hasChild')
						.addClass('on')
						.css('padding-bottom','15px')
						.find('ul:first')
							.slideDown(140)
						.end();
				},
				function(){
					$(thisList).removeClass('hasChild').removeClass('on').css('padding-bottom','0').find('ul:first').slideUp(140);
				}
			);
		});

		/* tabBoxArea */
		$('.tabBoxNav li:first a').addClass('on');
		$('.tabBox').hide();
		$('.tabBox01').show();
		$('.tabBoxArea').each(function(){
			var thisArea = $(this);
			if($(thisArea).attr('id') == 'indexTabMenu'){
				true;
			}else{
				// tab max width
				var liMaxWidth = $(this).find('.tabBoxNav').width() / 3 -32;
				$(this).find('.tabBoxNav').find('li').find('a').each(function(){
					var liThisWidth = $(this).width();
					if(liThisWidth >= liMaxWidth){
						$(this).width(liMaxWidth);
					} else {
						$(this).width('auto');
					}
				});
				// tab max height
				$('.tabBoxNav li a').height($('.tabBoxNav li a').maxHeight());
			}
			// tab click
			$(this).find('.tabBoxNav').find('a').each(function(){
				var thisRel = $(this).attr('rel');
				var showBlock = '.tabBox' + thisRel;
				$(this).hover(
					function(){
						$(this).addClass('hover');
					},
					function(){
						$(this).removeClass('hover');
					}
				);
				$(this).click(function(){
					$(thisArea)
						.find('.tabBoxNav')
							.find('a')
								.removeClass('on')
							.end()
						.end()
					.end();
					$(this).addClass('on');
					$('.tabBox').hide();
					$(showBlock).show();
					if($(thisArea).attr('id') == 'indexTabMenu'){
						$('.tabBoxNav li a').removeClass('else');
						if(thisRel == 1) {
							$('li#tabPress').find('a').removeClass('else');
						}
						if(thisRel == 2) {
							$('li#tabLatest').find('a').addClass('else');
						}
						if(thisRel == 3) {
							$('li#tabPress').find('a').addClass('else');
						}
					}
				});
			});
		});
		
			/* tabBoxAreaA */
		$('.tabBoxNavA li:first a').addClass('on');
		$('.tabBoxA').hide();
		$('.tabBoxA01').show();
		$('.tabBoxAreaA').each(function(){
			var thisArea = $(this);
			if($(thisArea).attr('id') == 'indexTabMenu'){
				true;
			}else{
				// tab max width
				var liMaxWidth = $(this).find('.tabBoxNavA').width() / 3 -32;
				$(this).find('.tabBoxNavA').find('li').find('a').each(function(){
					var liThisWidth = $(this).width();
					if(liThisWidth >= liMaxWidth){
						$(this).width(liMaxWidth);
					} else {
						$(this).width('auto');
					}
				});
				// tab max height
				$('.tabBoxNavA li a').height($('.tabBoxNavA li a').maxHeight());
			}
			// tab click
			$(this).find('.tabBoxNavA').find('a').each(function(){
				var thisRel = $(this).attr('rel');
				var showBlock = '.tabBoxA' + thisRel;
				$(this).hover(
					function(){
						$(this).addClass('hover');
					},
					function(){
						$(this).removeClass('hover');
					}
				);
				$(this).click(function(){
					$(thisArea)
						.find('.tabBoxNavA')
							.find('a')
								.removeClass('on')
							.end()
						.end()
					.end();
					$(this).addClass('on');
					$('.tabBoxA').hide();
					$(showBlock).show();
					if($(thisArea).attr('id') == 'indexTabMenu'){
						$('.tabBoxNavA li a').removeClass('else');
						if(thisRel == 1) {
							$('li#tabPress').find('a').removeClass('else');
						}
						if(thisRel == 2) {
							$('li#tabLatest').find('a').addClass('else');
						}
						if(thisRel == 3) {
							$('li#tabPress').find('a').addClass('else');
						}
					}
				});
			});
		});
		
		
		/* tabBoxAreaB */
		$('.tabBoxNavB li:first a').addClass('on');
		$('.tabBoxB').hide();
		$('.tabBoxB01').show();
		$('.tabBoxAreaB').each(function(){
			var thisArea = $(this);
			if($(thisArea).attr('id') == 'indexTabMenu'){
				true;
			}else{
				// tab max width
				var liMaxWidth = $(this).find('.tabBoxNavB').width() / 3 -32;
				$(this).find('.tabBoxNavB').find('li').find('a').each(function(){
					var liThisWidth = $(this).width();
					if(liThisWidth >= liMaxWidth){
						$(this).width(liMaxWidth);
					} else {
						$(this).width('auto');
					}
				});
				// tab max height
				$('.tabBoxNavB li a').height($('.tabBoxNavB li a').maxHeight());
			}
			// tab click
			$(this).find('.tabBoxNavB').find('a').each(function(){
				var thisRel = $(this).attr('rel');
				var showBlock = '.tabBoxB' + thisRel;
				$(this).hover(
					function(){
						$(this).addClass('hover');
					},
					function(){
						$(this).removeClass('hover');
					}
				);
				$(this).click(function(){
					$(thisArea)
						.find('.tabBoxNavB')
							.find('a')
								.removeClass('on')
							.end()
						.end()
					.end();
					$(this).addClass('on');
					$('.tabBoxB').hide();
					$(showBlock).show();
					if($(thisArea).attr('id') == 'indexTabMenu'){
						$('.tabBoxNavB li a').removeClass('else');
						if(thisRel == 1) {
							$('li#tabPress').find('a').removeClass('else');
						}
						if(thisRel == 2) {
							$('li#tabLatest').find('a').addClass('else');
						}
						if(thisRel == 3) {
							$('li#tabPress').find('a').addClass('else');
						}
					}
				});
			});
		});
		
		
		
		
		/* tabBoxAreaC */
		$('.tabBoxNavC li:first a').addClass('on');
		$('.tabBoxC').hide();
		$('.tabBoxC01').show();
		$('.tabBoxAreaC').each(function(){
			var thisArea = $(this);
			if($(thisArea).attr('id') == 'indexTabMenu'){
				true;
			}else{
				// tab max width
				var liMaxWidth = $(this).find('.tabBoxNavC').width() / 3 -32;
				$(this).find('.tabBoxNavC').find('li').find('a').each(function(){
					var liThisWidth = $(this).width();
					if(liThisWidth >= liMaxWidth){
						$(this).width(liMaxWidth);
					} else {
						$(this).width('auto');
					}
				});
				// tab max height
				$('.tabBoxNavC li a').height($('.tabBoxNavC li a').maxHeight());
			}
			// tab click
			$(this).find('.tabBoxNavC').find('a').each(function(){
				var thisRel = $(this).attr('rel');
				var showBlock = '.tabBoxC' + thisRel;
				$(this).hover(
					function(){
						$(this).addClass('hover');
					},
					function(){
						$(this).removeClass('hover');
					}
				);
				$(this).click(function(){
					$(thisArea)
						.find('.tabBoxNavC')
							.find('a')
								.removeClass('on')
							.end()
						.end()
					.end();
					$(this).addClass('on');
					$('.tabBoxC').hide();
					$(showBlock).show();
					if($(thisArea).attr('id') == 'indexTabMenu'){
						$('.tabBoxNavC li a').removeClass('else');
						if(thisRel == 1) {
							$('li#tabPress').find('a').removeClass('else');
						}
						if(thisRel == 2) {
							$('li#tabLatest').find('a').addClass('else');
						}
						if(thisRel == 3) {
							$('li#tabPress').find('a').addClass('else');
						}
					}
				});
			});
		});
		
		
		
			/* tabBoxAreaD */
		$('.tabBoxNavD li:first a').addClass('on');
		$('.tabBoxD').hide();
		$('.tabBoxD01').show();
		$('.tabBoxAreaD').each(function(){
			var thisArea = $(this);
			if($(thisArea).attr('id') == 'indexTabMenu'){
				true;
			}else{
				// tab max width
				var liMaxWidth = $(this).find('.tabBoxNavD').width() / 3 -32;
				$(this).find('.tabBoxNavD').find('li').find('a').each(function(){
					var liThisWidth = $(this).width();
					if(liThisWidth >= liMaxWidth){
						$(this).width(liMaxWidth);
					} else {
						$(this).width('auto');
					}
				});
				// tab max height
				$('.tabBoxNavD li a').height($('.tabBoxNavD li a').maxHeight());
			}
			// tab click
			$(this).find('.tabBoxNavD').find('a').each(function(){
				var thisRel = $(this).attr('rel');
				var showBlock = '.tabBoxD' + thisRel;
				$(this).hover(
					function(){
						$(this).addClass('hover');
					},
					function(){
						$(this).removeClass('hover');
					}
				);
				$(this).click(function(){
					$(thisArea)
						.find('.tabBoxNavD')
							.find('a')
								.removeClass('on')
							.end()
						.end()
					.end();
					$(this).addClass('on');
					$('.tabBoxD').hide();
					$(showBlock).show();
					if($(thisArea).attr('id') == 'indexTabMenu'){
						$('.tabBoxNavD li a').removeClass('else');
						if(thisRel == 1) {
							$('li#tabPress').find('a').removeClass('else');
						}
						if(thisRel == 2) {
							$('li#tabLatest').find('a').addClass('else');
						}
						if(thisRel == 3) {
							$('li#tabPress').find('a').addClass('else');
						}
					}
				});
			});
		});
		
		
		
					/* tabBoxAreaE */
		$('.tabBoxNavE li:first a').addClass('on');
		$('.tabBoxE').hide();
		$('.tabBoxE01').show();
		$('.tabBoxAreaE').each(function(){
			var thisArea = $(this);
			if($(thisArea).attr('id') == 'indexTabMenu'){
				true;
			}else{
				// tab max width
				var liMaxWidth = $(this).find('.tabBoxNavE').width() / 3 -32;
				$(this).find('.tabBoxNavE').find('li').find('a').each(function(){
					var liThisWidth = $(this).width();
					if(liThisWidth >= liMaxWidth){
						$(this).width(liMaxWidth);
					} else {
						$(this).width('auto');
					}
				});
				// tab max height
				$('.tabBoxNavE li a').height($('.tabBoxNavE li a').maxHeight());
			}
			// tab click
			$(this).find('.tabBoxNavE').find('a').each(function(){
				var thisRel = $(this).attr('rel');
				var showBlock = '.tabBoxE' + thisRel;
				$(this).hover(
					function(){
						$(this).addClass('hover');
					},
					function(){
						$(this).removeClass('hover');
					}
				);
				$(this).click(function(){
					$(thisArea)
						.find('.tabBoxNavE')
							.find('a')
								.removeClass('on')
							.end()
						.end()
					.end();
					$(this).addClass('on');
					$('.tabBoxE').hide();
					$(showBlock).show();
					if($(thisArea).attr('id') == 'indexTabMenu'){
						$('.tabBoxNavE li a').removeClass('else');
						if(thisRel == 1) {
							$('li#tabPress').find('a').removeClass('else');
						}
						if(thisRel == 2) {
							$('li#tabLatest').find('a').addClass('else');
						}
						if(thisRel == 3) {
							$('li#tabPress').find('a').addClass('else');
						}
					}
				});
			});
		});
		
		
		
		
		/* tabBoxArea02 */
		$('.tabBoxNav02 li:first a').addClass('on');
		$('.tabBox2').hide();
		$('.tabBox201').show();
		$('.tabBoxArea02').each(function(){
			var thisArea = $(this);
			if($(thisArea).attr('id') == 'indexTabMenu'){
				true;
			}else{
				// tab max width
				var liMaxWidth = $(this).find('.tabBoxNav02').width() / 3 -32;
				$(this).find('.tabBoxNav02').find('li').find('a').each(function(){
					var liThisWidth = $(this).width();
					if(liThisWidth >= liMaxWidth){
						$(this).width(liMaxWidth);
					} else {
						$(this).width('auto');
					}
				});
				// tab max height
				$('.tabBoxNav02 li a').height($('.tabBoxNav02 li a').maxHeight());
			}
			// tab click
			$(this).find('.tabBoxNav02').find('a').each(function(){
				var thisRel = $(this).attr('rel');
				var showBlock = '.tabBox2' + thisRel;
				$(this).hover(
					function(){
						$(this).addClass('hover');
					},
					function(){
						$(this).removeClass('hover');
					}
				);
				$(this).click(function(){
					$(thisArea)
						.find('.tabBoxNav02')
							.find('a')
								.removeClass('on')
							.end()
						.end()
					.end();
					$(this).addClass('on');
					$('.tabBox2').hide();
					$(showBlock).show();
					if($(thisArea).attr('id') == 'indexTabMenu'){
						$('.tabBoxNav02 li a').removeClass('else');
						if(thisRel == 1) {
							$('li#tabPress').find('a').removeClass('else');
						}
						if(thisRel == 2) {
							$('li#tabLatest').find('a').addClass('else');
						}
						if(thisRel == 3) {
							$('li#tabPress').find('a').addClass('else');
						}
					}
				});
			});
		});
		
		
	});
})(jQuery);

/*old site */
function getBMoc(prot, ocName, ocImg){
 var n = new Date();
 var qs = ocName + '*' + escape(window.location) + '*' + (navigator.javaEnabled()) + '/';
 if(window.screen){
		 qs += screen.width+'x'+screen.height + '/' + screen.colorDepth + '/'
 }else{
		 qs += '//'
 };
 qs += n.getTime() + '/';
 document.images[ocImg].src = prot + '://www.bmmetrix.com/V10' + qs;
}

function bmGo(ocLoc){
   document.location=ocLoc;
}

function bmPopUp(ocLoc){
   window.open(ocLoc);
}

function bmDD(prot, ddVal){
   var ary=ddVal.split('*');
   var bmDDname = ary[0];
   var bmDDimg = ary[1];
   getBMoc(prot, bmDDname, bmDDimg);
}

/*old site dc*/
	function puWindow(url,nam,wid,hei,prop){
	var offset = 100;
	var w = window.screen.width;
	var h = window.screen.height;
	var l = (w-wid)/2;
	var t = ((h-hei)/2)-offset;
	sty = prop;
	sty+= ",width=";
	sty+= wid;
	sty+= ",height=";
	sty+= hei;
	sty+= ",left=";
	sty+= l;
	sty+= ",top=";
	sty+= t;
	window.open(url,nam,sty);
}

function popup0(url,nam,wid,hei){
	prop = "status=yes,scrollbars=no,resizable=yes";
	puWindow(url,nam,wid,hei,prop);
}

function popup1(url,nam,wid,hei){
	prop = "status=yes,scrollbars=yes,resizable=yes";
	puWindow(url,nam,wid,hei,prop);
}
