

jQuery(function($) {
// Roll Over 
		rollover = {
		   init: function() {
			  this.preload();
			  $(".roll").hover(
				 function () { $(this).attr( 'src', rollover.newimage($(this).attr('src')) ); },
				 function () { $(this).attr( 'src', rollover.oldimage($(this).attr('src')) ); }
			  );
		   },
		   preload: function() {
			  $(window).bind('load', function() {
				 $('.roll').each( 
				 	function( key, elm ) { $('<img>').attr( 'src', rollover.newimage( $(this).attr('src') ) ); });
			  });
		   },
		   newimage: function( src ) {
			  return src.substring( 0, src.search(/(\.[a-z]+)$/) ) + '_on' + src.match(/(\.[a-z]+)$/)[0];
		   },
		   oldimage: function( src ) {
			  return src.replace(/_on\./, '.');
		   }
		};
		$(".sideMenu a.act>img").each(
			function() { $(this).removeClass('roll').attr( 'src', rollover.newimage($(this).attr('src')) ); }
		);
		$('div#lm *').css({'outline': 'none'});
		$('div#lm > ul').hide();
		$('div#lm > ul.view').show();
		//$('div#lm> div:gt(0)').hide();
		$('div#lm > h2').click(function() {
			$(this).next('ul').slideToggle('normal').siblings('ul:visible').slideUp('normal');
		});
		$('#my-dropdown').sSelect({ddMaxHeight: '100px'});
		rollover.init();

		
});


// Tab Content 시작
	function initTabMenu(tabContainerID) {
		var tabContainer = document.getElementById(tabContainerID);
		var tabAnchor = tabContainer.getElementsByTagName('a');
		var i = 0;
	
		for(i=0; i<tabAnchor.length; i++) {
			if (tabAnchor.item(i).className == 'tab') thismenu = tabAnchor.item(i);
			else continue;
			thismenu.container = tabContainer;
			thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split('#')[1]);
			thismenu.targetEl.style.display = 'none';
			thismenu.imgEl = thismenu.getElementsByTagName('img').item(0);
			thismenu.onclick = function tabMenuClick() {
				currentmenu = this.container.current;
				if (currentmenu == this)
					return false;
				if (currentmenu) {
					currentmenu.targetEl.style.display = 'none';
					if (currentmenu.imgEl) {
						currentmenu.imgEl.src = currentmenu.imgEl.src.replace('_on.gif', '.gif');
					} else {
						currentmenu.className = currentmenu.className.replace(' on', '');
					}
				}
				this.targetEl.style.display = '';
				if (this.imgEl) {
					this.imgEl.src = this.imgEl.src.replace('.gif', '_on.gif');
				} else {
					this.className += ' on';
				}
				this.container.current = this;
				return false;
			};
			if (!thismenu.container.first) thismenu.container.first = thismenu;
		}
		if (tabContainer.first) tabContainer.first.onclick();
	}
// Tab Content 끝

// 이미지 셀렉트 박스 시작
function showOffice(divName){
	if(document.getElementById(divName).style.display == 'block'){
		document.getElementById(divName).style.display = 'none';
	}else{
		document.getElementById(divName).style.display = 'block';
	}
}
// 이미지 셀렉트 박스 끝

// 퀵메뉴 시작
	var name = "#quickMenu";
	jQuery(function($) {
		try{
			menuYloc = parseInt($(name).css("top").substring(0,$(name).css("top").indexOf("px")))
			$(window).scroll(function () { 
				offset = menuYloc+$(document).scrollTop()+"px";
				$(name).animate({top:offset},{duration:500,queue:false});
			});
		}catch(e){}
	});

// 퀵메뉴 끝

//	플래시 함수 시작

function insertFlash(swf, width, height, bgcolor, id, flashvars,trans)
{
 insertFlashWithVersion( swf, width, height, bgcolor, id, flashvars, trans, '9,0,0,0' );
}


function insertFlashWithVersion(swf, width, height, bgcolor, id, flashvars, trans, verstr)
{
 var strFlashTag = new String();

 if (navigator.appName.indexOf("Microsoft") != -1)
 {
  strFlashTag += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
  strFlashTag += 'codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=version='+verstr+'" ';
  strFlashTag += 'id="' + id + '" width="' + width + '" height="' + height + '">';
  strFlashTag += '<param name="movie" value="' + swf + '"/>';

  if(flashvars != null) {strFlashTag += '<param name="flashvars" value="' + flashvars + '"/>'};
  strFlashTag += '<param name="quality" value="best"/>';
  strFlashTag += '<param name="bgcolor" value="' + bgcolor + '"/>';
  strFlashTag += '<param name="menu" value="false"/>';
  strFlashTag += '<param name="salign" value="LT"/>';
  strFlashTag += '<param name="scale" value="noscale"/>';
  strFlashTag += '<param name="wmode" value="' + trans + '"/>';
  strFlashTag += '<param name="base" value="."/>';
  strFlashTag += '<param name="allowScriptAccess" value="always"/>';
  strFlashTag += '</object>';
 }
 else
 {
  strFlashTag += '<embed src="' + swf + '" ';
  strFlashTag += 'quality="best" ';
  strFlashTag += 'bgcolor="' + bgcolor + '" ';
  strFlashTag += 'width="' + width + '" ';
  strFlashTag += 'height="' + height + '" ';
  strFlashTag += 'menu="false" ';
  strFlashTag += 'scale="noscale" ';
  strFlashTag += 'id="' + id + '" ';
  strFlashTag += 'salign="LT" ';
  strFlashTag += 'wmode="' + trans + '" ';
  strFlashTag += 'base="." ';
  strFlashTag += 'allowScriptAccess="always" ';
  if(flashvars != null) {strFlashTag += 'flashvars="' + flashvars + '" '};
  strFlashTag += 'type="application/x-shockwave-flash" ';
  strFlashTag += 'pluginspage="https://www.macromedia.com/go/getflashplayer">';
  strFlashTag += '</embed>';
 }
 document.write(strFlashTag);
}



function getFlashMovieObject(movieName) { 
	 if (window.document[movieName]) { 
	  return window.document[movieName]; 
	 } 
	 if (navigator.appName.indexOf("Microsoft Internet")==-1) { 
	  if (document.embeds && document.embeds[movieName]) return document.embeds[movieName]; 
	 } else { 
	  return document.getElementById(movieName); 
	 } 
}
//	플래시 함수 끝

//갤러리 함수
jQuery(function($) {
		var $overLay = $('#msg, #overLay');
		var $overLay1 = $('#msg1, #overLay1');
			$('.open').click(function() { $overLay.show() });
			$('.close').click(function() { $overLay.hide() })
			$('.open1').click(function() { $overLay1.show() });
			$('.close1').click(function() { $overLay1.hide() })
				var $overLay2 = $('#msg2, #overLay2');
			$('.open').click(function() { $overLay.show() });
			$('.close').click(function() { $overLay.hide() })
			$('.open2').click(function() { $overLay2.show() });
			$('.close2').click(function() { $overLay2.hide() })
});
//갤러리 함수 끝

