function setCookie(name, value, expire) {   

	document.cookie = name + "=" + escape(value)   + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))

}



function getCookie(Name) {   

	var search = Name + "="   

	if (document.cookie.length > 0) { 

		// if there are any cookies      

		offset = document.cookie.indexOf(search)       

		if (offset != -1) { // if cookie exists          

			offset += search.length          // set index of beginning of value         

			end = document.cookie.indexOf(";", offset)          // set index of end of cookie value         

			if (end == -1)

				end = document.cookie.length         

				return unescape(document.cookie.substring(offset, end))

		}    

	}





}



function popupWin() {

window.open('netbar_msg.jsp', 'popup', 'menubar=no, toolbar=no, location=no, directories=no, status=no, resizable=0, scrollbars=1, width=640, height=480');

}



// Good, morning or afternoon

var d = new Date();

hourValue = d.getHours();

if (hourValue < 12)

    {

    greeting = "早安" + "!";

    }

else if (hourValue == 12)

    {

    greeting = "午安" + "!";

    }

else if (hourValue < 17)

    {

    greeting = "午安" + "!";

    }

else

    {

    greeting = "晚安" + "!";

    }

// Write the greeting



//navigation control



button = new Array();

setCookie("netvigator_vas","22222222222");

for (i=1;i<=getCookie("netvigator_vas").length;i++){

        button[i] = getCookie("netvigator_vas").charAt(i-1);

}



function eng(){

	var expires = new Date();

	expires.setTime(d.getTime() + 1000*60*60*24*30);

	setCookie("netvigator_lan","eng",expires);

	top.location.href="http://www.netvigator.com/mega/index_eng.htm";

}





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_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_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&top.frames.length) {

    d=top.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 chkCookie(name)

{

        var result = "";

        var myCookie = " " + document.cookie + ";";

        var searchName = " " + name + "=";

        var startOfCookie = myCookie.indexOf(searchName);

        var endOfCookie;

        if (startOfCookie != -1) {

                startOfCookie += searchName.length;

                endOfCookie = myCookie.indexOf(";", startOfCookie);

                result = unescape(myCookie.substring(startOfCookie, endOfCookie));

        }

        return result;

}



function myLogout() {



        top.location.href = 'https://netpass.netvigator.com/netpass/servlet/NPMainServlet?action=np_logout&loadBean=yes&successurl=http://www.netvigator.com/&failurl=http://www.netvigator.com/';

        t = setTimeout("myRefresh()", 5000);

}



function myRefresh() {

        self.location = self.location;

}



function toggleEnv()

{

      document.envImage.src="/mega/images/mail_icon_static.gif";

	popupWin();

}



function toggleNPImg()

{

      var Name = "NPSESSIONID";

      var result = chkCookie(Name);

      if (result != "")

      {

          document.npbutton.src="/mega/images/chi/b_netpass_out.gif";

      }

      else

      {

          document.npbutton.src="/mega/images/chi/b_netpass_in.gif";

      }

      setTimeout("toggleNPImg();", 60000);

} 



function npToggle()

{

      var Name = "NPSESSIONID";

      var result = chkCookie(Name);

      if (result != "")

      {

          window.top.location.href="https://netpass.netvigator.com/netpass/servlet/NPMainServlet?action=np_logout&loadBean=yes&successurl=http://www.netvigator.com/&failurl=http://www.netvigator.com/";

          t = setTimeout("myRefresh();", 5000);

      }

      else

      {

          window.top.location.href="https://netpass.netvigator.com/netpass/jsp/np_login_index.jsp?successurl=http://www.netvigator.com&failurl=http://www.netvigator.com";

      }

}

//-->
