﻿// JScript File
function SelectAllCheckboxes(spanChk){
var oItem = spanChk.children;
var theBox=(spanChk.type=="checkbox")?spanChk:spanChk.children.item[0];
xState=theBox.checked;

elm=theBox.form.elements;
for(i=0;i<elm.length;i++)

if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)
{
if(elm[i].checked!=xState)
elm[i].click();

}

}

function ConfirmDelete(Msg,NoRecordsMessage)
{
    if (chkIsAnyThingChecked(NoRecordsMessage))
    {
      
       if (confirm(Msg))
       {
            return true;        
       }else
       {
            return false;
       }  
    }
    else
    {
        return false;
    }

}

function IsAnyCheckBoxSelectedForAdd(NoRecordsMessage)
{
    if (chkIsAnyThingChecked(NoRecordsMessage))
    {
        
       return true;  
    }else
    {
       
        return false;
    }

}

function chkIsAnyThingChecked(NoRecordsMessage)
{
  
   var formElement;
    var countSel = 0; 
//    alert("HI")
//     alert(document.aspnetForm.elements.length)
    for (var i = 0; i < document.aspnetForm.elements.length; i++) 
    {
        nameElement = document.aspnetForm.elements[i].id;
        if (document.aspnetForm.elements[i].type =="checkbox")
        {     
            formElement = document.getElementById(nameElement);
            if (formElement.checked)
            {
               countSel = countSel+1; 
            }
        }
    }
     
    if (countSel== 0)
    {
           
        alert(NoRecordsMessage);
        return false;
    }
   return true;
 }

//-- pop up window

var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
var popUpWin1=0;
function popUpWindow1(URLStr, left, top, width, height)
{
  if(popUpWin1)
  {
    if(!popUpWin1.closed) popUpWin1.close();
  }
  popUpWin1 = open(URLStr, 'popUpWin1', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbars=yes,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function com_change()
{
	if (document.frm.s.value!="")
	var URL = document.frm.s.value;
	window.location.href = URL;
}

