// JScript source code
// : Made By chan su



function onlyNum() {
   if((event.keyCode<48)||(event.keyCode>57))
      event.returnValue=false;
}

function isNumEng(oStr){
	var offSet, Reg_ExStr;
	offSet = true;
	
	Reg_ExStr = /[^A-Za-z0-9]/;
	
	if(oStr.match(Reg_ExStr)){
		offSet = false;
	}
	return offSet;
}	

function autoTap(arg,nextname,len) {  
if (arg.value.length==len) {		
	nextname.focus();
	return;
	}
}

function isAlert(Target_focus, Msg_Str, Comp1, Comp2){
	if(Comp1 == Comp2){
		alert(Msg_Str);
		Target_focus.focus();
		return true;
	}
}

function isAlerts(Target_focus, Msg_Str, Comp1, Comp2){
	if(Comp1 < Comp2){
		alert(Msg_Str);
		Target_focus.value = "";
		Target_focus.focus();
		return true;
	}
}

function popOpen(url,PopName,wth,hht) {
	window.open(url,PopName,"left=0,top=0,width="+ wth +",height="+ hht +",toolbar=no,scrollbars=auto,status=yes");
}
function popOpen_SCR(url,PopName,wth,hht) {
	window.open(url,PopName,"left=0,top=0,width="+ wth +",height="+ hht +",toolbar=no,scrollbars=yes,status=yes");
}

function popOpenName(url,PopName) {
	window.open(url,PopName,"left=0,top=0,width=0,height=0,toolbar=no,scrollbars=auto,status=yes");
}


function popResize(offsetTable) {
	
	var thisX = document.getElementById(offsetTable).offsetWidth;
	var thisY = document.getElementById(offsetTable).offsetHeight;
	/*
	
	var maxThisX = screen.width - 50;
	var maxThisY = screen.height - 200;

	if (thisX > maxThisX) {
		window.document.body.scroll = "yes";
		thisX = maxThisX;
	}
	if (thisY > maxThisY) {
		window.document.body.scroll = "yes";
		thisX += 16;
		thisY = maxThisY;
	}
	window.resizeTo(thisX+40,thisY+29+50);
	*/

	var windowX = (screen.width - (thisX+10))/2;
	var windowY = (screen.height - (thisY))/2 - 20;	
	window.moveTo(windowX,windowY);
}


function reSize(iframe_name) {
        try{	
		var objFrame;
		var objBody;
        //objFrame = top.frames('frames_Bot').document.all(iframe_name)
        objFrame = document.all(iframe_name)
        objBody = document.frames('frames_Bot').document.frames(iframe_name).document.body;
        iframe_height = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);
	        if (iframe_height > 490) {
	                objFrame.style.height = iframe_height
	        }else{
	                objFrame.style.height = 490;
	        }
			objFrame.style.width = "100%";			
        }catch(e){}
        setTimeout('reSize("' + iframe_name + '")',0)
}



function show_layer(layer_name)
{
	
	if (layer_name.style.display != "none"){
		layer_name.style.display = "none";
	}
	else {
		layer_name.style.display = "";	 
	}
}



function hide_layer(layer_name)
{
		layer_name.style.display = "none";
}



    function checkEmail(str)
    {
        var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
        if (filter.test(str)) { return true; }
        else { return false; }
    }

    function checkEmail2(young)
    {
        var str = young.value;

        if (str != null && str != "" && str.length != 0)
        {
            if (str.indexOf('@')==-1 || str.indexOf('.')==-1)
            {
                alert("Error");
                    young.value="";
                        young.focus();
                            return false;
            }

            for (i=0;i<=(str.length);i++)
            {
                var cha = str.substring(i,i+1);
                    if((cha=="'") || (cha==" ") || (cha==",") || (cha=="=") || (cha=="+") || (cha==")") || (cha=="(") || (cha=="*") || (cha=="&") || (cha=="^") || (cha=="%") || (cha=="$") || (cha=="#") || (cha=="!") || (cha=="`") || (cha=="~") || (cha=="<") || (cha==">") || (cha=="/") || (cha==":") || (cha==";"))
                    {
                        alert("Error");
                            young.value = "";
                                young.focus();
                                    return false;
                    }
            }

        return true;
        }
    }

var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var enableanchorlink=0 //Enable or disable the anchor link when clicked on? (1=e, 0=d)
var hidemenu_onclick=1 //hide menu when user clicks within menu? (1=yes, 0=no)


var ie5=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
    var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
    var parentEl=what.offsetParent;
    while (parentEl!=null){
        totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
        parentEl=parentEl.offsetParent;
    }
    return totaloffset;
}

function showhide(obj, e, visible, hidden){
    if (ie5||ns6)
        dropmenuobj.style.left=dropmenuobj.style.top=500
    if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
        obj.visibility=visible
    else if (e.type=="click")
        obj.visibility=hidden
}

function iecompattest(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
    var edgeoffset=0
    if (whichedge=="rightedge"){
    var windowedge=ie5 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
        dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
    if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
        edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
    }
    else{
    var windowedge=ie5 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
        dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
    if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
        edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
    }
    return edgeoffset
}

function dropdownmenu(obj, e, dropmenuID){
    if (window.event) event.cancelBubble=true
    else if (e.stopPropagation) e.stopPropagation()
    if (typeof dropmenuobj!="undefined") //hide previous menu
        dropmenuobj.style.visibility="hidden"
        clearhidemenu()
    if (ie5||ns6){
        obj.onmouseout=delayhidemenu
        dropmenuobj=document.getElementById(dropmenuID)
    if (hidemenu_onclick) dropmenuobj.onclick=function(){dropmenuobj.style.visibility='hidden'}
        dropmenuobj.onmouseover=clearhidemenu
        dropmenuobj.onmouseout=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)}
        showhide(dropmenuobj.style, e, "visible", "hidden")
        dropmenuobj.x=getposOffset(obj, "left")
        dropmenuobj.y=getposOffset(obj, "top")
        dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
        dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
    }
    return clickreturnvalue()
}

function clickreturnvalue(){
    if ((ie5||ns6) && !enableanchorlink) return false
    else return true
}

function contains_ns6(a, b) {
    while (b.parentNode)
    if ((b = b.parentNode) == a)
    return true;
    return false;
}

function dynamichide(e){
    if (ie5&&!dropmenuobj.contains(e.toElement))
        delayhidemenu()
    else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
    delayhidemenu()
}

function delayhidemenu(){
    delayhide=setTimeout("dropmenuobj.style.visibility='hidden'",disappeardelay)
}

function clearhidemenu(){
    if (typeof delayhide!="undefined")
        clearTimeout(delayhide)
}