﻿    function getCurrentDate()
    {
        var mydate=new Date();
        var year=mydate.getYear();
        if (year < 1000)
         year+=1900;
        if (year < 2500)
         year+=543;
        var day=mydate.getDay();
        var month=mydate.getMonth();
        var daym=mydate.getDate();
        if (daym<10){daym="0"+daym;}
         var hours = mydate.getHours();
    var min = mydate.getMinutes();
    var sec = mydate.getSeconds();
    var Time = hours ;
    Time += ((min < 10) ? ":0" : ":") + min;
    //Time += ((sec < 10) ? ":0" : ":") + sec;
        
        
        var dayarray=new Array("อาทิตย์","จันทร์","อังคาร","พุธ","พฤหัสบดี","ศุกร์","เสาร์");
       //  var dayarray=new Array("อา.","จ.","อ.","พ.","พฤ.","ศ.","ส.");
        var montharray=new Array("ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย","ธ.ค.");
      // var montharray=new Array("มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฏาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");
        //document.write( "วัน"+ dayarray[day]+"ที่ "+daym+" "+montharray[month]+" พ.ศ. "+year.toString().substring(2,4));
       
         document.write( "วัน" + dayarray[day] +"ที่ "+ daym+" "+montharray[month]+" "+year+" ,"+Time + " น.");
       // display();
       /*  
        ศ. 24 เม.ย.52 , 00.00 น.
        var label = window.document.getElementById(id); 
        label.innerHTML = "วัน"+ dayarray[day]+"ที่ "+daym+" "+montharray[month]+" พ.ศ. "+year;
       */
    }
    var iTimerID = 0;
    function menu_onmouseout(sender, e) {
        iTimerID = window.setTimeout("showWMP()", 100); 
    }
//     function display() {
//    var Today = new Date();
//    var hours = Today.getHours();
//    var min = Today.getMinutes();
//    var sec = Today.getSeconds();
//    var Time = hours ;
//    Time += ((min < 10) ? ":0" : ":") + min;
//    Time += ((sec < 10) ? ":0" : ":") + sec;
//	var MyLabel1 = document.getElementById("ctl00_MyClock")!=null ? document.getElementById("ctl00_MyClock") : document.getElementById("ctl00_ctl00_MyClock") 
//        if (MyLabel1 != null) {
//           // MyLabel1.value = "เวลา "+Time+" น";
//              MyLabel1.value = Time+" น";
//        }
//	   setTimeout("display()",1000);
//  } 
    function showWMP()
    { 
        var wmp_container = document.getElementById("wmp_container");
        if (wmp_container != null) {
            wmp_container.style.visibility = "visible";
        }
    
    }
function menu_onmouseover(sender,e)
{   
 
    var ul = sender.getElementsByTagName("ul");
    if  (ul != null && ul.length > 0)
    {
     var x;
     if(-1 != navigator.userAgent.indexOf("MSIE"))
     {  
        x  = -1 * (e.clientX  -  e.offsetX);      
     }
     else
     {
        x  = -1 * (e.clientX  -  (e.clientX  - ( sender.offsetLeft)));     
     }
     if ( x < ul[0].style.left  )
        ul[0].style.left  = x + "px";
    }
    var wmp_container = document.getElementById("wmp_container");
    if (wmp_container != null) {
        window.clearTimeout(iTimerID)
        wmp_container.style.visibility = "hidden";
    }
 }
 function getQueryString( name ){
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.search );
if( results == null )
return "";
else
return results[1];
}

function getHash() {
  var hash = window.location.hash;
  return hash.substring(1); // remove #
}

function MM_jumpMenu(targ, selObj, restore) { //v3.0
    window.open(selObj.options[selObj.selectedIndex].value, "_blank");
    //   eval(targ + ".location='" + selObj.options[selObj.selectedIndex].value + "'");
    if (restore) selObj.selectedIndex = 0;
}