﻿
$(function(){
bodyID = $('body').attr('id');
bodyCL = $('body').attr('class');


/*------------------------
  Header Navi
------------------------*/
$('#header ul li').each(function(){
	navID = $(this).attr('id').split('nav-')[1];
	if(bodyID == navID){
		$(this).find('img').css('visibility','hidden');
	}
});

$('#footer ul li').each(function(){
	navID = $(this).attr('id').split('nav-')[1];
	if(bodyID == navID){
		$(this).find('img').css('visibility','hidden');
	}
});


/*------------------------
  target="_blank"
------------------------*/
jQuery.fn.extend({
	tBlank:  $(document).ready(function(){
		return $('a._blank').click(function(){
			this.target = '_blank';
		});
	})
});

/*------------------------
  swapImg
------------------------*/
swapImgs = $('img.swapImg');
swapObj = new Image();
swapImgs.each(function(){
	
	//ImgPreLoad
	preLoad = $(this).attr('src').split('.gif')[0] + '_r.gif';
	//swapObj.src = preLoad;
	imgNm = $(this).attr('name',preLoad);
	
	//alert($(this).attr('name'));
	
	//MouseOver
	$(this).hover(
		function(){
			$(this).attr('lowsrc',$(this).attr('src'));
			$(this).attr('src',$(this).attr('name'));
		},
		function(){
			$(this).attr('src',$(this).attr('lowsrc'));
		}
	);
});

/*------------------------
  Layout Adjust
------------------------*/
$('dl.adjustW').each(function(){
	$(this).find('dt').css('float','left');
	$(this).find('dd').css('float','left');
	
	if($(this).attr('class').match('pdr')){
		if($(this).attr('class').split('pdr')[1].match(' ')){
			dtPdr = parseInt($(this).attr('class').split('pdr')[1].split(' ')[0]);
		}else{
			dtPdr = parseInt($(this).attr('class').split('pdr')[1]);
		}
	}else{
		dtPdr = 5;
	}
	dlW = $(this).width();
	
	dt = $(this).find('dt');
	dtW = dt.width() + dtPdr;
	dt.css('width',dtW +'px');
	
	dd = $(this).find('dd');
	ddW = dlW - dtW;
	dd.css('width',ddW +'px');
});


/* -- end -- */
});
