﻿// JScript File
// JScript File
function setHomepage()  //Thiết lập trang làm trang chủ của trình duyệt
{
    if (document.all)
        {
            document.body.style.behavior='url(#default#homepage)';
            document.body.setHomePage('http://www.caycanhhoanggia.com');
        }
    else if (window.sidebar)
        {
            if(window.netscape)
        {
    try
        {
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
        }
    catch(e)
        {
            alert("this action was aviod by your browser，if you want to enable，please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true");
        }
    }
    var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
    prefs.setCharPref('browser.startup.homepage','http://www.caycanhhoanggia.com');
    }
} 
function addFavorites()   //Đưa trang vào danh sách ưa thích
   {
   if (document.all)
      {
      window.external.AddFavorite
      ("http://www.caycanhhoanggia","Cây cảnh Hoàng Gia")
      }
   }

function selectAll(involker) {
        // Since ASP.NET checkboxes are really HTML input elements
        //  let's get all the inputs 
        var inputElements = document.getElementsByTagName('input');
        for (var i = 0 ; i < inputElements.length ; i++) {
            var myElement = inputElements[i];
            // Filter through the input types looking for checkboxes
            if (myElement.type === "checkbox") {
               // Use the involker (our calling element) as the reference 
               //  for our checkbox status
                myElement.checked = involker.checked;
            }
        }
    }  
//Hàm kiểm tra độ phân giải của màn hình
function checkSettting(div)
        {
            if(screen.width<1024 || screen.height<768)
                {
                document.getElementById('Message').innerHTML="Thiết lập độ phân giải màn hình của bạn không phù hợp.<br />Vui lòng thiết lập độ phân giải màn hình ở chế độ 1024*768<br />sau đó nhấn F5 để làm tươi lại hệ thống<hr /><div>Hệ thống trả lời tự động website quản lý điểm </div>";
                }
            else
                {
                document.getElementById('Message').innerHTML="<meta http-equiv='refresh' content='5; url=Default.aspx' />Chúc mừng bạn đăng nhập thành công. <br />Hệ thống sẽ tự động chuyển bạn tới trang quản lý hệ thống sau 5 giây.<br />Hoặc các bạn <a href='Default.aspx'>nhấn vào đây</a> nếu không muốn đợi lâu.";
                }
        }

// http://www.boutell.com/newfaq/creating/windowcenter.html
function wopen(url, name, w, h)
{
  // Fudge factors for window decoration space.
  // In my tests these work well on all platforms & browsers.
  w += 32;
  h += 96;
  wleft = (screen.width - w) / 2;
  wtop = (screen.height - h) / 2;
  // IE5 and other old browsers might allow a window that is
  // partially offscreen or wider than the screen. Fix that.
  // (Newer browsers fix this for us, but let's be thorough.)
  if (wleft < 0) {
    w = screen.width;
    wleft = 0;
  }
  if (wtop < 0) {
    h = screen.height;
    wtop = 0;
  }
  var win = window.open(url,
    name,
    'width=' + w + ', height=' + h + ', ' +
    'left=' + wleft + ', top=' + wtop + ', ' +
    'location=no, menubar=no, modal=yes' +
    'status=no, toolbar=no, scrollbars=no, resizable=no', 'tite=no', 'resizable=no', 'directories=no', 'status=no');
  // Just in case width and height are ignored
  win.resizeTo(w, h);
  // Just in case left and top are ignored
  win.moveTo(wleft, wtop);
  win.focus();
}
// -->        
