﻿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];}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.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; }
}


var stmnLEFT = 830;
var stmnGAP1 = 830;
var stmnGAP2 = 700;
var stmnBASE = 600;
var stmnActivateSpeed = 20;
var stmnScrollSpeed = 5;
var stmnTimer;

function RefreshStaticMenu()
{
	var stmnStartPoint, stmnEndPoint, stmnRefreshTimer;

	stmnStartPoint = parseInt(STATICMENU.style.top, 10);
	stmnEndPoint = document.body.scrollTop + stmnGAP2;

	if (stmnEndPoint < stmnGAP1) stmnEndPoint = stmnGAP1;

	stmnRefreshTimer = stmnActivateSpeed;


	if ( stmnStartPoint != stmnEndPoint )
	{
		stmnScrollAmount = Math.ceil( Math.abs( stmnEndPoint - stmnStartPoint ) / 15 );
		STATICMENU.style.top = parseInt(STATICMENU.style.top, 10) + ( ( stmnEndPoint<stmnStartPoint ) ? -stmnScrollAmount : stmnScrollAmount );
		stmnRefreshTimer = stmnScrollSpeed;
	}
	stmnTimer = setTimeout ("RefreshStaticMenu();", stmnRefreshTimer);

}

function InitializeStaticMenu()
{
	STATICMENU.style.top = document.body.scrollTop + stmnBASE;
	RefreshStaticMenu();
	STATICMENU.style.left = stmnLEFT;

}

function PresizeIframe(name) {		
	if (name == null || name == "") {
		return;
	}
	try {
		var oIFrame = document.getElementById(name);
		if( 500 > oIFrame.contentWindow.document.body.scrollHeight){
			oIFrame.style.height = 250;
		} else {
			oIFrame.style.height = oIFrame.contentWindow.document.body.scrollHeight;						
		}					
	} 
	catch (e) {}	
	//document.all["subIMG"].style.display = '';
}

function goMenu(url) {
	document.all.blogmain.src = url;
}		

// check element all
function CheckAllCheckbox(o) {
  if (o.length != null) {
    var b = !o[0].checked;

	  for (i = 0; i < o.length; i++) {
		  o[i].checked = b;
	  }
  } else {
	  o.checked = !o.checked;
  }
}

function CheckLogin() {
	CheckLoginProcess(document.forms[0].UserID, document.forms[0].PassWord,"");
}
function goMyInFo(){
	window.open("http://member.hanbiton.com/h_member/h_hms/ms_bypass.aspx?regsite=mythos");
}
function goUserInfo(){
	window.location.href = "http://member.hanbiton.com/h_member/h_hms/ms_bypass.aspx?regsite=mythos";	
}
function goPartiGuild(url)
{
	if(url.value) {
		if(url.index == 2) {
			location.href = url.value;
		}
		else {
			window.open(url.value, "HanbitOn_PartiGuild");		
		}
	}
}

function childLogOut()
{
	topNaviReLoad();
	try {
		if(self.parent.frames.length != 0)
		{
			//window.location.reload();
		}
	} catch (ex) {
		//ex 
	}	
}

// Submit form to another page without ViewState
function FormSubmit(f, action) {
	for (i = 0; (e = document.getElementsByTagName("input")[i]); i++) {
		if (e.getAttribute("type").indexOf("hidden") != -1) {
			if (e.getAttribute("name") == "__VIEWSTATE") {
				e.disabled = true;
				break;
			}
		}
	}

	f.action = action;
	f.submit();
}

function swf(src, w, h)
{
	html = '';
	html += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" WIDTH="'+w+'" HEIGHT="'+h+'">';
	html += '<PARAM NAME=movie VALUE="'+src+'">';
	html += '<PARAM NAME=quality VALUE=high>';
	html += '<PARAM NAME="wmode" value="transparent" />';
	html += '<EMBED src="'+src+'" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" wmode="transparent"  WIDTH="'+w+'" HEIGHT="'+h+'"></EMBED>';
	html += '</OBJECT>';
	document.write(html);
}

function goVoteResult(){
	var LeftPosition = (screen.width) ? (screen.width-135)/2 : 0;
	var TopPosition = (screen.height) ? (screen.height-320)/2 : 0;
	
	popvote = window.open("/popup/MainVoteResult.aspx", "goVoteResult", "width=500,height=400,status=no,scrollbars=no,top=" + TopPosition + ",left=" + LeftPosition);
	popvote.focus();
}

// 이미지 사이즈 조정하기
function ResizeImage(id) {
	var img = document.getElementById("UserImage" + id);
	
	if (img.width > 600) {
		img.width = 600;
	} else if (img.width == 0) {
		setTimeout("ResizeImage('" + id + "')", 200);
	}
}

//검색관련
function onClickHanbitOnSearch() 
{
    var SearchWord = document.forms[0].hanbitonSearchWord.value;
    if(SearchWord == false) {
        alert("검색어를 입력하세요.");
    }
    else
    {
        window.open("http://search.hanbiton.com/index.asp?sp=hellgate&isnet=y&query=" + SearchWord)
    }
  
}

//Header 링크
function LinkUrl(url)
{
    switch(url) 
    {
        case "0":                                   // 새소식
            location.href ="/New/NoticeList.aspx";
            break;
        case "1":                                  // 포포가이드
            location.href ="/Guide/Feature.aspx";
            break;
        case "2":                                 // 포포랭킹 
            location.href ="";
            break;
        case "3":                                   // 포포상점
            location.href ="";
            break;
        case "4":                                   // 포포길드
            location.href ="/Guild/GuildList.aspx";
            break;
        case "5":                                   // 커뮤니티
            location.href ="/Community/FreeBoardList.aspx";
            break;
        case "6":                                   // 자료실
            location.href ="/DataRoom/DownLoad.aspx";
            break;
        case "7":                                   // 고객지원
            location.href ="";
            break;
        
    }
    
}

//메인가기.
function mainGo()
{
    location.href ="/Home/Home.aspx";
}


function GetDownload(filename)
{
    window.location.href = "/Pds/AttachDownload.aspx?dbfilename=" + escape(filename);
}

// 회원가입
function GoJoinMember() {
	//location.href = "http://webservice.redbana.tw/Register/MemberRegister.aspx?regsite=Aika"
	location.href = "http://www.redbana.tw/Member/MemberRegister.aspx?regsite=redbana";
}

// 회원수정
function GoEditMember() {
	location.href = "http://webservice.redbana.tw/Info/UserModifyCheck.aspx?regsite=redbana"
}

// 아이디/패스워드 찾기
function GoSearchIdPass() {
	window.open("http://webservice.redbana.tw/Info/SearchID.aspx?regsite=redbana", "RedbanaMemberShip", "left=10,top=10,width=345,height=210,status=no");
}


// 캐시 충전
function GoChargeCash()
{
	window.open("http://billing.redbana.tw/cash_charge_pop.asp", "HanbitMemberCash", "left=10,top=10,width=345,height=380,status=no,scrollbars=yes");
}
