(function($){
	$.extend({
		/************************ localNav ************************/
		localNav : function(obj){
			if(document.getElementById('localNav')){
				$('#localNav ul ul').css('display','none');
				var cName = $('#localNav ul').attr('class');
				cName = '.' + cName.replace('C','');
				//first open
				$(cName).parents('ul').css('display','block');
				$(cName).parents('li').addClass('on');
				
				//secound open
				$(cName).children('ul').css('display','block');
				$(cName).addClass('on');
				
				// marking at the accordion ttl
				$(cName).parents('ul').prev('strong').addClass('active');
				$('#localNav ul li li strong').next('ul').css('padding-left','0');

				// accordion
				$('#localNav li strong').click(function(){
					if($(this).hasClass('active')){
						$(this).removeClass('active');
						$(this).parent().children('ul').slideUp();
					}else{
						$('#localNav li strong').removeClass('active');
						$('#localNav li strong').parent().children('ul').slideUp();
						$(this).parent().children('ul').slideDown();
						$(this).addClass('active');
					}
				});
			}else{
				return false;	
			}
		},
		topOver : function(obj){
			if(document.getElementById('indexGnv')){
				$('#indexGnv a').hover(
					function(){
						$(this).children('img').attr('src',$(this).children('img').attr('src').replace('.jpg','_on.jpg'));
					},function(){
						$(this).children('img').attr('src',$(this).children('img').attr('src').replace('_on.jpg','.jpg'));
					}
				);
				
				$('#indexSubGnv dd a').hover(
					function(){
						var menu = $(this).parents('dd').prev('dt').children().children();
						menu.attr('src',menu.attr('src').replace('.gif','_on.gif'));
					},function(){
						var menu = $(this).parents('dd').prev('dt').children().children();
						menu.attr('src',menu.attr('src').replace('_on.gif','.gif'));
					}
				);
				$('#indexSubGnv dt a').hover(
					function(){
						var menu2 = $(this).parents('dt').next('dd').children();
						menu2.addClass('hovers');
					},function(){
						var menu2 = $(this).parents('dt').next('dd').children();
						menu2.removeClass('hovers');
					}
						
				);
			}
		}
	})
	
}(jQuery))


/************************ contactLink ************************/
function contactLink(pass) {
	function opeContactnWin(url){
		window.open(url + location.href,'contactwin');
	};
	var num = pass;
	if(num == '00'){
			opeContactnWin("http://www.toray.jp/contact2/english/con_a400.html?");	
	}else{
			location.href="/contact/index.html?" + location.href;
	}
}

/************************ setEvent ************************/
function setEvent(target, ev, func){
	try {
		target.addEventListener(ev, func, false);
	} catch(e) {
		target.attachEvent("on" + ev, func);
	};
};

/************************ MM_openBrWindow ************************/
function MM_openBrWindow(theURL,winName,features) { //v2.0
  win = window.open(theURL,winName,features);
  win.focus();
}

/************************ init ************************/

jQuery(function($){
	$.localNav();
	$.topOver();
});

//setEvent(window,"load", doPopup);

