﻿
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_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; }
}
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() {
    clearCookie("ParentAcc");
	CheckLoginProcess(document.forms[0].UserID, document.forms[0].PassWord,"");
}

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_view(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
    {
        document.charset="euc-kr";  //한빛온검색은 euc-kr이기 때문에 한글이 깨지지 않게 하기 위해 명시
        window.open("http://search.hanbiton.com/index.asp?sp=audition&isnet=y&query=" + SearchWord)
    }
  
}

//검색엔터키 처리
function SerachEnterchk() {
    if(event.keyCode == 13){
        onClickHanbitOnSearch()
        return true;
    }
}
 
//Header 링크
function LinkUrl(url)
{
    switch(url) 
    {
        case "1":                                   // 새소식
            location.href ="/News/NoticeList.aspx";
            break;
        case "2":                                  // 포포가이드
            location.href ="/Guide/Feature_Intro.aspx";
            break;
        case "3":                                   // 자료실
            location.href ="/DataRoom/DownLoad.aspx";
            break;
        case "4":                                   // 커뮤니티
            location.href ="/Community/FreeBoardList.aspx";
            break;
        case "5":                                   // 고객지원
            location.href ="/Customer/FaqList.aspx";
            break;
        
    }
    
}


//메인가기.
function mainGo()
{
    location.href ="/Home/Home.aspx";
}



//txt 체크
function txtchk(t, m)
{

    if(t.value == "")    
    {
        alert(m);        
        t.focus();        
        return false;
    }
    else
    {        
        return true;
    }
        
}


// 이메일 체크 
function CheckMail(strMail) {


   /** 체크사항 
     - @가 2개이상일 경우 
     - .이 붙어서 나오는 경우 
     -  @.나  .@이 존재하는 경우 
     - 맨처음이.인 경우 
     - @이전에 하나이상의 문자가 있어야 함 
     - @가 하나있어야 함 
     - Domain명에 .이 하나 이상 있어야 함 
     - Domain명의 마지막 문자는 영문자 2~4개이어야 함 **/ 

    var check1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/;  

    var check2 = /^[a-zA-Z0-9\-\.\_]+\@[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4})$/; 
     
    if ( !check1.test(strMail) && check2.test(strMail) ) { 
        return true; 
    } else { 
        return false; 
    } 
} 



