jQuery.noConflict()(function($){

var pic_dir='/common_2010/pic/';
var preLoadImg = new Object();


	
	
// メインメニュー
	$('body.news #newsb').attr('src',pic_dir+'news-b_f3.jpg');
	$('body.newcar #newcarb').attr('src',pic_dir+'newcar-b_f3.jpg');
	$('body.usedcar #usedcarb').attr('src',pic_dir+'usedcar-b_f3.jpg');
	$('body.showroom #showroomb').attr('src',pic_dir+'showroom-b_f3.jpg');
	$('body.link #linkb').attr('src',pic_dir+'link-b_f3.jpg');
	$('#mainmenu > ul > li > ul').css('visibility','hidden').hide();
	$("#mainmenu > ul > li").each(function(){
		var swapimg = $(this).children('a').find('img');
		var imgSrc = swapimg.attr('src');
		var separater = imgSrc.lastIndexOf('.');
		var separaterprev = separater;
		var chkstr = imgSrc.substr(separater - 3, 3);
		if(chkstr == '_f3') {separaterprev = separaterprev - 3}
		var onSrc = imgSrc.substr(0, separaterprev) + '_f2' + imgSrc.substr(separater, 4);
		preLoadImg[imgSrc] = new Image();
		preLoadImg[imgSrc].src = onSrc;
		$(this).hover(
			function() {
				$(this).children('ul').css('visibility','visible').slideDown('250');
				swapimg.css({opacity: "0"}).attr('src',onSrc).animate({ 
    				opacity: 1}, 250 );
			},
			function() {
				$(this).children('ul').css('visibility','hidden').hide();
				swapimg.attr('src',imgSrc);
			}
		);
	});	
	
	
	

// ロールオーバー
	$("a.rollover img").each(function(){
		var imgSrc = this.src;
		var sep = imgSrc.lastIndexOf('.');
		var onSrc = imgSrc.substr(0, sep) + '_f2' + imgSrc.substr(sep, 4);
		preLoadImg[imgSrc] = new Image();
		preLoadImg[imgSrc].src = onSrc;
		$(this).parent("a.rollover").hover(
			function() {
				$(this).children("img").css({opacity: "0"}).attr('src',onSrc).animate({ 
    				opacity: 1}, 250 );
			},
			function() {
				$(this).children("img").attr('src',imgSrc);
			}
		);
	});





	
});

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:900, h:1000},//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: false,//add rollover fade to each multibox link
		addOverlayIcon: true,//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: true//adds MooTools built in 'Tips' class to each element (see: http://mootools.net/docs/Plugins/Tips)
	});
});

