/* 대빵까리 개발 */
var comment_cnt = "false";


function orange1 () {
document.all["FloatLayer1"].style.display="none";
//document.all["FloatLayer2"].style.display="inline";
}

/*
function ifrm_reload() {
	var chk = document.getElementsByName('ifrm');

	if(comment_cnt == "false") {
		for(var i = 0; i < chk.length; i++)
		{
			frames.item(i).location.reload();
		}
	}
}
*/
function ifrm_reload_20070220(){
	var list = new Array();
	list = new Array("top", "topright", "center", "boardfloating", "top_ex", "topright_ex", "center_ex");

	if(comment_cnt == "false") {
		for(i=0;i<list.length;i++) {
			try {
				var f = document.frames["ifrm"+list[i]];
				f.location.reload();
			}
			catch(e) {}
		}
	}
}

function adbanner(id, width, height) {
	if (navigator.userAgent.indexOf("http://www.google.com/bot.html") != -1) return;
	var banner = "<div id='ad"+id+"'><iframe name=\"ifrm"+id+"\" src='http://adserver.thisisgame.com/new_script.php?id="+id+"&width="+width+"&height="+height+"' width="+width+" height="+height+" border=0 frameborder=0 framemargin=0 leftmargin=0 margin=0 SCROLLING=no></iframe></div>";
	document.writeln(banner);
}

function adbanner_new(ifrmname, path, width, height) {
//if(width == 210 && height == 155)
//	return;
	if (navigator.userAgent.indexOf("http://www.google.com/bot.html") != -1) return;
	var banner = "<iframe name='ifrm" + ifrmname + "' src='http://ad.thisisgame.com:8080/NetInsight/html" + path + "?rolling=16' width=" + width + " height=" + height + " border=0 frameborder=0 framemargin=0 leftmargin=0 margin=0 SCROLLING=no></iframe>";
	document.writeln(banner);
}

function adbanner_new1(ifrmname, path, width, height) {
	if (navigator.userAgent.indexOf("http://www.google.com/bot.html") != -1) return;
	var banner = "<iframe name='ifrm" + ifrmname + "' src='http://ad.thisisgame.com:8080/NetInsight/html" + path + "' width=" + width + " height=" + height + " border=0 frameborder=0 framemargin=0 leftmargin=0 margin=0 SCROLLING=no></iframe>";
	alert(banner);
	document.writeln(banner);
}

function adbanner_new2(ifrmname, path, width, height) {
	if (navigator.userAgent.indexOf("http://www.google.com/bot.html") != -1) return;
	var banner = "<iframe name='ifrm" + ifrmname + "' src='http://ad.thisisgame.com:8080/NetInsight/html" + path + "?rolling=20' width=" + width + " height=" + height + " border=0 frameborder=0 framemargin=0 leftmargin=0 margin=0 SCROLLING=no></iframe>";
	alert(banner);
	document.writeln(banner);
}

/*롤오버*/

function Roll(num,tog){eval("document.m"+num+".src=m"+num+"_"+tog+".src");}

function pre_image_tig() {
for(a=1;a<=9;a++){
	eval('m'+a+'_on = new Image()');
	eval('m'+a+'_off = new Image()');
	eval('m'+a+'_on.src = \"http://file.thisisgame.com/img/common/menu/menu0'+a+'_o.gif\"');
	eval('m'+a+'_off.src = \"http://file.thisisgame.com/img/common/menu/menu0'+a+'.gif\"');
	}
}
/*퀵메뉴 롤오버*/
function Roll2(num,tog){eval("document.qm"+num+".src=qm"+num+"_"+tog+".src");}

function pre_image_tig2() {
for(a=1;a<=6;a++){
	eval('qm'+a+'_on = new Image()');
	eval('qm'+a+'_off = new Image()');
	eval('qm'+a+'_on.src = \"http://file.thisisgame.com/img/common/qmenu'+a+'_o.gif\"');
	eval('qm'+a+'_off.src = \"http://file.thisisgame.com/img/common/qmenu'+a+'.gif\"');
	}
}

function Roll3(num,tog){eval("document.sqm"+num+".src=sqm"+num+"_"+tog+".src");}

function pre_image_soccer() {
for(a=1;a<=7;a++){
	eval('sqm'+a+'_on = new Image()');
	eval('sqm'+a+'_off = new Image()');
	eval('sqm'+a+'_on.src = \"http://file.thisisgame.com/soccer/img/menu2/0'+a+'o.jpg\"');
	eval('sqm'+a+'_off.src = \"http://file.thisisgame.com/soccer/img/menu2/0'+a+'n.jpg\"');
	}
}

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_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_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];}
}

function Show() { //v3.0
  var i,p,v,obj,args=Show.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(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 ChangeLayer(id)
{
    if (document.getElementById(id).style.display == "")
	    document.getElementById(id).style.display = "none";
	else
		document.getElementById(id).style.display = "";
}

function ChangeLayerValue(id, value)
{
	document.getElementById(id).style.display = value;
}

function ChangeSound(f, img)
{
    //var f = document.wmplay;
    //var img = document.soundcontrolimg;

    if (f.mute)
    {
         f.mute = false;
         img.src = 'http://file.thisisgame.com/img/casual/btn_soundoff.gif';
    }
    else
    {
         f.mute = true;
         img.src = 'http://file.thisisgame.com/img/casual/btn_soundon.gif';
    }

    return false;
}

function CheckTopSearchForm(f)
{
  if (!f.search.value)
  {
    alert('검색할 내용을 입력하세요');
    f.search.focus();
    return false;
  }

  return true;
}

function toclip(s)
{
  var clip = document.body.createTextRange();
  clip.moveToElementText(document.all(s));
  clip.select();
  clip.execCommand('copy');

  if(s != "content_layer")
	  alert('주소를 복사하였습니다.');
}

function toclip2(s)
{
  var clip = document.body.createTextRange();
  clip.moveToElementText(document.getElementById(s));
  clip.select();
  clip.execCommand('copy');
}

function open_win(url, target, wid, hei, scroll) {
	winWid= (document.body.clientWidth - wid) / 2 ;
	winHgt = (document.body.clientHeight - hei) / 2 ;
	window.open(url, target, "left="+winWid+",top="+winHgt+",width="+wid+",height="+hei+", statusbar=no, scrollbars="+scroll);
}

function openWindow(url, target, wid, hei, scroll, xPos, yPos) {
	winWid = xPos ? xPos : (window.screen.width/2 - wid/2);
	winHgt = yPos ? yPos : (window.screen.height/2 - hei/2 - 50);
	scroll = scroll ? scroll : "no";
	window.open(url, target, "'left="+winWid+",top="+winHgt+",width="+wid+",height="+hei+", statusbar=no, scrollbars="+scroll);
}


function open_nowin(url) {
	window.open(url);
}

function go_view(id, category, subcategory) {
	eval("document.location='/board/view.php?id="+id+"&category="+category+"&subcategory="+subcategory+"'");
}

function go_page(url) {
	document.location = url;
}

function popup_getCookie(name) {
        var nameStr = name + "=" ;
        var nameLen = nameStr.length;
        var cookieLen = document.cookie.length;

        var i = 0;
        while( i < cookieLen ) {
                var j = i + nameLen;
                if ( document.cookie.substring(i, j) == nameStr ) {
                        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;
                }
        }
}

function script_viewimage(src, link)
{
	document.write('<a href="' + link + '">' + '<img src="' + src + '">' + '</a>');
}

function fn_fav(murl, site) {
	if ( navigator.appName != 'Microsoft Internet Explorer' )
	{
		window.sidebar.addPanel(site,murl,"");
	}else {
		window.external.AddFavorite(murl,site);
	}
}

// flashWrite(파일경로, 가로, 세로[, 변수][,배경색][,윈도우모드])
function flashWrite(url,w,h,vars,bg,win,id){
	var id=url.split("/")[url.split("/").length-1].split(".")[0]; //id는 파일명으로 설정
	if(vars==null) vars='';
	if(bg==null) bg='#FFFFFF';
	if(win==null) win='transparent';


	// 플래시 코드 정의
	var flashStr= "	<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'";
		flashStr+="			codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0'";
		flashStr+="			width='"+w+"'";
		flashStr+="			height='"+h+"'";
		flashStr+="			id='"+id+"'";
		flashStr+="			align='middle'>";

		flashStr+="		<param name='allowScriptAccess' value='always' />";
		flashStr+="		<param name='movie' value='"+url+"' />";
		flashStr+="		<param name='FlashVars' value='"+vars+"' />";
		flashStr+="		<param name='wmode' value='"+win+"' />";
		flashStr+="		<param name='menu' value='false' />";
		flashStr+="		<param name='quality' value='high' />";
		flashStr+="		<param name='bgcolor' value='"+bg+"' />";


		flashStr+="		<embed src='"+url+"'";
		flashStr+="		       flashVars='"+vars+"'";
		flashStr+="		       wmode='"+win+"'";
		flashStr+="		       menu='false'";
		flashStr+="		       quality='high'";
		flashStr+="		       bgcolor='"+bg+"'";
		flashStr+="		       width='"+w+"'";
		flashStr+="		       height='"+h+"'";
		flashStr+="		       name='"+id+"'";
		flashStr+="		       align='middle'";
		flashStr+="		       allowScriptAccess='always'";
		flashStr+="			   swLiveConnect='true'";
		flashStr+="		       type='application/x-shockwave-flash'";
		flashStr+="		       pluginspage='http://www.macromedia.com/go/getflashplayer' />";
		flashStr+=" </object>";

	// 플래시 코드 출력
	document.write(flashStr);
}


function  viewMediaPlayer(sURL, sName, sFeatures){

 //미디어 플레이어 오브젝트를 뿌려줍니다.
 //미디어 플레이어 버전은 7~10 버전에 호환되는 오브젝트ID를 사용합니다.
 var WMPCID = "CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6";

 var sFeature;
 var sWidth  = "100%";
 var sHeight  = "100%";
 var pmBoolean;
 var sTempArray;
 var sParamTag = "";

 sFeature = sFeatures.split(/\s*,\s*/);
 for (var i=0; i< sFeature.length ; i++)
 {
  sTempArray = sFeature[i].split(/\s*=\s*/);
  if (sTempArray[0].toLowerCase() == "width"){
  //넓이
  sWidth = sTempArray[1];
  }else if (sTempArray[0].toLowerCase() == "height"){
  //높이
  sHeight = sTempArray[1];
  }else{
  //기타 파라메터 처리
  if (sTempArray[1].toLowerCase() == "yes" || sTempArray[1] == "1" || sTempArray[1].toLowerCase() == "true"){
    pmBoolean = "true";
  }else if (sTempArray[1].toLowerCase() == "no" || sTempArray[1] == "0" || sTempArray[1].toLowerCase() == "false"){
    pmBoolean = "false";
  }else{
    pmBoolean = sTempArray[1];
  }
  sParamTag = "<PARAM NAME='"+sTempArray[0]+"'VALUE='" + pmBoolean + "'>\n"+sParamTag;
  }
 }

 document.write("<OBJECT ID='"+sName+"' NAME='"+sName+"' CLASSID='"+WMPCID+"' WIDTH='"+sWidth+"' HEIGHT='"+sHeight+"' >");
 document.write("<PARAM NAME='URL'VALUE='" + sURL + "'>");
 document.write(sParamTag);
 document.write("</OBJECT>");
}


var isIE = (navigator.appName.indexOf("Microsoft") != -1) ? 1 : 0;
var isIE70 = (navigator.appVersion).indexOf("MSIE 7.0" != -1) ? true : false;

function call(url, id) {

	if(!id) id = "AJAX_DIV";
	var client = false;

	if(window.ActiveXObject) {
		try {
			client = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				client = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {}
		}
	} else {
		client = new XMLHttpRequest();
	}
	if(client) {
		client.onreadystatechange = function() {
			if(client.readyState == 4) {

				//출력레이어가 없을 경우 생성
				var el = document.getElementById(id);
				if(!el) {
					el = document.createElement("div");
					el.style.display = 'none';
					document.body.appendChild(el);
				}
				
				//IE의 경우 버그가 존재함. 그래서 &nbsp;를 추가
				if(isIE && client.responseText.indexOf("<script") == 0) {
					el.innerHTML = "&nbsp;" + client.responseText;
				} else {
					el.innerHTML = client.responseText;
				}

				//자바스크립트 실행 (defer는 IE 에서 실행되어 안씀)
				var scripts = el.getElementsByTagName("script");
				for(var i=0; i<scripts.length; i++) {
					eval(scripts[i].innerHTML.replace("<!--", "").replace("-->", ""));
				}
			}
		}
		var f;
		if(f = document.forms[url]) {
			var parameters = "";
			for(var i=0; i<f.elements.length; i++) {
				if(f.elements[i].name == "") continue; 
				if(f.elements[i].type == "radio" || f.elements[i].type == "checkbox") {
					if(f.elements[i].checked == false) continue;
				}
				//parameters += f.elements[i].name + "=" + encodeURI( f.elements[i].value ) + "&";
				parameters += f.elements[i].name + "=" + escape( f.elements[i].value ) + "&";
			}
			if(!f.action) f.action = location.href;
			client.open('POST', f.action, true);
			client.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			client.setRequestHeader("Content-length", parameters.length);
			client.setRequestHeader("Connection", "close");
			client.send(parameters);
		} else {
			client.open("GET", url, true);
			client.send(null);
		}
	}
}

function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;
 
   for (i = 0; i < sText.length && IsNumber == true; i++) { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) {
         IsNumber = false;
      }
   }

   return IsNumber;
}

function IsAuth2(code)
{
	if ( code )
		var url = '/user/need_auth2.php?code=' + code ;
	else
		var url = '/user/need_auth2.php' ;
	
	openWindow(url, 'needauth2', '450', '230', 'no', '200', '150')
}

function js_blindOpen(from_text){
	if(from_text != "admin"){
		alert("타 유저의 신고로 인하여, 해당 글을 보실 수 없습니다.");
		return false;
	} else {
		return true;
	}
}
// 블라인드 시스템 스크립트
function js_commentView(from_idx, from_mode, from_text){
	var tgt1 = document.getElementById("commentBlind" + from_idx);
	var tgt2 = document.getElementById("commentView1" + from_idx);
	var tgt3 = document.getElementById("commentView2" + from_idx);
	if(from_mode == "open") {
		tbool = js_blindOpen(from_text);
		if(tbool) {
			tgt1.style.display = "none";
			tgt2.style.display = "inline";
			tgt3.style.display = "inline";
		} else {
			tgt1.style.display = "inline";
			tgt2.style.display = "none";
			tgt3.style.display = "none";
		}
	} else {
		tgt1.style.display = "inline";
		tgt2.style.display = "none";
		tgt3.style.display = "none";
	}
}

/*
function js_blindOpen(){
	alert("타 유저의 신고로 인하여, 해당 글을 보실 수 없습니다.");
	return;
}
// 블라인드 시스템 스크립트
function js_commentView(from_idx, from_mode){
	var tgt1 = document.getElementById("commentBlind" + from_idx);
	var tgt2 = document.getElementById("commentView1" + from_idx);
	var tgt3 = document.getElementById("commentView2" + from_idx);
	if(from_mode == "open") {

		tbool = js_blindOpen();
		if(tbool) {
			tgt1.style.display = "none";
			tgt2.style.display = "inline";
			tgt3.style.display = "inline";
		} else {
			tgt1.style.display = "inline";
			tgt2.style.display = "none";
			tgt3.style.display = "none";
		}
	} else {
		tgt1.style.display = "inline";
		tgt2.style.display = "none";
		tgt3.style.display = "none";
	}
}


*/
function js_blindListOpen(from_id, from_type, from_i){
	alert("타 유저의 신고로 인하여, 해당 글을 보실 수 없습니다.");
	return;
}

function fy_blindClear(from_id, from_type){
	window.open('../popup/report_blind_clear.php?id='+from_id+'&type='+from_type, '블라인드해제', 'width=400,height=275');
}

function js_report(type, id, category, item, from_validtime){ //신고하기
	window.open('/popup/reportblindout.php?type=' + type + '&id=' + id + '&category=' + category + '&item=' + item + '&validtime='+ from_validtime , 'pop01' , 'width=450,height=405');
}

function fy_blindImgBtn(from_id, from_type){
	window.open('../popup/report_blind.php?id='+from_id+'&type='+from_type, 'pop01' , 'width=400,height=275');
}

