var virtual = new ActiveXObject("Microsoft.XMLHTTP"); 
var _httpMethod = "GET";
var _syncFlag = false;
function _xmlGetData(remoteURL){
  virtual.open(_httpMethod,remoteURL, _syncFlag);
  virtual.setRequestHeader("Content-type:", "text/html");   
  virtual.setRequestHeader("Referer:", remoteURL);   
  virtual.send(); 
  if (virtual.status > 200) {
  }
  return virtual.responseText;
}
function _onRetriveComplete(){
  if (virtual.readyState == 4) {
    virtual.onreadystatechange = null;
  }
}
function virtualGET(remoteURL){
  return _xmlGetData(remoteURL);
}


function objForWinEventOnload(){
	this.commandList = new Array();
	this.commandAdd = commandAddForWinEventOnload;
	this.commandDo = commandDoForWinEventOnload;
}

function commandAddForWinEventOnload(eval_str){
	this.commandList[this.commandList.length] = eval_str;
}

function commandDoForWinEventOnload(){
	for (var i = 0; i < this.commandList.length; i++)
		eval(this.commandList[i]);	
}
var doOnLoadCommand = new objForWinEventOnload();

/*±ÝÀÏ ¹æ¹®ÀÚ ¼ö¸¦ °®°í ¿É´Ï´Ù.*/
function getTodayVisit(jbbSerial,targetDiv,targetDiv1){
	var rtnValue = virtualGET("/_club/vgetTodayVisit.html?jbbserial="+jbbSerial);
	if (typeof(rtnValue) != "undefined"){
			targetDiv.innerHTML = rtnValue.toString().split("|")[0];
			targetDiv1.innerHTML = rtnValue.toString().split("|")[1];
	}
}

function pifrmResize(ifrmName){
	if (parent && parent.resizeIframe != null && parent != this){
		parent.resizeIframe(ifrmName);
	}
}


function resizeIframe(ifrmName){
	if (ifrmName == null || ifrmName == "")
		ifrmName = "jbbContainer";
	try	{
		var oBody   = document.frames(ifrmName).document.body;
		var oIFrame = document.all(ifrmName);
		var frmWidth  = oBody.scrollWidth;
		var frmHeight = oBody.scrollHeight;
		
		oIFrame.style.height = frmHeight;
		oIFrame.style.width = (frmWidth<700)?frmWidth:700;
		window.status = oIFrame.style.width+" X "+oIFrame.style.height + " : " + frmWidth+" X "+frmHeight;
	}	catch (e){
		window.status = oIFrame.style.width + " X " + oIFrame.style.height + " = ? ";
	}
}


function resizeImage(obj,fK,nW,nH){
		var fK2 = fK + (2*fK/10);
		if (nW > fK){
			obj.width = fK;
			obj.height = Math.round((fK) * nH / nW);
			if (obj.height > fK2){obj.height = fK2;}
		}
}

function resizeImage_list(){
	if(typeof(document.all.sImages) != 'undefined'){
		if(typeof(document.all.sImages.length) == 'number'){
			for(var i=0;i<document.all.sImages.length;i++){
				resizeImage(document.all.sImages[i],100,document.all.sImages[i].width,document.all.sImages[i].height);
			}
		}else{
				resizeImage(document.all.sImages,100,document.all.sImages.width,document.all.sImages.height);
		}
	}
}

function resizeImage_view(){
	if(typeof(document.all.contentImg) != 'undefined'){
		if(typeof(document.all.contentImg.length) == 'number'){
			for(var i=0;i<document.all.contentImg.length;i++){
				resizeImage(document.all.contentImg[i],600,document.all.contentImg[i].width,document.all.contentImg[i].height);
			}
		}else{
				resizeImage(document.all.contentImg,600,document.all.contentImg.width,document.all.contentImg.height);
		}
	}
}


function moveJbbMenu(url){
	document.all("jbbContainer").src = url;
}

function mnLink(jbbSerial,menuSerial,sflevel){
	var rtnValue = virtualGET("/_club/vgetMenuLink.html?jbbserial="+jbbSerial+"&menuSerial="+menuSerial+"&sfl="+sflevel);
	if (rtnValue.substring(0,7) == "http://"){
		window.open(rtnValue,'');
	}else{
		alert(rtnValue+'\n\n¸Þ´º¸¦ ÀÌ¿ëÇÏ½Ç ¼ö ÀÖ´Â ±ÇÇÑÀÌ ¾ø½À´Ï´Ù.\n\n');
	}
}

function pMoveTop(){
//	try{
		parent.document.all.focus_top.focus();
//	}catch (e){
//	}
}


/*ÀÌ¹ÌÁö ¿ø·¡ Å©±â·Î º¸±â*/
/*oriImgview('·Î°í°æ·Î&ÆÄÀÏ¸í',°¡·Î»çÀÌÁî,¼¼·Î»çÀÌÁî,'Å¸ÀÔ:logo')*/
function oriImgview(imgsrc,imgwidth,imgheight,imgtype)
{
		if ( imgwidth > 1000 ){
			imgwidth = 1000;
		}else{
			imgwidth += 50;
		}
		if ( imgheight > 700 ){
			imgheight = 700;
		}else{
			imgheight += 40;
		}
		openwin("/imageview.html?imgsrc=" + imgsrc, "_imageview", imgwidth, imgheight, 1, true, true, false);
}


/* start popup function */
/* todo get winodws params */
function getwinparam( winw, winh, adjust, resizable, scrollable, status ) {
    var left, top;
    switch( adjust ) {
	case 1: //top left aligned
		left = top = 0;
		break;
	case 2: //top right aligned
		left = window.screen.availWidth - winw;
		top = 0;
		break;
	case 3: //centered
		left = (window.screen.availWidth - winw) / 2;
		top = (window.screen.availHeight - winh) / 2;
		break;
	case 4: //bottom left aligned
		left = 0;
		top = window.screen.availHeight - winh;
		break;
	case 5: //bottom right aligned
		left = window.screen.availWidth - winw - 8;
		top = window.screen.availHeight - winh;
		break;
    }
    var option = "";
    if( adjust > 0 ) option = "left=" + left + ",top=" + top;
    option = option + ",width=" + winw + ",height=" + winh;
    if( (!resizable) || (resizable == false) ) 
        option += ",resizable=no";
    else 
        option += ",resizable=yes";
    if( (!scrollable) || (scrollable == false) ) 
        option += ",scrollbars=no";
    else
        option += ",scrollbars=yes";
    if( (!status) || (status == false) ) 
        option += ",status=no";
    else
        option += ",status=yes";
    param = "toolbar=no," + option + ",directories=no,menubar=no";
    return( param );
}

/* todo popup window */
function openwin( winurl, winnm, winw, winh, adjust, resizable, scrollable, status ) {
	var param = getwinparam( winw, winh, adjust, resizable, scrollable, status );
    newwin = window.open( winurl, winnm, param );
    return( newwin );
}


function codetocat(c1,c2){
	var rtnValue= '';
	if (typeof(arr_jbbCat2nd[c1]) != 'undefined'){
		for(var i=0;i<arr_jbbCat2nd[c1].length;i++){
			if(arr_jbbCat2nd[c1][i].code == c2){
				rtnValue = arr_jbbCat2nd[c1][i].name;
				break;
			}
		}
	}
	return(rtnValue);
}


function jbbCat2nd_count(cat2ndCode){
	eval("var tov = typeof(_2CatJbb_"+cat2ndCode+");");
	if (tov != 'undefined')
		return eval("_2CatJbb_"+cat2ndCode);
	else
		return 0;
}



//////////////////////////////////////////////////////////////////////////////////////////
function goSJSF(f){
	if(!((f.search1.checked) || (f.search2.checked))){
		alert('Ä«Æä¸í ¶Ç´Â Ä«ÆäÁö±â µÑÁß ÇÏ³ª´Â ¼±ÅÃ ÇÏ¼Å¾ß ÇÕ´Ï´Ù.');
		return;
	}
	if(f.searchstring.value.length < 1){
		alert('°Ë»ö¾î¸¦ ÀÔ·Â ÇÏ¼¼¿ä.');
		return;
	}
	f.submit();
}
function spanPrintSearchJbb(obj){
	var rtnValue = '';
	rtnValue += '<table cellpadding="0" cellspacing="0"><form name=subJbbSearchForm action=/_club/clubsearch.html method=get onSubmit="goSJSF(document.subJbbSearchForm);return false;"><tr><td style="padding-right:3;"><img src="/_blogimg/btn/000000116.gif" width="43" height="11" border="0"></td>';
	rtnValue += '<td style="padding-right:5;"><input type=checkbox name=search1 value=1 checked>Ä«Æä¸í&nbsp;&nbsp;<input type=checkbox name=search2 value=1>Ä«ÆäÁö±â&nbsp;&nbsp;</td>';
	rtnValue += '<td><input type="text" name="searchstring" size="30" class="int"></td><td style="padding-right:3; padding-left:3;"><input type=image src="/_blogimg/btn/000000117.gif" width="19" height="19" border="0"></td>';
	rtnValue += '</tr></form></table>';

	if (typeof(obj) != 'undefined')
		obj.innerHTML = rtnValue;
}
//////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////
function doVote(jbbSerial){
	var rtnValue = virtualGET("/_club/vgetJbbFav.html?jbbserial="+jbbSerial);
	switch (rtnValue)
	{
	case 'error':
		alert('¾Ë¼ö ¾ø´Â ¿À·ù·Î ÃßÃµ¿¡ µî·Ï µÇÁö ¾Ê¾Ò½À´Ï´Ù.');break;
	case 'needlogin':
		alert('·Î±×ÀÎÈÄ ÃßÃ· °¡´ÉÇÕ´Ï´Ù.\n\n·Î±×ÀÎÀ» ÇÏ¿© ÁÖ¼¼¿ä.');break;
	case 'udone':
		alert('ÀÌ¹Ì ÃßÃµ¿¡ Âü¿© ÇÏ¿´½À´Ï´Ù.');break;
	default:
		sp_favcnt.innerHTML = rtnValue;
		alert('ÃßÃµ µÇ¾ú½À´Ï´Ù.\n\n°¨»çÇÕ´Ï´Ù.');break;
	}
}