
var is_ie = navigator.appName == 'Microsoft Internet Explorer';
var is_op = navigator.appName == 'Opera' ? true : false;
//var is_ns = !is_ie && !is_op ? true : false;

String.prototype.trim = function() {
	return this.replace(/^\s*(\b.*\b|)\s*$/, "$1"); // 문장의 앞과 뒤의 공백 제거
}

function show_waiting() {
	var x = document.body.clientWidth/2 + document.body.scrollLeft - 150 ;
	var y = document.body.clientHeight/2 + document.body.scrollTop - 50 ;
	document.all.waiting.style.left = x ;
	document.all.waiting.style.top  = y ;
	document.all.waiting.style.visibility='visible';
}

/*-- 한글체크 ; 0 - 9 , a - z 사이의 값이 아닌 경우는 -1을 반환 --*/
function check_Hangeul(obj) {

	var intErr
	var strValue = obj.value
	var retCode = 0

	for (i=0; i<strValue.length; i++) {

		var retCode = strValue.charCodeAt(i)
		var retChar = strValue.substr(i,1).toUpperCase()

		retCode = parseInt(retCode)

		if ((retChar<"0" || retChar>"9") && (retChar<"A" || retChar>"Z") && ((retCode>255) || (retCode<0))) {
			intErr = -1;
			break;
		}
	}
	return (intErr);
}

/*-- 숫자 체크 ; 숫자가 아니면 -1을 반환한다. --*/
function check_Number(obj) {

	var intErr
	var newValue = obj.value
	var newLength = newValue.length;

	for(var i=0; i!=newLength; i++) {
		aChar = newValue.substring(i, i+1)
		if (aChar<"0" || aChar>"9") {
			intErr = -1;
			break;
		}
	}
	return (intErr);
}

function only_number(obj) {
	var intErr
	var newValue = obj.value
	var newLength = newValue.length;

	for (var i=0; i!=newLength; i++) {
		aChar = newValue.substring(i, i+1)
		if (aChar<"0" || aChar>"9") { 
			obj.value = '' ; 
		}
	}
}

/*-- 숫자 체크 --*/
function onlyNumber() {
	if((event.keyCode<48)||(event.keyCode>57))
    event.returnValue=false;
}

function isNum(str){ 
	if (isEmpty(str)) return false;
	for (var idx=0; idx<str.length; idx++) {
		if (str.charAt(idx)<'0' || str.charAt(idx)>'9') {
			return false;
		}
	}
	return true;
}

// 지정된 문자만...
// 가격 스타일 
function isValidPrice(e) { 
	var keynum;
	var keychar;

	if(window.event) { // IE
		keynum = e.keyCode;
	} else if(e.which) { // Netscape/Firefox/Opera
		keynum = e.which;
	}
	keychar = String.fromCharCode(keynum);

	var pattern = new RegExp('[^.0-9_]');
	//var pattern = /\d/; // 숫자만 입력안되게 할 때. 
	return !pattern.test(keychar);
	//event.returnValue=false; 
} 

// 빈값인지 리턴한다.
function isEmpty(pValue){
	if ((pValue=="") || (pValue==null)) {
		return true;
	}
	return false;
}

function isValidFormat(input, format) {
	if (input.value.search(format)!=-1) {
		return true; //올바른 포맷 형식
	}
	return false;
}
 
function isValidEmail(input) {
	var format = /^((\w|[\-\.])+)@((\w|[\-\.])+)\.([A-Za-z]+)$/;
	return isValidFormat(input, format);
}

function isValidPhone(input) {
	var format = /^(\d+)-(\d+)-(\d+)$/;
	return isValidFormat(input,format);
}

// 콤마 없애기 
function removeComma(input) {
	return input.value.replace(/,/gi,"");
}

function removeComma_2(value) {
	return value.replace(/,/gi,"");
}

// 숫자 3자리마다 콤마넣기 소스 
function commaSplit(obj) {
	objectValue = obj.value ; 
	objectValue = objectValue.replace(/,/gi,"");

	var txtNumber = '' + objectValue;
	var rxSplit = new RegExp('([0-9])([0-9][0-9][0-9][,.])');
	var arrNumber = txtNumber.split('.');
	arrNumber[0] += '.';
	
	do {
		arrNumber[0] = arrNumber[0].replace(rxSplit, '$1,$2');
	} while (rxSplit.test(arrNumber[0]));
	
	if (arrNumber.length>1) {
		val = arrNumber.join('');
	} else {
		val = arrNumber[0].split('.')[0];
	}

	obj.value = val ; 
}

function stripNumber(val) {
	val = val.replace(/[^0123456789.]/g, "");
	val = Number(val);
	return val;
}

function formatNumber(val) {
	val = (val).toLocaleString();
	return val;
}

function NumberFormat(fn){
	var str = fn;
	var Re = /[^0-9]/g;
	var ReN = /(-?[0-9]+)([0-9]{3})/;
	str = str.replace(Re,'');              
	while (ReN.test(str)) { 
		str = str.replace(ReN, "$1,$2"); 
	}
	return str;
}

function setCookie(name,value,expires) { 
	document.cookie=name + "=" + escape(value) + ((expires == null)? "" : (" ; expires=" + expires.toGMTString())); 
} 

function getCookie(name) { 
	var arg = name + "="; 
	var alen = arg.length; 
	var clen = document.cookie.length; 
	var i = 0; 
	while (i<clen) { 
		var j = i + alen; 
		if (document.cookie.substring(i,j)==arg) { 
			var end = document.cookie.indexOf(";",j);
			if(end == -1) end = document.cookie.length; 
			return unescape(document.cookie.substring(j,end)); 
		} 
		i = document.cookie.indexOf(" ",i)+1;
		if (i==0) break; 
	} 
	return null; 
} 

function getFontCookie() { 
	var cookie = getCookie("news_font_size"); 
	if (cookie==null) return 12; 
	if (cookie.length) return cookie; else return 12; 
} 

function scaleFont(val) { 
	var content, lineHeight; 
	content = document.getElementById("main_content");
	if (val>0){ 
		if (fontSize<=18)	{ 
			fontSize = fontSize + val; 
			lineHeight = fontSize+Math.round(1.1*fontSize); 
			content.style.fontSize = fontSize + "px"; 
		}
	} else { 
		if (fontSize>12) { 
			fontSize = fontSize + val;
			lineHeight = fontSize+Math.round(1.1*fontSize); 
			content.style.fontSize = fontSize + "px"; 
		}
	} 
	var mydate = new Date; 
	mydate.setDate(mydate.getDate()+1000); 
	setCookie("news_font_size", fontSize, mydate); 
} 
var fontSize = parseInt(getFontCookie()); 

// 확장자 체크. 
function check_extension(ext, img_types) { 

	var img_types = new Array(img_types);
	var i = 0;
	var check_value = 0; 
	for (i; i<img_types.length; i++) { 
		if (ext==img_types[i]) check_value = 1;  
	}
	return check_value; 
}

/*
function validPW(str) {

	var chk_pattern = /^[a-z0-9]{6,16}$/;
	
	if( !chk_pattern.test(str) ) {
		alert("비밀번호는 6~16자의 영문 소문자와 숫자만 사용할 수 있습니다.");
		return 0;
	}
	return 1;
}
*/ 



// ajax type 1 start 
function uriEncode(data){
	if(data!=""){
		//&와=로 일단 분해해서 encode
		var encdata = '';
		var datas = data.split('&');
		for(i=0;i<datas.length;i++)
		{
			var dataq = datas[i].split('=');
			encdata += '&'+encodeURIComponent(dataq[0])+'='+encodeURIComponent(dataq[1]);
		}
	} else {
		encdata = "";
	}
	return encdata;
}

var xh = false;
function get_ajax_01() { 
	try {
		xh = new XMLHttpRequest();
	} catch (trymicrosoft) {
		try {
			xh = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (othermicrosoft) {
			try {
				xh = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (failed) {
				xh = false;
			}  
		}
	}
	return xh; 
} 

function request_ajax_01(method, url, params, async, rpfunc, target) {
	xh = get_ajax_01(); 
	//alert(xh); 
	if (!xh) { 
		alert("Error initializing XMLHttpRequest!");
	} else { 
		params = uriEncode(params); 
		if (method.toUpperCase()=='GET') {
			url += "?" + "t=" + (new Date()).getTime() + "&" + params ;
		}
		//alert(url); 
		xh.open(method, url, async); 
		xh.onreadystatechange = function () { rpfunc(target); }
		xh.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8"); // 요청헤더의 정의 
		xh.send(null);
	} 
}

function response_ajax_01(target) {
	//alert(target); 
	if (xh.readyState == 4) {
		//alert(xh.status); 
		if (xh.status == 200) {
			//var _ctype = xh.getResponseHeader("Content-type");
			//alert(_ctype);
			//alert(_ctype.indexOf("text/xml"));
			var xmlDoc = xh.responseXML;
			//alert(xh.responseXML.xml); 
			root = xmlDoc.documentElement; 
			//alert(root.nodeName); 
			str = root.firstChild.nodeValue;
			document.all[target].innerHTML = str;
			if (target=='contentsBox') { setLoadConfirm(); } 
		} else { 
			alert("status is " + xh.status);
		}
	}
	return false;
}
// ajax type 1 end 


function print_flash(uwidth,uheight,usrc) {

	var flash_tag = "";

	flash_tag = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';

	flash_tag +='codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" ';

	flash_tag +='WIDTH="'+uwidth+'" HEIGHT="'+uheight+'" >';

	flash_tag +='<param name="movie" value="'+usrc+'">';

	flash_tag +='<param name="quality" value="high">';

	flash_tag +='<param name="wmode" value="transparent">';

	//flash_tag +='<param name="wmode" value="transparent">';

	flash_tag +='<embed src="'+usrc+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" ';

	flash_tag +='type="application/x-shockwave-flash" WIDTH="'+uwidth+'" HEIGHT="'+uheight+'"></embed></object>'

	document.write(flash_tag);

}
/* shopping mall ?*/ 
function visible_layer(id, flag) {
	if(flag==true) {
		document.getElementById(id).style.visibility = "visible" ;
	} else { 
		document.getElementById(id).style.visibility = "hidden" ;
	}
}

function display_layer(id, flag) {
	if(flag==true) {
		document.getElementById(id).style.display = "";
	} else { 
		document.getElementById(id).style.display = "none";
	}
}

former_id = ''; 
function toggle(id, group_id) {
	if (former_id==id) {
		document.getElementById(id).style.display = ""; 
		//document.getElementById(id).style.display = "none"; 
		//id = ''; 
	} else {
		document.getElementById(id).style.display = ""; 
		if (former_id) {
			document.getElementById(former_id).style.display = "none"; 
		}
	}
	former_id = id; /* 전역 변수 선언은 var 없이 */ 
} 

//function toggle2(id) {
//	if(id.style.display != "none") {
//		id.style.display = "none"
//	} else { 
//		id.style.display = "";
//	}
//}
function toggle2(id) {
	if(document.getElementById(id).style.display != "none") {
		document.getElementById(id).style.display = "none"
	} else { 
		document.getElementById(id).style.display = "";
	}
}

function toggle3(id, group_id, cnt) {
	for(var i = 1; i <= cnt ; i++) {
		//alert('tap_'+ group_id + '_' + i); 
		document.getElementById('tap_'+ group_id + '_' + i).className = "idx_ajax_top_out";
		eval("document.getElementById(group_id + '_' + i)").style.display = "none";
	}
	document.getElementById('tap_'+ group_id + '_' + id).className = "idx_ajax_top_over"
	eval("document.getElementById(group_id + '_' + id)").style.display = "";
}

function toggle4(id, flag) {
	if(flag=="1") {
		document.getElementById(id).style.display = ""
	} else { 
		document.getElementById(id).style.display = "none"
	}
}

function toggle5(id, group_id, cnt) {
	for(var i = 1; i <= cnt ; i++) {
		//alert('tap_'+ group_id + '_' + i); 
		eval("document.getElementById(group_id + '_' + i)").style.display = "none";
	}
	eval("document.getElementById(group_id + '_' + id)").style.display = "";
}

function toggle6(id, group_id, cnt, class_name) {
	for(var i = 1; i <= cnt ; i++) {
		eval("document.getElementById(group_id + '_' + i)").style.display = "none";
		eval("document.getElementById(group_id + '_' + i + '_tap')").className = class_name + "out";
	}
	eval("document.getElementById(group_id + '_' + id)").style.display = "";
	eval("document.getElementById(group_id + '_' + id + '_tap')").className = class_name + "over";
}
function toggle6_img(id, group_id, cnt, class_name) {
	for(var i = 1; i <= cnt ; i++) {
		eval(document.getElementById(group_id + '_' + i)).style.display = "none";
		eval(document.getElementById(group_id + '_' + i + '_tap')).src = eval(group_id + '_' + i + '_tap' + "_of.src");
	}
	eval(document.getElementById(group_id + '_' + id)).style.display = "";
	eval(document.getElementById(group_id + '_' + id + '_tap')).src = eval(group_id + '_' + id + '_tap' + '_on.src');
}

function rollover_bg(id, isOver) {
	var lmObj = document.getElementById(id);
	var lmHandle = lmObj.className.replace(/_over/i, "");
	if (isOver=='1') {
		lmHandle += "_over";
	}
	lmObj.className = lmHandle;
}

function rollover_bg2(obj, isOver) {
	var lmObj = obj;
	var lmHandle = lmObj.className.replace(/_over/i, "");
	if (isOver=='1') {
		lmHandle += "_over";
	}
	lmObj.className = lmHandle;
}

var view_file_window = null; 
function view_file(file_path, width, height, left, top, scroll, resize) { 
	var URL = file_path;
	if ( view_file_window == null || view_file_window.closed) {
		view_file_window = window.open(URL, 'fileView', 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar=no,menubar=no,statusbar=no,scrollbars='+scroll+',resizable='+resize)
		view_file_window.focus();
	} else {
		view_file_window.location = URL;
		view_file_window.focus();
	}
}

var view_image_window = null; 
function view_image(file_path) { 
	if (file_path=='[object]') { 
		var file_path = file_path.src;
	} 
	var URL = 'view_image.php?file_path=' + file_path;
	//var URL = '/web/gboard/view_image.php?file_path=' + file_path;
	if (view_image_window==null || view_image_window.closed) {
		view_image_window = window.open(URL, 'imageView', 'left=20,top=20,width=1,height=1,toolbar=no,menubar=no,statusbar=no,scrollbars=no,resizable=yes')
		view_image_window.focus();
	} else {
		view_image_window.location = URL;
		view_image_window.focus();
	}
}

/* 2007.11.25 added */
function get_img_info(obj) {
	var arr = obj.src.split('/');
	var fname = arr[(arr.length-3)] + "/" + arr[(arr.length-2)] + "/" + arr[(arr.length-1)]; 
	obj.alt = fname + ' (' + obj.width + '*' + obj.height + ')'; 
}

/* 2008.01.17 added */
function ResizeThem() {  
	var maxheight = 300;  
	var maxwidth = 300; 
	var imgs = document.getElementsByTagName("img");  
	for ( var p = 0; p < imgs.length; p++ )  
	{   
		if ( imgs[p].getAttribute("alt") == "user posted image" )
		{
			var w = parseInt( imgs[p].width );   
			var h = parseInt( imgs[p].height );  
			if ( w > maxwidth ) { 
				imgs[p].style.cursor = "pointer";      
				imgs[p].onclick = function( ) {          
					var iw = window.open ( this.src, 'ImageViewer','resizable=1' );          
					iw.focus();       
				};      
				h = ( maxwidth / w ) * h;      
				w = maxwidth;        
				imgs[p].height = h;       
				imgs[p].width = w;     
			}      
			
			if ( h > maxheight ) { 
				imgs[p].style.cursor="pointer";        
				imgs[p].onclick = function( ) {
					var iw = window.open ( this.src, 'ImageViewer','resizable=1' );      
					iw.focus( );        
				};       
				imgs[p].width = ( maxheight / h ) * w;        
				imgs[p].height = maxheight;    
			}   
		}  
	}
}
/* <body onLoad="ResizeThem()"> */

/* 2008.04.06 added */ 
function isURLFormat(url) {
	var re = new RegExp("^http://|^mms://", "i");
	return re.test(url);
}

function getPath(url) {
	var qmark = url.indexOf("?");
	if (qmark == -1) return url;
	else return url.substring(0, qmark);
}

function isCompatibleURL(url, type) {
	if (type == 'multi_video') {
		var re = new RegExp("\\.(avi|mov|mpg|mpeg|asf|wmv|wma)$", "i");
	} else if (type == 'multi_flash') {
		var re = new RegExp("\\.(swf)$", "i");
	} else if (type == 'multi_audio') {
		var re = new RegExp("\\.(mp3|wma|mmf)$", "i");
	} else if (type == 'image') {
		var re = new RegExp("\\.(gif|jpg|jpeg|png|bmp)$", "i");
	} 

	return re.test(getPath(url));
}

function checkLinkUrl(url, type) {
	
	if (false == isURLFormat(url)) {
		return false;
	}

	if (false == isCompatibleURL(url, type)) {
		return false;	
	}
	
	return true;
}


function textCounter(obj, max, bgcolor) { 
	var form = document.input_form; 

	//------------------------------------------// 
	var maxLimit = max ; 

  var str = obj.value ;
	var strLength = str.length  ;

	if ( strLength > maxLimit) {  
		obj.blur() ; 
		obj.style.backgroundColor = bgcolor;  
		obj.value = obj.value.substring(0, maxLimit); 
	} else { 
		//form.text_counter.value = maxLimit - strLength ; 
	}
} 

function set_favorite(title, url){
	if (document.all)
	window.external.AddFavorite(url, title);
	else if (window.sidebar)
	window.sidebar.addPanel(title, url, "")
}
// <span onclick="set_favorite('welcome to home.com', 'http://home.com/')" >favorite</span>
// <a href="javascript:set_favorite('welcome to home.com', 'http://home.com/')" >favorite</a>

function set_homepage(obj, url) { 
	obj.style.behavior='url(#default#homepage)'; 
	obj.setHomePage(url); 
} 
// <span onclick="set_homepage(this, 'http://home.com')" >시작페이지</span> => 에러남 
// <a href="javascript:set_homepage(this, 'http://home.com')" >시작페이지</a> => 에러남. 
// <a href="JavaScript:" onclick="this.style.behavior='url(#default#homepage)'; this.setHomepage('http://home.com')"> => 오케이 


function set_ip(ip) { 
	var mydate = new Date; 
	mydate.setDate(mydate.getDate()+1000); 
	setCookie("trace_ip", ip, mydate); 
} 

function get_ip() { 
	var cookie = getCookie("trace_ip"); 
	if (cookie==null) {
		return ""; 
	} 
	if (cookie.length) {
		return cookie; 
	} else {
		return ""; 
	} 
} 

function BrowserDetect() {
   var ua = navigator.userAgent.toLowerCase(); 

   // browser engine name
   this.isGecko       = (ua.indexOf('gecko') != -1 && ua.indexOf('safari') == -1);
   this.isAppleWebKit = (ua.indexOf('applewebkit') != -1);

   // browser name
   this.isKonqueror   = (ua.indexOf('konqueror') != -1); 
   this.isSafari      = (ua.indexOf('safari') != - 1);
   this.isOmniweb     = (ua.indexOf('omniweb') != - 1);
   this.isOpera       = (ua.indexOf('opera') != -1); 
   this.isIcab        = (ua.indexOf('icab') != -1); 
   this.isAol         = (ua.indexOf('aol') != -1); 
   this.isIE          = (ua.indexOf('msie') != -1 && !this.isOpera && (ua.indexOf('webtv') == -1) ); 
   this.isMozilla     = (this.isGecko && ua.indexOf('gecko/') + 14 == ua.length);
   this.isFirefox     = (ua.indexOf('firefox/') != -1 || ua.indexOf('firebird/') != -1);
   this.isNS          = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && !this.isOpera && !this.isSafari && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) );
   
   // spoofing and compatible browsers
   this.isIECompatible = ( (ua.indexOf('msie') != -1) && !this.isIE);
   this.isNSCompatible = ( (ua.indexOf('mozilla') != -1) && !this.isNS && !this.isMozilla);
   
   // rendering engine versions
   this.geckoVersion = ( (this.isGecko) ? ua.substring( (ua.lastIndexOf('gecko/') + 6), (ua.lastIndexOf('gecko/') + 14) ) : -1 );
   this.equivalentMozilla = ( (this.isGecko) ? parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) ) : -1 );
   this.appleWebKitVersion = ( (this.isAppleWebKit) ? parseFloat( ua.substring( ua.indexOf('applewebkit/') + 12) ) : -1 );
   
   // browser version
   this.versionMinor = parseFloat(navigator.appVersion); 
   
   // correct version number
   if (this.isGecko && !this.isMozilla) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('/', ua.indexOf('gecko/') + 6) + 1 ) );
   }
   else if (this.isMozilla) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) );
   }
   else if (this.isIE && this.versionMinor >= 4) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );
   }
   else if (this.isKonqueror) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('konqueror/') + 10 ) );
   }
   else if (this.isSafari) {
      this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('safari/') + 7 ) );
   }
   else if (this.isOmniweb) {
      this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('omniweb/') + 8 ) );
   }
   else if (this.isOpera) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera') + 6 ) );
   }
   else if (this.isIcab) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab') + 5 ) );
   }
   
   this.versionMajor = parseInt(this.versionMinor); 
   
   // dom support
   this.isDOM1 = (document.getElementById);
   this.isDOM2Event = (document.addEventListener && document.removeEventListener);
   
   // css compatibility mode
   this.mode = document.compatMode ? document.compatMode : 'BackCompat';

   // platform
   this.isWin    = (ua.indexOf('win') != -1);
   this.isWin32  = (this.isWin && ( ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1 || ua.indexOf('xp') != -1) );
   this.isMac    = (ua.indexOf('mac') != -1);
   this.isUnix   = (ua.indexOf('unix') != -1 || ua.indexOf('sunos') != -1 || ua.indexOf('bsd') != -1 || ua.indexOf('x11') != -1)
   this.isLinux  = (ua.indexOf('linux') != -1);
   
   // specific browser shortcuts
   this.isNS4x = (this.isNS && this.versionMajor == 4);
   this.isNS40x = (this.isNS4x && this.versionMinor < 4.5);
   this.isNS47x = (this.isNS4x && this.versionMinor >= 4.7);
   this.isNS4up = (this.isNS && this.versionMinor >= 4);
   this.isNS6x = (this.isNS && this.versionMajor == 6);
   this.isNS6up = (this.isNS && this.versionMajor >= 6);
   this.isNS7x = (this.isNS && this.versionMajor == 7);
   this.isNS7up = (this.isNS && this.versionMajor >= 7);
   
   this.isIE4x = (this.isIE && this.versionMajor == 4);
   this.isIE4up = (this.isIE && this.versionMajor >= 4);
   this.isIE5x = (this.isIE && this.versionMajor == 5);
   this.isIE55 = (this.isIE && this.versionMinor == 5.5);
   this.isIE5up = (this.isIE && this.versionMajor >= 5);
   this.isIE6x = (this.isIE && this.versionMajor == 6);
   this.isIE6up = (this.isIE && this.versionMajor >= 6);
   
   this.isIE4xMac = (this.isIE4x && this.isMac);
}

// 이미지 애니메이션 
var dcount = 1;
function cnj_init() { 
	
	var browser = new BrowserDetect();

	if (browser.isIE) {
		cnj_img.filters.blendTrans.apply(); 
		document.images.cnj_img.src = dimages[dcount].src; 
		cnj_img.filters.blendTrans.play(); 
	} else {	
		document.images.cnj_img.src = dimages[dcount].src; 
	}	
	
	if (dcount < (maxLoops-1)) { 
		dcount++; 
	} else { 
		dcount = 0; 
	} 
	setTimeout("cnj_init()", bInterval*700+2000); 
} 

// 배너 
var banner_1_mouseEvent = 1;
var banner_2_mouseEvent = 1;
var banner_3_mouseEvent = 1;
var banner_4_mouseEvent = 1;
var banner_5_mouseEvent = 1;

// 가로형 배너 
// banner_roll_1("div태그 id", 전체넓이, 딜레이, 이동속도, , );
function banner_roll_1(id, width, delay, speed, cell_width, step){
	if(eval(id + "_mouseEvent")){
		var obj = document.getElementById(id); 		
		obj.style.pixelLeft = (obj.style.pixelLeft + step) % width; // 처음으로 돌아가기 
		//if (obj.style.pixelLeft % cell_width==1) { // 계속 지나감. (왼쪽으로 갈때만 적용, 왼쪽은 항상 -값이므로 1이 나올 수 없음) 
		if (obj.style.pixelLeft % cell_width==0) { // 한번 멈춘 후 지나감. (왼쪽,오른쪽 방향 모두 적용됨) 
			//document.getElementById(id + "_d").innerHTML = obj.style.pixelLeft;
			setTimeout("banner_roll_1('" + id + "', " + width + ", " + delay + ", " + speed + ", " + cell_width + ", " + step + ");", delay);
		} else { 
			setTimeout("banner_roll_1('" + id + "', " + width + ", " + delay + ", " + speed + ", " + cell_width + ", " + step + ");", speed);
		} 
	} else{
		setTimeout("banner_roll_1('" + id + "', " + width + ", " + delay + ", " + speed + ", " + cell_width + ", " + step + ");", speed);
	}
	return true;
}

// 배너2 
var banner2_1_mouseEvent = 1;
var banner2_2_mouseEvent = 1;
var banner2_3_mouseEvent = 1;
var banner2_4_mouseEvent = 1;
var banner2_5_mouseEvent = 1;
var banner2_1_step = 1;
var banner2_2_step = 1;
var banner2_3_step = 1;
var banner2_4_step = 1;
var banner2_5_step = 1;
var banner2_1_type = 'stop';
var banner2_2_type = 'stop';
var banner2_3_type = 'stop';
var banner2_4_type = 'stop';
var banner2_5_type = 'stop';

// 가로형 배너 
// banner_roll_2("div태그 id", 전체넓이, 딜레이, 이동속도, 넓이, 방향(step) );
function banner_roll_2(id, width, delay, speed, cell_width){
	var step = eval(id + "_step"); 
	var type = eval(id + "_type"); 

	if (eval(id + "_mouseEvent")) {
		var obj = document.getElementById(id); 		
		obj.style.pixelLeft = (obj.style.pixelLeft + step) % width; // 처음으로 돌아가기 
		if (obj.style.pixelLeft % cell_width==0) { // 한번 멈춘 후 지나감. (왼쪽,오른쪽 방향 모두 적용됨) 
			if (type=='stop') { 
				setTimeout("banner_roll_2('" + id + "', " + width + ", " + delay + ", " + speed + ", " + cell_width + ");", delay);
			} else { 
				setTimeout("banner_roll_2('" + id + "', " + width + ", " + delay + ", " + speed + ", " + cell_width + ");", speed);
			} 
		} else { 
			setTimeout("banner_roll_2('" + id + "', " + width + ", " + delay + ", " + speed + ", " + cell_width + ");", speed);
		} 
	} else{
		setTimeout("banner_roll_2('" + id + "', " + width + ", " + delay + ", " + speed + ", " + cell_width + ");", speed);
	}
	return true;
}

// 배너 1 
function bnr_01(div) {
  bnr_01_current++; 
  if (bnr_01_current==bnr_01_max) {
    bnr_01_current = 0; 
  }
	document.getElementById(div).innerHTML = bnr_01_str[bnr_01_current];
  setTimeout("bnr_01('"+div+"')", bnr_01_delay*700+2000)
}

// 구글 맵 API 
function load_google_map(address, subject) {
	if (GBrowserIsCompatible()) {

		// 기본 
		var map = new GMap2(document.getElementById("div_google_map")); 
		map.addControl(new GSmallMapControl()); // +,- 버튼 추가 
		map.addControl(new GMapTypeControl());  // +,- 버튼 추가  
		//map.setCenter(new GLatLng(lat, lng), 4); // 지도 위치 처음 고정, 뒤의 숫자는 지도의 배율 
		// 맵, 위성, 합성의 3가지 모드. 따로 지정하지 않을 경우 맵모드로 실행.
		//map.setMapType(G_SATELLITE_TYPE); // 위성모드 
		//map.setMapType(G_HYBRID_TYPE);    // 합성모드
		var geocoder = new GClientGeocoder();

		// 함수 
		function createMarker(point, subject, icon) { 
			var marker = new GMarker(point, icon); 
			GEvent.addListener(marker, "click", function() 
			{ 
				marker.openInfoWindowHtml(subject); 
			}); 
			return marker; 
		} 

		function get_point(address, subject, icon) {  
			geocoder.getLatLng(address,    
				function(point) {      
					if (!point) {        
						alert(address + " not found");      
					} else {        
						map.setCenter(point, 14);    
						map.addOverlay(createMarker(point, subject, icon)); // 마크 하기 4, 설명 첨가, 아이콘  
					}    
				}
			);
		}

		// 사용자 아이콘 사용할 때 
		var icon = new GIcon(); 
		icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png"; 
		icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png"; 
		icon.iconSize = new GSize(12, 20); 
		icon.shadowSize = new GSize(22, 20); 
		icon.iconAnchor = new GPoint(6, 20); 
		icon.infoWindowAnchor = new GPoint(5, 1); 

		//var point = new GLatLng(lat, lng); // 마크 위치 
		// map.addOverlay(new GMarker(point)); // 마크 하기 1. 
		//map.addOverlay(new GMarker(point, icon)); // 마크하기 2, 사용자 아이콘 
		//map.addOverlay(createMarker(point, subject)); // 마크 하기 3, 설명 첨가 
		//map.addOverlay(createMarker(point, subject, icon)); // 마크 하기 4, 설명 첨가, 아이콘 

		get_point(address, subject, icon); 
	}
}


function doBlink() { 
	var blink = document.all.tags("BLINK") 
	for (var i=0; i < blink.length; i++) 
		blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "" 
} 
function startBlink() { // Make sure it is IE4 
	if (document.all) 
		setInterval("doBlink()",1000) 
} 
//window.onload = startBlink; 
//startBlink(); // 아래 코드를 해당 텍스트 밑에 넣을 것. 


