function $(s) { return document.getElementById(s) }

function isEmail(s) {
	return s.search(/^\s*[\w\~\-\.]+\@[\w\~\-]+(\.[\w\~\-]+)+\s*$/g)>=0;
}


// µ¿¿µ»ó ºä¾î
function funVodOpen(mode,vod_id,title) {
	var window_position = "left=0,top=0,width=342,height=519,scrollbars=no,resizable=yes,menubar=no,toolbar=no,location=no,directories=no,status=no"

	var F = window.open('http://www.anionetv.com/etc/e_vod_viewer.asp?mode='+mode+'&vod_id='+vod_id+'&title='+title, 'vod', window_position);
	F.focus();
}

function funCheckBox(s_code) {
	var strID=0;
	var cLen = document.all(s_code).length;

	if (cLen > 0) {
		for (i=0;i<cLen;i++) {
			if (document.all(s_code)(i).checked) {
				strID = strID + 1;
			}
		}
	}
	else {
		if (document.all(s_code).checked) {
			strID = 1;
		}
	}

	return strID;
}

function eventVodPlay(f)
{
    $("dPlayer").filename = "/vod/"+f+".wmv";
}

function _loadWMP(media_url,width_val,height_val,id)
{
	str = "<object id="+id+" width="+width_val+" height="+height_val+" viewastext style=\"z-index:1\" classid=\"CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95\" codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701\" standby=\"Loading Microsoft Windows Media Player components...\" type=\"application/x-oleobject\">"
        + "<param name=\"filename\" value=\""+media_url+"\" />"
        + "<param name=\"animationatstart\" value=\"1\" />"
        + "<param name=\"autostart\" value=\"1\" />"
        + "<param name=\"balance\" value=\"0\" />"
        + "<param name=\"currentmarker\" value=\"0\" />"
        + "<param name=\"currentposition\" value=\"0\" />"
        + "<param name=\"displaymode\" value=\"4\" />"
        + "<param name=\"enablecontextmenu\" value=\"0\" />"
        + "<param name=\"enabled\" value=\"1\" />"
        + "<param name=\"fullscreen\" value=\"0\" />"
        + "<param name=\"invokeurls\" value=\"1\" />"
        + "<param name=\"playcount\" value=\"0\" />"
        + "<param name=\"rate\" value=\"1\" />"
        + "<param name=\"showcontrols\" value=\"0\" />"
        + "<param name=\"showstatusbar\" value=\"0\" />"
        + "<param name=\"stretchtofit\" value=\"0\" />"
        + "<param name=\"transparentatstart\" value=\"1\" />"
        + "<param name=\"uimode\" value=\"FULL\" />"
        + "<param name=\"displaybackcolor\" value=\"0\" />"
		+ "<embed id="+id+" animationatstart='0' autostart='1' displaybackcolor='black' showcontrols='1' showstatusbar='1' showtracker='1' showpositioncontrols='0' pluginspage='http://www.microsoft.com/korea/windows/windowsmedia/'src='"+media_url+"' type='video/x-ms-asf-plugin' height='"+height_val+"' width='"+width_val+"'></embed>"
		+ "</object>"

	document.write(str);
}

//¾ÆÀÌµðÃ£±â °Ë»ö Ã¢¶ç¿ì±â
function popIdFind()
{
	window.open("/member/find_id.php","id","width=590,scrollbars=no,height=328,top=100,left=200");
}

//ºñ¹Ð¹øÈ£Ã£±â °Ë»ö Ã¢¶ç¿ì±â
function popPwFind()
{
	window.open("/member/find_pw.php","pw","width=590,scrollbars=no,height=328,top=100,left=200");
}

function setPngImg(obj) 
{
  obj.width=obj.height=1;
  obj.className=obj.className.replace(/\bpngimg\b/i,'');
  obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
  obj.src='';
  return '';
}


function loginChk(f)
{
	if(!f.userid.value)
	{
		alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä!");
		f.userid.focus();
		return false;
	}

	if(!f.userpw.value)
	{
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä!");
		f.userpw.focus();
		return false;
	}

	return true;

}

function js_event_anti_right(e)
{
    evt = e || event;
    try{
        if (document.all)
        {
        if(evt.button == 2 || evt.button == 3)
        {
            js_event_anti_stop_event(evt);
            return false;    }
        }
        else
        {
            if(evt.which == 3 || evt.which == 2)
            {
                js_event_anti_stop_event(evt);
                return false;
            }
        }
    }catch(ex){
        return false;
    }
}

// Å°º¸µå ÀÔ·Â ¸·±â
function js_event_anti_processKey(e)
{
    evt = e || event;

 var z = ((event.keyCode > 19 && event.keyCode < 111) || event.keyCode == 8 || event.keyCode == 13 || event.keyCode == 229) ? 1 : 0;

 var z = (event.ctrlKey == true && event.keyCode == 78) ? 0 : z;

 document.documentElement.onhelp = f1Stop;

 if(z == 0)
 {
  try{
   js_event_anti_stop_event(evt);
   return false;
  }catch(ex){
   return false;
  }
 }
}

function f1Stop()
{
 return false;
}

// ÀÌº¥Æ® µ¿ÀÛ ¹«½Ã!
function js_event_anti_stop_event(evt)
{
    if(window.event)
    {
        window.event.keyCode = 0;
        window.event.cancelBubble = true;
        window.event.returnValue = true;
    }
    else
    {
        evt.stopPropagation();
        evt.preventDefault();
        evt.initEvent;
    }
    return false;
}
// ±âº»¾ÈÆ¼ ÀÌº¥Æ® µî·Ï(¿À¸¥ÂÊ¸¶¿ì½º,µå·¡±×,Å°ÀÔ·Â)
function js_event_anti(this_s)
{

    if(!this_s){this_s = window.document;}
    if(document.attachEvent)
    {
        this_s.attachEvent("onkeydown", js_event_anti_processKey );
        this_s.attachEvent("onmousedown", js_event_anti_right );
        this_s.attachEvent("onselectstart", js_event_anti_stop_event );
        this_s.attachEvent("ondragstart", js_event_anti_stop_event );
        this_s.attachEvent("oncontextmenu", js_event_anti_stop_event );
    }
    else
    {
        window.captureEvents(Event.MOUSEDOWN);
        window.captureEvents(Event.ONKEYDOWN);
        this_s.addEventListener("keydown", js_event_anti_processKey , false);
        this_s.addEventListener("mousedown", js_event_anti_right , false);
        this_s.addEventListener("dragstart", js_event_anti_stop_event , false);  //FF¿¡¼­ Áö¿øµÇÁö ¾Ê´Â´Ù.
        this_s.addEventListener("selectstart", js_event_anti_stop_event , false);  //FF¿¡¼­ Áö¿øµÇÁö ¾Ê´Â´Ù.
        this_s.addEventListener("contextmenu", js_event_anti_stop_event , false);
    }
}
