//////////////////////////////////////////////////////////////////////////////
/*
À¥Å¬¸®¾î ÀÚ¹Ù ½ºÅ©¸³Æ®

	À¥Å¬¸®¾î (ºí·Î°Å : Àú½ºÆ¾)
	pegasus79@naver.com
	http://www.justin.or.kr (Á¦ÀÛÀÚ È¨ÆäÀÌÁö)
	http://webclear.co.kr (À¥Å¬¸®¾î ºí·Î±×)
	
	2008³â 01¿ù 05ÀÏ ÃÊ¾È Á¦ÀÛ
	2008³â 00¿ù 00ÀÏ  ver2 ¿ëÀ¸·Î °³Æí
*/

//////////////////////////////////////////////////////////////////////////////

//Flash Script
function FlashObject(swf, width, height, bgcolor, id, flashvars)
{
    var strFlashTag = new String();
    
    if (navigator.appName.indexOf("Microsoft") != -1)
    {
        strFlashTag += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
        strFlashTag += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=version=8,0,0,0" ';
        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="transparent"/>';
        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="transparent" ';
        strFlashTag += 'allowScriptAccess="always" ';
        if(flashvars != null) {strFlashTag += 'flashvars="' + flashvars + '" '};
        strFlashTag += 'type="application/x-shockwave-flash" ';
        strFlashTag += 'pluginspage="http://www.macromedia.com/go/getflashplayer">';
        strFlashTag += '</embed>';
    }

 document.write(strFlashTag);
}

function swfView(s, d, m, w, h){
	document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width="+w+" height="+h+" id="+d+">");
	document.write("<param name='allowScriptAccess' value='always' />");
	document.write("<param name=wmode value="+m+" />");
	document.write("<param name=movie value="+s+" />");
	document.write("<param name=quality value=high />");
	document.write("<param name=menu value=false />");
	document.write("<embed src="+s+" quality=high wmode="+m+" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash\" width="+w+" height="+h+" id="+d+">");
	document.write("</embed>");
	document.write("</object>");
}

//Flash Script End

//////////////////////////////////////////////////////////////////////////////
//All Focus
function allblur() {
	for (i = 0; i < document.links.length; i++) {
	var obj = document.links[i];
	if(obj.addEventListener) obj.addEventListener("focus", oneblur, false);
	else if(obj.attachEvent) obj.attachEvent("onfocus", oneblur);
	}
}
function oneblur(e) {
	var evt = e ? e : window.event;
	if(evt.target) evt.target.blur();
	else if(evt.srcElement) evt.srcElement.blur();
}
//All Focus End

//////////////////////////////////////////////////////////////////////////////
//Smooth Top Script
function go_Top(fstx,fsty,lstx,lsty) {   
    var Timer;   
    var winHeight = document.body.scrollTop;   
    if(Timer) clearTimeout(Timer);   
       
    startx = 0;   
    starty = winHeight;   
    if(!fstx || fstx < 0) fstx = 0;   
    if(!fsty || fsty < 0) fsty = 0;   
       
    var speed = 5;   
    if(!lstx) lstx = 0 + startx;   
    if(!lsty) lsty = 0 + starty;   
    lstx += (fstx - startx) / speed;   
    if (lstx < 0) lstx = 0;   
    lsty += (fsty - starty) / speed;   
    if (lsty < 0) lsty = 0;   
  
    var posX = Math.ceil(lstx);   
    var posY = Math.ceil(lsty);   
    window.scrollTo(posX, posY);   
    if((Math.floor(Math.abs(startx - fstx)) < 1) && (Math.floor(Math.abs(starty - fsty)) < 1)){   
        clearTimeout(Timer);   
        window.scroll(fstx,fsty);   
    }   
    else if(posX != fstx || posY != fsty){   
        Timer = setTimeout("go_Top("+fstx+","+fsty+","+lstx+","+lsty+")",15);   
    }   
    else{   
        clearTimeout(Timer);   
    }   
}
//Smooth Top End

//////////////////////////////////////////////////////////////////////////////
//Favorites Plus (IE, FF, Opera)
function bookmarksite(title,url){ 
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a'); 
	elem.setAttribute('href',url); 
	elem.setAttribute('title',title); 
	elem.setAttribute('rel','sidebar'); 
	elem.click();
}
else if(document.all)// ie
	window.external.AddFavorite(url, title); 
}
//Favorites Plus (IE, FF, Opera) End

//////////////////////////////////////////////////////////////////////////////
//Menu Open/Close
function clickshow(num){
	menu = document.getElementById("block"+num);
	if( menu != null && typeof menu != "undefined" )
		{
			if (menu.style.display=="block"){
			menu.style.display="none";//Close
		}
	else{
		menu.style.display="block";//Sub Menu Open
		}
	}
}
//Menu Open/Close End
function clickblock(num)
{
	for (i=1;i<=100;i++) {
		var menu=eval("block"+i+".style");
		
		if (num==i) {menu.display="block";}
		else { menu.display="none"; }
	}
}

//////////////////////////////////////////////////////////////////////////////
// Button script
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr;
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
	var d=document;
	if(d.images){
		if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments;
		for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){
			d.MM_p[j]=new Image;
			d.MM_p[j++].src=a[i];
		}
	}
}

function MM_findObj(n, d) { //v4.01
	var p,i,x;
	if(!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length){
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n);
	return x;
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments;
	document.MM_sr=new Array;
	for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){
		document.MM_sr[j++]=x;
		if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
	}
}

//////////////////////////////////////////////////////////////////////////////
//MoreBox Controll Script
var msg_hidden_idle=null; 
function msg(id) { 
	if(msg_hidden_idle) { 
		clearInterval(msg_hidden_idle); 
	} if(id) { 
	var mid=document.getElementById(id);
	mid.style.display=''; 
	mid.style.visibility='visible'; 
	} 
}
function msg_hidden(id,f) { 
if(f==1) {
	hidden(id);
	}else{ 
		msg_hidden_idle=setInterval("hidden('"+id+"')",100); 
	} 
} 
function hidden(id) { 
	var mid=document.getElementById(id);
	mid.style.display='none';
	mid.style.visibility='hidden'; 
	} function nx_toggle_svc(t) {
	var s = document.getElementById("nx_svclist") ;
	if (typeof(t) != "undefined") {
	if (!t && !s_svc && s.style.display == 'block') s.style.display = 'none' ;
	else sleep = false ;
	return false ;
	} else {
	if (s.style.display == 'none') { 
	s.style.display = 'block' ; s_svc = true ;
		}else { s.style.display = 'none' ;
		s_svc = false ;
		}
	}
}
//MoreBox Controll Script End

//////////////////////////////////////////////////////////////////////////////
// PNG Trans Start
function setPng24(obj) {
	obj.width=obj.height=1;
	obj.className=obj.className.replace(/\bpng24\b/i,'');
	obj.style.filter =
	"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
	obj.src='';
	return '';
}
// PNG Trans End

//////////////////////////////////////////////////////////////////////////////
// quick
var stmnLEFT = -20; // ¿ÞÂÊ ¿©¹é (¸Þ´º°¡ ¿ÞÂÊ¿¡¼­ 400ÇÈ¼¿ ¶³¾îÁø °÷¿¡ º¸¿©Áý´Ï´Ù) 
var stmnGAP1 = 150; // À§ÂÊ ¿©¹é (¸Þ´º°¡ À§¿¡¼­ 10ÇÈ¼¿ ¶³¾îÁø °÷¿¡ º¸¿©Áý´Ï´Ù) 
var stmnGAP2 = 150; // ½ºÅ©·Ñ½Ã ºê¶ó¿ìÀú À§ÂÊ°ú ¶³¾îÁö´Â °Å¸® 
var stmnBASE = 150; // ½ºÅ©·Ñ ½ÃÀÛÀ§Ä¡ 
var stmnActivateSpeed = 35; 
var stmnScrollSpeed = 20; 

var stmnTimer; 


function RefreshStaticMenu() { 
	var stmnStartPoint, stmnEndPoint; 
	
	stmnStartPoint = parseInt(document.getElementById('STATICMENU').style.top, 10); 
	stmnEndPoint = Math.max(document.documentElement.scrollTop, document.body.scrollTop) + stmnGAP2; 
	if (stmnEndPoint < stmnGAP1) stmnEndPoint = stmnGAP1; 
	
	if (stmnStartPoint != stmnEndPoint) { 
		stmnScrollAmount = Math.ceil( Math.abs( stmnEndPoint - stmnStartPoint ) / 15 ); 
		document.getElementById('STATICMENU').style.top = parseInt(document.getElementById('STATICMENU').style.top, 10) + ( ( stmnEndPoint<stmnStartPoint ) ? -stmnScrollAmount : stmnScrollAmount ) + 'px'; 
		stmnRefreshTimer = stmnScrollSpeed; 
	}
	
	stmnTimer = setTimeout("RefreshStaticMenu();", stmnActivateSpeed); 
} 


function InitializeStaticMenu() {
	document.getElementById('STATICMENU').style.left = stmnLEFT + 'px'; 
	document.getElementById('STATICMENU').style.top = document.body.scrollTop + stmnBASE + 'px'; 
	RefreshStaticMenu();
}
// quick END

//////////////////////////////////////////////////////////////////////////////
// Action Layer
var dragapproved=false
function drag_dropie(){
	if (dragapproved==true){
	document.all.showsubmenu.style.pixelLeft=tempx+event.clientX-iex
	document.all.showsubmenu.style.pixelTop=tempy+event.clientY-iey
	return false
	}
}
function initializedragie(){
	iex=event.clientX
	iey=event.clientY
	tempx=showsubmenu.style.pixelLeft
	tempy=showsubmenu.style.pixelTop
	dragapproved=true
	document.onmousemove=drag_dropie
	}
	if (document.all){
	document.onmouseup=new Function("dragapproved=false")
}
//end
function sub_hidden(){
	showsubmenu.style.display='none';
}
function sub_view(){
	showsubmenu.style.display='block';
}
// Action Layer END

//////////////////////////////////////////////////////////////////////////////
// Action Layer
var move_width = 80;
var total_width = 539;
var time_flag = 1;
var time_id;

/*function startRolling_m() {
  pds_time_id = setInterval("scroll_m(1)",3000);
}

function stopRolling_m() {
  clearInterval(pds_time_id);
}*/

function scroll_m(flag) {
	if (time_flag > 3)
	{
		return;
	}
	var cnt = document.getElementsByName('scroll_area').length;
	var mod = cnt%8;
	var i;
	var j;
	var tmp;
	var max;
	var min;

	if (flag == 0){
		j=1;
		min=0;
		for(i=0; i < cnt; i++){
			tmp = document.getElementsByName('scroll_area')[i].style;
			if(min > parseFloat(tmp.left.replace("px", ""))){
				min = parseFloat(tmp.left.replace("px", ""));
			}
		}
		for(i=(cnt-1); i >= 0; i--){
			tmp = document.getElementsByName('scroll_area')[i].style;
			if(parseFloat(tmp.left.replace("px", "")) >= total_width){
				tmp.left = (min + (move_width*j*(-1))) + "px";
				j++;
			}
		}	

		if(time_id){
			clearInterval(time_id);
			time_flag = 0;
		}
		time_id = setInterval("scroll_Move_Next()", 1);		
	}

	if (flag == 1){
		j=1;
		max = 0;

		for(i=0; i < cnt; i++){
			tmp = document.getElementsByName('scroll_area')[i].style;
			if(max < parseFloat(tmp.left.replace("px", ""))){
				max = parseFloat(tmp.left.replace("px", ""));
			}
		}
		for(i=0; i < cnt; i++){
			tmp = document.getElementsByName('scroll_area')[i].style;
			if(parseFloat(tmp.left.replace("px", "")) < 0){
				tmp.left = (max + (move_width*j)) + "px";
				j++;
			}			
		}
		if(time_id){
			clearInterval(time_id);
			time_flag = 0;
		}

		time_id = setInterval("scroll_Move_Prev()", 1);		
	}
}

function scroll_Move_Next(){
	if ((move_width) > time_flag)
	{
		var cnt = document.getElementsByName('scroll_area').length;
		for(i=0; i < cnt; i++){
			var tmp = document.getElementsByName('scroll_area')[i].style;
			tmp.left = (parseFloat(tmp.left.replace("px", "")) + 3) + "px";			
		}
		}else{
		clearInterval(time_id);
		time_flag = 0;
	}
	//time_flag++;
	time_flag = time_flag + 3;
}

function scroll_Move_Prev(){
	if (move_width > time_flag)
	{
		var cnt = document.getElementsByName('scroll_area').length;
		for(i=0; i < cnt; i++){
			var tmp = document.getElementsByName('scroll_area')[i].style;
			tmp.left = (parseFloat(tmp.left.replace("px", "")) - 3) + "px";
		}
		}else{
		clearInterval(time_id);
		time_flag = 0;
	}
	//time_flag++;
	time_flag = time_flag + 3;
}
// Action Layer END

//////////////////////////////////////////////////////////////////////////////
// TAB Jquery //
/*
$(document).ready(function() {
	var item_code_lists;
	$("#tab_01").innerHtml= "Comment";
	$("#tab_02").innerHtml= "Trackback";
	$("#tab_03").innerHtml= "Tags";
});

function Show(tabtn) {
	if (tabtn == 0) {
		$("#tabtxt_0").hide().fadeIn();
		$("#tabtxt_1").hide();
		$("#tabtxt_2").hide();
		$("#tabtxt_3").hide();
		$("#tabtxt_4").hide();
	}
	else if (tabtn == 1) {
		$("#tabtxt_0").hide();
		$("#tabtxt_1").hide().fadeIn();
		$("#tabtxt_2").hide();
		$("#tabtxt_3").hide();
		$("#tabtxt_4").hide();
	}
	else if (tabtn == 2) {
		$("#tabtxt_0").hide();
		$("#tabtxt_1").hide();
		$("#tabtxt_2").hide().fadeIn();
		$("#tabtxt_3").hide();
		$("#tabtxt_4").hide();
	}
}
*/
// TAB Jquery END

//////////////////////////////////////////////////////////////////////////////
// MENU Jquery //
/*
$(document).ready(function() {
	//Code goes here
});
*/

//On Hover Over
function megaHoverOver(){
    $(this).find(".sub").stop().fadeTo('fast', 1).show(); //Find sub and fade it in
    (function($) {
        //Function to calculate total width of all ul's
        jQuery.fn.calcSubWidth = function() {
            rowWidth = 0;
            //Calculate row
            $(this).find("ul").each(function() { //for each ul...
                rowWidth += $(this).width(); //Add each ul's width together
            });
        };
    })(jQuery); 

    if ( $(this).find(".row").length > 0 ) { //If row exists...
        var biggestRow = 0;	

        $(this).find(".row").each(function() {	//for each row...
            $(this).calcSubWidth(); //Call function to calculate width of all ul's
            //Find biggest row
            if(rowWidth > biggestRow) {
                biggestRow = rowWidth;
            }
        });

        $(this).find(".sub").css({'width' :biggestRow}); //Set width
        $(this).find(".row:last").css({'margin':'0'});  //Kill last row's margin

    } else { //If row does not exist...

        $(this).calcSubWidth();  //Call function to calculate width of all ul's
        $(this).find(".sub").css({'width' : rowWidth}); //Set Width
    }
}
//On Hover Out
function megaHoverOut(){
  $(this).find(".sub").stop().fadeTo('fast', 0, function() { //Fade to 0 opactiy
      $(this).hide();  //after fading, hide it
  });
}

//Set custom configurations
var config = {
     sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
     interval: 100, // number = milliseconds for onMouseOver polling interval
     over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
     timeout: 500, // number = milliseconds delay before onMouseOut
     out: megaHoverOut // function = onMouseOut callback (REQUIRED)
};

// $("ul#topnav li .sub").css({'opacity':'0'}); //Fade sub nav to 0 opacity on default
// $("ul#topnav li").hoverIntent(config); //Trigger Hover intent with custom configurations

// MENU Jquery END


//////////////////////////////////////////////////////////////////////////////
// DropDown Menu //
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function RePos()
{
	if (document.body.clientWidth >= 960)
	{
		m1.style.left			= (document.body.clientWidth - 960)/2;
		m2.style.left			= (document.body.clientWidth - 960)/2;
		m3.style.left			= (document.body.clientWidth - 960)/2;
		m4.style.left			= (document.body.clientWidth - 960)/2;
		m5.style.left			= (document.body.clientWidth - 960)/2;
		m6.style.left			= (document.body.clientWidth - 960)/2;
		m7.style.left			= (document.body.clientWidth - 960)/2;
		m8.style.left			= (document.body.clientWidth - 960)/2;
		m9.style.left			= (document.body.clientWidth - 960)/2;
	}
	else
	{
		m1.style.left			= 0;
		m2.style.left			= 0;
		m3.style.left			= 0;
		m4.style.left			= 0;
		m5.style.left			= 0;
		m6.style.left			= 0;
		m7.style.left			= 0;
		m8.style.left			= 0;
		m9.style.left			= 0;
	}

}


function Sup_close_Layer() {
    var s = document.getElementById('supstar')
    s.style.display = 'none';
}





// DropDown Menu END


