﻿
$(function(){
if($('body').attr('id')){
	bodyID = $('body').attr('id');
	if($('#header')){
		$('#header a').each(function(){
			if($(this).attr('id')){
				nvID = $(this).attr('id').split('nv-')[1];
				if(bodyID == nvID){
					$(this).find('img').css('visibility','hidden');
				}
			}
		});
	}
}



if($('body').attr('class')){
	bodyCL = $('body').attr('class');
	if($('#subnavi')){
		$('#subnavi li a').each(function(){
			if($(this).attr('class')){
				nvCL = $(this).attr('class');
				if(bodyCL == nvCL){
					$(this)
						.css('background','#83befa')
						.css('color','#fff');

				}

			}
		});
	}
}

if($('.moviebtn a')){
	$('.moviebtn a').click(function(){
		xHref = $(this).attr('href');
		window.open(xHref,'popWin','resizable=no,scrollbars=yes,menubar=no,directories=no,status=no,location=no,width=690,height=580');
		return false;
	});
}

if($('a.comment')){
	$('a.comment').click(function(){
		xHref = $(this).attr('href');
		window.open(xHref,'popWin','resizable=no,scrollbars=yes,menubar=no,directories=no,status=no,location=no,width=610,height=580');
		return false;
	});
}

/*------------------------
  .swapImg
------------------------*/
jQuery.fn.extend({
	swapImg: $(document).ready(function(){
		return $('.swapImg').each(function(){
			if($(this).attr('class').match('swapImg change')){
				//ImgPreLoad
				swapObj = new Image();
				preLoad = $(this).attr('class').split('swapImg change(')[1].split(')')[0];
				swapObj.src = preLoad;
				imgNm = $(this).attr('name',preLoad);
				
				//MouseOver
				$(this).hover(
					function(){
						$(this).attr('lowsrc',$(this).attr('src'));
						$(this).attr('src',$(this).attr('name'));
					},
					function(){
						$(this).attr('src',$(this).attr('lowsrc'));
					}
				);
			}else if($(this).attr('src').match('_no.')){
				//ImgPreLoad
				swapObj = new Image();
				imgpath = $(this).attr('src');
				preLoad = imgpath.replace('_no.','_ro.');
				swapObj.src = preLoad;
				
				$(this).hover(
					function(){
						$(this).attr('src',$(this).attr('src').replace('_no.','_ro.'));
					},
					function(){
						$(this).attr('src',$(this).attr('src').replace('_ro.','_no.'));
					}
				);
			}
		});
	})
});

});


