jQuery.noConflict()(function($){

var pic_dir='/mazda-autozam/common/';
var preLoadImg = new Object();

// TOPパネル
	$('body.panel401 #panel401b').attr('src',pic_dir+'panel401-b_f3.png');
	$('body.panel402 #panel402b').attr('src',pic_dir+'panel402-b_f3.png');
	$('body.panel403 #panel403b').attr('src',pic_dir+'panel403-b_f3.png');	
	$('body.panel404 #panel404b').attr('src',pic_dir+'panel404-b_f3.png');
	
	$('#panel3 > ul > li > ul').css('visibility','hidden').hide();
	$("#panel3 > 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);
			}
		);
	});	


// ロールオーバー
	var preLoadImg = new Object();
	$("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);
			}
		);
	});

});

function openSidemenu(selector){
	jQuery.noConflict()(function($){
		$(selector).children('ul').slideDown(250).end()
		.children('div.open').css('display','none').end()
		.children('div.close').css('display','block');
  		return $(selector);
	});
}




function ImageOpen(theURL) {
	ImageOpenWindow(theURL);
}

function ImageOpenWindow(theURL,winName,features) {
if(!winName){winName = "photo";}
if(!features){features = "scrollbars=1,resizable=1,width=720,height=600";}

      imgWindow = window.open("",winName,features);
      imgWindow.document.close();
      imgWindow.document.open;
      imgWindow.document.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n");
      imgWindow.document.write("       \"http://www.w3.org/TR/html4/loose.dtd\">\n");
      imgWindow.document.write("<html lang=\"ja\"\n");
      imgWindow.document.write("<head>\n");
      imgWindow.document.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=Shift_JIS\">\n");
      imgWindow.document.write("<meta http-equiv=\"Content-Language\" Content=\"ja\">\n");
      imgWindow.document.write("<title>Photo</title>\n");
      imgWindow.document.write("<meta http-equiv=\"Content-Script-Type\" content=\"text/javascript\">\n");
      imgWindow.document.write("<meta http-equiv=\"Content-Style-Type\" content=\"text/css\">\n");
      imgWindow.document.write("<link rel=\"stylesheet\" media=\"screen,print\" href=../../../common_2009/js//"/common/dummy.css/" type=\"text/css\">");
      imgWindow.document.write("<script type=\"text/javascript\">");
      imgWindow.document.write("<!--\n");
      imgWindow.document.write("self.window.focus()\;\n");
      imgWindow.document.write("//-->\n");
	  imgWindow.document.write("</script>\n");
      imgWindow.document.write("</head>\n");
      imgWindow.document.write("<body class=\"smallwindow\">\n");
      imgWindow.document.write("<div id=\"photo\">\n");
      imgWindow.document.write("<img src=\"" + theURL + "\"></div>\n");
      imgWindow.document.write("<div id=\"closewindow\"><a href=\"javascript:window.close();\">Close</a></div>\n");
      imgWindow.document.write("</body>\n");
      imgWindow.document.write("</html>");
      imgWindow.document.close();
}



