jQuery.noConflict()(function($){

// リストページ テーブル
	var listbody = $('.list-table > tbody');
	listbody.find('tr:odd').css('background-color','#f5f5f5');
	listbody.find('tr').css('cursor','pointer').each(function(){
		var trbgcolor = $(this).css('background-color');
		$(this).hover(
		function(){
			$(this).css('background-color','#E7FFFF');
		},
		function(){
			$(this).css('background-color',trbgcolor);
		}).click(
		function(){
			var detaillink=$(this).find('a').attr('href');
			location.href=detaillink;
		});
	});
	
// リストページ 吹き出し
	listbody.find('.shortcomment').each(function(){
    	var self = $(this), text = self.text();
		self.parent().parent().hover(function(e){
			$("body").append('<div id="tooltip"><div class="tooltiptop">&nbsp;</div><div class="tooltipbody">'+text+'</div><div class="tooltipbottom">&nbsp;</div></div>');
			self.attr('text','');
        	$("#tooltip").css({
				top: e.pageY+18,
				left: e.pageX-100
				}).fadeIn(250);
			},function(){
				$("#tooltip").hide().remove();
				self.attr('text',title);
		});
    	self.parent().parent().mousemove(function(e){
			$("#tooltip").css({
				top: e.pageY+18,
				left: e.pageX-100
			});
		});
	});

// グリッドページ ソートボタン

	$('.sortList a > img').hover(
		function(){
			$(this).css({opacity: "0"}).animate({ 
    				opacity: 0.5
			}, 250 );
		},
		function(){
			$(this).animate({ 
    				opacity: 1
			}, 250 );
		});

// グリッドページ リスト
	var gridbody = $('.gridWrapperInner');
	$('.gridWrapperInner:odd').css('background-color','#f5f5f5');
	var grid_max_height = 0;
	var carname_max_height = 0;
	gridbody.find('.gridItem').css('cursor','pointer').each(function(){
		var	carname_height = $(this).find('.carname').height();
		if(carname_max_height < carname_height){carname_max_height = carname_height;}
		var	grid_height = $(this).height();
		if(grid_max_height < grid_height){grid_max_height = grid_height;}
		var trbgcolor = $(this).css('background-color');
		$(this).hover(
		function(){
			$(this).css('background-color','#E7FFFF');
		},
		function(){
			$(this).css('background-color',trbgcolor);
		}).click(
		function(){
			var detaillink=$(this).find('a').attr('href');
			location.href=detaillink;
		});
	});
	gridbody.find('.gridItem').height(grid_max_height);
	gridbody.find('.carname').height(carname_max_height);

// グリッドページ 吹き出し
	gridbody.find('.shortcomment').each(function(){
    	var self = $(this), text = self.text();
		self.parent().hover(function(e){
			$("body").append('<div id="tooltip"><div class="tooltiptop">&nbsp;</div><div class="tooltipbody">'+text+'</div><div class="tooltipbottom">&nbsp;</div></div>');
			self.attr('text','');
        	$("#tooltip").css({
				top: e.pageY+18,
				left: e.pageX-100
				}).fadeIn(250);
			},function(){
				$("#tooltip").hide().remove();
				self.attr('text',title);
		});
    	self.parent().parent().mousemove(function(e){
			$("#tooltip").css({
				top: e.pageY+18,
				left: e.pageX-100
			});
		});
	});

// 詳細ページ
	$('#listinquiryb').hover(
		function(){
			$(this).css({opacity: "0"}).animate({ 
    				opacity: 0.5
			}, 250 );
		},
		function(){
			$(this).animate({ 
    				opacity: 1
			}, 250 );
		});

// コラム
	$('#columnbox ul li').each(function(){
		var imgSrc = $(this).find('img').attr('src');
		var sep = imgSrc.lastIndexOf('.');
		var bgimg = imgSrc.substr(0, sep - 7) + '-bg.jpg';
		$(this).attr('style','background:url('+bgimg+') no-repeat');
		});


// ツーリング
	$('#touringbox ul li').each(function(){
		var imgSrc = $(this).find('img').attr('src');
		var sep = imgSrc.lastIndexOf('.');
		var bgimg = imgSrc.substr(0, sep - 7) + '-bg.jpg';
		$(this).attr('style','background:url('+bgimg+') no-repeat');
		});


//トップページ ツイッター
	$('#twitterbox').css('cursor','pointer').toggle(
		function(){
			$('#twitterbody').slideDown(250);
			$('#twitterfooter img').attr('src','pic/twitter-close.gif');
		},
		function(){
			$('#twitterbody').slideUp(250);
			$('#twitterfooter img').attr('src','pic/twitter-open.gif');
		});

});

window.addEvent('domready', function(){
	//call multiBox
	var initMultiBox = new multiBox({
		mbClass: '.mb',//class you need to add links that you want to trigger multiBox with (remember and update CSS files)
		container: $(document.body),//where to inject multiBox
		descClassName: 'mbDesc',//the class name of the description divs
		path: './Files/',//path to mp3 and flv players
		useOverlay: true,//use a semi-transparent background. default: false;
		maxSize: {w:800, h:600},//max dimensions (width,height) - set to null to disable resizing
		addDownload: false,//do you want the files to be downloadable?
		pathToDownloadScript: './Scripts/ForceDownload.asp',//if above is true, specify path to download script (classicASP and ASP.NET versions included)
		addRollover: true,//add rollover fade to each multibox link
		addOverlayIcon: false,//adds overlay icons to images within multibox links
		addChain: false,//cycle through all images fading them out then in
		recalcTop: true,//subtract the height of controls panel from top position
		addTips: false//adds MooTools built in 'Tips' class to each element (see: http://mootools.net/docs/Plugins/Tips)
	});
});

