
/* Browser Info*/
var ua			= navigator.userAgent.toLowerCase();
var isMSIE	= (ua.indexOf("msie") > -1) ? true : false;
var isGecko	= (ua.indexOf("gecko") > -1) ? true : false;
var isOpera	= (ua.indexOf("opera") > -1) ? true : false;
var isMSIE7 = (ua.indexOf("msie 7") > -1) ? true : false;
var isNetscape = (ua.indexOf("netscape") > -1) ? true : false;



/* Script File Load */
var ScriptLoader				= new Object() ;
ScriptLoader.IsLoading	= false ;
ScriptLoader.Queue			= new Array() ;
ScriptLoader.AddScript	= function( scriptPath ){ ScriptLoader.Queue[ ScriptLoader.Queue.length ] = scriptPath ; 	if ( !this.IsLoading ) this.CheckQueue() ;}

function ScriptLoader_OnLoad(){ 	if ( this.tagName == 'LINK' || !this.readyState || this.readyState == 'loaded' ) ScriptLoader.CheckQueue() ;}
ScriptLoader.CheckQueue = function() {
	if ( this.Queue.length > 0 ){ this.IsLoading = true ; var sScriptPath = this.Queue[0] ; var oTempArray = new Array() ;
		for ( i = 1 ; i < this.Queue.length ; i++ ) oTempArray[ i - 1 ] = this.Queue[ i ] ;
		this.Queue = oTempArray ; this.LoadFile( sScriptPath ) ;
	}else{
		this.IsLoading = false ;	if ( this.OnEmpty ) this.OnEmpty() ;
	}
}

ScriptLoader.LoadFile = function( filePath ) {
	var e ;
	if ( filePath.lastIndexOf( '.js' ) > 0 ){ 
		e = document.createElement( "script" ) ; 
		e.type	= "text/javascript" ;
	}else{ 
		e = document.createElement( 'LINK' ) ; 	
		e.rel	= 'stylesheet' ;	
		e.type	= 'text/css' ;	 
		e.href = filePath;
	}
	document.getElementsByTagName("head")[0].appendChild( e ) ; 
	if ( e.tagName == 'LINK' ){	
		if (isIE ) e.onload = ScriptLoader_OnLoad ; 
		else ScriptLoader.CheckQueue() ; 
		e.href = filePath ;
	}else{ 
		e.onload = e.onreadystatechange = ScriptLoader_OnLoad ; 
		e.src = filePath ;
	}
}

/* Check Empty Value */
function _empty(input) { return (input.value == null || input.value.replace(/ /gi,"") == ""); }

/* Remove Space In String */
function trim(inputString) {
  if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
} 

/* Byte Length*/
function _length(input) { 
	var byte_length = 0; 
	for (var i = 0; i < input.value.length; i++) { 
		var one_char = escape(input.value.charAt(i)); 
		if (one_char.length == 1) byte_length ++; 
		else if (one_char.indexOf("%u") != -1) byte_length += 2; 
		else if (one_char.indexOf("%") != -1) byte_length += one_char.length / 3; 
	}
	return byte_length; 
}

/* insertAfter(<>insertBefore)*/
function insertAfter(newElement, targetElement){
	var parent = targetElement.parentNode;
	if(parent.lastChild == targetElement){
		parent.appendChild(newElement);
	}else{
		parent.insertBefore(newElement, targetElement.nextSibling);
	}
}


/* window.onload ½Ã ½ÇÇàµÉ ÇÔ¼öÃß°¡ ½ÃÅ°´Â ÇÔ¼ö */
function addLoadEvent(func)
{
	var oldonload = window.onload;
	if(typeof window.onload != "function"){
		window.onload = func;
	}else{
		window.onload = function(){
			oldonload();
			func();
		}
	}
}

/* Á¤ÇØÁø ¼ýÀÚ¸¸Å­ ÀÚ¸£±â */
String.prototype.cut = function(len)
{
	var str = this;
	var I = 0;
	for (var i = 0; i < str.length; i++)
	{
		I += (str.charCodeAt(i) > 128) ? 2 : 1;	 // ÇÑ±ÛÃ¼Å©
		if(I > len)	return str.substring(0, i) + "..";
	}
	return str;
}




/* Æû ÀÔ·Â°ª Check*/
function frmchk_char(str, condition)
/*
¼³¸í		: Æû ÀÔ·Â°ªÀ» Á¤±Ô½ÄÆÐÅÏÀ» ÀÌ¿ëÇØ¼­ Ã¼Å©ÇÔ
»ç¿ë¹ý	: frmchk_char(¹®ÀÚ¿­, Á¶°Ç)
°á°ú°ª	: true/false
Á¶°Ç		: 
	0 = Ã¹±ÛÀÚ ¿µ¹®, ¿µ¹®, ¼ýÀÚ, _ »ç¿ë°¡´É
	1 = ¿µ¹®¸¸ »ç¿ë°¡´É
	2 = ¼ýÀÚ¸¸ »ç¿ë°¡´É
	3 = ÇÑ±Û¸¸ »ç¿ë°¡´É
	4 = ¿µ¹®, ¼ýÀÚ »ç¿ë°¡´É
	5 = ¿µ¹®, ¼ýÀÚ, ÇÑ±Û »ç¿ë°¡´É
	6 = ÇÑ±Û, ¼ýÀÚ »ç¿ë°¡´É
	7 = ÇÑ±Û, ¿µ¹® »ç¿ë°¡´É
	8 = ÇÑ±ÛÀ» Æ÷ÇÔÇÏ´ÂÁö ¿©ºÎ
*/
{
	var objPattern
	switch(condition){
		case(0) :
			objPattern = /^[a-zA-Z]{1}[a-zA-Z0-9_]+$/;
			break;
		case(1) :
			objPattern = /^[a-zA-Z]+$/;
			break;
		case(2) :
			objPattern = /^[0-9]+$/;
			break;
		case(3) :
			objPattern = /^[°¡-ÆR]+$/;
			break;
		case(4) :
			objPattern = /^[a-zA-Z0-9]+$/;
			break;
		case(5) :
			objPattern = /^[°¡-ÆRa-zA-Z0-9]+$/;
			break;
		case(6) :
			objPattern = /^[°¡-ÆR0-9]+$/;
			break;
		case(7) :
			objPattern = /^[°¡-ÆRa-zA-Z]+$/;
			break;
		case(8) :
			objPattern = /[°¡-ÆR]/;
			break;
		case(9) :
			objPattern = /[a-zA-Z0-9]/;
			break;
	}
	return objPattern.test(str);
}

/* Image File PreLoading */
function preLoading(_array){
	if(!_array || _array < 0) return false;
	var _img = new Array;
	for (var i = 0; i < _array.length; i++)
	{
		_img[i] = new Image();
		_img[i].src = _array[i];
	}
}


// Insert Flash File
var flash = function(objId, _width, _height, _src)
{
	if(!document.getElementById || !document.createElement)		return false;
	if(!document.getElementById(objId)) return false;
	var _obj = document.getElementById(objId);
	

	if (!isOpera)
	{
		var _flash = document.createElement("embed");
		_flash.setAttribute("src", _src);
		_flash.setAttribute("quality", "high");
		_flash.setAttribute("pluginspage", "http://www.macromedia.com/go/getflashplayer");
		_flash.setAttribute("type", "application/x-shockwave-flash");
		_flash.setAttribute("wmode", "transparent");
		_flash.setAttribute("width", _width);
		_flash.setAttribute("height", _height);
		_flash.setAttribute("menu", "false");		
	}else{
		var _flash = document.createElement("object");
		_flash.setAttribute("classid", "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000");
		_flash.setAttribute("codebase", "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0");
		_flash.setAttribute("width", _width);
		_flash.setAttribute("height", _height);

		
		var _par01 = document.createElement("param");
		_par01.setAttribute("name", "movie");
		_par01.setAttribute("value", _src);

		var _par02 = document.createElement("param");
		_par02.setAttribute("name", "Wmode");
		_par02.setAttribute("value", "transparent");
		

		var _par03 = document.createElement("param");
		_par03.setAttribute("name", "quality");
		_par03.setAttribute("value", "high");

		_flash.appendChild(_par01);
		_flash.appendChild(_par02);
		_flash.appendChild(_par03);
	}
_obj.appendChild(_flash);
}

function insert_rightBanner(){		// ¿ìÃø ÇÃ·¡½Ã ¹è³Ê »ðÀÔ
		flash("banner_rightTop", "212", "155", "http://image.barobook.com/ijakga/images/swf/sub_banner.swf");
	}
function insert_rightBanner(){		// ¿ìÃø ÇÃ·¡½Ã ¹è³Ê »ðÀÔ
		flash("t_section_flash", "290", "30", "http://images.barobook.com/ijakga/images/swf/section.swf");
	}
addLoadEvent(insert_rightBanner);



// Áñ°ÜÃ£±â ±â´É Ãß°¡
function addFavorite(){
	if(!document.getElementById) return false;
	if(!document.getElementById("favor")) return false;
	var favorId = document.getElementById("favor");	
	var _favorUrl = "http://www.ijakga.com/";
	var _favorTitle = "¾ÆÀÌÀÛ°¡ - ´ëÇÑ¹Î±¹ ¹®ÇÐ Æ÷Å»"
	favorId.onclick = function(){
		if(window.sidebar){
			window.sidebar.addPanel(_favorTitle, _favorUrl, "");
		}else if(window.external){			
			try{
				window.external.AddFavorite(_favorUrl, _favorTitle); 
			}catch(e){
				return true;
			}
		}else{
			this.href = _favorUrl;
			this.title = _favorTitle;
			this.rel = "sidebar";
			return true;
		}
	};	
}

addLoadEvent(addFavorite);


/* Å×ÀÌºí¸®½ºÆ® ¸¶¿ì½º ¿À¹ö½Ã ¹è°æ»ö */
function listOver()
{
	if(!document.getElementById) return false;
	if(!document.getElementsByTagName) return false;
	if(!document.getElementsByTagName("table")) return false;

	var listTable = document.getElementsByTagName("table");
	for (var i = 0; i < listTable.length; i++ )
	{
		if(listTable[i].className == "boardList"){
			var _tbody = listTable[i].getElementsByTagName("tbody");
			var _rows = _tbody[0].getElementsByTagName("tr");		
			for (var j = 0; j < _rows.length; j++ )
			{
				_rows[j].onmouseover	= function() { this.style.backgroundColor = "#faf8ef"; };
				_rows[j].onmouseout	= function() { this.style.backgroundColor = ""; };
			}
		}else if(listTable[i].className == "m_boardLIst"){
			var _tbody = listTable[i].getElementsByTagName("tbody");
			var _rows = _tbody[0].getElementsByTagName("tr");		
			for (var j = 0; j < _rows.length; j++ )
			{
				_rows[j].onmouseover	= function() { this.style.backgroundColor = "#fbfbfb"; };
				_rows[j].onmouseout	= function() { this.style.backgroundColor = ""; };
			}
		}
	}
}
addLoadEvent(listOver);



	function nowPageImg(){
		preLoading(Array(
				"http://image.barobook.com/ijakga/images/tab01_all.gif",
				"http://image.barobook.com/ijakga/images/tab01_pro.gif",
				"http://image.barobook.com/ijakga/images/tab01_new.gif",
				"http://image.barobook.com/ijakga/images/tab01_free.gif",
				"http://image.barobook.com/ijakga/images/tab01on_all.gif",
				"http://image.barobook.com/ijakga/images/tab01on_pro.gif",
				"http://image.barobook.com/ijakga/images/tab01on_new.gif",
				"http://image.barobook.com/ijakga/images/tab01on_free.gif"
			)
		);
	}

	addLoadEvent(nowPageImg);


	/* ÇöÀç ÆäÀÌÁöÀÇ ¸Þ´º Å¬¸¯½Ã return false */
	function _return_location(objID)
	{
		if(!document.getElementById)				return false;
		if(!document.getElementById(objID))  return false;
		var _obj = document.getElementById(objID);
		var _aLink = _obj.getElementsByTagName("a");
		var currentUrl = window.location.href;
		
		for (i = 0;i < _aLink.length ;i++ )
		{
			var _href = _aLink[i].getAttribute("href");
			if(_href == currentUrl){
				_aLink[i].onclick = function(){ this.blur(); return false; };
			}
		}
	}
	
	/* °Ë»ö ÆäÀÌÁö ¸Þ´º ÇöÀçÆäÀÌÁö Å¬¸¯½Ã return false */
	function _return_location_search()
	{
		_return_location("search_menuTab");
		_return_location("bbsMenu");
	}
	addLoadEvent(_return_location_search)



	/* ·Î±×ÀÎ Form ÄÁÆ®·Ñ ¹× ¹«°á¼º °Ë»ç */
	function login_control(){
		if(!document.getElementById("login_form"))	return false;

		var login_frm = document.getElementById("login_form");

		login_frm.onsubmit = function()
		{			
			if (this.login_id.value == "" || this.login_id.value == null){
				alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä!");
				this.login_id.focus();
				return false;
			}else if(this.login_pwd.value == "" || this.login_pwd.value == null){
				alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä!");
				this.login_pwd.focus();
				return false;
			}else{
				return true;
			}
		};
		
		var _id = document.getElementById("login_id");
		var _pwd = document.getElementById("login_pwd");

		if(_id.className != "loginbox" && _id.className != "loginbox01"){
		if (_id.value == "") {		// Firefox Bug
			_id.style.cssText = "background: #faf8ef url(http://image.barobook.com/ijakga/images/n_id.gif) 4px 4px no-repeat;";
		}else{
			_id.style.cssText="background: none;";
		}
		if (this.value == "") this.style.cssText = "background: #faf8ef url(http://image.barobook.com/ijakga/images/n_pw.gif) 4px 4px no-repeat;"; 
		_id.onfocus = function() {  this.style.cssText="background: none;";};
		_pwd.onfocus = function() { this.style.cssText="background: none;";};

		_id.onblur = function() { if (this.value == "") this.style.cssText = "background: #faf8ef url(http://image.barobook.com/ijakga/images/n_id.gif) 4px 4px no-repeat;"; };
		_pwd.onblur = function() { if (this.value == "") this.style.cssText = "background: #faf8ef url(http://image.barobook.com/ijakga/images/n_pw.gif) 4px 4px no-repeat;"; };		
		}else{
			login_frm.login_id.focus();
		}
	}

	addLoadEvent(login_control);


/* ´ñ±Û ÆäÀÌÁö °ü·Ã */

function reply_display(){
	if(!document.getElementsByTagName || !document.getElementById)	return false;
	if(!document.getElementById("replybox"))	return false;
	var ReplyBox = document.getElementById("replybox");
	if(!ReplyBox.getElementsByTagName("img")) return false;

	var objImg = ReplyBox.getElementsByTagName("img");	
	
	for(i = 0; i < objImg.length; i++){
		if(objImg[i].className == "reply_btn"){
			
			objImg[i].onclick = function() {
				var replyBtnNo = this.id.split("replyBtn");
				var reply_box = document.getElementById("reply_box" + replyBtnNo[1]);
				if(reply_box.style.display == "none" || reply_box.style.display == ""){
					reply_box.style.display = "block";
				}else{
					reply_box.style.display = "none";
				}
			};			
		}
	}	
}
function comment_display(){
	if(!document.getElementsByTagName || !document.getElementById("comment_hidden")) return false;

	var reply_hidden = document.getElementById("comment_hidden");
	reply_hidden.onclick = function() {
		if (!document.getElementById) return true;
		var comment_list = document.getElementById("comment_list");
		var hiddenBtn	= this.getElementsByTagName("span")[0];
		var hiddenText = this.lastChild.nodeValue;

		if(comment_list.style.display == "none" ){
			comment_list.style.display = "block";
			hiddenBtn.firstChild.nodeValue = "-";
			this.lastChild.nodeValue = " ´ñ±Û ¼û±â±â";
		}else{
			comment_list.style.display = "none";
			hiddenBtn.firstChild.nodeValue = "+";
			this.lastChild.nodeValue = " ´ñ±Û º¸ÀÌ±â";
		}
		this.blur();
		return false;
	};
}
function review_display(){
	if(!document.getElementsByTagName || !document.getElementById("review_hidden")) return false;

	var reply_hidden = document.getElementById("review_hidden");
	reply_hidden.onclick = function() {
		if (!document.getElementById) return true;
		var review_list = document.getElementById("review_list");
		var hiddenBtn	= this.getElementsByTagName("span")[0];
		var hiddenText = this.lastChild.nodeValue;

		if(review_list.style.display == "none" ){
			review_list.style.display = "block";
			hiddenBtn.firstChild.nodeValue = "-";
			this.lastChild.nodeValue = " ¸®ºä ¼û±â±â";
		}else{
			review_list.style.display = "none";
			hiddenBtn.firstChild.nodeValue = "+";
			this.lastChild.nodeValue = " ¸®ºä º¸ÀÌ±â";
		}
		this.blur();
		return false;
	};
}



function reply_frmChk()
{
	if(!document.getElementsByTagName("form")) return false;
	var f = document.getElementsByTagName("form");

	for (var i = 0; i < f.length; i++ )
	{
		if (f[i].className == "reply_form")
		{
			var comment = f[i].comment_content;
			comment.style.width = comment.clientWidth;
			if (f[i].parentNode.className == "reply_write")
			{
				f[i].parentNode.style.display = "none";
			}
			//alert(comment.clientWidth);
			comment.onkeyup = function(){			
				var textLength = _length(this);		// ¹ÙÀÌÆ®±æÀÌ				
				var lengthNode = this.parentNode.getElementsByTagName("em")[0]; //±æÀÌ¸¦ ¹Ù²ãÁÙ ³ëµå
				var parentId = this.parentNode.getAttribute("id");
				lengthNode.firstChild.nodeValue = textLength.toString(); //ÇöÀç ¹ÙÀÌÆ® ±æÀÌ¸¦ ¹Ù²ãÁÜ

				if (textLength > 1000)
				{
					if(!document.getElementById("warning" + parentId)){
						var warning = document.createElement("div");
						warning.setAttribute("id", "warning" + parentId);
						warning.className = "warning";
						warning.appendChild(document.createTextNode("´ñ±ÛÀÌ 1000Byte (ÇÑ±Û 500ÀÚ/¿µ¹® 1000ÀÚ)¸¦ ÃÊ°úÇÏ¿´½À´Ï´Ù."));
						this.parentNode.appendChild(warning);
					}
				}else{
					if(document.getElementById("warning" + parentId)){
						var warning = document.getElementById("warning" + parentId)
						warning.parentNode.removeChild(warning);
					}
				}
				
				var currentWidth = this.style.width;

				this.style.wordWrap = "break-word";
				this.style.wordBreak = "break-all";					
				
				if(this.scrollHeight < 50){
					this.style.height = "50px";
					this.style.width = currentWidth;
				}else{
					this.style.height = (this.scrollHeight + 2) + "px";
					this.style.width = currentWidth;
				}
			};
			f[i].onsubmit = function(){
				if (_length(this.comment_content) == 0)
				{
					alert("³»¿ëÀ» ÀÔ·ÂÇÏ¼¼¿ä!");
					this.comment_content.focus();
					return false;
				}
				if (_length(this.comment_content) > 1000)
				{
					alert("´ñ±ÛÀº 1000Byte(ÇÑ±Û 500ÀÚ/¿µ¹®1000ÀÚ)±îÁö¸¸ ÀÔ·ÂÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.");
					this.comment_content.focus();
					return false;
				}
				this.comment_content.value = HTMLEncode(this.comment_content.value);		// ¹®ÀÚ¿­À» HTMLEncodeÇÑ´Ù. ÇÔ¼ö ÂüÁ¶								
				return true;
			};
		}
	}
}

addLoadEvent(reply_frmChk);
addLoadEvent(reply_display);
addLoadEvent(comment_display);
addLoadEvent(review_display);

/* °Ô½ÃÆÇ °Ë»ö */
function chk_searchFrm(){
	if(!document.getElementById("listSearch_frm"))		return false;

	var searchFrm = document.getElementById("listSearch_frm");
	searchFrm.onsubmit = function(){
		if(_length(this.search_word) == 0){
			alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä!");
			this.search_word.focus();
			return false;
		}
		return true;
	};
}
addLoadEvent(chk_searchFrm);


/* content Area ÀÌ¹ÌÁö Å©±â Á¶Àý */
function controlImage(){
	if(!document.getElementById("view_content"))	return false;
	var _content = document.getElementById("view_content");

	if(!_content.getElementsByTagName("img"))		return false;
	var contentImg = _content.getElementsByTagName("img");
	var _width = _content.clientWidth -28;			//ÇöÀç content AreaÀÇ ³Êºñ¿¡¼­ ÆÐÆÃÀ» »« ³Êºñ
	
	for (var i = 0; i < contentImg.length ;i++ )
	{
		var imgWidth = contentImg[i].width;		//ÀÌ¹ÌÁöÀÇ ³Êºñ		
		if (imgWidth > _width)
		{
			contentImg[i].width =  _width;
		}			
	}		
}
addLoadEvent(controlImage);


function ijakga_menu()
{	
	if(!document.getElementById("h_tab"))	return false;
	var menutab = document.getElementById("h_tab");
	var aNode = menutab.getElementsByTagName("a");

	for (var i = 0; i < aNode.length ; i++ )
	{		
		aNode[i].onclick = function(){
			if(this.getAttribute("href") == (window.location.href + "#")){
				alert("ÇöÀç ÁØºñÁßÀÔ´Ï´Ù.");
				this.blur();
				return false;
			}
			return true;
		}
		
	}
}
addLoadEvent(ijakga_menu);


/* °Ë»ö°ü·Ã*/
function search_frm()
{
	if(!document.getElementById("search_frm"))	 return false;
	var f = document.getElementById("search_frm");
	f.onsubmit = function(){	
		if(_length(this.word) == 0){
			alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä!");
			this.word.focus();
			return false;
		}
		if (f.category.value != "all")
		{
			f.action="/search/search.asp";
		}
		
		return true;
	}
}
addLoadEvent(search_frm);


/* ¸ÞÀÎ ¿¬Àç ¸®½ºÆ®*/
function main_series_list()
{
	if(!document.getElementById("weekGlog")) return false;

	var m_serial = document.getElementById("m_serial");
	var _link = document.getElementsByTagName("a");

	for (var i = 0; i < _link.length; i++)
	{
		if(_link[i].className == "tab_03"){
			_link[i].onclick = function(){
				var tabId = this.parentNode.getAttribute("id");
				var targetId = tabId.replace("tab_", "");				
				
				for (var j = 0; j < 5; j++)
				{
					var hiddenId = "series_recent_" + j;
					if (hiddenId == targetId)
					{
						document.getElementById("series_recent_tab_" +j).className = "current"
						document.getElementById(hiddenId).style.display = "block";
					}else{
						document.getElementById("series_recent_tab_" +j).className = ""
						document.getElementById(hiddenId).style.display = "none";
					}
				}
				this.blur();
				return false;
			};
		}
	}
}
addLoadEvent(main_series_list);

/* Ajax °´Ã¼ */
var ajaxRequest = function(array){
/*
¼³¸í : prototypeÀÇ ajax¸¦ ·ÎµåÇÒ¶§ »ç¿ë
»ç¿ë¹ý :
	var °´Ã¼º¯¼ö = new ajaxRequest([È£ÃâÇÒ url, ³ëµåID, ¼º°ø½Ã È£ÃâÇÒ ÇÔ¼ö, ½ÇÆÐ½Ã È£ÃâÇÒ ÇÔ¼ö, method(¾øÀ»°æ¿ì 'get') ]);
	°´Ã¼º¯¼ö.Start(ÆÄ¶ó¹ÌÅÍ);
result :
	¼º°ø½Ã : successÇÔ¼ö( XML°´Ã¼, ´ë»ó³ëµå°´Ã¼ ) ½ÇÇà
	¿¡·¯½Ã : FailureÇÔ¼ö(´ë»ó³ëµå°´Ã¼) ½ÇÇà
*/
		this.Url					= (array[0]) ? array[0] : null;	// url
		this.objId				= (array[1]) ? array[1] : null;	// Å¸°Ù¾ÆÀÌµð
		this.successFunc	= (array[2]) ? array[2] : null;	// ¼º°ø½Ã ½ÇÇàµÉ ÇÔ¼ö

		if(!this.Url || !this.objId || !this.successFunc)	return false;		// ¼¼°¡Áö °ªÀº ÇÊ¼ö ¾øÀ¸¸é ¸®ÅÏ
		this.errorFunc					= (array[3]) ? array[3] : errorReport;		// ¿¡·¯½Ã ½ÇÇàµÉ ÇÔ¼ö
		this.Method						= (array[4]) ? array[4] : "get";					// method(default¸¦ get·Î ¼³Á¤)
		this.loading						= document.createElement("div");		
		this.loading.className		= "loading";		//   .loading { background: url(http://image.barobook.com/ijakga/images/loading.gif) no-repeat 50% 50%; width: 100%; height: 100%;}
		this.obj								= document.getElementById(this.objId);
		//this.loading.appendChild(document.createTextNode("Å×½ºÆ®"));
}
ajaxRequest.prototype.Start = function(pars){
		// ¾÷µ¥ÀÌÆ® µÉ ¿µ¿ª¿¡ ÀÚ½Ä³ëµå°¡ ÀÖÀ»°æ¿ì »èÁ¦ÈÄ ·ÎµùÀÌ¹ÌÁö µð½ºÇÃ·¹ÀÌ
		var objChild = (this.obj.childNodes) ? this.obj.childNodes : null;
		if (objChild || objChild.length > 0)
		{
			for (var i = 0; i < objChild.length; i++)
			{
				this.obj.removeChild(objChild[i]);
			}
		}		
		this.obj.appendChild(this.loading);
		this.pars = pars;
		this.newAjax();
}
ajaxRequest.prototype.newAjax = function(){	
	//alert(this.Url);
	var sel = this
	new Ajax.Request (
			sel.Url,
			{				
				method				: sel.Method,
				parameters		: sel.pars,
				onSuccess			: function(request){											
											var xmlData = request;
											sel.successFunc(xmlData, sel.obj)
										},
				onFailure			: function(){sel.errorFunc();},
				asynchronous	: true
			});
}

function errorReport(){
//	alert('kk');
}






/* ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å© */
function chk_ssn(jNum1, jNum2){
	var sum = 0;
	for (var i = 0; i < jNum1.length; i++){
		// °¢ÀÚ¸®ÀÇ ¼ýÀÚ¸¦ °öÇØ¼­ ´õÇÔ
		sum += (i + 2) * jNum1.charAt(i);
	}

	for (i = 0; i < 2; i++)	{
		// 7 ~ 8ÀÚ¸®±îÁö Ã³¸®
		sum += (i+8) * jNum2.charAt(i);
	}

	for (i = 2; i < 6; i++){
		// 9 ~ 13ÀÚ¸®±îÁö Ã³¸®
		sum += (i) * jNum2.charAt(i);
	}

	var chkSum = sum % 11;
	var chkCode;
	if (chkSum == 0){
		chkCode = 10;
	}else if(chkSum == 1){
		chkCode = 11;
	}else{
		chkCode = chkSum;
	}
	var chk1 = 11 - chkCode; //³ª¸ÓÁö¿¡¼­ 11À» »«´Ù.
	var chk2 = parseInt(jNum2.charAt(6))
	
	if( chk1 != chk2){
		return false;
	}else{
		return true;
	}
}


function chkAdult_frm(){
	if(!document.getElementById("chkAdult_frm"))	return false;
	var f = document.getElementById("chkAdult_frm");
	f.jNum1.onkeyup = function(){		
		if(this.value.length == 6){
			f.jNum2.focus();
		}
	}

	f.onsubmit = function(){
		var j1 = this.jNum1;
		var j2 = this.jNum2;
		if (_length(this.name) == 0)
		{
			alert("ÀÌ¸§À» ÀÔ·ÂÇÏ¼¼¿ä");
			this.name.focus();
			return false;
		}
		if (j1.value.length != 6 || j2.value.length != 7)
		{
			alert("ÁÖ¹Îµî·Ï¹øÈ£ 13ÀÚ¸®¸¦ ÀÔ·ÂÇÏ¼¼¿ä");
			j1.focus();
			return false;
		}

		if (!frmchk_char(j1.value, 2) || !frmchk_char(j2.value, 2))
		{
			alert("ÁÖ¹Îµî·Ï¹øÈ£´Â ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
			j1.value = "";
			j2.value = "";
			j1.focus();
			return false;
		}

		if (!chk_ssn(j1.value, j2.value))
		{
			alert("À¯È¿ÇÏÁö ¾ÊÀº ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù.\n¿Ã¹Ù¸¥ ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
			j1.value = "";
			j2.value = "";
			j1.focus();
			return false;
		}
	}
	
}
addLoadEvent(chkAdult_frm);


function board_write_chk_login(){
	if(!document.getElementById("btn_board_write"))	return false;
	var btn = document.getElementById("btn_board_write");
	btn.onclick = function(){
		if (confirm("·Î±×ÀÎ ÈÄ ÀÛ¼ºÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.\n·Î±×ÀÎ ÇÏ½Ã°Ú½À´Ï±î?"))
		{
			return true;
		}else{
			return false;
		}
	};
}
addLoadEvent(board_write_chk_login);

function bbs_writeFrm_chk(){
	if(!document.getElementById("bbs_writeFrm"))	return false;
	var f = document.getElementById("bbs_writeFrm");

	f.onsubmit = function(){
		if(this.event_id)
		{						
			if(_length(this.event_id) == 0)
			{
				alert("Âü¿©ÇÏ½Ç ÀÌº¥Æ®¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
				this.event_id.focus();
				return false;
			}
		}
		if (_length(this.title) == 0)
		{
			alert("Á¦¸ñÀ» ÀÔ·ÂÇÏ¼¼¿ä");
			this.title.focus();
			return false;
		}

		if (_length(this.content) == 0)
		{
			alert("³»¿ëÀ» ÀÔ·ÂÇÏ¼¼¿ä");
			this.content.focus();
			return false;
		}

		return true;
	};
}
addLoadEvent(bbs_writeFrm_chk);

function preloadImages(arr){
	var docImgs = new Array();
	for (var i = 0; i < arr.length; i++)
	{	
		docImgs[i] = new Image();
		docImgs[i].setAttribute("src", arr[i]);
		//alert(docImgs[i].src)
	}
}

/* ÇÊ¸í·Î±×ÀÎ µµ¿ò¸»*/
function pennameHelp(){
	if (!document.getElementById("btnPenname_help"))	return false;	
	var pennameBtn = document.getElementById("btnPenname_help");
	var pennameContent = document.createElement("div");
	pennameContent.style.padding = "10px";
	pennameContent.style.lineHeight = "150%";

	pennameContent.innerHTML = ("<span class=\"txt_666_u\"><span class=\"txt_0C57A4_u\">ÇÊ¸í·Î±×ÀÎ</span>¶õ ¹«¾ùÀÎ°¡¿ä?</span><br /><br />ÇÊ¸í ·Î±×ÀÎÀº ·Î±×ÀÎ ÇÒ ¶§ ¿©·¯ºÐÀÇ ID ´ë½Å ÇÊ¸íÀ» ÀÌ¿ëÇÏ´Â °ÍÀ» ÀÇ¹ÌÇÕ´Ï´Ù. <br />·Î±×ÀÎ ½Ã ÇÊ¸í·Î±×ÀÎ Ã¼Å©¹Ú½º¿¡ Ã¼Å©¸¦ ÇÏ½Å µÚ °¡ÀÔÇÒ ¶§ ±âÀÔÇÑ ÇÊ¸í°ú ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ½Ã¸é ÇÊ¸í¸¸À¸·Îµµ ÆíÇÏ°Ô ·Î±×ÀÎÀ» ÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù. ");
	var pennameHelp = new IJ_helpPopup("pennameHelp_popup", "cover_pop", "ÇÊ¸í·Î±×ÀÎÀÌ¶õ?", pennameContent);
	pennameBtn.onclick=function(e){		
		pennameHelp.Show();
		var evn = (e) ? e : window.event;		
		pennameHelp.obj.style.left = (evn.clientX + document.documentElement.scrollLeft) + "px";
		pennameHelp.obj.style.top = (evn.clientY + document.documentElement.scrollTop) + "px";
		return false;
	}

}
addLoadEvent(pennameHelp);

var IJ_helpPopup = function(objId, ClassName, Tit, Content){
	this.objId = objId;
	this.ClassName = ClassName;
	this.Tit = Tit;
	this.Content = Content;
}
IJ_helpPopup.prototype.Create = function(){
	//alert("»ý¼º");
	popId = this;
	var obj = this.obj = document.createElement("div");
	obj.setAttribute("id", this.objId);
	obj.className = this.ClassName;

	/* Á¦¸ñ ºÎºÐ */
	var TitArea = this.TitArea = document.createElement("div");
	TitArea.setAttribute("id", this.objId + "_TitArea");

	var TitNode = document.createElement("h3");
	TitNode.className = "title_01";
	TitNode.appendChild(document.createTextNode(this.Tit));

	TitArea.appendChild(TitNode);
	obj.appendChild(TitArea);

	/*Content */
	obj.appendChild(this.Content);
	/* È®ÀÎ¹öÆ° */
	var btnArea = this.btnArea = document.createElement("div");	
	btnArea.className = "cover_btn";
	
	var confirmBtn = new Image();
	confirmBtn.src = "http://images.barobook.com/ijakga/images/g_btn_admin_confirm.gif";
	confirmBtn.alt = "È®ÀÎ";
	confirmBtn.style.cursor = "pointer";
	confirmBtn.onclick = function(){
		obj.style.display = "none";
	}
	btnArea.appendChild(confirmBtn);

	obj.appendChild(btnArea);

	var doc = this.doc = (document.body) ? document.body : document.documentElement;
	doc.appendChild(obj);

	
};
IJ_helpPopup.prototype.Hide = function(){
	this.obj.style.display = "none";
};
IJ_helpPopup.prototype.Show = function(){
	if (!this.obj){
		this.Create();
	}	
	this.obj.style.display = "block";	
}


function info_open(pageName) {
	win_style = "toolbar=yes,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no, width=900, height=800";
	window.open('http://www.barobook.com/'+pageName,'barobook_information', win_style);
}

/* ÀüÃ¼ Ã¢ ·Îµù(»ç¿ëÀÚ°¡ ´Ù¸¥ °´Ã¼ Á¦¾îºÒ°¡) */
var loadingProgressFull = function(objId){
	this.objId = objId;
}
loadingProgressFull.prototype.Create = function(){
	var doc = (document.body) ? document.body : document.documentElement;
	var obj = this.obj = document.createElement("div");
	var objId = this.objId
	obj.setAttribute("id", objId);
	obj.style.position = "absolute";
	obj.style.zIndex = "100";
	obj.style.backgroundColor = "#999999";
	obj.style.backgroundImage = "url(http://images.barobook.com/ijakga/images/loading.gif)";
	obj.style.backgroundRepeat = "no-repeat";
	obj.style.backgroundPosition = "50% 50%";	
	obj.style.width = doc.clientWidth + "px";
	obj.style.height = doc.clientHeight + "px";
	obj.style.filter = "alpha(opacity=35)";
	obj.style.opacity = "0.35";
	obj.style.display = "none";
	obj.style.left = "0";
	obj.style.top = "0";
	doc.appendChild(obj);
}
loadingProgressFull.prototype.Loading = function(){
	if (!this.obj)	this.Create();
	var obj = this.obj;
	obj.style.display = "block";
}
loadingProgressFull.prototype.Completed = function(){
	if(!this.obj)	this.Create();
	var obj = this.obj;
	obj.style.display = "none";
}


/* ½ºÅ©·Ñ °´Ã¼ */
var IJ_Scroll = function( targetObjId)
{	
	this.objId = targetObjId;
	this.obj = document.getElementById(targetObjId);
	this.Speed = 1;
	this.Delay = 1000;
	this.stop = true;
	this.Width = "193px";
	this.Height = "30px";
	this.ScrollHeight = 1;
	this.items = new Array();
	this.count = 0;
	this.currentIndex = 0;
	this.objHeight = null;
}

IJ_Scroll.prototype.Create = function(cfg)
{
	if(cfg.Height)	this.Height = cfg.Height;
	if(cfg.ScrollHeight)	this.ScrollHeight = cfg.ScrollHeight;
	if(cfg.Width)	this.Width = cfg.Width;
	if(cfg.Delay)	 this.Delay = cfg.Delay;	
	if(cfg.objHeight)	this.objHeight = cfg.objHeight;
	if(cfg.Speed) this.Speed = cfg.Speed;
}

IJ_Scroll.prototype.Add = function(html)
{
	this.items[this.count++] = html;	
}

IJ_Scroll.prototype.Start = function()
{
	var scrollObj = this;
	this.stop = true;
	scrollObj.Show();
	window.setTimeout(
		function()
		{			
			scrollObj.Scroll();
			scrollObj.stop = false;
		}, this.Delay
	);
}
IJ_Scroll.prototype.Show = function()
{
	var scrollObj = this;
	var Parent = document.createElement("div");
	Parent.setAttribute("id", this.objId + "_scrollId");
	Parent.style.width = this.Width;
	Parent.style.height = (this.objHeight) ? this.objHeight : this.Height;
	Parent.style.position = "relative";
	Parent.style.overflow = "hidden";

	Parent.onmouseover = function(){scrollObj.stop=true;}
	Parent.onmouseout = function(){scrollObj.stop=false;}

	for (var i = 0, k = this.currentIndex; i < this.items.length; i++ )
	{
		var child = document.createElement("div");
		child.setAttribute("id", this.objId+"_scrollChild_" + i);		
		child.style.top = (parseInt(this.Height) * i) + "px";		
		child.style.left = "0";
		child.style.width = this.Width;
		child.style.position = "absolute";
		child.appendChild(this.items[k]);		
		k = (k + 1) % this.items.length;
		Parent.appendChild(child);
	}
	this.obj.appendChild(Parent);
}
IJ_Scroll.prototype.Scroll = function()
{
	var scrollObj = this;
	this.scrollSpeed = this.Speed;
	if(!this.stop)
	{
		for (var  i = 0; i < this.items.length; i++)
		{
			var e = document.getElementById(this.objId + "_scrollChild_" + i);
			e.style.top = (parseInt(e.style.top) - parseInt(this.ScrollHeight)) + "px";
			if (parseInt(e.style.top) <= parseInt(this.Height) * (-1))
			{
				e.style.top = (parseInt(this.Height) * (this.items.length - 1)) + "px";
			}
			if (parseInt(e.style.top) == 0)
			{
				this.currentIndex = ((++this.currentIndex) % this.items.length);
				this.scrollSpeed = this.Delay;
			}
		}
	}
	window.setTimeout(
		function(){scrollObj.Scroll();},
		this.scrollSpeed
	);
}

/* ¾ÆÀÌÀÛ°¡ Àü±¤ÆÇ*/
function scrollLIstStart()
{
	if(!document.getElementById("scrollList") || !document.getElementById("scrollList"))	return false;
	var scrollList = document.getElementById("scrollList");
	var Lists = scrollList.getElementsByTagName("li");
	prideScroll = new IJ_Scroll("t_section");
	prideScroll.Create({Height : "22px", ScrollHeight : "1", Width : "189px", Delay : "3000"})

	for (i = 0; i < Lists.length; i++)
	{
		var List = Lists[i].firstChild;
		var innerList = document.createElement("a");
		innerList.setAttribute("href", List.getAttribute("href"));
		innerList.setAttribute("title", List.getAttribute("title"));
		innerList.style.display = "block";
		innerList.style.paddingTop = "5px";
		innerList.style.height = "17px";
		innerList.appendChild(document.createTextNode(List.childNodes[0].nodeValue));
		prideScroll.Add(innerList);
	}
	prideScroll.Start();
}
addLoadEvent(scrollLIstStart);

/* ¾ÆÀÌÀÛ°¡ ÃÊ´ëÀÛ */
function scrollPremiumStart()
{	
	if(!document.getElementById("premiumAnimation")) return false;
	var premiumList = document.getElementById("premiumAnimation");
	var Lists = premiumList.getElementsByTagName("div");
	var boxWidth = premiumList.clientWidth;

	try
	{
		premiumList.style.display = "none";
		premiumScroll = new IJ_Scroll("t_test");
		premiumScroll.Create({Height : "125px", ScrollHeight : "1", Width : boxWidth, Delay : "2000", objHeight : "246px", Speed : "0.8"});

		for (i = 0; i < Lists.length; i++)
		{
			//var List = Lists[i].firstChild;
			if(Lists[i].className == "premiumSeriesList")
				premiumScroll.Add(Lists[i]);
		}
		premiumScroll.Start();
	}
	catch (e)
	{
		document.getElementById("t_test").style.display = "none";
		premiumList.style.display = "block";
	}
	
}
//addLoadEvent(scrollPremiumStart);