﻿// JScript File

function openPopup(url)
    {
	   var winTop = (screen.height / 2) - 250;
	   var winLeft = (screen.width / 2) - 175;
	   var windowFeatures = "width= 550"+ ",height= 500" + ",";
	   windowFeatures = windowFeatures + "left=" + winLeft + ",";
	   windowFeatures = windowFeatures + "top=" + winTop +",resizable=yes,scrollbars=yes,location=yes";
	   newWindow = window.open(url,"myWindow",windowFeatures);
  }
  function comfirmDelete()
  {
    var isOk;
    isOk = confirm('Bạn thật sự muốn xóa phải không ? Nhắm mắt đưa chân thì bấm Ok còn không bấm cancel');
    return isOk;
  }
  
  var veryGood = 0;
    var good = 0;
    var midle = 0;
    function vote()
    {
        
        var rattot = window.document.getElementById("rbGood");
        var tot = window.document.getElementById("rdMidle");
        var binhthuong = window.document.getElementById("rbBad");
        if(!rattot.checked && !tot.checked && !binhthuong.checked)
        {
            alert('Bạn phải chọn một trong các mục trước khi biểu quyết');
            return false;
        }
        else
        {
            if(rattot.checked)
            {
                veryGood = 1;
                good = 0;
                midle = 0;
            }
            if(tot.checked)
            {
                 veryGood = 0;
                good = 1;
                midle = 0;
            }
            if(binhthuong.checked)
            {
                veryGood = 0;
                good = 0;
                midle = 1;
            }
            return true;
         }
    }
  function openPopupVote(url)
    {  
        
       var istrue = vote();
       if(istrue)
       {
	   var winTop = (screen.height / 2) - 100;
	   var winLeft = (screen.width / 2) - 300;
	   var windowFeatures = "width= 465"+ ",height= 215" + ",";
	   windowFeatures = windowFeatures + "left=" + winLeft + ",";
	   windowFeatures = windowFeatures + "top=" + winTop +",resizable=yes,scrollbars=yes";
	   newWindow = window.open(url,"myWindow",windowFeatures);
	   }
  }
  function openPopupVote1(url)
    {  
      
	   var winTop = (screen.height / 2) - 100;
	   var winLeft = (screen.width / 2) - 300;
	   var windowFeatures = "width= 465"+ ",height= 215" + ",";
	   windowFeatures = windowFeatures + "left=" + winLeft + ",";
	   windowFeatures = windowFeatures + "top=" + winTop +",resizable=yes,scrollbars=yes";
	   newWindow = window.open(url,"myWindow",windowFeatures);
	   
  }
